org.cip4.jdflib.core
Class VElement

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector<KElement>
              extended by org.cip4.jdflib.core.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:
Serialized Form

Field Summary
 
Fields inherited from class java.util.Vector
capacityIncrement, elementCount, elementData
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
VElement()
          constructor
VElement(NodeList n)
          constructor
VElement(Vector m)
          constructor
 
Method Summary
<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 !
 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. do thay only contain elements that are isEqual() or if this is empty and the comparison is against null
 KElement item(int index)
          item - returns null if index is out of bounds or the requested item is not an ELEMENT_NODE !
 void removeAttribute(String key, String nameSpaceURI)
          Remove Attribute in all elements of this
 void removeElements(KElement e, int nMax)
          RemoveElements
 void removeElements(VElement v)
          Remove elements listed in v from this
 void setAttribute(String key, String value, String nameSpaceURI)
          SetAttribute in all elements of this
 void setAttributes(String key, Vector<String> vValue, String nameSpaceURI)
          set the values of attribute key to the values defined in vValue
 void sort()
          sorts the vector in canonical order using SimpleNodeComparator
 String toString()
          toString
 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.
 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, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
iterator, listIterator, listIterator
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
iterator, listIterator, listIterator
 

Constructor Detail

VElement

public VElement()
constructor


VElement

public VElement(Vector m)
constructor

Parameters:
m -

VElement

public VElement(NodeList n)
constructor

Parameters:
n -
Method Detail

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(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(String key,
                          Vector<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 e,
                           int nMax)
RemoveElements

Parameters:
e - 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

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

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



Copyright © 2013. All Rights Reserved.