Overview | Package | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## de.grogra.xl.query
Interface Graph

All Known Implementing Classes:
  Graph, Graph, Graph, GraphImpl, RGGGraph

    public interface Graph

A `Graph` represents a single relational data source for XL's relational query and rewriting facilities within the context of a single thread (i.e., the methods are not thread-safe). While a `RuntimeModel` provides methods for obtaining information and performing operations which are common to a set of relational data sources with an equal structure, a `Graph` provides methods which operate on a single instance of these data sources within a fixed thread. E.g., a `RuntimeModel` could represent features of XML documents in general, while a `Graph` of this model represents a single XML document. Thus, a `RuntimeModel` provides a set of common operations, a `Graph` provides the data.

Author:
  Ole Kniemeyer

Method Summary
`boolean` | `canEnumerateEdges(EdgeDirection dir, boolean constEdge, java.io.Serializable edge)`
`boolean` | `canEnumerateNodes(Type type)` Can nodes of the specified `type` be enumerated?
`Pattern.Matcher` | `createMatcher(Pattern pred, XBitSet providedConstants, IntList neededConstantsOut)`
`Producer` | `createProducer(QueryState qs)` Creates an instance of `Producer`.
`QueryState` | `createQueryState()` Creates a query state to be used for queries which use this graph.
`void` | `enumerateEdges(java.lang.Object node, EdgeDirection dir, Type edgeType, QueryState qs, int toIndex, int patternIndex, java.io.Serializable pattern, int matchIndex, MatchConsumer consumer, int arg)`
`void` | `enumerateNodes(Type type, QueryState qs, int tp, MatchConsumer consumer, int arg)` This methods enumerates all nodes of this graph of the given type to the given `MatchConsumer` via the given query state.
`RuntimeModel` | `getModel()` Returns this graph's run-time model.
`java.lang.Object` | `getRoot()` Returns the root node of this graph.

Method Detail

### canEnumerateEdges

    boolean canEnumerateEdges(EdgeDirection dir,
                              boolean constEdge,
                              java.io.Serializable edge)

### canEnumerateNodes

    boolean canEnumerateNodes(Type type)

  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 `enumerateNodes(de.grogra.reflect.Type, de.grogra.xl.query.QueryState, int, de.grogra.xl.query.MatchConsumer, int)`.

  Parameters:
    `type` - the type of nodes
  Returns:
    `true` iff nodes of `type` can be enumerated

### createMatcher

    Pattern.Matcher createMatcher(Pattern pred,
                                  XBitSet providedConstants,
                                  IntList neededConstantsOut)

### createProducer

    Producer createProducer(QueryState qs)

  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:
    `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`

### createQueryState

    QueryState createQueryState()

  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.

  Returns:
    a new query state

### enumerateEdges

    void enumerateEdges(java.lang.Object node,
                        EdgeDirection dir,
                        Type edgeType,
                        QueryState qs,
                        int toIndex,
                        int patternIndex,
                        java.io.Serializable pattern,
                        int matchIndex,
                        MatchConsumer consumer,
                        int arg)

### enumerateNodes

    void enumerateNodes(Type type,
                        QueryState qs,
                        int tp,
                        MatchConsumer consumer,
                        int arg)

  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
    `tp` - the index-parameter for the `amatch`-method
    `consumer` - the consumer-parameter for the `amatch`-method
    `arg` - the arg-parameter for the `amatch`-method

### getModel

    RuntimeModel getModel()

  Returns this graph's run-time model.

  Returns:
    the run-time model

### getRoot

    java.lang.Object getRoot()

  Returns the root node of this graph.

  Returns:
    the root

Overview | Package | Class | Tree | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD