Class VElement

All Implemented Interfaces:
Serializable, Cloneable, Iterable<KElement>, Collection<KElement>, List<KElement>, RandomAccess
Direct Known Subclasses:
VResource

public class VElement extends Vector<KElement>
See Also:
  • Constructor Details

    • VElement

      public VElement()
      constructor
    • VElement

      public VElement(Collection m)
      constructor
      Parameters:
      m -
    • VElement

      public VElement(NodeList n)
      constructor
      Parameters:
      n -
  • Method Details

    • toString

      public String toString()
      toString
      Overrides:
      toString in class Vector<KElement>
      Returns:
      String
    • index

      public int index(KElement s)
      index - get the index of s in the vector using isEquals or ID rather than equals
      Parameters:
      s - KElement to search for
      Returns:
      int - the index of s in the vector
    • hasElement

      @Deprecated public boolean hasElement(KElement kElem)
      Deprecated.
      060216 use containsElement
      hasElement - checks if kElem is in the vector in contrast to contains, this uses the isEquals method
      Parameters:
      kElem - the element to look for
      Returns:
      true if s is contained in this
    • appendUniqueNotNull

      @Deprecated public void appendUniqueNotNull(KElement v)
      Deprecated.
      simply use appendUnique
      appendUniqueNotNull - append a string but ignore multiple entries
      Parameters:
      v -
    • appendUniqueNotNull

      @Deprecated public void appendUniqueNotNull(VElement v)
      Deprecated.
      simply use appendUnique
      AppendUniqueNotNull - append a vector but ignore multiple entries
      Parameters:
      v -
    • appendUnique

      public void appendUnique(KElement elem)
      AppendUnique - append a string but ignore multiple entries
      Parameters:
      elem - the element to append
    • addAll

      public void addAll(VElement elem)
      addAll ignoring null collections
      Parameters:
      elem - the vector of elements to append
    • addAll

      public <a extends KElement> void addAll(a[] l)
      create a all elements of an Array
      Type Parameters:
      a -
      Parameters:
      l -
    • containsElement

      public boolean containsElement(KElement elem)
      does this contain an equivalent element similar to contains but uses isEqual() instead of equals()
      Parameters:
      elem - the element to look for
      Returns:
      true, if v is contained in this
    • isEqual

      public boolean isEqual(List<KElement> v)
      are the two vectors equivalent, i.e. do thay only contain elements that are isEqual() or if this is empty and the comparison is against null
      Parameters:
      v - the vector to compare
      Returns:
      true, if v is equal to this
    • appendUnique

      public void appendUnique(Collection<KElement> v)
      AppendUnique - append a vector but ignore multiple entries - equivalence is calculated with .equals
      Parameters:
      v - the vector of elements to append
    • appendUnique

      public void appendUnique(VElement v)
    • appendUniqueElement

      public void appendUniqueElement(Collection<KElement> v)
      AppendUnique - append a vector but ignore multiple entries - equivalence is calculated with isEqual,
      Parameters:
      v - the vector of elements to append
    • setAttributes

      public void setAttributes(String key, List<String> vValue, String nameSpaceURI)
      set the values of attribute key to the values defined in vValue
      Parameters:
      key - key the attribute name
      vValue - vValue the vector of values
      nameSpaceURI - nameSpace of the attribute to set
      Throws:
      IllegalArgumentException - if size mismatch of vValue anf this
    • sort

      public void sort()
      sorts the vector in canonical order using SimpleNodeComparator
    • setAttribute

      public void setAttribute(String key, String value, String nameSpaceURI)
      SetAttribute in all elements of this
      Parameters:
      key - key the attribute name
      value - the value
      nameSpaceURI - nameSpace of the attribute to set
    • removeAttribute

      public void removeAttribute(String key, String nameSpaceURI)
      Remove Attribute in all elements of this
      Parameters:
      key - key the attribute name
      nameSpaceURI - nameSpace of the attribute to set
    • removeElements

      public void removeElements(VElement v)
      Remove elements listed in v from this
      Parameters:
      v - elements to remove
    • removeElements

      public void removeElements(KElement testElem, int nMax)
      RemoveElements
      Parameters:
      testElem - the element to remove
      nMax - maximum number of dulicate elements to remove
    • getElementNameVector

      public VString getElementNameVector(boolean bLocal)
      get the node names of this vector in the same order
      Parameters:
      bLocal - if true use getLocalName() else getNodeName() o each item
      Returns:
      VString vector of node names
    • getElementNameSet

      public Set<String> getElementNameSet(boolean bLocal)
      get the node names of this vector in the same order
      Parameters:
      bLocal - if true use getLocalName() else getNodeName() o each item
      Returns:
      VString vector of node names
    • toVector

      public VElement toVector(String element, JDFAttributeMap mAttrib, boolean bAnd, String nameSpaceURI)
      ToVector - parse a node list for elements spezified through parameters note that the vector is static - i.e. the elements are NOT modified by operations to the nodeList. This behavior is different than that of the actual nodelist!
      Parameters:
      element - name of the element typ you want
      mAttrib - a attribute typ you want
      bAnd - true, if you want to add the element if mAttrib was found in the element
      nameSpaceURI - the namespace to search in
      Returns:
      VElement - vector of all elements matching the conditions above
    • elementAt

      public KElement elementAt(int index)
      item - returns null if index is out of bounds or the requested item is not an ELEMENT_NODE !
      Overrides:
      elementAt in class Vector<KElement>
      Parameters:
      index - vector index of the element you want
      Returns:
      KElement - the requested item or null, if index is out of bounds
    • get

      public KElement get(int index)
      item - returns null if index is out of bounds or the requested item is not an ELEMENT_NODE !
      Specified by:
      get in interface List<KElement>
      Overrides:
      get in class Vector<KElement>
      Parameters:
      index - vector index of the element you want
      Returns:
      KElement - the requested item or null, if index is out of bounds
    • item

      public KElement item(int index)
      item - returns null if index is out of bounds or the requested item is not an ELEMENT_NODE !
      Parameters:
      index - vector index of the element you want
      Returns:
      KElement - the requested item or null, if index is out of bounds
    • getCommonAncestor

      public KElement getCommonAncestor()
      returns the common ancestor of all entries of this
      Returns:
      the element that is a common ancestor of all vector members
      Since:
      050721
    • unify

      public void unify()
      unify - make VElement unique, retaining initial order
    • unifyElement

      public void unifyElement()
      unify - make VElement unique, retaining initial order uses containsElement, not contains
    • nameIndex

      public int nameIndex(String nodeName, int skip)
      similar to index but only compares nodenames
      Parameters:
      nodeName -
      Returns: