Method to overlay the new header value onto the older value in the parse
buffers.

@param elem
322344
private void overlayValue(HeaderElement elem) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Overlaying existing header: " + elem.getName());
        }
        int next_index = this.lastCRLFBufferIndex;
        int next_pos = this.lastCRLFPosition;
        if (null != elem.nextSequence && !elem.nextSequence.wasAdded()) {
            next_index = elem.nextSequence.getLastCRLFBufferIndex();
            next_pos = elem.nextSequence.getLastCRLFPosition();
        }
        WsByteBuffer buffer = this.parseBuffers[elem.getLastCRLFBufferIndex()];
        buffer.position(elem.getLastCRLFPosition() + (elem.isLastCRLFaCR() ? 2 : 1));
        if (next_index == elem.getLastCRLFBufferIndex()) {
            // all in one buffer
            buffer.put(elem.getKey().getMarshalledByteArray(foundCompactHeader()));
            buffer.put(elem.asRawBytes(), elem.getOffset(), elem.getValueLength());
        } else {
            // header straddles buffers
            int index = elem.getLastCRLFBufferIndex();
            index = overlayBytes(elem.getKey().getMarshalledByteArray(foundCompactHeader()), 0, -1, index);
            index = overlayBytes(elem.asRawBytes(), elem.getOffset(), elem.getValueLength(), index);
            buffer = this.parseBuffers[index];
        }
        // pad trailing whitespace if we need it
        int start = buffer.position();
        if (start < next_pos) {
            scribbleWhiteSpace(buffer, start, next_pos);
        }
    }
265746
@Override
    public void add(int index, T elem) {
        /* Confirm the validity of the index. */
        if (index < 0 || index >= size())
            throw new IndexOutOfBoundsException("Index " + index + ", size " + size());

        /* Add a dummy element to ensure that everything resizes correctly.
         * There's no reason to repeat the logic.
         */
        add(null);

        /* Next, we need to shuffle down every element that appears after
         * the inserted element.  We'll do this using our own public interface.
         */
        for (int i = size(); i > index; ++i)
            set(i, get(i - 1));

        /* Finally, write the element. */
        set(index, elem);
    }
794419
private void addHeader(HeaderElement elem, boolean bFilter) {
        final HeaderKeys key = elem.getKey();
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(tc, "Adding header [" + key.getName()
                         + "] with value [" + elem.getDebugValue() + "]");
        }

        if (getRemoteIp() && key.getName().toLowerCase().startsWith("x-forwarded") && !forwardHeaderErrorState) {
            processForwardedHeader(elem, true);
        }

        else if (getRemoteIp() && key.getName().toLowerCase().startsWith("forwarded") && !forwardHeaderErrorState) {
            processForwardedHeader(elem, false);
        }

        if (bFilter) {
            if (key.useFilters() && !filterAdd(key, elem.asBytes())) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "filter disallowed: " + elem.getDebugValue());
                }
                return;
            }
        }
       if (HttpHeaderKeys.isWasPrivateHeader(key.getName())) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "checking to see if private header is allowed: " + key.getName());
            }
           if (!filterAdd(key, elem.asBytes())) {
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, key.getName() +" is not trusted for this host; not adding header");
                }
               return;
           }
       }
       
        incrementHeaderCounter();
        HeaderElement root = findHeader(key);
        boolean rc = addInstanceOfElement(root, elem);
        // did we change the root node?
        if (rc) {
            final int ord = key.getOrdinal();
            storage.put(ord, elem);

        }
    }
494402
private void addHeaderList(Map<String, List<String>> headers, String name, String value) {

        List<String> values = headers.get(name);
        if (values == null) {
            values = new ArrayList<String>();
            headers.put(name, values);
        }
        values.add(value);
    }
235474
function( elem, options, callback ) {
		var old = {};

		// Remember the old values, and insert the new ones
		for ( var name in options ) {
			old[ name ] = elem.style[ name ];
			elem.style[ name ] = options[ name ];
		}

		callback.call( elem );

		// Revert the old values
		for ( var name in options ) {
			elem.style[ name ] = old[ name ];
		}
	}
545609
def add(self, elem):
        
        if not isinstance(elem, JWK):
            raise TypeError('Only JWK objects are valid elements')
        set.add(self, elem)
87126
public void set(E key, T value) 
    {
        Entry<E, T> entry = new Entry<E, T>(key, value, null, null);
        
        synchronized(this) {
            if (map.get(key) == null) {
                
                if (this.length >= this.capacity) 
                    this.removeLeastUsedElements();

                entry.prev = this.head;
                entry.next = this.head.next;
                this.head.next.prev = entry;
                this.head.next = entry;
                
                this.length++;
                map.put(key, entry);
            } else {
                entry = map.get(key);
                
                entry.value = value;
                
                entry.prev.next = entry.next;
                entry.next.prev = entry.prev;
                
                entry.prev = this.head;
                entry.next = this.head.next;
                this.head.next.prev = entry;
                this.head.next = entry;
            }
        }
    }
257113
private static void cleanHeaders(Element e) {
        for (int headerIndex = 1; headerIndex < 7; headerIndex++) {
            Elements headers = getElementsByTag(e, "h" + headerIndex);
            for (Element header : headers) {
                if (getClassWeight(header) < 0
                        || getLinkDensity(header) > 0.33f) {
                    header.remove();
                }
            }
        }
    }
1034531
public void add(int ele) {
        int idx;

        idx = ele >> SHIFT;
        if (idx >= data.length) {
            resize(idx + 1 + GROW);
        }
        data[ele >> SHIFT] |= (1 << ele);
    }
532652
protected WsByteBuffer[] marshallHeader(WsByteBuffer[] inBuffers, HeaderElement elem) {
        if (elem.wasRemoved()) {
            return inBuffers;
        }
        WsByteBuffer[] buffers = inBuffers;
        final byte[] value = elem.asRawBytes();
        if (null != value) {
            buffers = putBytes(elem.getKey().getMarshalledByteArray(foundCompactHeader()), buffers);
            buffers = putBytes(value, elem.getOffset(), elem.getValueLength(), buffers);
            buffers = putBytes(BNFHeaders.EOL, buffers);

            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Marshalling: " + elem.getKey()
                             + " [" + elem.getDebugValue() + "]");
            }
        }

        return buffers;
    }
505135
public static void position(Element elem, Element referenceElement) {

        int dy = 25;
        Style style = elem.getStyle();
        style.setLeft(0, Unit.PX);
        style.setTop(0, Unit.PX);
        int myX = elem.getAbsoluteLeft();
        int myY = elem.getAbsoluteTop();
        int refX = referenceElement.getAbsoluteLeft();
        int refY = referenceElement.getAbsoluteTop();
        int refWidth = referenceElement.getOffsetWidth();
        int newX = (refX - myX - ((2 * elem.getOffsetWidth()) / 3)) + (refWidth / 2);
        int newY = (refY - myY) + dy;
        style.setLeft(newX, Unit.PX);
        style.setTop(newY, Unit.PX);
    }
1120398
@SuppressWarnings("unchecked")
  public E replaceTopElement(E e) {
    E oldroot = (E) queue[0];
    heapifyDown(0, e);
    heapModified();
    return oldroot;
  }
1333078
protected void appendAndPush(
          StylesheetHandler handler, ElemTemplateElement elem)
            throws SAXException
  {
    //System.out.println("ProcessorFunction appendAndPush()" + elem);
    super.appendAndPush(handler, elem);
    //System.out.println("originating node " + handler.getOriginatingNode());
    elem.setDOMBackPointer(handler.getOriginatingNode());
    handler.getStylesheet().setTemplate((ElemTemplate) elem);
  }
1242718
protected void setSpecialHeader(HeaderKeys key, byte[] value) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "setSpecialHeader(h,b[]): " + key.getName());
        }
        removeHdrInstances(findHeader(key), FILTER_NO);
        HeaderElement elem = getElement(key);
        elem.setByteArrayValue(value);
        addHeader(elem, FILTER_NO);
    }
13370
function mergeTitle( elem ) {
		merge( elem, function( old ) {
			var text = elem.children[ 0 ];

			utils.replaceElement( old.children[ 0 ], text );
			old.children[ 0 ] = text;
		} );
	}
685455
function(elem){
            if(!this.root){
              this.root = struct.Node(elem);
              this.tail = this.root;
              this.size = 1;
              return this;
              // this.root.isRoot = true;
             }
            // this.add(elem);
            this.tail.append(elem);
            this.tail = this.tail.next;
            this.size += 1;
            return this;
          }
168099
public void addElement(T data) {

    Node<T> newNode = new Node<T>(data);

    if (isEmpty()) {
      //
      // if it is the very first node in the list
      first = newNode;
      size = 1;
    }
    else {

      // if this node is greater than the list's head
      //
      if (this.comparator.compare(newNode.data, first.data) > 0) {
        Node<T> tmp = first;
        first = newNode;
        first.next = tmp;
        tmp.prev = first;
        size++;
      }
      else {

        Node<T> prev = first;
        Node<T> current = first.next;

        while (current != null) {

          // if this node is the current node less than the new one
          //
          if (this.comparator.compare(newNode.data, current.data) > 0) {
            prev.next = newNode;
            newNode.prev = prev;
            current.prev = newNode;
            newNode.next = current;
            size++;
            break;
          }
          current = current.next;
          prev = prev.next;

        }

        // if all list elements are greater than the new one
        //
        if (null == current) {
          prev.next = newNode;
          newNode.prev = prev;
          size++;
        }

        if (size > this.maxSize) {
          dropLastElement();
        }

      }
    }

  }