sk.uniba.euromath.gene.controller
Class NamespacePath

java.lang.Object
  extended by sk.uniba.euromath.gene.controller.NamespacePath

public final class NamespacePath
extends Object

Stack of all namespaces from root namespace (bottom item) to the namespace of the parent nametree (topmost item). This is the 'namespace path' from the root of the result document to the result, where currently executing transformation will place its result. If this list is empty then the exporter is producing a root part.

If the coordinator has requested the stream or object result then this argument is an empty list.

When a namespace is added multiple times into the path, it is pushed only virtually: pop() may return multiple namespaces, but the list addressed by the topmost(int) remains distinctive (no same neighbour namespaces). For example, path.push(path.topmost()) will not increase size().

Author:
Martin Vysny

Constructor Summary
NamespacePath()
          Constructs an empty path.
NamespacePath(NamespacePath other)
          Copy-constructor.
 
Method Summary
 boolean equals(Object obj)
           
 String getRoot()
          Returns the root namespace.
 int hashCode()
           
 boolean isEmpty()
          Tests if this stack is empty.
 String pop()
          Removes the topmost namespace and returns is as the value of this function.
 String push(String namespace)
          Pushes a namespace onto the top of this stack.
 int size()
          Returns the length of the path.
 String topmost()
          Looks at the topmost namespace without removing it from the stack.
 String topmost(int i)
          Looks at the i-th topmost namespace without removing it from the stack.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NamespacePath

public NamespacePath()
Constructs an empty path.


NamespacePath

public NamespacePath(NamespacePath other)
Copy-constructor.

Parameters:
other - copy this path.
Method Detail

isEmpty

public boolean isEmpty()
Tests if this stack is empty.

Returns:
true if the stack is empty.

topmost

public String topmost()
Looks at the topmost namespace without removing it from the stack.

Returns:
topmost namespace.
Throws:
NoSuchElementException - if path is empty.

topmost

public String topmost(int i)
Looks at the i-th topmost namespace without removing it from the stack.

Parameters:
i - index into the namespace path, 1 is the topmost, 2 is the second topmost etc.
Returns:
topmost namespace.
Throws:
NoSuchElementException - if i points beyond root namespace.

pop

public String pop()
Removes the topmost namespace and returns is as the value of this function.

Returns:
ex-topmost namespace.
Throws:
NoSuchElementException - if path is empty.

push

public String push(String namespace)
Pushes a namespace onto the top of this stack.

Parameters:
namespace - new topmost namespace.
Returns:
the namespace argument.

size

public int size()
Returns the length of the path.

Returns:
the path size.

getRoot

public String getRoot()
Returns the root namespace.

Returns:
the bottom of the stack.
Throws:
NoSuchElementException - if path is empty.

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright 2003-2003-2006 null. All Rights Reserved.