SMILA (incubation) API documentation

org.eclipse.smila.blackboard.path
Class Path

java.lang.Object
  extended by org.eclipse.smila.blackboard.path.Path
All Implemented Interfaces:
java.io.Serializable, java.lang.Iterable<PathStep>

public class Path
extends java.lang.Object
implements java.io.Serializable, java.lang.Iterable<PathStep>

String format of attribute path is "attributeName1@index1/attributeName2@index2/...". the specification of index is optional and defaults to 0. if the index refers to a literal or a sub-object depends on methods getting the argument

See Also:
Serialized Form

Field Summary
static char SEPARATOR
          The Constant SEPARATOR.
 
Constructor Summary
Path()
          Instantiates a new path.
Path(Path path)
          Instantiates a new path by a given Path object.
Path(java.lang.String path)
          Instantiates a new path by parsing the attribute path string.
 
Method Summary
 Path add(PathStep step)
          Extends path with the given PathStep.
 Path add(java.lang.String attributeName)
          Creates PathStep and extends path with it.
 Path add(java.lang.String attributeName, int index)
          Creates PathStep and extends path with it.
 boolean equals(java.lang.Object other)
          
 PathStep get(int index)
          Gets the PathStep at the given index.
 int getIndex(int index)
          Gets the PathStep index at the given index.
 java.lang.String getName(int index)
          Gets the PathStep name at the given index.
 int hashCode()
          
 Path incIndex()
          Increase index of tail step by 1.
 boolean isEmpty()
          Checks if the Path is empty.
 java.util.Iterator<PathStep> iterator()
          
 int length()
          Length of the Path.
 java.lang.String toString()
          
 Path up()
          Remove tail element of this.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SEPARATOR

public static final char SEPARATOR
The Constant SEPARATOR.

See Also:
Constant Field Values
Constructor Detail

Path

public Path()
Instantiates a new path.


Path

public Path(Path path)
Instantiates a new path by a given Path object.

Parameters:
path - the path

Path

public Path(java.lang.String path)
Instantiates a new path by parsing the attribute path string.

Parameters:
path - the path
Method Detail

add

public Path add(PathStep step)
Extends path with the given PathStep.

Parameters:
step - the step
Returns:
the path

add

public Path add(java.lang.String attributeName)
Creates PathStep and extends path with it.

Parameters:
attributeName - the attribute name
Returns:
the path

add

public Path add(java.lang.String attributeName,
                int index)
Creates PathStep and extends path with it.

Parameters:
attributeName - the attribute name
index - the index
Returns:
the path

up

public Path up()
Remove tail element of this. This modifies the object itself and returns it again for further modifications, e.g. path.up().add("siblingAttribute");

Returns:
the path

incIndex

public Path incIndex()
Increase index of tail step by 1.

Returns:
the path

iterator

public java.util.Iterator<PathStep> iterator()

Specified by:
iterator in interface java.lang.Iterable<PathStep>

isEmpty

public boolean isEmpty()
Checks if the Path is empty.

Returns:
true, if is empty

get

public PathStep get(int index)
Gets the PathStep at the given index.

Parameters:
index - the index
Returns:
the string

getName

public java.lang.String getName(int index)
Gets the PathStep name at the given index.

Parameters:
index - the index
Returns:
the string

getIndex

public int getIndex(int index)
Gets the PathStep index at the given index.

Parameters:
index - the index
Returns:
the string

length

public int length()
Length of the Path.

Returns:
the int

equals

public boolean equals(java.lang.Object other)

Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()

Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()

Overrides:
toString in class java.lang.Object

SMILA (incubation) API documentation