Interface InstanceNode
-
- All Superinterfaces:
Serializable
public interface InstanceNode extends Serializable
An instance node represents an instance and provides direct access to the corresponding child instances in the corresponding iteration. In this way it allows to have the complete hierarchy of a (parent) instance, aka. an instance tree. Each instance tree has 3 dimensions:- parent/child relations
- iterations (time dimension)
- var par siblings
Instances of a varpar have siblings and provide access to the next (with respect to the order of varpar instances) var par instance.
-
-
Field Summary
Fields Modifier and Type Field Description static long
serialVersionUID
Generated ID for serialisation.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addChild(int nodeId, InstanceNode child)
Adds the designated instance node as child at the designated node ID.InstanceNode
addVarParSibling(InstanceNode sibling)
Adds the designated instance node as new varpar sibling.boolean
filterMatches()
Gets whether the filter matches for one (child) instance of this instance tree.UUID
getBaseTemplId()
Gets the templateId this instance node is based on.SortedMap<Integer,InstanceNode>
getChildAt(int nodeId)
Gets the direct child instances at the designated node of the instance this instance node refers to indexed by the iterations of the designated node.Map<Integer,SortedMap<Integer,InstanceNode>>
getChildren()
Gets the direct child instances of the instance this instance node refers to.InstanceReference
getInstRef()
Gets the instance (reference) this instance node refers to.int
getIteration()
Gets the node iteration of the parent node of this instance orInteger.MIN_VALUE
if this instance is a top-level instance.int
getVarParIndex()
Gets the index of this instance in the varpar orInteger.MIN_VALUE
if this instance is not part of a varpar.InstanceNode
getVarParSibling()
Gets the next sibling of this instance in case of varpar.void
propagateFilterMatches(AtomicBoolean filterMatches)
Sets the boolean determining whether the instance filter has matched for one instance of this instance tree and propagates thisAtomicBoolean
to all children.void
setFilterMatches(boolean filterMatches)
Sets whether the filter matches for one instance of this tree.void
setSiblings(TreeMap<Integer,InstanceNode> siblings)
Sets the designated map as varpar sibling map of this instance node.
-
-
-
Field Detail
-
serialVersionUID
static final long serialVersionUID
Generated ID for serialisation.- See Also:
- Constant Field Values
-
-
Method Detail
-
getChildren
Map<Integer,SortedMap<Integer,InstanceNode>> getChildren()
Gets the direct child instances of the instance this instance node refers to. The map is indexed by the ID of the node referring to iteration and the corresponding subprocess instance. In case of varpar, this will contain (the instance node for) the first varpar instance.- Returns:
- The direct child instances of the instance this instance node refers to, indexed by the node ID and the iteration of the corresponding subprocess nodes.
-
getChildAt
SortedMap<Integer,InstanceNode> getChildAt(int nodeId)
Gets the direct child instances at the designated node of the instance this instance node refers to indexed by the iterations of the designated node. The map is sorted by the iteration.- Parameters:
nodeId
- The ID of the (subprocess) node of which to get the subprocess instance.- Returns:
- The direct child instances at the designated node of the instance this instance node
refers to indexed by the iterations of the designated node. This will be
null
if the designated node is no subprocess node.
-
getInstRef
InstanceReference getInstRef()
Gets the instance (reference) this instance node refers to.- Returns:
- The instance (reference) this instance node refers to.
-
getBaseTemplId
UUID getBaseTemplId()
Gets the templateId this instance node is based on.- Returns:
- The templateId this instance node is based on.
-
getIteration
int getIteration()
Gets the node iteration of the parent node of this instance orInteger.MIN_VALUE
if this instance is a top-level instance.- Returns:
- The node iteration of the parent node of this instance or
Integer.MIN_VALUE
if this instance is a top-level instance.
-
filterMatches
boolean filterMatches()
Gets whether the filter matches for one (child) instance of this instance tree.- Returns:
- Whether the filter matches for one (child) instance of this instance tree.
-
getVarParSibling
InstanceNode getVarParSibling()
Gets the next sibling of this instance in case of varpar. This will benull
if this instance is not a varpar instance or it is the last varpar instance.- Returns:
- The next sibling of this instance in case of varpar or
null
.
-
getVarParIndex
int getVarParIndex()
Gets the index of this instance in the varpar orInteger.MIN_VALUE
if this instance is not part of a varpar.- Returns:
- The index of this instance in the varpar or
Integer.MIN_VALUE
if this instance is not part of a varpar.
-
setFilterMatches
void setFilterMatches(boolean filterMatches)
Sets whether the filter matches for one instance of this tree. This will automatically set the value for all instance nodes of this tree.- Parameters:
filterMatches
- Whether the filter matches for one (child) instance of this instance tree.
-
propagateFilterMatches
void propagateFilterMatches(AtomicBoolean filterMatches)
Sets the boolean determining whether the instance filter has matched for one instance of this instance tree and propagates thisAtomicBoolean
to all children.- Parameters:
filterMatches
- The boolean determining whether the instance filter has matched for one instance of this instance tree.
-
addChild
void addChild(int nodeId, InstanceNode child)
Adds the designated instance node as child at the designated node ID. This node ID refers to a subprocess node of the instance this instance node refers to. The designated child instance (node) refers to the subprocess instance at the designated node.
This will also propagate the filter boolean to this child (the complete subtree).- Parameters:
nodeId
- The ID of the node in the instance that refers to the designated subprocess instance.child
- The instance node referring to the subprocess instance at the designated node.
-
setSiblings
void setSiblings(TreeMap<Integer,InstanceNode> siblings)
Sets the designated map as varpar sibling map of this instance node. This map is shared across all siblings and allows to retrieve the siblings in the correct order.Make sure the designated siblings belong to the same iteration as this instance node.
- Parameters:
siblings
- The map containing all (known) siblings of this instance ordered by the varpar index.
-
addVarParSibling
InstanceNode addVarParSibling(InstanceNode sibling)
Adds the designated instance node as new varpar sibling. The designated child instance (node) refers to a subprocess instance that is a (new) varpar sibling of this instance.
The designated sibling needs to be of the same iteration is this instance node, otherwise anIllegalArgumentException
will be thrown.- Parameters:
sibling
- The instance node referring to a new sibling varpar instance.- Returns:
- The lowest known varpar instance, i. e. the instance with the lowest index. This represents the varpar as child in the parent instance node and needs to be set appropriately
- Throws:
IllegalArgumentException
- If the designated sibling does not belong to the same iteration as this instance node, anIllegalArgumentException
will be thrown.
-
-