com.endeca.navigation.analytics
Class FilterOr

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

public class FilterOr
extends AbstractList
implements Filter, List

A FilterOr is a Filter implementing a Boolean n-way OR operation. The filter evaluates to true for a given record if any 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
FilterOr()
          Creates a new FilterOr with no child 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 FilterOr.
 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 FilterOr.
 String toString()
          Returns the string form of this FilterOr.
 String toWire()
          Returns the wire format of this FilterOr.
 void validateSyntax()
          Validates the syntax of this FilterOr.
 
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

FilterOr

public FilterOr()
Creates a new FilterOr with no child 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 FilterOr.

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 FilterOr. 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 FilterOr. These are of the format:
(filter1 OR filter2 ...)

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

toWire

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

validateSyntax

public void validateSyntax()
                    throws SyntaxException
Validates the syntax of this FilterOr. A FilterOr 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