java.lang.Object
com.marginallyclever.nodegraphcore.NodeFactory

public class NodeFactory
extends java.lang.Object
Maintains a map of Nodes 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

      public static void registerNode​(Node n) throws java.lang.IllegalArgumentException
      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

      public static Node createNode​(java.lang.String name) throws java.lang.IllegalArgumentException
      Parameters:
      name - The Node you want.
      Returns:
      The Node
      Throws:
      java.lang.IllegalArgumentException - if the matchine Node cannot be found.
    • getNames

      public static java.lang.String[] getNames()
      Returns:
      an array containing the unique names of every Node registered.