org.eigenbase.sarg
Class SargIntervalBase

java.lang.Object
  extended by org.eigenbase.sarg.SargIntervalBase
Direct Known Subclasses:
SargInterval, SargIntervalExpr

public abstract class SargIntervalBase
extends Object

SargIntervalBase is a common base for SargInterval and SargIntervalExpr.

Version:
$Id: //open/dev/farrago/src/org/eigenbase/sarg/SargIntervalBase.java#10 $
Author:
John V. Sichi

Field Summary
protected  SargFactory factory
           
protected  SargMutableEndpoint lowerBound
           
protected  SargMutableEndpoint upperBound
           
 
Constructor Summary
SargIntervalBase(SargFactory factory, RelDataType dataType)
           
 
Method Summary
 RelDataType getDataType()
           
 SargFactory getFactory()
           
 SargEndpoint getLowerBound()
           
 SargEndpoint getUpperBound()
           
 boolean isEmpty()
           
 boolean isPoint()
           
 boolean isRange()
           
 boolean isUnconstrained()
           
private  void printBound(StringBuilder sb, SargEndpoint endpoint)
           
(package private)  void setEmpty()
          Sets this interval to empty (matching nothing at all).
(package private)  void setLower(RexNode coordinate, SargStrictness strictness)
          Sets the lower bound for this interval.
(package private)  void setNull()
          Sets this interval to represent a single point matching the null value.
(package private)  void setPoint(RexNode coordinate)
          Sets this interval to represent a single point (possibly the null value).
(package private)  void setUnconstrained()
          Sets this interval to unconstrained (matching everything, including null).
(package private)  void setUpper(RexNode coordinate, SargStrictness strictness)
          Sets the upper bound for this interval.
 String toString()
           
(package private)  void unsetLower()
          Removes the lower bound for this interval, setting it to -infinity.
(package private)  void unsetUpper()
          Removes the upper bound for this interval, setting it to +infinity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

factory

protected final SargFactory factory

lowerBound

protected final SargMutableEndpoint lowerBound

upperBound

protected final SargMutableEndpoint upperBound
Constructor Detail

SargIntervalBase

SargIntervalBase(SargFactory factory,
                 RelDataType dataType)
See Also:
SargFactory.newIntervalExpr(org.eigenbase.reltype.RelDataType)
Method Detail

getLowerBound

public SargEndpoint getLowerBound()
Returns:
an immutable reference to the endpoint representing this interval's lower bound

getUpperBound

public SargEndpoint getUpperBound()
Returns:
an immutable reference to the endpoint representing this interval's upper bound

isPoint

public boolean isPoint()
Returns:
whether this represents a single point

isEmpty

public boolean isEmpty()
Returns:
whether this represents the empty interval

isRange

public boolean isRange()
Returns:
whether this represents a (non-empty, non-point) range interval

isUnconstrained

public boolean isUnconstrained()
Returns:
whether this represents the universal set

getFactory

public SargFactory getFactory()
Returns:
the factory which produced this expression

setPoint

void setPoint(RexNode coordinate)
Sets this interval to represent a single point (possibly the null value).

Parameters:
coordinate - coordinate of point to set, or null for the null value

setNull

void setNull()
Sets this interval to represent a single point matching the null value.


setLower

void setLower(RexNode coordinate,
              SargStrictness strictness)
Sets the lower bound for this interval.

Parameters:
coordinate - coordinate of point to set, must not be null
strictness - strictness

setUpper

void setUpper(RexNode coordinate,
              SargStrictness strictness)
Sets the upper bound for this interval.

Parameters:
coordinate - coordinate of point to set
strictness - boundary strictness

unsetLower

void unsetLower()
Removes the lower bound for this interval, setting it to -infinity.


unsetUpper

void unsetUpper()
Removes the upper bound for this interval, setting it to +infinity.


setUnconstrained

void setUnconstrained()
Sets this interval to unconstrained (matching everything, including null).


setEmpty

void setEmpty()
Sets this interval to empty (matching nothing at all).


getDataType

public RelDataType getDataType()

toString

public String toString()
Overrides:
toString in class Object

printBound

private void printBound(StringBuilder sb,
                        SargEndpoint endpoint)