MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich

ch.ethz.mxquery.opt.expr
Class LogicalUnit

java.lang.Object
  extended by ch.ethz.mxquery.opt.expr.LogicalUnit
All Implemented Interfaces:
Traversable, java.lang.Cloneable, java.lang.Comparable
Direct Known Subclasses:
Literal, Term

public abstract class LogicalUnit
extends java.lang.Object
implements java.lang.Comparable, java.lang.Cloneable, Traversable

Every term and literal inherits from logical unit. This calls introduces some helper methods


Field Summary
static int DEPENDENCY_END
           
static int DEPENDENCY_NO
           
static int DEPENDENCY_START
           
static int DEPENDENCY_STARTEND
           
static int INDEX_IMPOSSIBLE
           
static int INDEX_POSSIBLE
           
static int INDEX_RECOMMEND
           
static int RESET
           
static int RESULT_FALSE
           
static int RESULT_TRUE
           
static int RESULT_UNKNOWN
           
 
Constructor Summary
LogicalUnit()
           
 
Method Summary
 void addDependency(int dep)
          Adds a new dependency to the logical unit
 int compareTo(java.lang.Object o)
          Compares to logical units according to their dependencies
abstract  int evaluate(int level)
          Evaluates the logical unit until a certain degree on variable dependency and returns if the result is false, true or unknown
 int getDependency()
           
static java.lang.String getDependencyName(int dependency)
           
static int getDependencyNb(boolean start, boolean end)
          Returns for the combination of start and end variable the corresponding constant
 int getResult()
          Returns if the result if the result if false, ture or unknown
static boolean isDependendOnEnd(int dependency)
          Test if it depends on the end variables
static boolean isDependendOnStart(int dependency)
          Test if it depends on the start variables
 boolean isIndexable()
          Returns if for this logical unit a index is recommended.
 boolean isLowerDependency(int dep1, int dep2)
          Compares two dependecies.
 boolean isLowerOrEqualDependency(int dep1, int dep2)
          Compares to dependencies to each other
 int reset(int level)
          Resets the logical unit up to a certain degree on variable dependency
 void setDependency(int dep)
           
 void setIndexable(int value)
          Sets if a logical unit is indexable.
 KXmlSerializer traverse(KXmlSerializer serializer)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RESET

public static final int RESET
See Also:
Constant Field Values

DEPENDENCY_NO

public static final int DEPENDENCY_NO
See Also:
Constant Field Values

DEPENDENCY_START

public static final int DEPENDENCY_START
See Also:
Constant Field Values

DEPENDENCY_END

public static final int DEPENDENCY_END
See Also:
Constant Field Values

DEPENDENCY_STARTEND

public static final int DEPENDENCY_STARTEND
See Also:
Constant Field Values

RESULT_FALSE

public static final int RESULT_FALSE
See Also:
Constant Field Values

RESULT_UNKNOWN

public static final int RESULT_UNKNOWN
See Also:
Constant Field Values

RESULT_TRUE

public static final int RESULT_TRUE
See Also:
Constant Field Values

INDEX_POSSIBLE

public static final int INDEX_POSSIBLE
See Also:
Constant Field Values

INDEX_RECOMMEND

public static final int INDEX_RECOMMEND
See Also:
Constant Field Values

INDEX_IMPOSSIBLE

public static final int INDEX_IMPOSSIBLE
See Also:
Constant Field Values
Constructor Detail

LogicalUnit

public LogicalUnit()
Method Detail

getDependency

public int getDependency()

setDependency

public void setDependency(int dep)

compareTo

public int compareTo(java.lang.Object o)
Compares to logical units according to their dependencies

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o -
Returns:
-1 of this logical unit is small, 0 if equal, 1 if this is greater

reset

public int reset(int level)
Resets the logical unit up to a certain degree on variable dependency

Parameters:
level -
Returns:
UNKNOWN, TRUE or FALSE

evaluate

public abstract int evaluate(int level)
                      throws MXQueryException
Evaluates the logical unit until a certain degree on variable dependency and returns if the result is false, true or unknown

Parameters:
level - Up to this dependency level the unit is evaluated
Returns:
false, true or unknown
Throws:
MXQueryException

isLowerOrEqualDependency

public boolean isLowerOrEqualDependency(int dep1,
                                        int dep2)
Compares to dependencies to each other

Parameters:
dep1 -
dep2 -
Returns:
true if equals or lower dependency

isIndexable

public boolean isIndexable()
Returns if for this logical unit a index is recommended.

Returns:
true if an index is recommended, false otherwise

setIndexable

public void setIndexable(int value)
Sets if a logical unit is indexable. But only following changes are allowed:
INDEX_POSSIBLE --> INDEX_RECOMMEND INDEX_POSSIBLE --> INDEX_IMPOSSIBLE INDEX_RECOMMEND --> INDEX_IMPOSSIBLE

Parameters:
value -

isLowerDependency

public boolean isLowerDependency(int dep1,
                                 int dep2)
Compares two dependecies. The order is as follows RESET < DEPENDENCY_NO < DEPENDENCY_START | DEPENDENCY_END < DEPENDENCY_STARTEND

Parameters:
dep1 -
dep2 -
Returns:
true of dep1 has a lower dependency

addDependency

public void addDependency(int dep)
Adds a new dependency to the logical unit

Parameters:
dep -

isDependendOnStart

public static boolean isDependendOnStart(int dependency)
Test if it depends on the start variables

Parameters:
dependency -
Returns:
true of there is a dependency on start variables

isDependendOnEnd

public static boolean isDependendOnEnd(int dependency)
Test if it depends on the end variables

Parameters:
dependency -
Returns:
true of there is a dependency on end variables

getDependencyName

public static java.lang.String getDependencyName(int dependency)

getDependencyNb

public static int getDependencyNb(boolean start,
                                  boolean end)
Returns for the combination of start and end variable the corresponding constant

Parameters:
start - Depends on the start variable
end - Depends on the end variable
Returns:
the correct dependency class

getResult

public int getResult()
Returns if the result if the result if false, ture or unknown

Returns:
the predicate index result

traverse

public KXmlSerializer traverse(KXmlSerializer serializer)
Specified by:
traverse in interface Traversable

MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich

MXQuery 0.6.0 API Documentation - Copyright 2006-2009 ETH Zurich