edu.neu.ccs.filter
Class StringableFilterSequence

java.lang.Object
  extended byedu.neu.ccs.filter.StringableFilterSequence
All Implemented Interfaces:
Serializable, StringableFilter

public class StringableFilterSequence
extends Object
implements StringableFilter, Serializable

An ordered collection of filter objects similar to a List that is itself a filter representing the ordered application of the list of filters.

Since:
1.0
Version:
2.2
See Also:
Serialized Form

Field Summary
protected  List filters
          The underlying list used for storage of filters.
 
Constructor Summary
StringableFilterSequence()
          Constructs a sequence using the default underlying linear data structure.
StringableFilterSequence(List l)
          Constructs a sequence using the given underlying linear data structure.
 
Method Summary
 void add(int index, StringableFilter f)
          Inserts the given filter at the given index in this sequence.
 boolean add(StringableFilter f)
          Appends the given filter to the end of this sequence.
 void clear()
          Removes all of the filters from this sequence.
 boolean contains(StringableFilter f)
          Returns true if the given filter is contained in this sequence, or false if it is not.
 boolean containsAll(Collection c)
          Returns true if this sequence contains all of the elements of the specified collection.
 boolean equals(StringableFilterSequence sequence)
          Returns true if the given sequence is equal to this sequence, and false if it is not.
 Stringable filterStringable(Stringable obj)
          Applies the filters in this sequence in order.
 StringableFilter get(int index)
          Returns the filter at the given index in this sequence.
 int hashCode()
          Returns a hash code value for this sequence.
 int indexOf(StringableFilter f)
          Returns the index in this sequence of the first occurence of the given filter, or -1 if this sequence does not contain this filter.
 boolean isEmpty()
          Returns true if this sequence is empty, and false if it is not.
 Iterator iterator()
          Returns an iterator over the filters in this sequence in order.
 int lastIndexOf(StringableFilter f)
          Returns the index in this sequence of the last occurrence of the given filter, or -1 if this list does not contain this filter.
 ListIterator listIterator()
          Returns a list iterator over the filters in this sequence in order.
 ListIterator listIterator(int index)
          Returns a list iterator over the filters in this sequence in order, starting at the given index.
 StringableFilter remove(int index)
          Removes the filter at the given index of the sequence.
 boolean remove(StringableFilter f)
          Removes the first occurrence of the given filter in this sequence, and returns true, or returns false if this sequence does not contain the filter.
 StringableFilter set(int index, StringableFilter f)
          Replaces the filter at the given index in this sequence with the given filter.
 int size()
          Returns the number of filters in this sequence.
 StringableFilterSequence subList(int fromIndex, int toIndex)
          Returns a sequence of filters containing the filters in this sequence from the given starting index to the given ending index, exclusive.
 StringableFilter[] toArray()
          Returns an array containing the filters in this sequence in order.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filters

protected List filters
The underlying list used for storage of filters.

Constructor Detail

StringableFilterSequence

public StringableFilterSequence()
Constructs a sequence using the default underlying linear data structure.

See Also:
StringableFilterSequence(List)

StringableFilterSequence

public StringableFilterSequence(List l)
Constructs a sequence using the given underlying linear data structure. If the given structure is null, the default structure is used.

Parameters:
l - the data structure to be used
See Also:
StringableFilterSequence()
Method Detail

filterStringable

public Stringable filterStringable(Stringable obj)
                            throws FilterException
Applies the filters in this sequence in order.

Specified by:
filterStringable in interface StringableFilter
Parameters:
obj - the object to be filtered
Throws:
FilterException - if the object does not meet the criteria for the filter, or cannot be filtered
See Also:
StringableFilter

add

public void add(int index,
                StringableFilter f)
Inserts the given filter at the given index in this sequence.

See Also:
add(StringableFilter)

add

public boolean add(StringableFilter f)
Appends the given filter to the end of this sequence.

Returns:
whether or not the filter was successfully added
See Also:
add(int, StringableFilter)

clear

public void clear()
Removes all of the filters from this sequence.


contains

public boolean contains(StringableFilter f)
Returns true if the given filter is contained in this sequence, or false if it is not.

See Also:
containsAll(Collection)

containsAll

public boolean containsAll(Collection c)
Returns true if this sequence contains all of the elements of the specified collection.

See Also:
contains(StringableFilter)

equals

public boolean equals(StringableFilterSequence sequence)
Returns true if the given sequence is equal to this sequence, and false if it is not.


get

public StringableFilter get(int index)
Returns the filter at the given index in this sequence.


hashCode

public int hashCode()
Returns a hash code value for this sequence.


indexOf

public int indexOf(StringableFilter f)
Returns the index in this sequence of the first occurence of the given filter, or -1 if this sequence does not contain this filter.

See Also:
lastIndexOf(StringableFilter)

isEmpty

public boolean isEmpty()
Returns true if this sequence is empty, and false if it is not.

See Also:
size()

iterator

public Iterator iterator()
Returns an iterator over the filters in this sequence in order.

See Also:
listIterator(), listIterator(int)

lastIndexOf

public int lastIndexOf(StringableFilter f)
Returns the index in this sequence of the last occurrence of the given filter, or -1 if this list does not contain this filter.

See Also:
indexOf(StringableFilter)

listIterator

public ListIterator listIterator()
Returns a list iterator over the filters in this sequence in order.

See Also:
listIterator(int), iterator()

listIterator

public ListIterator listIterator(int index)
Returns a list iterator over the filters in this sequence in order, starting at the given index.

See Also:
listIterator(), iterator()

remove

public StringableFilter remove(int index)
Removes the filter at the given index of the sequence.

Returns:
the filter that was removed
See Also:
remove(StringableFilter)

remove

public boolean remove(StringableFilter f)
Removes the first occurrence of the given filter in this sequence, and returns true, or returns false if this sequence does not contain the filter.

See Also:
remove(int)

set

public StringableFilter set(int index,
                            StringableFilter f)
Replaces the filter at the given index in this sequence with the given filter.

Returns:
the filter that was replaced

size

public int size()
Returns the number of filters in this sequence.

See Also:
isEmpty()

subList

public StringableFilterSequence subList(int fromIndex,
                                        int toIndex)
Returns a sequence of filters containing the filters in this sequence from the given starting index to the given ending index, exclusive.

See Also:
listIterator(int)

toArray

public StringableFilter[] toArray()
Returns an array containing the filters in this sequence in order.

See Also:
iterator(), listIterator()