org.palo.api.utils
Class ElementPath

java.lang.Object
  extended by org.palo.api.utils.ElementPath

public class ElementPath
extends java.lang.Object

An ElementPath is a distinct reference to an Element inside a structure of multiple Dimensions. Therefore a path could be build up of several so called parts where each part describes a path inside a single Dimension.

NOTE: the assemble of the ElementPath is determined by the order at which the single parts are added. It is therefore important to add the path parts of each dimension according to the dimension hierarchy.

The toString() and the restore(Dimension[], String) can be used to save and restore an ElementPath.

Version:
$Id: ElementPath.html,v 1.15 2009/07/09 11:01:47 ArndHouben Exp $

Field Summary
static java.lang.String DIM_HIER_DELIM
           
static java.lang.String DIMENSION_DELIM
           
static java.lang.String ELEMENT_DELIM
           
 
Constructor Summary
ElementPath()
          Default constructor which creates an empty ElementPath instance.
ElementPath(Element[] elements)
          Creates an ElementPath instance which consists of the given Elements.
 
Method Summary
 void addPart(Dimension dimension, Element[] path)
          Adds a new part to this element path with the given path for the specified Dimension
 void addPart(Hierarchy hierarchy, Element[] path)
           
 boolean contains(Dimension dimension)
          Checks if the given Dimension is part of this element paths.
 boolean contains(Hierarchy hierarchy)
           
 ElementPath copy()
          Returns a copy of this element path instance
 boolean equals(java.lang.Object obj)
           
 Element[] getComplete()
           
 Dimension[] getDimensions()
          Returns all Dimensions which are part of this element path.
 Hierarchy[] getHierarchies()
           
 Element[] getPart(Dimension dimension)
          Returns the path part which corresponds to the given Dimension
 Element[] getPart(Hierarchy hierarchy)
           
 int hashCode()
           
static ElementPath restore(Dimension[] dimensions, java.lang.String pathStr)
          Restores the element path specified by the given Dimensions and element path string
static ElementPath restore(Hierarchy[] hierarchies, java.lang.String pathStr)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ELEMENT_DELIM

public static final java.lang.String ELEMENT_DELIM
See Also:
Constant Field Values

DIMENSION_DELIM

public static final java.lang.String DIMENSION_DELIM
See Also:
Constant Field Values

DIM_HIER_DELIM

public static final java.lang.String DIM_HIER_DELIM
See Also:
Constant Field Values
Constructor Detail

ElementPath

public ElementPath()
Default constructor which creates an empty ElementPath instance.


ElementPath

public ElementPath(Element[] elements)
Creates an ElementPath instance which consists of the given Elements.

Parameters:
elements - the path Elements
Method Detail

addPart

public final void addPart(Dimension dimension,
                          Element[] path)
Adds a new part to this element path with the given path for the specified Dimension

Parameters:
dimension -
pathPart -

addPart

public final void addPart(Hierarchy hierarchy,
                          Element[] path)

getComplete

public final Element[] getComplete()

contains

public final boolean contains(Dimension dimension)
Checks if the given Dimension is part of this element paths.

Returns:
true if Dimension is part of this element paths, false otherwise

contains

public final boolean contains(Hierarchy hierarchy)

getDimensions

public final Dimension[] getDimensions()
Returns all Dimensions which are part of this element path.

Returns:
all Dimensions which build up this path

getHierarchies

public final Hierarchy[] getHierarchies()

getPart

public final Element[] getPart(Dimension dimension)
                        throws PaloAPIException
Returns the path part which corresponds to the given Dimension

Parameters:
dimension - the Dimension which contains the path part
Returns:
the path part as an array of Elements
Throws:
PaloAPIException - if no path part could be determined, i.e. the given Dimension is not part of this element path

getPart

public final Element[] getPart(Hierarchy hierarchy)
                        throws PaloAPIException
Throws:
PaloAPIException

toString

public final java.lang.String toString()
Overrides:
toString in class java.lang.Object

copy

public ElementPath copy()
Returns a copy of this element path instance

Returns:
a copy of this element path

equals

public final boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public final int hashCode()
Overrides:
hashCode in class java.lang.Object

restore

public static final ElementPath restore(Dimension[] dimensions,
                                        java.lang.String pathStr)
Restores the element path specified by the given Dimensions and element path string

Parameters:
dimensions - the code>Dimensions which build up this element path
pathStr - an element path definition string
Returns:
a new element path instance

restore

public static final ElementPath restore(Hierarchy[] hierarchies,
                                        java.lang.String pathStr)