public class Node extends java.lang.Object implements Connectable, Duplicable
Modifier and Type | Field and Description |
---|---|
protected java.util.Map<java.lang.Integer,java.util.List<Pin<? extends Node>>> |
m_inputs
A map associating input pin indices with a list of output pins of other
nodes.
|
protected java.util.Map<java.lang.Integer,java.util.List<Pin<? extends Node>>> |
m_outputs
A map associating output pin indices with a list of input pins of other
nodes.
|
Constructor and Description |
---|
Node(int in_arity,
int out_arity)
Creates a new node.
|
Modifier and Type | Method and Description |
---|---|
void |
addToInput(int index,
Pin<? extends Node> pin)
Adds a node's output pin to the set of connections of this node's
input pin.
|
void |
addToOutput(int index,
Pin<? extends Node> pin)
Adds a node's input pin to the set of connections of this node's
output pin.
|
protected void |
copyInto(Node n,
boolean with_state)
Copies the contents of the current node into another node instance.
|
Node |
duplicate()
Creates a copy of an object.
|
Node |
duplicate(boolean with_state)
Creates a possibly stateful copy of an object.
|
int |
getInputArity()
Gets the input arity of the node.
|
java.util.Collection<Pin<? extends Node>> |
getInputLinks(int index)
Gets the output pins of other nodes that are connected to a given
input pin of this node.
|
Pin<? extends Node> |
getInputPin(int index)
Gets the node's input pin for a given index.
|
int |
getOutputArity()
Gets the output arity of the node.
|
java.util.List<Pin<? extends Node>> |
getOutputLinks(int index)
Gets the input pins of other nodes that are connected to a given
output pin of this node.
|
Pin<? extends Node> |
getOutputPin(int index)
Gets the node's input pin for a given index.
|
void |
removeFromInput(int index,
Pin<? extends Node> pin)
Removes a node's output pin to the set of connections of this node's
input pin.
|
void |
removeFromOutput(int index,
Pin<? extends Node> pin)
Removes a node's input pin to the set of connections of this node's
output pin.
|
void |
setToInput(int index,
Pin<? extends Node> pin)
Sets a node's output pin as the connection of this node's input
pin.
|
void |
setToOutput(int index,
Pin<? extends Node> pin)
Sets a node's input pin as the connection of this node's output
pin.
|
protected java.util.Map<java.lang.Integer,java.util.List<Pin<? extends Node>>> m_inputs
public Node(int in_arity, int out_arity)
in_arity
- The number of input pins on this nodeout_arity
- The number of output pins on this nodepublic int getInputArity()
Connectable
getInputArity
in interface Connectable
public int getOutputArity()
Connectable
getOutputArity
in interface Connectable
public java.util.Collection<Pin<? extends Node>> getInputLinks(int index)
Connectable
getInputLinks
in interface Connectable
index
- The index of the current node's input pinpublic java.util.List<Pin<? extends Node>> getOutputLinks(int index)
Connectable
getOutputLinks
in interface Connectable
index
- The index of the current node's output pinpublic void addToInput(int index, Pin<? extends Node> pin)
Connectable
addToInput
in interface Connectable
index
- The index of the current node's input pinpin
- A node's output pin to add to the connectionspublic void setToInput(int index, Pin<? extends Node> pin)
Connectable
setToInput
in interface Connectable
index
- The index of the current node's input pinpin
- A node's output pin to add to the connectionspublic void removeFromInput(int index, Pin<? extends Node> pin)
Connectable
removeFromInput
in interface Connectable
index
- The index of the current node's input pinpin
- A node's output pin to remove from the connectionspublic void addToOutput(int index, Pin<? extends Node> pin)
Connectable
addToOutput
in interface Connectable
index
- The index of the current node's output pinpin
- A node's input pin to add to the connectionspublic void setToOutput(int index, Pin<? extends Node> pin)
Connectable
setToOutput
in interface Connectable
index
- The index of the current node's output pinpin
- A node's input pin to add to the connectionspublic void removeFromOutput(int index, Pin<? extends Node> pin)
Connectable
removeFromOutput
in interface Connectable
index
- The index of the current node's output pinpin
- A node's input pin to remove from the connectionspublic Pin<? extends Node> getInputPin(int index) throws java.lang.IndexOutOfBoundsException
Connectable
getInputPin
in interface Connectable
index
- The indexjava.lang.IndexOutOfBoundsException
- If the index is incompatible with
the node's input aritypublic Pin<? extends Node> getOutputPin(int index) throws java.lang.IndexOutOfBoundsException
Connectable
getOutputPin
in interface Connectable
index
- The indexjava.lang.IndexOutOfBoundsException
- If the index is incompatible with
the node's output aritypublic Node duplicate()
Duplicable
duplicate(false)
.duplicate
in interface Duplicable
public Node duplicate(boolean with_state)
Duplicable
duplicate
in interface Duplicable
with_state
- Set to true
for a stateful copy, false
otherwiseprotected void copyInto(Node n, boolean with_state)
n
- The other nodewith_state
- Set to true
for a stateful copy, false
otherwiseCopyright © Sylvain HallĂ©. All Rights Reserved.