Module xl.impl

Class Graph

All Implemented Interfaces:
Graph, Cloneable

@HasModel(CompiletimeModel.class) public class Graph extends GraphImpl
  • Constructor Details

    • Graph

      public Graph(RuntimeModel runtime, boolean canSupplyBackward)
  • Method Details

    • size

      public int size()
    • canEnumerateEdges

      public boolean canEnumerateEdges(EdgeDirection dir, boolean constEdge, Serializable edge)
    • beginModifications

      protected void beginModifications()
      Specified by:
      beginModifications in class Graph
    • commitModifications

      protected void commitModifications()
      Specified by:
      commitModifications in class Graph
    • enumerateNodes

      public void enumerateNodes(Type type, QueryState qs, int index, 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);
       
      Parameters:
      type - the type of nodes
      qs - the query state on which the amatch-method has to be invoked
      index - the index-parameter for the amatch-method
      consumer - the consumer-parameter for the amatch-method
      arg - the arg-parameter for the amatch-method
    • getRoot

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

      public Object getTypeRoot()
      Description copied from interface: Graph
      Returns the root node of the type graph for this graph
      Returns:
      the root of the type graph
    • addNode

      public void addNode(Object node)
      Description copied from class: GraphImpl
      Adds a node to this graph extent. This method is invoked by the XL runtime system before invocations of GraphImpl.addEdgeBits(java.lang.Object, java.lang.Object, int). Implementations may perform tasks in preparation of the addition of edges, if necessary.
      Specified by:
      addNode in class GraphImpl
      Parameters:
      node - the node for which edges will be added later on
    • removeNode

      public void removeNode(Object node)
      Overrides:
      removeNode in class GraphImpl
    • addEdgeBits

      public void addEdgeBits(Object source, Object target, int bits)
      Description copied from class: GraphImpl
      Adds a set of edge bits from a source node to a target node. This method is invoked within the right hand sides of XL productions ==>>, ==>.
      Specified by:
      addEdgeBits in class GraphImpl
      Parameters:
      source - the source node of the edge
      target - the target node of the edge
      bits - the edge bits that are to be added
    • removeEdgeBits

      public void removeEdgeBits(Object source, Object target, int bits)
      Description copied from class: GraphImpl
      Removes a set of edge bits from a source node to a target node. This method is invoked within the right hand sides of XL productions ==>>, ==>.
      Specified by:
      removeEdgeBits in class GraphImpl
      Parameters:
      source - the source node of the edge
      target - the target node of the edge
      bits - the edge bits that are to be removed
    • createProducer

      public Producer createProducer(QueryState match)
      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.

      Parameters:
      match - query state which holds current match for which the producer shall produce a replacement
      Returns:
      a producer for use in the context of qs