public final class LapPath extends Object implements Iterable<LapPath.Link>
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.| Modifier and Type | Class and Description |
|---|---|
static class |
LapPath.Link
One link of the path, immutable.
|
| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
LapPath() |
| Modifier and Type | Method and Description |
|---|---|
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() |
<T extends PoshElement> |
traversePath(PoshPlan plan)
Methods with name traverseXYZ mean traverse from XYZ below xyzLink means
gor from xyz below according to type and id.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitforEach, spliteratorpublic static final LapPath EMPTY
public static LapPath PLAN_PATH
public static LapPath DRIVE_COLLECTION_PATH
LapType.DRIVE_COLLECTION. Equivalent of
/P:0/DC:0public <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
syntaxIndexOutOfBoundsException - 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:1ParseExceptionpublic LapPath concat(LapType type, int id)
public 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)
Copyright © 2018 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All rights reserved.