public class FormIndex
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private boolean |
beginningOfForm |
private boolean |
endOfForm |
private int |
instanceIndex
The multiplicity of the current instance of a repeated question or group
|
private int |
localIndex
The index of the questiondef in the current context
|
private FormIndex |
nextLevel
The next level of this index
|
private TreeReference |
reference |
Constructor and Description |
---|
FormIndex(FormIndex nextLevel,
FormIndex currentLevel)
Constructs an index which references an element past the level of
specificity of the current context, founded by the currentLevel
index.
|
FormIndex(FormIndex nextLevel,
int localIndex,
int instanceIndex,
TreeReference reference)
Constructs an index which indexes an element, and provides an index
into that elements children, along with the current index of a
repeated instance.
|
FormIndex(FormIndex nextLevel,
int localIndex,
TreeReference reference)
Constructs an index which indexes an element, and provides an index
into that elements children
|
FormIndex(int localIndex,
int instanceIndex,
TreeReference reference)
Constructs a simple form index that references a specific element in
a list of elements.
|
FormIndex(int localIndex,
TreeReference reference)
Constructs a simple form index that references a specific element in
a list of elements.
|
Modifier and Type | Method and Description |
---|---|
void |
assignRefs(FormDef f) |
int |
compareTo(java.lang.Object o) |
static FormIndex |
createBeginningOfFormIndex() |
static FormIndex |
createEndOfFormIndex() |
FormIndex |
diff(FormIndex subIndex)
Takes in a form index which is a subset of this index, and returns the
total difference between them.
|
boolean |
equals(java.lang.Object o) |
int |
getDepth() |
int |
getElementMultiplicity()
For the fully qualified element, get the multiplicity of the element's reference
|
int |
getInstanceIndex() |
int |
getLocalIndex() |
TreeReference |
getLocalReference() |
FormIndex |
getNextLevel() |
TreeReference |
getReference() |
FormIndex |
getTerminal() |
boolean |
isBeginningOfFormIndex() |
boolean |
isEndOfFormIndex() |
boolean |
isInForm() |
static boolean |
isSubElement(FormIndex parent,
FormIndex child) |
static boolean |
isSubIndex(FormIndex parent,
FormIndex child) |
boolean |
isTerminal()
Identifies whether this is a terminal index, in other words whether this
index references with more specificity than the current context
|
FormIndex |
snip() |
java.lang.String |
toString() |
static FormIndex |
trimNegativeIndices(FormIndex index)
Trims any negative indices from the end of the passed in index.
|
private boolean beginningOfForm
private boolean endOfForm
private int localIndex
private int instanceIndex
private FormIndex nextLevel
private TreeReference reference
public FormIndex(int localIndex, TreeReference reference)
localIndex
- An integer index into a flat list of elementsreference
- A reference to the instance element identified by this index;public FormIndex(int localIndex, int instanceIndex, TreeReference reference)
localIndex
- An integer index into a flat list of elementsinstanceIndex
- An integer index expressing the multiplicity
of the current levelreference
- A reference to the instance element identified by this index;public FormIndex(FormIndex nextLevel, int localIndex, TreeReference reference)
nextLevel
- An index into the referenced element's indexlocalIndex
- An index to an element at the current level, a child
element of which will be referenced by the nextLevel index.reference
- A reference to the instance element identified by this index;public FormIndex(FormIndex nextLevel, FormIndex currentLevel)
public FormIndex(FormIndex nextLevel, int localIndex, int instanceIndex, TreeReference reference)
nextLevel
- An index into the referenced element's indexlocalIndex
- An index to an element at the current level, a child
element of which will be referenced by the nextLevel index.instanceIndex
- How many times the element referenced has been
repeated.reference
- A reference to the instance element identified by this index;public static FormIndex createBeginningOfFormIndex()
public static FormIndex createEndOfFormIndex()
public boolean isInForm()
public int getLocalIndex()
public int getInstanceIndex()
public int getElementMultiplicity()
public FormIndex getNextLevel()
public TreeReference getLocalReference()
public TreeReference getReference()
public FormIndex getTerminal()
public boolean isTerminal()
public boolean isEndOfFormIndex()
public boolean isBeginningOfFormIndex()
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int compareTo(java.lang.Object o)
public FormIndex snip()
public FormIndex diff(FormIndex subIndex)
subIndex
- public java.lang.String toString()
toString
in class java.lang.Object
public int getDepth()
public static FormIndex trimNegativeIndices(FormIndex index)
index
- public void assignRefs(FormDef f)