com.espertech.esper.epl.join.plan
Class QueryGraph

java.lang.Object
  extended by com.espertech.esper.epl.join.plan.QueryGraph

public class QueryGraph
extends Object

Model of relationships between streams based on properties in both streams that are specified as equal in a filter expression.


Constructor Summary
QueryGraph(int numStreams)
          Ctor.
 
Method Summary
 boolean add(int streamLeft, String propertyLeft, int streamRight, String propertyRight)
          Add properties for 2 streams that are equal.
protected static void fillEquivalentNav(QueryGraph queryGraph)
          Fill in equivalent key properties (navigation entries) on all streams.
 String[] getIndexProperties(int streamLookup, int streamIndexed)
          Returns index properties.
 String[] getKeyProperties(int streamLookup, int streamIndexed)
          Returns key properties.
 Set<Integer> getNavigableStreams(int streamFrom)
          Returns set of streams that the given stream is navigable to.
 int getNumStreams()
          Returns the number of streams.
 boolean isNavigable(int streamFrom, int streamTo)
          Returns true if there is a relationship between streams via equal properties.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

QueryGraph

public QueryGraph(int numStreams)
Ctor.

Parameters:
numStreams - - number of streams
Method Detail

getNumStreams

public int getNumStreams()
Returns the number of streams.

Returns:
number of streams

add

public boolean add(int streamLeft,
                   String propertyLeft,
                   int streamRight,
                   String propertyRight)
Add properties for 2 streams that are equal.

Parameters:
streamLeft - - left hand stream
propertyLeft - - left hand stream property
streamRight - - right hand stream
propertyRight - - right hand stream property
Returns:
true if added and did not exist, false if already known

isNavigable

public boolean isNavigable(int streamFrom,
                           int streamTo)
Returns true if there is a relationship between streams via equal properties.

Parameters:
streamFrom - - from stream number
streamTo - - to stream number
Returns:
true if relationship exists, false if not

getNavigableStreams

public Set<Integer> getNavigableStreams(int streamFrom)
Returns set of streams that the given stream is navigable to.

Parameters:
streamFrom - - from stream number
Returns:
set of streams related to this stream, or empty set if none

getIndexProperties

public String[] getIndexProperties(int streamLookup,
                                   int streamIndexed)
Returns index properties.

Parameters:
streamLookup - - stream to serve as source for looking up events
streamIndexed - - stream to look up in
Returns:
index property names

getKeyProperties

public String[] getKeyProperties(int streamLookup,
                                 int streamIndexed)
Returns key properties.

Parameters:
streamLookup - - stream to serve as source for looking up events
streamIndexed - - stream to look up in
Returns:
key property names

fillEquivalentNav

protected static void fillEquivalentNav(QueryGraph queryGraph)
Fill in equivalent key properties (navigation entries) on all streams. For example, if a=b and b=c then add a=c. The method adds new equalivalent key properties until no additional entries to be added are found, ie. several passes can be made.

Parameters:
queryGraph - - navigablity info between streamss

toString

public String toString()
Overrides:
toString in class Object

© 2007 EsperTech Inc.
All rights reserved.
Visit us at espertech.com