A discrete range expression. More...
#include <qExpr.h>
Public Member Functions | |
virtual const char * | colName () const |
Name of the column. | |
ibis::qExpr * | convert () const |
Convert to a sequence of qContinuousRange. | |
virtual qDiscreteRange * | dup () const |
Duplicate thy self. | |
virtual bool | empty () const |
Is the current range empty? | |
const ibis::array_t< double > & | getValues () const |
Reference to the values. | |
ibis::array_t< double > & | getValues () |
Reference to the values. | |
virtual bool | inRange (double val) const |
Is the argument val one of the values stored ? Return true or false. | |
virtual double | leftBound () const |
The lower bound of the range. | |
virtual uint32_t | nItems () const |
Count the number of items in the query expression. | |
bool | overlap (double, double) const |
virtual void | print (std::ostream &) const |
Print out the node in the string form. | |
virtual void | printFull (std::ostream &out) const |
Print out the full expression. | |
qDiscreteRange () | |
Construct an empty dicrete range expression. | |
qDiscreteRange (const char *col, const char *nums) | |
Construct a discrete range from two strings. Used by the parser. | |
qDiscreteRange (const char *col, const std::vector< uint32_t > &val) | |
Construct a qDiscreteRange object from a vector of unsigned 32-bit integers. | |
qDiscreteRange (const char *col, const std::vector< double > &val) | |
Construct a qDiscreteRange object from a vector of double values. | |
qDiscreteRange (const char *col, ibis::array_t< uint32_t > &val) | |
Construct a qDiscreteRange from an array of 32-bit integers. | |
qDiscreteRange (const char *col, ibis::array_t< double > &val) | |
Construct a qDiscreteRange object from an array of double values. | |
qDiscreteRange (const qDiscreteRange &dr) | |
Copy constructor. | |
virtual void | restrictRange (double left, double right) |
Reduce the range to be no more than [left, right]. | |
virtual double | rightBound () const |
The upper bound of the range. |
A discrete range expression.
It is used to capture expression of the form "A in (aaa, bbb, ccc, ...)."
ibis::qDiscreteRange::qDiscreteRange | ( | const char * | col, |
const std::vector< uint32_t > & | val | ||
) |
Construct a qDiscreteRange object from a vector of unsigned 32-bit integers.
Initially used to convert qMultiString to qDiscreteRange, but made visible to public upon user request.
References ibis::util::copy(), ibis::gVerbose, ibis::array_t< T >::push_back(), ibis::array_t< T >::reserve(), ibis::array_t< T >::resize(), and ibis::array_t< T >::size().
ibis::qDiscreteRange::qDiscreteRange | ( | const char * | col, |
ibis::array_t< uint32_t > & | val | ||
) |
Construct a qDiscreteRange from an array of 32-bit integers.
References ibis::util::copy(), ibis::gVerbose, ibis::array_t< T >::resize(), and ibis::array_t< T >::size().
ibis::qDiscreteRange::qDiscreteRange | ( | const char * | col, |
ibis::array_t< double > & | val | ||
) |
Construct a qDiscreteRange object from an array of double values.
References ibis::array_t< T >::copy(), and ibis::array_t< T >::deduplicate().
bool ibis::qDiscreteRange::inRange | ( | double | val | ) | const [inline, virtual] |
Is the argument val one of the values stored ? Return true or false.
It uses a binary search if there are more than 32 elements and uses linear search otherwise.
Implements ibis::qRange.
void ibis::qDiscreteRange::print | ( | std::ostream & | out | ) | const [virtual] |
Print out the node in the string form.
The short-form of the print function.
It only prints information about the current node of the query expression tree.
Reimplemented from ibis::qExpr.
References ibis::gVerbose.
Referenced by printFull().
virtual void ibis::qDiscreteRange::printFull | ( | std::ostream & | out | ) | const [inline, virtual] |
Print out the full expression.
The long form of the print function.
It recursively prints out the whole query expression tree, which can be quite long.
Reimplemented from ibis::qExpr.
References print().
![]() |