Class Path
java.lang.Object
|
+--Path
- public class Path
- extends Object
This class implements a path in a term.
- Author:
- P. URSO
- See Also:
Function
,
NodeList
Field Summary |
static Path |
Empty
Empty path |
Path |
next
Rest of the path. |
int |
num
Number of the argument. |
Constructor Summary |
Path(int car,
Path cdr)
Constructor of the path. |
Method Summary |
int |
length()
Returns the length of the path. |
Path |
prefix(int n)
Returns the prefix of the path of a specified length. |
String |
toString()
Returns string representation of the path. |
Empty
public static Path Empty
- Empty path
num
public int num
- Number of the argument.
next
public Path next
- Rest of the path.
Path
public Path(int car,
Path cdr)
- Constructor of the path.
- Parameters:
car
- the number of the argument.cdr
- the rest of the path.
length
public int length()
- Returns the length of the path.
- Returns:
- 1 plus length of the rest.
prefix
public Path prefix(int n)
- Returns the prefix of the path of a specified length.
- Parameters:
n
- the length of the prefix (less or equal than length
of this path).- Returns:
- Empty if the length is zero, a new path with the same number and
next.prefix(n-1) as rest.
toString
public String toString()
- Returns string representation of the path.
- Overrides:
toString
in class Object