Package org.cip4.jdflib.core
Class VElement
- All Implemented Interfaces:
Serializable,Cloneable,Iterable<KElement>,Collection<KElement>,List<KElement>,RandomAccess
- Direct Known Subclasses:
VResource
- See Also:
-
Field Summary
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementDataFields inherited from class java.util.AbstractList
modCount -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<a extends KElement>
voidaddAll(a[] l) create a all elements of an ArrayvoidaddAll ignoring null collectionsvoidAppendUnique - append a vector but ignore multiple entries - equivalence is calculated with .equalsvoidappendUnique(KElement elem) AppendUnique - append a string but ignore multiple entriesvoidvoidAppendUnique - append a vector but ignore multiple entries - equivalence is calculated with isEqual,voidDeprecated.simply use appendUniquevoidDeprecated.simply use appendUniquebooleancontainsElement(KElement elem) does this contain an equivalent element similar to contains but uses isEqual() instead of equals()elementAt(int index) item - returns null if index is out of bounds or the requested item is not an ELEMENT_NODE !get(int index) item - returns null if index is out of bounds or the requested item is not an ELEMENT_NODE !returns the common ancestor of all entries of thisgetElementNameSet(boolean bLocal) get the node names of this vector in the same ordergetElementNameVector(boolean bLocal) get the node names of this vector in the same orderbooleanhasElement(KElement kElem) Deprecated.060216 use containsElementintindex - get the index of s in the vector using isEquals or ID rather than equalsbooleanare the two vectors equivalent, i.e.item(int index) item - returns null if index is out of bounds or the requested item is not an ELEMENT_NODE !intsimilar to index but only compares nodenamesvoidremoveAttribute(String key, String nameSpaceURI) Remove Attribute in all elements of thisvoidremoveElements(KElement testElem, int nMax) RemoveElementsvoidRemove elements listed in v from thisvoidsetAttribute(String key, String value, String nameSpaceURI) SetAttribute in all elements of thisvoidsetAttributes(String key, List<String> vValue, String nameSpaceURI) set the values of attribute key to the values defined in vValuevoidsort()sorts the vector in canonical order using SimpleNodeComparatortoString()toStringtoVector(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.voidunify()unify - make VElement unique, retaining initial ordervoidunify - make VElement unique, retaining initial order uses containsElement, not containsMethods 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, trimToSizeMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, stream, toArray
-
Constructor Details
-
VElement
public VElement()constructor -
VElement
constructor- Parameters:
m-
-
VElement
constructor- Parameters:
n-
-
-
Method Details
-
toString
toString -
index
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.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.simply use appendUniqueappendUniqueNotNull - append a string but ignore multiple entries- Parameters:
v-
-
appendUniqueNotNull
Deprecated.simply use appendUniqueAppendUniqueNotNull - append a vector but ignore multiple entries- Parameters:
v-
-
appendUnique
AppendUnique - append a string but ignore multiple entries- Parameters:
elem- the element to append
-
addAll
addAll ignoring null collections- Parameters:
elem- the vector of elements to append
-
addAll
create a all elements of an Array- Type Parameters:
a-- Parameters:
l-
-
containsElement
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
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
AppendUnique - append a vector but ignore multiple entries - equivalence is calculated with .equals- Parameters:
v- the vector of elements to append
-
appendUnique
-
appendUniqueElement
AppendUnique - append a vector but ignore multiple entries - equivalence is calculated with isEqual,- Parameters:
v- the vector of elements to append
-
setAttributes
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:
IllegalArgumentException- if size mismatch of vValue anf this
-
sort
public void sort()sorts the vector in canonical order using SimpleNodeComparator -
setAttribute
SetAttribute in all elements of this- Parameters:
key- key the attribute namevalue- the valuenameSpaceURI- nameSpace of the attribute to set
-
removeAttribute
Remove Attribute in all elements of this- Parameters:
key- key the attribute namenameSpaceURI- nameSpace of the attribute to set
-
removeElements
Remove elements listed in v from this- Parameters:
v- elements to remove
-
removeElements
RemoveElements- Parameters:
testElem- the element to removenMax- maximum number of dulicate elements to remove
-
getElementNameVector
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
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 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
item - returns null if index is out of bounds or the requested item is not an ELEMENT_NODE ! -
get
item - returns null if index is out of bounds or the requested item is not an ELEMENT_NODE ! -
item
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
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
similar to index but only compares nodenames- Parameters:
nodeName-- Returns:
-