Package edu.caltech.nanodb.expressions
Class OrderByExpression
- java.lang.Object
-
- edu.caltech.nanodb.expressions.OrderByExpression
-
public class OrderByExpression extends java.lang.Object
This class represents an expression that results are ordered by, as well as whether the order is ascending or descending. Lists of this object specify ordering of results from a query, as well as the ordering of tuples in a sequential file, or attributes in an ordered index.
-
-
Field Summary
Fields Modifier and Type Field Description private boolean
ascending
A flag indicating whether the results should be in ascending or descending order.private Expression
expression
The expression that the results should be ordered by.
-
Constructor Summary
Constructors Constructor Description OrderByExpression(Expression expression)
Initialize a new order-by object with the specified expression.OrderByExpression(Expression expression, boolean ascending)
Initialize a new order-by object with the specified expression and order.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Expression
getExpression()
Returns the expression that results will be sorted onboolean
isAscending()
Returns the flag indicating whether the results should be in ascending or descending order.java.lang.String
toString()
-
-
-
Field Detail
-
expression
private Expression expression
The expression that the results should be ordered by.
-
ascending
private boolean ascending
A flag indicating whether the results should be in ascending or descending order. A value of true means ascending order.
-
-
Constructor Detail
-
OrderByExpression
public OrderByExpression(Expression expression)
Initialize a new order-by object with the specified expression. Results will be in ascending order.- Parameters:
expression
- The expression to order results by.
-
OrderByExpression
public OrderByExpression(Expression expression, boolean ascending)
Initialize a new order-by object with the specified expression and order.- Parameters:
expression
- The expression to order results by.ascending
- a value of true will cause the results to be in ascending order; a value of false will cause them to be in descending order
-
-
Method Detail
-
getExpression
public Expression getExpression()
Returns the expression that results will be sorted on- Returns:
- the expression that results will be sorted on
-
isAscending
public boolean isAscending()
Returns the flag indicating whether the results should be in ascending or descending order.- Returns:
- true if the results should be in ascending order, false otherwise.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-