public class NestedNode extends Node
Modifier and Type | Class and Description |
---|---|
class |
NestedNode.CopyCrawler
A crawler that creates copies of all visited nodes and connects them in
the same way as the originals.
|
static class |
NestedNode.NestedNodeCrawler
A crawler visiting all inner nodes of the nested node.
|
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.Integer,Pin<? extends Node>> |
m_inputAssociations
A map storing associations between the node's input pins and an input
pin of some internal node.
|
protected java.util.List<Node> |
m_internalNodes
The internal nodes contained within this node.
|
protected java.util.Map<java.lang.Integer,Pin<? extends Node>> |
m_outputAssociations
A map storing associations between the node's output pins and an output
pin of some internal node.
|
Constructor and Description |
---|
NestedNode(int in_arity,
int out_arity)
Creates a new empty nested node.
|
Modifier and Type | Method and Description |
---|---|
void |
addNodes(java.util.Collection<? extends Node> nodes)
Adds nodes to the internal nodes of this nested node.
|
void |
addNodes(Node... nodes)
Adds nodes to the internal nodes of this nested node.
|
void |
associateInput(int i,
Pin<? extends Node> p)
Associates an input pin of the nested node to an input pin of one of its
internal nodes.
|
void |
associateOutput(int i,
Pin<? extends Node> p)
Associates an input pin of the nested node to an output pin of one of its
internal nodes.
|
protected void |
copyInto(NestedNode nn,
boolean with_state) |
static NestedNode |
createFromTree(Node root)
Creates a new nested node from a tree of connected nodes.
|
NestedNode |
duplicate(boolean with_state)
Creates a possibly stateful copy of an object.
|
Pin<? extends Node> |
getAssociatedInput(int i)
Gets the input pin of the internal node associated to a given input pin
of the nested node.
|
Pin<? extends Node> |
getAssociatedOutput(int i)
Gets the output pin of the internal node associated to a given output pin
of the nested node.
|
protected NodeConnector |
getConnector()
Gets an instance of node connector.
|
int |
getNestedInput(Node node,
int index)
Gets the nested node input to which the n-th input of an inner node
is associated with.
|
addToInput, addToOutput, copyInto, duplicate, getInputArity, getInputLinks, getInputPin, getOutputArity, getOutputLinks, getOutputPin, removeFromInput, removeFromOutput, setToInput, setToOutput
protected java.util.List<Node> m_internalNodes
protected java.util.Map<java.lang.Integer,Pin<? extends Node>> m_inputAssociations
public NestedNode(int in_arity, int out_arity)
in_arity
- The node's input arityout_arity
- The node's output aritypublic static NestedNode createFromTree(Node root)
root
- The root of the treepublic void associateInput(int i, Pin<? extends Node> p)
i
- The index of the node's input pinp
- The input pin of the internal nodepublic Pin<? extends Node> getAssociatedInput(int i)
i
- The index of the input pin of the nested nodepublic void associateOutput(int i, Pin<? extends Node> p)
i
- The index of the node's output pinp
- The output pin of the internal nodepublic Pin<? extends Node> getAssociatedOutput(int i)
i
- The index of the output pin of the nested nodepublic void addNodes(java.util.Collection<? extends Node> nodes)
nodes
- The nodes to addpublic void addNodes(Node... nodes)
nodes
- The nodes to addpublic int getNestedInput(Node node, int index)
node
- The nodeindex
- The value of n in the previous descriptionpublic NestedNode duplicate(boolean with_state)
Duplicable
duplicate
in interface Duplicable
duplicate
in class Node
with_state
- Set to true
for a stateful copy, false
otherwiseprotected void copyInto(NestedNode nn, boolean with_state)
protected NodeConnector getConnector()
NodeConnector
.Copyright © Sylvain HallĂ©. All Rights Reserved.