|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.softwareag.mdm.schema.Path
A path is used for locating a node in a tree structure. It consists of a sequence of steps, each step identifying a branch in the tree.
In the string notation, the steps are separated by "/" (slash). The syntax supported is indeed a small subset of XPath:
Examples :
/domain/customer/lastName
is an absolute location.../customer/lastName
is a relative location starting on parent.
./customer/lastName
and customer/lastName
are both
relative locations starting on current node (self) and are equal.
Field Summary | |
static Path |
PARENT
Corresponds to the path " .. |
static Path |
ROOT
Corresponds to the path " / ". |
static Path |
SELF
Corresponds to the path " . |
Method Summary | |
abstract Path |
add(Path aPath)
Concatenates this path instance with the path specified. |
abstract Path |
add(Step aStep)
|
abstract Path |
add(String aKey)
|
abstract String |
format()
Returns the canonical string representation of this instance. |
abstract Step |
getFirstStep()
Returns the first step of this path, null for root path. |
abstract Step |
getLastStep()
Returns the last step of this path, null for root path. |
abstract Path |
getPathWithoutLastStep()
Returns this path minus its last step. |
abstract int |
getSize()
Returns the number of steps in this path. |
abstract Step |
getStep(int i)
Returns the step at the specified position in this path. |
abstract Step[] |
getSteps()
Returns the steps array of this path. |
abstract Path |
getSubPath(int beginIndex)
Returns a new path that is a subpath of this path. |
abstract Path |
getSubPath(int beginIndex,
int endIndex)
Returns a new path that is a subpath of this path. |
abstract boolean |
isRelative()
Returns true if this path begins with '.' |
abstract boolean |
isRoot()
Returns true if this is the root path (whose canonical notation is "
/ "). |
abstract boolean |
isSelf()
Returns true if this is the self path (whose canonical notation is "
. |
static Path |
parse(String pathString)
Returns the path from the string specified. |
abstract Path |
resolveWith(Path aPath)
Resolves the path specified against this instance by considering that this instance is the "current location". |
boolean |
startsWith(Path aPath)
Tests if this path starts with the specified prefix. |
abstract boolean |
startsWith(Path aPath,
int offset)
Tests if this path starts with the specified prefix beginning at specified index. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface java.lang.Comparable |
compareTo |
Field Detail |
public static final Path ROOT
/
".
public static final Path SELF
.
".
public static final Path PARENT
..
".
Method Detail |
public static Path parse(String pathString)
See class comment for syntax description. This method also operates path simplification when
possible if it includes .
or ..
.
public abstract Path add(String aKey)
add(Path)
public abstract Path add(Path aPath)
Examples:
this |
aPath |
result |
/a/b/c | /d/e | /a/b/c/d/e |
/a/b/c | . | /a/b/c |
/a/b/c | ./d/e | /a/b/c/d/e |
/a/b/c | ../d/e | /a/b/d/e |
/a/b/c | .. | /a/b |
/a/b/c | ../.. | /a |
/a/b/c | ../../.. | / |
/a/b/c | ../../../.. | .. |
/a/b/c | ../../../../d/e | ../d/e |
/a/b/c | ../../.. | / |
. | /a/b/c | ./a/b/c |
. | .. | .. |
resolveWith(Path)
public abstract Path add(Step aStep)
add(Path)
public abstract Step getFirstStep()
null
for root path.
public abstract Path resolveWith(Path aPath)
aPath
is absolute then it returns aPath
(no relative
resolution); if aPath
is relative then it returns
this.add(aPath)
add(Path)
public abstract Step getStep(int i)
public abstract Step[] getSteps()
public abstract Step getLastStep()
null
for root path.
public abstract Path getPathWithoutLastStep()
Example and special cases:
/a/b/c
, it returns /a/b
/
, it returns null
.
, it returns /
..
, it returns /
public abstract Path getSubPath(int beginIndex)
beginIndex
key and extends to the end of this path.
public abstract Path getSubPath(int beginIndex, int endIndex)
beginIndex
key and extends to the key at index endIndex - 1
.
Thus the size of the subpath is endIndex-beginIndex
.
public boolean startsWith(Path aPath)
public abstract boolean startsWith(Path aPath, int offset)
public abstract int getSize()
A relative notation with SELF
always counts SELF
as a first
step. For example, for the notation a/b/c
, this method returns 4 since it is
viewed as ./a/b/c
.
public abstract boolean isRelative()
true
if this path begins with '.' (current) or '..' (parent).
public abstract boolean isRoot()
true
if this is the root path (whose canonical notation is "
/
").
public abstract boolean isSelf()
true
if this is the self path (whose canonical notation is "
.
").
public abstract String format()
Examples: /a/b/c
is an absolute path notation, ./a/b/c
is the
notation for a relative path starting with self, ../a/b/c
is the notation for
a relative path starting with parent; .
parse(String)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
(report a bug)
webMethods MDM 4.2.8 [0558]
Copyright Software AG 2000-2007. All rights reserved.