Class SecGraphM

All Implemented Interfaces:
GraphContext, GraphManagerContext, GraphObject, SecGraph, ProducingNode, Transformation, Manageable, PersistenceCapable, Shareable, RegistryContext, UserFields, XObject, TurtleModifier, Map, Instantiator, Graph, Serializable, Cloneable

@HasModel(Compiletime.class) public class SecGraphM extends M implements SecGraph, Instantiator
See Also:
  • Field Details Link icon

  • Constructor Details Link icon

    • SecGraphM Link icon

      public SecGraphM()
    • SecGraphM Link icon

      public SecGraphM(float len)
  • Method Details Link icon

    • getNTypeImpl Link icon

      protected Node.NType getNTypeImpl()
      Description copied from class: Node
      This method returns the Node.NType which describes the managed fields of the class of this node. This method has to be implemented in every concrete subclass.
      Overrides:
      getNTypeImpl in class M
      Returns:
      type describing the managed fields of the class of this node
    • newInstance Link icon

      protected Node newInstance()
      Description copied from class: Node
      This method returns a new instance of the class of this node. This method has to be implemented in every concrete subclass.
      Overrides:
      newInstance in class M
      Returns:
      new instance of class of this node
    • getSecGraph Link icon

      public SecGraphImpl getSecGraph()
    • setSecGraph Link icon

      public void setSecGraph(SecGraphImpl value)
    • getInstantiator Link icon

      public Instantiator getInstantiator()
      Overrides:
      getInstantiator in class Node
    • getRootNode Link icon

      public Node getRootNode()
      Description copied from interface: GraphObject
      Return the root node of the GraphObject, i.e. the root of the object loaded
      Specified by:
      getRootNode in interface GraphObject
      Returns:
      a Node
    • setRootNode Link icon

      public void setRootNode(Node root)
      Description copied from interface: GraphObject
      Set the rootnode of a GraphObject object.
      Specified by:
      setRootNode in interface GraphObject
      Parameters:
      root -
    • cloneGraph Link icon

      public Node cloneGraph() throws CloneNotSupportedException
      Description copied from interface: GraphObject
      clone the graph of the rootnode and returns it
      Specified by:
      cloneGraph in interface GraphObject
      Returns:
      Throws:
      CloneNotSupportedException
    • write Link icon

      public void write()
      Description copied from interface: GraphObject
      Override the file GraphObject in the project with its current version. Required on GraphObject created in RGG to be saved
      Specified by:
      write in interface GraphObject
    • reload Link icon

      public void reload()
      Description copied from interface: GraphObject
      If the GraphObject uses some modules defined in the project, reload forces the modules in the GraphObject to be relinked after compilation
      Specified by:
      reload in interface GraphObject
    • describes Link icon

      public Object describes()
      Description copied from interface: GraphObject
      Gives an array of node types and number contained in the GraphObject
      Specified by:
      describes in interface GraphObject
      Returns:
    • getNode Link icon

      public Node getNode(String key)
      Description copied from interface: GraphObject
      Return a node of the given name
      Specified by:
      getNode in interface GraphObject
      Parameters:
      key - : the name of the type of node
    • resolve Link icon

      public GraphObject resolve()
      Description copied from interface: GraphObject
      Resolves the real object if a reference is used If the real object is used the function returns it self
      Specified by:
      resolve in interface GraphObject
      Returns:
    • view3d Link icon

      public void view3d(Context ctx)
      Description copied from interface: GraphObject
      Opens the 3d view of the current graph
      Specified by:
      view3d in interface GraphObject
      Parameters:
      ctx -
    • view2d Link icon

      public void view2d(Context ctx)
      Description copied from interface: GraphObject
      Opens the 2d view of the current graph
      Specified by:
      view2d in interface GraphObject
      Parameters:
      ctx -
    • getRegistry Link icon

      public Registry getRegistry()
      Description copied from interface: RegistryContext
      Returns the Registry which is linked with this instance.
      Specified by:
      getRegistry in interface RegistryContext
      Returns:
      the registry linked with this instance
    • produceNode Link icon

      public Node produceNode()
      Specified by:
      produceNode in interface ProducingNode
    • getModel Link icon

      public RuntimeModel getModel()
      Description copied from interface: Graph
      Returns this graph's run-time model.
      Specified by:
      getModel in interface Graph
      Returns:
      the run-time model
    • createQueryState Link icon

      public QueryState createQueryState()
      Description copied from interface: Graph
      Creates a query state to be used for queries which use this graph. The returned query state has to be an instance of the type defined by CompiletimeModel.getQueryStateType() of the corresponding compile-time model.
      Specified by:
      createQueryState in interface Graph
      Returns:
      a new query state
    • createProducer Link icon

      public Producer createProducer(QueryState qs)
      Description copied from interface: Graph
      Creates an instance of Producer. This factory method creates an instance of a subclass of Producer which will be exclusively used later on in the context of the current match represented by qs. The instance must be an instance of the class returned by CompiletimeModel.getProducerType() for the corresponding compile-time model.

      The usage of producers is specified by the XL programming language.

      Specified by:
      createProducer in interface Graph
      Parameters:
      qs - query state which holds current match for which the producer shall produce a replacement
      Returns:
      a producer for use in the context of qs
    • createMatcher Link icon

      public Pattern.Matcher createMatcher(M.Pattern pred, XBitSet providedConstants, IntList neededConstantsOut)
    • canEnumerateNodes Link icon

      public boolean canEnumerateNodes(Type type)
      Description copied from interface: Graph
      Can nodes of the specified type be enumerated? This method returns true iff this graph can enumerate nodes of the given type using the method Graph.enumerateNodes(de.grogra.reflect.Type, de.grogra.xl.query.QueryState, int, de.grogra.xl.query.MatchConsumer, int).
      Specified by:
      canEnumerateNodes in interface Graph
      Parameters:
      type - the type of nodes
      Returns:
      true iff nodes of type can be enumerated
    • enumerateNodes Link icon

      public void enumerateNodes(Type type, QueryState qs, int tp, MatchConsumer consumer, int arg)
      Description copied from interface: Graph
      This methods enumerates all nodes of this graph of the given type to the given MatchConsumer via the given query state. I.e., for every node c of this extent that has type type, the following statement is executed:
           qs.amatch (tp, c, consumer, arg);
       
      Specified by:
      enumerateNodes in interface Graph
      Parameters:
      type - the type of nodes
      qs - the query state on which the amatch-method has to be invoked
      tp - the index-parameter for the amatch-method
      consumer - the consumer-parameter for the amatch-method
      arg - the arg-parameter for the amatch-method
    • canEnumerateEdges Link icon

      public boolean canEnumerateEdges(EdgeDirection dir, boolean constEdge, Serializable edge)
      Specified by:
      canEnumerateEdges in interface Graph
    • enumerateEdges Link icon

      public void enumerateEdges(Object node, EdgeDirection dir, Type edgeType, QueryState qs, int toIndex, int patternIndex, Serializable pattern, int matchIndex, MatchConsumer consumer, int arg)
      Specified by:
      enumerateEdges in interface Graph
    • getRoot Link icon

      public Object getRoot()
      Description copied from interface: Graph
      Returns the root node of this graph.
      Specified by:
      getRoot in interface Graph
      Returns:
      the root
    • getTypeRoot Link icon

      public Object getTypeRoot()
      Description copied from interface: Graph
      Returns the root node of the type graph for this graph
      Specified by:
      getTypeRoot in interface Graph
      Returns:
      the root of the type graph
    • enumerateSpaces Link icon

      public void enumerateSpaces(Object node, EdgeDirection dir, Type edgeType, QueryState qs, int toIndex, int patternIndex, Serializable pattern, int matchIndex, MatchConsumer consumer, int arg)
      Description copied from interface: Graph
      This method enumerates all edges that possibly related 2 nodes with a spacing pattern inbetween them.
      Specified by:
      enumerateSpaces in interface Graph
      Parameters:
      node -
      dir -
      edgeType -
      qs -
      toIndex -
      patternIndex -
      pattern -
      matchIndex -
      consumer -
      arg -
    • sortedTypeGraph Link icon

      public HashMap<Object,Integer> sortedTypeGraph()
      Description copied from interface: Graph
      Returns the ordered scale values of the nodes in the type graph
      Specified by:
      sortedTypeGraph in interface Graph
      Returns:
      HashMap instance containing mappings from the type graph nodes to scale values
    • clear Link icon

      public void clear()
      Description copied from interface: SecGraph
      removes all Nodes except the root
      Specified by:
      clear in interface SecGraph
    • apply Link icon

      public void apply(String name)
      Description copied from interface: SecGraph
      Apply a RGG function on the SecGraph
      Specified by:
      apply in interface SecGraph
      Parameters:
      name - : name of the function
    • applyXL Link icon

      public void applyXL(String query)
      Description copied from interface: SecGraph
      Apply an XL Query on the SecGraph
      Specified by:
      applyXL in interface SecGraph
      Parameters:
      query - : the XL query
    • toInstance Link icon

      public Node toInstance()
      Description copied from interface: SecGraph
      creates a Node holding a instanciation of the SecGraph
      Specified by:
      toInstance in interface SecGraph
      Returns:
      the Node
    • toNode Link icon

      public Node toNode()
    • producer$begin Link icon

      public SecGraphInitialProducer producer$begin()
      Specified by:
      producer$begin in interface SecGraph
    • handleSaveEvent Link icon

      public void handleSaveEvent()
      Description copied from interface: SecGraph
      function triggered by the saving of the project
      Specified by:
      handleSaveEvent in interface SecGraph
    • setAutoRecreate Link icon

      public void setAutoRecreate(boolean b)
      Description copied from interface: SecGraph
      defines if the SecGraph is automatically recreated if the model is saved
      Specified by:
      setAutoRecreate in interface SecGraph
      Parameters:
      b - sets if recreated or not
    • getInitalProducer Link icon

      public Object getInitalProducer()
      Description copied from interface: SecGraph
      create a new producer to initialize the Graph
      Specified by:
      getInitalProducer in interface SecGraph
      Returns:
    • setCurrent Link icon

      public void setCurrent()
      Description copied from interface: SecGraph
      set this graph to be the currently used one
      Specified by:
      setCurrent in interface SecGraph
    • releaseCurrent Link icon

      public void releaseCurrent()
      Description copied from interface: SecGraph
      set the project graph to be teh current one
      Specified by:
      releaseCurrent in interface SecGraph
    • isQueryGraph Link icon

      public boolean isQueryGraph()
      Description copied from interface: SecGraph
      check if the secgraph includes a queryRoot
      Specified by:
      isQueryGraph in interface SecGraph
      Returns:
    • isRuleGraph Link icon

      public boolean isRuleGraph()
      Description copied from interface: SecGraph
      check if the secgraph includes a QueryRoot and a ProductionRoot
      Specified by:
      isRuleGraph in interface SecGraph
      Returns:
    • getQueryRoot Link icon

      public Node getQueryRoot(boolean create)
      Specified by:
      getQueryRoot in interface SecGraph
    • getProductionRoot Link icon

      public Node getProductionRoot(boolean create)
      Specified by:
      getProductionRoot in interface SecGraph
    • query Link icon

      public Object query()
      Specified by:
      query in interface SecGraph
    • production Link icon

      public Object production()
      Specified by:
      production in interface SecGraph
    • includes Link icon

      public boolean includes(SecGraph sg) throws de.grogra.graph.object.sg.impl.exception.NoQueryGraphException
      Description copied from interface: SecGraph
      test if this SecGraph incldues the SecGraph SG
      Specified by:
      includes in interface SecGraph
      Parameters:
      sg -
      Returns:
      Throws:
      de.grogra.graph.object.sg.impl.exception.NoQueryGraphException
    • includes Link icon

      public boolean includes(SecGraph sg, boolean asQuery) throws de.grogra.graph.object.sg.impl.exception.NoQueryGraphException
      Description copied from interface: SecGraph
      test if this SecGraph incldues the given SecGraph or if the query SecGraph of this graph is included in the given SecGraph
      Specified by:
      includes in interface SecGraph
      Parameters:
      sg -
      Returns:
      Throws:
      de.grogra.graph.object.sg.impl.exception.NoQueryGraphException
    • inProjectGraph Link icon

      public boolean inProjectGraph() throws de.grogra.graph.object.sg.impl.exception.NoQueryGraphException
      Description copied from interface: SecGraph
      test if this graph is included in the ProjectGraph
      Specified by:
      inProjectGraph in interface SecGraph
      Returns:
      Throws:
      de.grogra.graph.object.sg.impl.exception.NoQueryGraphException
    • inProjectGraph Link icon

      public boolean inProjectGraph(boolean asQuery) throws de.grogra.graph.object.sg.impl.exception.NoQueryGraphException
      Description copied from interface: SecGraph
      test if this graph is included in the ProjectGraph or if the query SecGraph of this graph is included in the Project Graph
      Specified by:
      inProjectGraph in interface SecGraph
      Parameters:
      asQuery -
      Returns:
      Throws:
      de.grogra.graph.object.sg.impl.exception.NoQueryGraphException
    • execute Link icon

      public void execute() throws de.grogra.graph.object.sg.impl.exception.NoRuleGraphException
      Description copied from interface: SecGraph
      run this SecGraph as a rule on the MainGraph
      Specified by:
      execute in interface SecGraph
      Throws:
      de.grogra.graph.object.sg.impl.exception.NoRuleGraphException
    • execute Link icon

      public void execute(SecGraph sg) throws de.grogra.graph.object.sg.impl.exception.NoRuleGraphException
      Description copied from interface: SecGraph
      run this SecGraph as a rule on the given secGraph
      Specified by:
      execute in interface SecGraph
      Parameters:
      sg -
      Throws:
      de.grogra.graph.object.sg.impl.exception.NoRuleGraphException
    • apply Link icon

      public void apply(SecGraph rule) throws de.grogra.graph.object.sg.impl.exception.NoRuleGraphException
      Description copied from interface: SecGraph
      apply the given SecGraph on this SecGraph
      Specified by:
      apply in interface SecGraph
      Parameters:
      rule -
      Throws:
      de.grogra.graph.object.sg.impl.exception.NoRuleGraphException
    • add Link icon

      public void add(GraphContext sg)
      Specified by:
      add in interface SecGraph
    • getRGGGraph Link icon

      public RGGGraph getRGGGraph()
      Specified by:
      getRGGGraph in interface SecGraph
    • derive Link icon

      public long derive()
      Specified by:
      derive in interface SecGraph
    • instantiate Link icon

      public void instantiate(Object producer)
      Specified by:
      instantiate in interface Instantiator
    • createMatcher Link icon

      public Pattern.Matcher createMatcher(Pattern pred, XBitSet providedConstants, IntList neededConstantsOut)
      Specified by:
      createMatcher in interface Graph