Class VElement

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<KElement>, java.util.Collection<KElement>, java.util.List<KElement>, java.util.RandomAccess
    Direct Known Subclasses:
    VResource

    public class VElement
    extends java.util.Vector<KElement>
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.util.Vector

        capacityIncrement, elementCount, elementData
      • Fields inherited from class java.util.AbstractList

        modCount
    • Constructor Summary

      Constructors 
      Constructor Description
      VElement()
      constructor
      VElement​(java.util.Vector m)
      constructor
      VElement​(org.w3c.dom.NodeList n)
      constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      <a extends KElement>
      void
      addAll​(a[] l)
      create a all elements of an Array
      void addAll​(VElement elem)
      addAll ignoring null collections
      void appendUnique​(KElement elem)
      AppendUnique - append a string but ignore multiple entries
      void appendUnique​(VElement v)
      AppendUnique - append a vector but ignore multiple entries - equivalence is calculated with .equals
      void appendUniqueElement​(VElement v)
      AppendUnique - append a vector but ignore multiple entries - equivalence is calculated with isEqual,
      void appendUniqueNotNull​(KElement v)
      Deprecated.
      simply use appendUnique
      void appendUniqueNotNull​(VElement v)
      Deprecated.
      simply use appendUnique
      boolean containsElement​(KElement elem)
      does this contain an equivalent element similar to contains but uses isEqual() instead of equals()
      KElement elementAt​(int index)
      item - returns null if index is out of bounds or the requested item is not an ELEMENT_NODE !
      KElement get​(int index)
      item - returns null if index is out of bounds or the requested item is not an ELEMENT_NODE !
      KElement getCommonAncestor()
      returns the common ancestor of all entries of this
      java.util.Set<java.lang.String> getElementNameSet​(boolean bLocal)
      get the node names of this vector in the same order
      VString getElementNameVector​(boolean bLocal)
      get the node names of this vector in the same order
      boolean hasElement​(KElement kElem)
      Deprecated.
      060216 use containsElement
      int index​(KElement s)
      index - get the index of s in the vector using isEquals or ID rather than equals
      boolean isEqual​(VElement v)
      are the two vectors equivalent, i.e.
      KElement item​(int index)
      item - returns null if index is out of bounds or the requested item is not an ELEMENT_NODE !
      int nameIndex​(java.lang.String nodeName, int skip)
      similar to index but only compares nodenames
      void removeAttribute​(java.lang.String key, java.lang.String nameSpaceURI)
      Remove Attribute in all elements of this
      void removeElements​(KElement testElem, int nMax)
      RemoveElements
      void removeElements​(VElement v)
      Remove elements listed in v from this
      void setAttribute​(java.lang.String key, java.lang.String value, java.lang.String nameSpaceURI)
      SetAttribute in all elements of this
      void setAttributes​(java.lang.String key, java.util.Vector<java.lang.String> vValue, java.lang.String nameSpaceURI)
      set the values of attribute key to the values defined in vValue
      void sort()
      sorts the vector in canonical order using SimpleNodeComparator
      java.lang.String toString()
      toString
      VElement toVector​(java.lang.String element, JDFAttributeMap mAttrib, boolean bAnd, java.lang.String nameSpaceURI)
      ToVector - parse a node list for elements spezified through parameters note that the vector is static - i.e.
      void unify()
      unify - make VElement unique, retaining initial order
      void unifyElement()
      unify - make VElement unique, retaining initial order uses containsElement, not contains
      • Methods inherited from class java.util.Vector

        add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elements, ensureCapacity, equals, firstElement, forEach, hashCode, indexOf, indexOf, insertElementAt, isEmpty, iterator, lastElement, lastIndexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeIf, removeRange, replaceAll, retainAll, set, setElementAt, setSize, size, sort, spliterator, subList, toArray, toArray, trimToSize
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, stream, toArray
    • Constructor Detail

      • VElement

        public VElement()
        constructor
      • VElement

        public VElement​(java.util.Vector m)
        constructor
        Parameters:
        m -
      • VElement

        public VElement​(org.w3c.dom.NodeList n)
        constructor
        Parameters:
        n -
    • Method Detail

      • toString

        public java.lang.String toString()
        toString
        Overrides:
        toString in class java.util.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​(VElement 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​(VElement v)
        AppendUnique - append a vector but ignore multiple entries - equivalence is calculated with .equals
        Parameters:
        v - the vector of elements to append
      • appendUniqueElement

        public void appendUniqueElement​(VElement 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​(java.lang.String key,
                                  java.util.Vector<java.lang.String> vValue,
                                  java.lang.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:
        java.lang.IllegalArgumentException - if size mismatch of vValue anf this
      • sort

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

        public void setAttribute​(java.lang.String key,
                                 java.lang.String value,
                                 java.lang.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​(java.lang.String key,
                                    java.lang.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 java.util.Set<java.lang.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​(java.lang.String element,
                                 JDFAttributeMap mAttrib,
                                 boolean bAnd,
                                 java.lang.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 java.util.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 java.util.List<KElement>
        Overrides:
        get in class java.util.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​(java.lang.String nodeName,
                             int skip)
        similar to index but only compares nodenames
        Parameters:
        nodeName -
        Returns: