com.endeca.navigation.analytics
Class FilterAnd

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

public class FilterAnd
extends AbstractList
implements Filter, List

A FilterAnd is a Filter implementing a Boolean n-way AND operation. The filter evaluates to true for a given record if all of its child Filters evaluate to true for that record. This type of filter provides a List interface, where the List elements represent child Filter operations.


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

FilterAnd

public FilterAnd()
Creates a new FilterAnd with no sub-filters (no Filter elements).

Method Detail

get

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

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

size

public int size()
Returns the number of Filter objects in this FilterAnd.

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

set

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

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

add

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

remove

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

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

toString

public String toString()
Returns the string form of this FilterAnd. These are of the format:
(filter1 AND filter2 ...)
where each filter is the string form of a Filter.

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

toWire

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

validateSyntax

public void validateSyntax()
                    throws SyntaxException
Validates the syntax of this FilterAnd. A FilterAnd is valid if the number of sub-filters (Filter elements) is greater than zero and each sub-filter is itself valid.

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


2010 Endeca Technologies, Inc.
Endeca Confidential