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 CompiletimeModel

All Known Implementing Classes:
  Compiletime, CompiletimeModel, CompiletimeModel, CompiletimeModel

    public interface CompiletimeModel

A `CompileModel` is used by an XL compiler to parametrize the access to graph-like data sources in queries. This mechanism allows XL to be used for a variety of data sources, e.g., trees, graphs or hypergraphs. Implementations have to provide a suitable mapping of the specific structure of the data source in order to define an easy-to-use model.

A `CompiletimeModel` defines the specificity of a data source at compile-time. This has to be accompanied by an implementation of a `RuntimeModel` that is used at run-time. The correct run-time model instance is obtained by invocations of `RuntimeModelFactory.modelForName(java.lang.String, java.lang.ClassLoader)` with the name returned by `getRuntimeName()` as parameter.

A comprehensive specification of the behaviour of `Model` is given by the specification of the XL programming language.

Author:
  Ole Kniemeyer

Method Summary
`Type<?>` | `getEdgeType()` Specifies the type of standard edges.
`Type<?>` | `getEdgeTypeFor(Type<?> type)` Specifies the compile-time type of edges for a given type.
`Type<?>` | `getNodeType()` Specifies the base type of nodes of this model.
`Type<? extends Producer>` | `getProducerType()` Returns the type of producers for right-hand sides of rules for this model.
`Type<? extends QueryState>` | `getQueryStateType()` Returns the type of query states to be used for queries for this model.
`java.lang.String` | `getRuntimeName()` Defines the name of the corresponding `RuntimeModel`.
`java.io.Serializable` | `getStandardEdgeFor(int edge)` Returns a constant value representing a standard edge.
`Type<?>` | `getWrapperTypeFor(Type<?> type)` Return the type of wrappers for values of the given type.
`CompiletimeModel.Property` | `getWrapProperty(Type<?> wrapperType)` Returns the unwrapping property of a wrapper type.
`boolean` | `needsWrapperFor(Type<?> type)` Determines whether a value of the given type has to be wrapped before it is added as a node to a `Graph`.

Method Detail

### getEdgeType

    Type<?> getEdgeType()

  Specifies the type of standard edges. This method returns the type which is used for the representation of standard edges in this model. This has to be the type of the (possibly unwrapped) values returned by `getStandardEdgeFor(int)`.

  Returns:
    the type of standard edges

### getEdgeTypeFor

    Type<?> getEdgeTypeFor(Type<?> type)

  Specifies the compile-time type of edges for a given type. This method returns the type to which an expression of compile-time type `type` should be cast before it is interpreted as an edge expression.

  Parameters:
    `type` - the type of the expression
  Returns:
    the type of the resulting edge expression

### getNodeType

    Type<?> getNodeType()

  Specifies the base type of nodes of this model. This type is used where no specific type is available, e.g., for the node predicate "." and for the ends of standard edges.

  Returns:
    base type of nodes

### getProducerType

    Type<? extends Producer> getProducerType()

  Returns the type of producers for right-hand sides of rules for this model.

  Returns:
    type of producers

### getQueryStateType

    Type<? extends QueryState> getQueryStateType()

  Returns the type of query states to be used for queries for this model.

  Returns:
    type of producers

### getRuntimeName

    java.lang.String getRuntimeName()

  Defines the name of the corresponding `RuntimeModel`. This name is used during run-time in invocations of `RuntimeModelFactory.modelForName(java.lang.String, java.lang.ClassLoader)` in order to obtain the `RuntimeModel` suitable for the code that is compiled within this compile-time model.

  Returns:
    the name of the corresponding run-time model

### getStandardEdgeFor

    java.io.Serializable getStandardEdgeFor(int edge)

  Returns a constant value representing a standard edge. The returned value represents the given standard `edge` (`EdgePattern.ANY_EDGE`, `EdgePattern.BRANCH_EDGE`, `EdgePattern.SUCCESSOR_EDGE` or `EdgePattern.REFINEMENT_EDGE`) for this model. It is used as argument to constructor invocations of `EdgePattern`. Primitive values have to be wrapped as usual.

  Parameters:
    `edge` - `int`-value encoding a standard edge
  Returns:
    corresponding representation for this model

### getWrapperTypeFor

    Type<?> getWrapperTypeFor(Type<?> type)

  Return the type of wrappers for values of the given type. This method is only invoked when `needsWrapperFor(de.grogra.reflect.Type)` returns `true`.

  Parameters:
    `type` - a value type
  Returns:
    the corresponding wrapper type

### getWrapProperty

    CompiletimeModel.Property getWrapProperty(Type<?> wrapperType)

  Returns the unwrapping property of a wrapper type. `wrapperType` is the type of a wrapper. If there is a property declared in this type which can be used to obtain the wrapped argument, this property is returned, otherwise `null`.

  Parameters:
    `wrapperType` - the type of a wrapper
  Returns:
    the unwrapping property for this type

### needsWrapperFor

    boolean needsWrapperFor(Type<?> type)

  Determines whether a value of the given type has to be wrapped before it is added as a node to a `Graph`.

  Parameters:
    `type` - a value type
  Returns:
    `true` iff a wrapper is needed for `type`

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