com.endeca.navigation.analytics
Class GroupByList

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

public class GroupByList
extends AbstractList
implements List, QueryNode

A GroupByList is a list of GroupBy instances, each of which represent a single dimension of record grouping. Additionally, the GroupByList may be tagged with a method for computing subtotal aggregates, which are basically aggregates grouped by subsets of the GroupBy dimensions. If an empty GroupByList is attached to a Statement, this indicates that the input records will be GROUPed to a single record.


Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
GroupByList()
          Constructs a new, empty GroupByList.
 
Method Summary
 void add(int index, Object obj)
          Inserts a GroupBy object at position index.
 Object get(int index)
          Gets the GroupBy object at position index.
 Object remove(int index)
          Removes the GroupBy at the specified position in this list.
 Object set(int index, Object obj)
          Replaces the GroupBy object at position index with the the GroupBy object specified by obj.
 int size()
          Returns the number of GroupBy objects in this GroupByList.
 String toString()
          Returns the string form of this GroupByList.
 String toWire()
          Returns the wire format of this GroupByList.
 void validateSyntax()
          Validates the syntax of this GroupByList.
 
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

GroupByList

public GroupByList()
Constructs a new, empty GroupByList.

Method Detail

get

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

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

size

public int size()
Returns the number of GroupBy objects in this GroupByList.

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

set

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

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

add

public void add(int index,
                Object obj)
Inserts a GroupBy object at position index. Shifts the GroupBy element currently at that position (if any) and any subsequent GroupBy 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 GroupBy is to be inserted.
obj - the GroupBy to be inserted.
Throws:
IndexOutOfBoundsException - if index is out of range.
IllegalArgumentException - if obj is not a GroupBy.

remove

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

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

toString

public String toString()
Returns the string form of this GroupByList.

"GROUP" is returned if the GroupByList is empty.

The format for a GroupByList with one or more GroupBy objects is:

GROUP BY grouping-key-name1, ...
For example:
GROUP BY Region, Year
is returned if the aggregated records are grouped by the Region and Year combination.

Specified by:
toString in interface QueryNode
Overrides:
toString in class AbstractCollection
Returns:
A string representation of this GroupByList in the specified format.

toWire

public String toWire()
Returns the wire format of this GroupByList. 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 GroupByList.

validateSyntax

public void validateSyntax()
                    throws SyntaxException
Validates the syntax of this GroupByList. A GroupByList is valid if any GroupBy element it contains is itself valid. An empty GroupByList is valid because it represents grouping to a single record (bucket).

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


© 2003, 2012 Oracle and/or its affiliates. All rights reserved.
Oracle and/or its affiliates Confidential