public class Pedigree
extends java.lang.Object
Pedigree
is transient information relating to a map or array indicating
the route by which it was reached; it thus compensates for the absence of parent
pointers in a JSON-like tree, by allowing the steps used to reach a map or array
in such a structure to be retraced.
A map or array that has a Pedigree
is represented by a PedigreeValue
,
which is a combination of the map/array and the Pedigree
. The Pedigree
holds a reference to the "container" PedigreeValue
from which this map or
array was reached, and the key or index value within that container.
Note that maps and arrays have no externally visible identity. It is not meaningful to ask whether the same map can be reached by two different routes, because there is no way to establish "sameness".
A map or array will have a Pedigree
if it is found by downwards selection
from a map or array that itself has a Pedigree
, or if it was explicitly
created with a Pedigree
.
Modifier and Type | Field and Description |
---|---|
static Pedigree |
PEDIGREE_ROOT
An empty
Pedigree : that is, the Pedigree of a map or array that
was created as the root of a pedigree tree. |
Constructor and Description |
---|
Pedigree(PedigreeValue container,
AtomicValue key)
Create a pedigree for a map or array obtained by selection
from a map, using a key value
|
Pedigree(PedigreeValue container,
int index)
Create a pedigree for a map or array obtained by selection
from an array, using an index value as a subscript into the array
|
Modifier and Type | Method and Description |
---|---|
PedigreeValue |
getContainer()
Get the containing map or array
|
int |
getIndex()
Get the index if this item was obtained by selection from an array
|
AtomicValue |
getKey()
Get the key if this item was obtained by selection from a map
|
GroundedValue<?> |
makePedigreeValue(GroundedValue<?> value)
Make a map or array that combines a supplied map or array with this pedigree
|
public static final Pedigree PEDIGREE_ROOT
Pedigree
: that is, the Pedigree
of a map or array that
was created as the root of a pedigree tree.public Pedigree(PedigreeValue container, AtomicValue key)
container
- the containing mapkey
- the key value used to select an entry in the containing mappublic Pedigree(PedigreeValue container, int index)
container
- the containing mapindex
- the zero-based index value used to select a member of the containing arraypublic PedigreeValue getContainer()
public int getIndex()
public AtomicValue getKey()
public GroundedValue<?> makePedigreeValue(GroundedValue<?> value)
value
- the supplied valueCopyright (c) 2004-2020 Saxonica Limited. All rights reserved.