Class NodeFactory
java.lang.Object
com.marginallyclever.nodegraphcore.NodeFactory
public class NodeFactory
extends java.lang.Object
Maintains a map of
Node
s and their names. Can create nodes on request, by name.
Can deliver a list of names.- Since:
- 2022-02-01
-
Constructor Summary
Constructors Constructor Description NodeFactory()
-
Method Summary
Modifier and Type Method Description static Node
createNode(java.lang.String name)
static java.lang.String[]
getNames()
static void
registerNode(Node n)
Does not allow nodes to be registered more than once.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
NodeFactory
public NodeFactory()
-
-
Method Details
-
registerNode
Does not allow nodes to be registered more than once.- Parameters:
n
- one instance of the node.- Throws:
java.lang.IllegalArgumentException
- if two nodes are registered with the same name.
-
createNode
-
getNames
public static java.lang.String[] getNames()- Returns:
- an array containing the unique names of every
Node
registered.
-