org.jscience.architecture.traffic.xml
Class XMLStack

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.Vector<E>
              extended by java.util.Stack
                  extended by org.jscience.architecture.traffic.xml.XMLStack
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.List, java.util.RandomAccess

public class XMLStack
extends java.util.Stack

This class is used by the XMLLoader and the XMLSaver to remember where the parser is saving/loading in the XML tree. XMLStack is an extension of the normal java.util.Stack.

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
XMLStack()
          Make a new XMLStack
 
Method Summary
 void assertIsCurrentParent(java.lang.String s)
          Make sure that the branch name equals a certain XML tag name
 void assertIsCurrentParent(XMLSerializable x)
          Make sure that a certain XMLSerializable is at the top of the XML stack
 java.lang.String getBranchName()
          DOCUMENT ME!
 boolean isARootParent(java.lang.String s)
          Check if the branch name begins with a certain XML name
 boolean isARootParent(XMLSerializable x)
          Check if a certain branch name is at the root of the stack
 boolean isCurrentParent(java.lang.String s)
          Check if the branch name equals a certain XML tag name
 boolean isCurrentParent(XMLSerializable x)
          Check if a certain branch name is currenly at control in the stack
 java.lang.Object pop()
          Standard stack pop method
 java.lang.Object push(java.lang.Object x)
          Standard stack push method
protected  void updateBranchName()
          Internal method to update the branch name if the stack has changed
 
Methods inherited from class java.util.Stack
empty, peek, search
 
Methods inherited from class java.util.Vector
add, add, addAll, addAll, addElement, capacity, clear, clone, contains, containsAll, copyInto, elementAt, elements, ensureCapacity, equals, firstElement, get, hashCode, indexOf, indexOf, insertElementAt, isEmpty, lastElement, lastIndexOf, lastIndexOf, remove, remove, removeAll, removeAllElements, removeElement, removeElementAt, removeRange, retainAll, set, setElementAt, setSize, size, subList, toArray, toArray, toString, 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

XMLStack

public XMLStack()
Make a new XMLStack

Method Detail

push

public java.lang.Object push(java.lang.Object x)
Standard stack push method

Overrides:
push in class java.util.Stack
Parameters:
x - DOCUMENT ME!
Returns:
DOCUMENT ME!

pop

public java.lang.Object pop()
Standard stack pop method

Overrides:
pop in class java.util.Stack
Returns:
DOCUMENT ME!

getBranchName

public java.lang.String getBranchName()
DOCUMENT ME!

Returns:
the complete dot separated branchname

assertIsCurrentParent

public void assertIsCurrentParent(XMLSerializable x)
                           throws XMLTreeException
Make sure that a certain XMLSerializable is at the top of the XML stack

Parameters:
x - The XMLSerializable
Throws:
XMLTreeException - If the XMLSerializable is not at the top of the stack

assertIsCurrentParent

public void assertIsCurrentParent(java.lang.String s)
                           throws XMLTreeException
Make sure that the branch name equals a certain XML tag name

Parameters:
s - The full XML tag name
Throws:
XMLTreeException - If the XMLSerializable is not at the top of the stack

isCurrentParent

public boolean isCurrentParent(java.lang.String s)
Check if the branch name equals a certain XML tag name

Parameters:
s - The full XML name
Returns:
A boolean indicating if the branch name equals the tag name

isCurrentParent

public boolean isCurrentParent(XMLSerializable x)
Check if a certain branch name is currenly at control in the stack

Parameters:
x - The XMLSerializable
Returns:
A boolean indicating if the XMLSerializable is at the top of the stack.

isARootParent

public boolean isARootParent(java.lang.String s)
Check if the branch name begins with a certain XML name

Parameters:
s - The full XML name
Returns:
A boolean indicating if the branch name begins with the tag name

isARootParent

public boolean isARootParent(XMLSerializable x)
Check if a certain branch name is at the root of the stack

Parameters:
x - The XMLSerializable
Returns:
A boolean indicating if the XMLSerializable is at the root of the stack.

updateBranchName

protected void updateBranchName()
Internal method to update the branch name if the stack has changed