public class PosInProgram
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
PosInProgram.PosArrayIntIterator |
Modifier and Type | Field and Description |
---|---|
private int |
depth
pointer to the (last element + 1) in pos valid for this position
|
static PosInProgram |
ONE |
static PosInProgram |
ONE_ONE |
static PosInProgram |
ONE_ZERO |
private int[] |
pos
the position number
|
static PosInProgram |
TOP
pos at the beginning of the program
|
static PosInProgram |
ZERO
often used positions
|
static PosInProgram |
ZERO_ONE |
static PosInProgram |
ZERO_ZERO |
Modifier | Constructor and Description |
---|---|
private |
PosInProgram()
creates a new PosInProgram
position.
|
private |
PosInProgram(int[] pos,
int depth) |
private |
PosInProgram(PosInProgram pip,
int posNr)
creates a new program position
|
Modifier and Type | Method and Description |
---|---|
private PosInProgram |
add(PosInProgram first,
PosInProgram second) |
PosInProgram |
append(PosInProgram pp) |
int |
depth()
size of the position list
|
PosInProgram |
down(int n)
descending downwards choosing the n'th statement of the program
|
boolean |
equals(java.lang.Object obj)
compares this PosInProgram with another PosInProgram
and returns true if both describe the same position
|
int |
get(int i) |
ProgramElement |
getProgram(ProgramElement pe) |
static ProgramElement |
getProgramAt(PosInProgram pos,
ProgramElement prg)
returns the ProgramElement at the given position
|
int |
hashCode() |
IntIterator |
iterator()
returns an iterator over the list defining the position in a term.
|
int |
last()
return the last index (or -1 if this == TOP)
|
boolean |
leq(PosInProgram pip) |
PosInProgram |
prepend(PosInProgram pp) |
java.lang.String |
toString()
toString
|
PosInProgram |
up()
ascends one AST level
|
public static final PosInProgram TOP
public static final PosInProgram ZERO
public static final PosInProgram ZERO_ZERO
public static final PosInProgram ZERO_ONE
public static final PosInProgram ONE
public static final PosInProgram ONE_ZERO
public static final PosInProgram ONE_ONE
private final int[] pos
private final int depth
private PosInProgram(PosInProgram pip, int posNr)
private PosInProgram()
private PosInProgram(int[] pos, int depth)
public static ProgramElement getProgramAt(PosInProgram pos, ProgramElement prg)
pos
- the PosInProgramprg
- the ProgramElement we walk throughjava.lang.IndexOutOfBoundsException
- if the given position
refers to a non-existant programpublic int depth()
public PosInProgram down(int n)
n
- the int describes the position of the statement in the blockpublic PosInProgram up()
public PosInProgram append(PosInProgram pp)
public PosInProgram prepend(PosInProgram pp)
private PosInProgram add(PosInProgram first, PosInProgram second)
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public boolean leq(PosInProgram pip)
public int get(int i)
public int last()
public ProgramElement getProgram(ProgramElement pe)
public IntIterator iterator()
public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object