de.grogra.xl.query
public interface Graph
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.| Modifier and Type | Method and Description |
|---|---|
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. |
void |
enumerateSpaces(java.lang.Object node,
EdgeDirection dir,
Type edgeType,
QueryState qs,
int toIndex,
int patternIndex,
java.io.Serializable pattern,
int matchIndex,
MatchConsumer consumer,
int arg)
This method enumerates all edges that possibly related 2 nodes with a spacing pattern inbetween them.
|
RuntimeModel |
getModel()
Returns this graph's run-time model.
|
java.lang.Object |
getRoot()
Returns the root node of this graph.
|
java.lang.Object |
getTypeRoot()
Returns the root node of the type graph for this graph
|
java.util.HashMap<java.lang.Object,java.lang.Integer> |
sortedTypeGraph()
Returns the ordered scale values of the nodes in the type graph
|
boolean canEnumerateEdges(EdgeDirection dir, boolean constEdge, java.io.Serializable edge)
boolean canEnumerateNodes(Type type)
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).type - the type of nodestrue iff nodes of type can be enumeratedPattern.Matcher createMatcher(Pattern pred, XBitSet providedConstants, IntList neededConstantsOut)
Producer createProducer(QueryState qs)
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.
qs - query state which holds current match for which the producer
shall produce a replacementqsQueryState createQueryState()
CompiletimeModel.getQueryStateType()
of the corresponding compile-time model.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)
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);
type - the type of nodesqs - the query state on which the amatch-method has to be invokedtp - the index-parameter for the amatch-methodconsumer - the consumer-parameter for the amatch-methodarg - the arg-parameter for the amatch-methodvoid enumerateSpaces(java.lang.Object node,
EdgeDirection dir,
Type edgeType,
QueryState qs,
int toIndex,
int patternIndex,
java.io.Serializable pattern,
int matchIndex,
MatchConsumer consumer,
int arg)
node - dir - edgeType - qs - toIndex - patternIndex - pattern - matchIndex - consumer - arg - RuntimeModel getModel()
java.lang.Object getRoot()
java.lang.Object getTypeRoot()
java.util.HashMap<java.lang.Object,java.lang.Integer> sortedTypeGraph()