com.endeca.navigation.analytics
Class CoalesceList

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

public class CoalesceList
extends AbstractList
implements List, QueryNode

CoalesceList instances represent a list of expressions used to return the the first non-null value in the list. These coalesce expressions are objects of type Expr

Coalesce expressions provide the ability to evalute records for multiple values and return the first non-null value encountered, in the order specified. The CoalesceList saves the expressions in the form of a list, in the same order as specified in the query.


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

CoalesceList

public CoalesceList()
Constructs an empty CoalesceList.

Method Detail

get

public Object get(int index)
Gets the expression at position index. The expression must be of type Expr.

Specified by:
get in interface List
Specified by:
get in class AbstractList
Parameters:
index - offset of the desired coalesce expression.
Returns:
The coalesce expression (Expr object) at position index.
Throws:
IndexOutOfBoundsException - if index is out of range.

size

public int size()
Returns the number of coalesce expressions in this CoalesceList.

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

set

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

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

add

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

remove

public Object remove(int index)
Removes the coalesce expression element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list. Object returned is of type Expr.

Specified by:
remove in interface List
Overrides:
remove in class AbstractList
Parameters:
index - offset of element.
Returns:
element previously at position index.
Throws:
IndexOutOfBoundsException - If the index is out of range.

toString

public String toString()
Returns the string form of this CoalesceList. These are of the format:
expression1, expression2...
where expression is the string form of Expr.

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

toWire

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

validateSyntax

public void validateSyntax()
                    throws SyntaxException
Validates the syntax of this CoalesceList. A CoalesceList is valid if all of its expressions are themselves valid and the list is not empty.

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.