Update the component type information with
the type of the new array element.

@param newElement is the element for which the known top type in this array must be eventually updated.
10292
@SuppressWarnings("unchecked")
	protected final void updateComponentType(E newElement) {
		final Class<? extends E> lclazz = (Class<? extends E>) newElement.getClass();
		this.clazz = (Class<? extends E>) ReflectionUtil.getCommonType(this.clazz, lclazz);
	}
1310739
public void addElement(ObjectProperty element) {
        assertNotNull(element);
        if (elements == null) {
            elements = new ArrayList<ObjectProperty>();
        }
        elements.add(element);
        element.setParent(this);
    }
321491
@Nullable
  public ExpressionTreeElement addTreeElement(@Nonnull final ExpressionTreeElement element) {
    assertNotEmptySlot();
    assertNotNull("The element is null", element);

    final int newElementPriority = element.getPriority();

    ExpressionTreeElement result = this;

    final ExpressionTreeElement parentTreeElement = this.parentTreeElement;

    final int currentPriority = getPriority();

    if (newElementPriority < currentPriority) {
      if (parentTreeElement == null) {
        element.addTreeElement(this);
        result = element;
      } else {
        result = parentTreeElement.addTreeElement(element);
      }
    } else if (newElementPriority == currentPriority) {
      if (parentTreeElement != null) {
        parentTreeElement.replaceElement(this, element);
      }
      if (element.nextChildSlot >= element.childElements.length) {
        throw new PreprocessorException("[Expression]Can't process expression item, may be wrong number of arguments", this.sourceString, this.includeStack, null);
      }
      element.childElements[element.nextChildSlot] = this;
      element.nextChildSlot++;
      this.parentTreeElement = element;
      result = element;
    } else if (isFull()) {
      final int lastElementIndex = getArity() - 1;

      final ExpressionTreeElement lastElement = childElements[lastElementIndex];
      if (lastElement.getPriority() > newElementPriority) {
        element.addElementToNextFreeSlot(lastElement);
        childElements[lastElementIndex] = element;
        element.parentTreeElement = this;
        result = element;
      }

    } else {
      addElementToNextFreeSlot(element);
      result = element;
    }
    return result;
  }
1132482
public void updateBackupElements(Map<String, CmsContainerElementData> updateElements) {

        ArrayList<CmsContainerPageElementPanel> updatedList = new ArrayList<CmsContainerPageElementPanel>();
        String containerId = m_groupContainer.getContainerId();
        for (CmsContainerPageElementPanel element : m_backUpElements) {
            if (updateElements.containsKey(element.getId())
                && CmsStringUtil.isNotEmptyOrWhitespaceOnly(
                    updateElements.get(element.getId()).getContents().get(containerId))) {
                CmsContainerElementData elementData = updateElements.get(element.getId());
                try {
                    CmsContainerPageElementPanel replacer = m_controller.getContainerpageUtil().createElement(
                        elementData,
                        m_groupContainer,
                        false);
                    if (element.getInheritanceInfo() != null) {
                        // in case of inheritance container editing, keep the inheritance info
                        replacer.setInheritanceInfo(element.getInheritanceInfo());
                    }
                    updatedList.add(replacer);

                } catch (Exception e) {
                    // in this case keep the old version
                    updatedList.add(element);
                }
            } else {
                updatedList.add(element);
            }
        }
        m_backUpElements = updatedList;
    }
25656
@SuppressWarnings("unchecked")
    public static <T> T[] newArray(final T[] oldElements, final int length)
    {
        return (T[])Array.newInstance(oldElements.getClass().getComponentType(), length);
    }
1255164
private void addToCreateElements(String elementName) {
        HashMap<String, String> elementAttributes = new HashMap<>();

        elementAttributes.put(XsdAbstractElement.NAME_TAG, elementName);

        if (!createdElements.containsKey(getCleanName(elementName))){
            createdElements.put(getCleanName(elementName), new XsdElement(null, elementAttributes));
        }
    }
1205191
private void addNthLastOfType() {
        for (Node node : nodes) {
            int count = 1;
            Node n = DOMHelper.getNextSiblingElement(node);
            while (n != null) {
                if (DOMHelper.getNodeName(n).equals(DOMHelper.getNodeName(node))) {
                    count++;
                }
                
                n = DOMHelper.getNextSiblingElement(n);
            }
            
            if (specifier.isMatch(count)) {
                result.add(node);
            }
        }
    }
1283058
private void addTypeElement(TypeElement typeElement, Map<PackageElement, SortedSet<TypeElement>> map) {

        PackageElement pkg = utils.containingPackage(typeElement);
        if (utils.isSpecified(pkg) || configuration.nodeprecated && utils.isDeprecated(pkg)) {
            // No need to catalog this class if it's package is
            // specified on the command line or if -nodeprecated option is set
            return;
        }

        SortedSet<TypeElement> s = map.get(pkg);
        if (s == null) {
            packageSet.add(pkg);
            s = new TreeSet<>(comparator);
        }
        s.add(typeElement);
        map.put(pkg, s);

    }
254900
public static void replaceIsElement(HTMLElement context, String identifier, IsElement newElement) {
        replaceElement(context, identifier, newElement.element());
    }
367125
private void addLastOfType() {
        for (Node node : nodes) {
            Node n = DOMHelper.getNextSiblingElement(node);
            while (n != null) {
                if (DOMHelper.getNodeName(n).equals(DOMHelper.getNodeName(node))) {
                    break;
                }
                
                n = DOMHelper.getNextSiblingElement(n);
            }
            
            if (n == null) {
                result.add(node);
            }
        }
    }
380463
public final void setElement(final WebElement element) {

		if (element == null) {
			throw new IllegalArgumentException(String.format(ErrorMessages.ERROR_TEMPLATE_VARIABLE_NULL,"element"));
		}

		this.element = element;

		validateElementTag();
		validateAttributes();
	}
1294610
private static void replaceOrAppend(Element oldElement, Element newElement) {
    assert oldElement != null && newElement != null;

    if (matchesTags(oldElement, appendingTags)) {
      GQuery.$(oldElement).html("").append(newElement);
    } else {
      GQuery.$(oldElement).replaceWith(newElement);

      // copy class
      String c = oldElement.getClassName();
      if (!c.isEmpty()) {
        newElement.addClassName(c);
      }
      // copy id
      newElement.setId(oldElement.getId());
      // ensure no duplicate id
      oldElement.setId("");
    }
  }
999928
public ElemTemplateElement appendChild(ElemTemplateElement newChild)
  {

    int type = ((ElemTemplateElement) newChild).getXSLToken();

    if (Constants.ELEMNAME_SORT == type)
    {
      setSortElem((ElemSort) newChild);

      return newChild;
    }
    else
      return super.appendChild(newChild);
  }
954751
private void init(AnnotatedElement element) {
		Annotation[] declaredAnnotations = element.getDeclaredAnnotations();
		this.declaredAnnotationMap = new HashMap<>();
		parseDeclared(declaredAnnotations);
		
		Annotation[] annotations = element.getAnnotations();
		if(declaredAnnotations == annotations) {
			this.annotationMap = this.declaredAnnotationMap;
		}else {
			this.annotationMap = new HashMap<>();
			parse(annotations);
		}
	}
533860
@SuppressWarnings("unchecked")
	protected final void updateComponentType(Collection<? extends P> newElements) {
		final Class<? extends P> lclazz = extractClassFrom(newElements);
		this.clazz = (Class<? extends P>) ReflectionUtil.getCommonType(this.clazz, lclazz);
	}
796304
function(element) {
		Array.forEach(this._xnew.attributes, function(newatt) {
			var oldatt = this._xold.getAttribute(newatt.name);
			if (oldatt === null || oldatt !== newatt.value) {
				this._set(element, newatt.name, newatt.value);
				this._summary.push(
					"@" + newatt.name + "=\"" + newatt.value + "\"" +
					(element.id ? ' (#' + element.id + ')' : '')
				);
			}
		}, this);
		Array.forEach(this._xold.attributes, function(oldatt) {
			if (!this._xnew.hasAttribute(oldatt.name)) {
				this._del(element, oldatt.name, null);
				this._summary.push(
					"removed @" + oldatt.name +
					(element.id ? ' (#' + element.id + ')' : '')
				);
			}
		}, this);
	}
405636
public void update(int element, double priority) {
    this.doImport(element);
    final double q = this.prior.get(element);
    if (Double.compare(q, priority) == 0)
      return;
    this.prior.set(element, priority);
    if (this.pos.get(element) < 0)
      return;
    if (priority < q)
      this.down(element);
    if (q < priority)
      this.up(element);
  }