com.endeca.navigation.analytics
Class OrderByList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList
          extended by com.endeca.navigation.analytics.OrderByList
All Implemented Interfaces:
QueryNode, Iterable, Collection, List

public class OrderByList
extends AbstractList
implements List, QueryNode

An OrderByList is a list of OrderBy instances. Unlike a GroupByList, an OrderByList may not be empty, because an empty list does not imply a repeatable order.


Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
OrderByList()
          Constructs a new, empy OrderByList.
 
Method Summary
 void add(int index, Object obj)
          Inserts an OrderBy object at position index.
 Object get(int index)
          Gets the OrderBy object at position index.
 Object remove(int index)
          Removes the OrderBy at the specified position in this list.
 Object set(int index, Object obj)
          Replaces the OrderBy object at position index with the the OrderBy object specified by obj.
 int size()
          Returns the number of OrderBy expressions in this OrderByList.
 String toString()
          Returns the string form of this OrderByList.
 String toWire()
          Returns the wire format of this OrderByList.
 void validateSyntax()
          Validates the syntax of this OrderByList.
 
Methods inherited from class java.util.AbstractList
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, removeAll, retainAll, subList, toArray, toArray
 

Constructor Detail

OrderByList

public OrderByList()
Constructs a new, empy OrderByList.

Method Detail

get

public Object get(int index)
Gets the OrderBy object at position index.

Specified by:
get in interface List
Specified by:
get in class AbstractList
Parameters:
index - offset of the desired OrderBy object.
Returns:
OrderBy object at position index.
Throws:
IndexOutOfBoundsException - if index is out of range.

size

public int size()
Returns the number of OrderBy expressions in this OrderByList.

Specified by:
size in interface Collection
Specified by:
size in interface List
Specified by:
size in class AbstractCollection
Returns:
Number of OrderBy elements in the list.

set

public Object set(int index,
                  Object obj)
Replaces the OrderBy object at position index with the the OrderBy object specified by obj.

Specified by:
set in interface List
Overrides:
set in class AbstractList
Parameters:
index - offset of the OrderBy object to replace.
obj - the OrderBy object to store.
Returns:
The OrderBy object previously at position index.
Throws:
IndexOutOfBoundsException - if index is out of range.
IllegalArgumentException - if obj is not an OrderBy.

add

public void add(int index,
                Object obj)
Inserts an OrderBy object at position index. Shifts the OrderBy element currently at that position (if any) and any subsequent OrderBy elements to the right (adds one to their indices).

Specified by:
add in interface List
Overrides:
add in class AbstractList
Parameters:
index - offset at which the OrderBy is to be inserted.
obj - the OrderBy to be inserted.
Throws:
IndexOutOfBoundsException - if index is out of range.
IllegalArgumentException - if obj is not an OrderBy.

remove

public Object remove(int index)
Removes the OrderBy at the specified position in this list. Shifts any subsequent OrderBy elements to the left (subtracts one from their indices). Returns the OrderBy that was removed from the list.

Specified by:
remove in interface List
Overrides:
remove in class AbstractList
Parameters:
index - offset of the OrderBy to be removed.
Returns:
OrderBy previously at position index.
Throws:
IndexOutOfBoundsException - if index is out of range.

toString

public String toString()
Returns the string form of this OrderByList. These are of the format:
ORDER BY key-sort-name1 sortdir, key-sort-name2 sortdir ...
where sortdir is either ASC or DESC. For example:
ORDER BY Total DESC
is returned if the sorting key is a property named Total and a descending sort direction has been set.

Specified by:
toString in interface QueryNode
Overrides:
toString in class AbstractCollection
Returns:
A string representation of this OrderByList.

toWire

public String toWire()
Returns the wire format of this OrderByList. This method is not intended for public use because the wire format is subject to change.

Specified by:
toWire in interface QueryNode
Returns:
A wire format representation of this OrderByList.

validateSyntax

public void validateSyntax()
                    throws SyntaxException
Validates the syntax of this OrderByList. An OrderByList is valid if it is non-empty (must contain at least one OrderBy element) and all its OrderBy elements are themselves valid.

Specified by:
validateSyntax in interface QueryNode
Throws:
SyntaxException - if the syntax requirements are not satisfied.


2010 Endeca Technologies, Inc.
Endeca Confidential