V
- Type used to store values. May be an array for parsed nodes, or a String for unparsed.S
- CRTP parameter, used so that getSubNodes()
and similar return the same type.public abstract class ArrayNode<V,S extends ArrayNode<V,S>>
extends java.lang.Object
Class representing unparsed array nodes.
Modifier and Type | Class and Description |
---|---|
static class |
ArrayNode.Parsed<A>
A parsed tree that represents the values of (part of) an ARRAY-valued parameter.
|
static class |
ArrayNode.Raw
An unparsed tree that represents (part of) an ARRAY-valued parameter.
|
Modifier and Type | Field and Description |
---|---|
protected V |
elems
Elements for a data node.
|
Constructor and Description |
---|
ArrayNode(java.util.List<? extends S> subNodes)
Create an internal node with the given subnodes.
|
ArrayNode(V values)
Create a data node with the given values.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
dataEquals(ArrayNode<?,?> other)
Comparison of data values, override if more fields need to be compared.
|
protected int |
dataHashCode()
Hash code of data values, override if more fields need to be considered.
|
protected abstract java.lang.String |
dataToStr()
String version of the data elements.
|
boolean |
equals(java.lang.Object other) |
V |
getData()
Returns the raw data elements, or null if this is an internal node without data.
|
V |
getDataAtSub(int... indices)
Return the data at the given index position in the tree.
|
protected abstract int |
getDataDim()
For data nodes, return the size of the data elements.
|
int |
getDim()
Get the size of this array node (i.e.
|
java.util.List<java.lang.Integer> |
getDimsEnvelope()
Compute the rectangular envelope for the dimensions of this array node, considering
all nodes below it in the tree.
|
S |
getSubNodeAt(int... indices)
Return the subnode at the given index position in the tree.
|
java.util.List<S> |
getSubNodes()
Returns the list of subnodes, or the empty list if this is a data node without subnodes.
|
int |
hashCode() |
boolean |
isDataNode()
Returns true if this node was built with data elements, false if it was built with subnodes.
|
java.lang.String |
toString()
Return a user-understandable representation of the tree, useful for debugging.
|
protected final V elems
public ArrayNode(V values)
public ArrayNode(java.util.List<? extends S> subNodes)
public final boolean isDataNode()
public V getData()
public final java.util.List<S> getSubNodes()
public final S getSubNodeAt(int... indices)
s = s.getSubNodes().get(i)
for each index given, with
s initially equal to this object. The final s value is returned.indices
- Index values for each dimension.public final V getDataAtSub(int... indices)
getSubNodeAt(indices).getData()
, except in the case
that indices is empty, in which this method does return the result
of calling getData()
on this instead of throwing.indices
- Index values for each dimension.getData()
,
getSubNodeAt(int...)
public final int getDim()
protected abstract int getDataDim()
public final java.util.List<java.lang.Integer> getDimsEnvelope()
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object other)
equals
in class java.lang.Object
protected boolean dataEquals(ArrayNode<?,?> other)
public int hashCode()
hashCode
in class java.lang.Object
protected int dataHashCode()
protected abstract java.lang.String dataToStr()