Package org.cip4.jdflib.core
Class VElement
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.Vector<KElement>
-
- org.cip4.jdflib.core.VElement
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description <a extends KElement>
voidaddAll(a[] l)create a all elements of an ArrayvoidaddAll(VElement elem)addAll ignoring null collectionsvoidappendUnique(KElement elem)AppendUnique - append a string but ignore multiple entriesvoidappendUnique(VElement v)AppendUnique - append a vector but ignore multiple entries - equivalence is calculated with .equalsvoidappendUniqueElement(VElement v)AppendUnique - append a vector but ignore multiple entries - equivalence is calculated with isEqual,voidappendUniqueNotNull(KElement v)Deprecated.simply use appendUniquevoidappendUniqueNotNull(VElement v)Deprecated.simply use appendUniquebooleancontainsElement(KElement elem)does this contain an equivalent element similar to contains but uses isEqual() instead of equals()KElementelementAt(int index)item - returns null if index is out of bounds or the requested item is not an ELEMENT_NODE !KElementget(int index)item - returns null if index is out of bounds or the requested item is not an ELEMENT_NODE !KElementgetCommonAncestor()returns the common ancestor of all entries of thisjava.util.Set<java.lang.String>getElementNameSet(boolean bLocal)get the node names of this vector in the same orderVStringgetElementNameVector(boolean bLocal)get the node names of this vector in the same orderbooleanhasElement(KElement kElem)Deprecated.060216 use containsElementintindex(KElement s)index - get the index of s in the vector using isEquals or ID rather than equalsbooleanisEqual(VElement v)are the two vectors equivalent, i.e.KElementitem(int index)item - returns null if index is out of bounds or the requested item is not an ELEMENT_NODE !intnameIndex(java.lang.String nodeName, int skip)similar to index but only compares nodenamesvoidremoveAttribute(java.lang.String key, java.lang.String nameSpaceURI)Remove Attribute in all elements of thisvoidremoveElements(KElement testElem, int nMax)RemoveElementsvoidremoveElements(VElement v)Remove elements listed in v from thisvoidsetAttribute(java.lang.String key, java.lang.String value, java.lang.String nameSpaceURI)SetAttribute in all elements of thisvoidsetAttributes(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 vValuevoidsort()sorts the vector in canonical order using SimpleNodeComparatorjava.lang.StringtoString()toStringVElementtoVector(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.voidunify()unify - make VElement unique, retaining initial ordervoidunifyElement()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
-
-
-
-
Method Detail
-
toString
public java.lang.String toString()
toString- Overrides:
toStringin classjava.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 containsElementhasElement - 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 appendUniqueappendUniqueNotNull - append a string but ignore multiple entries- Parameters:
v-
-
appendUniqueNotNull
@Deprecated public void appendUniqueNotNull(VElement v)
Deprecated.simply use appendUniqueAppendUniqueNotNull - 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 namevValue- vValue the vector of valuesnameSpaceURI- 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 namevalue- the valuenameSpaceURI- 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 namenameSpaceURI- 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 removenMax- 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 wantmAttrib- a attribute typ you wantbAnd- true, if you want to add the element if mAttrib was found in the elementnameSpaceURI- 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:
elementAtin classjava.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 !
-
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:
-
-