|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectcz.cuni.amis.pogamut.sposh.elements.LapPath
public final class LapPath
LapPath is used to describe path from the root of PoshPlan to
some subnode of the plan. The path consists from several links, each link
describes which cild of current node should be used to change into new
current node.
There are three major features we require:
1. Parse path from string
2. traverse plan according to the path and return the node.
3. serialize path to the string
Examples of serialized path:
/P:0/DC:0 - default plan, drive collection 0
/P:0/DC:0/S:1 - Drive collection 0, goal sense 1
/P:0/DC:0/DE:4 - fifth drive in the DC
/P:0/DC:0/DE:4/S:0 - first trigger sense of fifth drive in the DC
/P:0/DC:0/DE:4/A:0/AP:4 - reference to AP node.
| Nested Class Summary | |
|---|---|
static class |
LapPath.Link
One link of the path, immutable. |
| Field Summary | |
|---|---|
static LapPath |
DRIVE_COLLECTION_PATH
Path to the LapType.DRIVE_COLLECTION. |
static LapPath |
EMPTY
Empty path with no links. |
static LapPath |
PLAN_PATH
Path to the root of the plan, equivalent of /P:0 |
| Constructor Summary | |
|---|---|
LapPath()
|
|
| Method Summary | ||
|---|---|---|
LapPath |
concat(LapPath.Link appendedLink)
|
|
LapPath |
concat(LapPath appendPath)
Create new path consisting from this path and @appendPath |
|
LapPath |
concat(LapType type,
int id)
Create and return new LapPath by appending new link to all links of current path. |
|
boolean |
equals(Object obj)
|
|
LapPath.Link |
getLink(int linkId)
|
|
static LapPath |
getLinkPath(PoshElement endElement)
Construct path from the @endElement to its very first branch node(DC, AD, AP, C) upward in the tree. |
|
int |
hashCode()
|
|
Iterator<LapPath.Link> |
iterator()
|
|
int |
length()
|
|
static LapPath |
parse(String serializedPath)
Parse @serializedPath to |
|
LapPath |
subpath(int beginIndex,
int endIndex)
Return subpath of this path. |
|
String |
toString()
|
|
|
traversePath(PoshPlan plan)
Methods with name traverseXYZ mean traverse from XYZ below xyzLink means gor from xyz below according to type and id. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final LapPath EMPTY
public static LapPath PLAN_PATH
public static LapPath DRIVE_COLLECTION_PATH
LapType.DRIVE_COLLECTION. Equivalent of
/P:0/DC:0
| Constructor Detail |
|---|
public LapPath()
| Method Detail |
|---|
public <T extends PoshElement> T traversePath(PoshPlan plan)
plan -
IllegalStateException - If path does not play nice with tree, e.g.
when paths wants sense subnode in AP, but there is none according to
syntax
IndexOutOfBoundsException - If some id on the path references to
nonexistent node.public static LapPath getLinkPath(PoshElement endElement)
LapType.SENSE
in the second CompetenceElement of fourth Competence, the
path will be something like /C:4/CE:2/S:3, since the Competence
is a branch node.
endElement - Element whose ancestor we use to create path.
public static LapPath parse(String serializedPath)
throws ParseException
serializedPath - LapPath in serialized form, e.g.
/P:0/DC:0/DE:1/S:1
ParseException
public LapPath concat(LapType type,
int id)
public String toString()
toString in class Objectpublic boolean equals(Object obj)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic LapPath concat(LapPath appendPath)
appendPath - Path that will be appended to this and returned.public LapPath concat(LapPath.Link appendedLink)
public LapPath subpath(int beginIndex,
int endIndex)
beginIndex - The beginning link index, inclusive.endIndex - The ending link index, exclusive.
IndexOutOfBoundsException - If beginIndex < 0 or endIndex >
length of path or beginIndex > endIndex.public int length()
public Iterator<LapPath.Link> iterator()
iterator in interface Iterable<LapPath.Link>public LapPath.Link getLink(int linkId)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||