org.abstracthorizon.mercury.imap.util
Class ComposedSequence

java.lang.Object
  extended by org.abstracthorizon.mercury.imap.util.ComposedSequence
All Implemented Interfaces:
Comparable<Sequence>, Sequence

public class ComposedSequence
extends Object
implements Sequence

Composed sequence - an ordered sequence of sequences.

Author:
Daniel Sendula

Field Summary
protected  int ptr
          Current pointer
protected  List<Sequence> sequences
          Sequences
 
Constructor Summary
ComposedSequence()
          Constructor
 
Method Summary
 void add(Sequence s)
          Adds new sequence to composed sequence
 void clear()
          Clears list of sequences
 int compareTo(Sequence other)
          Compares two sequences returning -1, 0 or 1
 boolean contains(Sequence s)
          Returns true if sequence exists
 void first()
          Sets pointer to first element in sequences
 int getMax()
          Returns maximum number from the sequence
 int getMin()
          Returns minimum number from the sequence
 Iterator<Sequence> getSequencesAsIterator()
          Returns sequences list iterator
 boolean more()
          Returns true if there are more elements in the sequence
 int next()
          Returns next element from the sequence
 void remove(Sequence s)
          Removes sequence from list of sequences
 void setLowerLimit(int lower)
          Sets the lower limit in the sequence removing subsequences below that point
 void setUpperLimit(int upper)
          Sets the upper limit in the sequence removing subsequences above that point
 String toString()
          Creates a string representing all sequences
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sequences

protected List<Sequence> sequences
Sequences


ptr

protected int ptr
Current pointer

Constructor Detail

ComposedSequence

public ComposedSequence()
Constructor

Method Detail

add

public void add(Sequence s)
Adds new sequence to composed sequence

Parameters:
s - sequence to be added

remove

public void remove(Sequence s)
Removes sequence from list of sequences

Parameters:
s - sequence to be removed

clear

public void clear()
Clears list of sequences


contains

public boolean contains(Sequence s)
Returns true if sequence exists

Parameters:
s - sequence
Returns:
true if sequence exists

getMin

public int getMin()
Returns minimum number from the sequence

Specified by:
getMin in interface Sequence
Returns:
minimum number from the sequence

getMax

public int getMax()
Returns maximum number from the sequence

Specified by:
getMax in interface Sequence
Returns:
maximum number from the sequence

setLowerLimit

public void setLowerLimit(int lower)
Sets the lower limit in the sequence removing subsequences below that point

Specified by:
setLowerLimit in interface Sequence
Parameters:
lower - lower limit

setUpperLimit

public void setUpperLimit(int upper)
Sets the upper limit in the sequence removing subsequences above that point

Specified by:
setUpperLimit in interface Sequence
Parameters:
lower - upper limit

first

public void first()
Sets pointer to first element in sequences

Specified by:
first in interface Sequence

more

public boolean more()
Returns true if there are more elements in the sequence

Specified by:
more in interface Sequence
Returns:
true if there are more elements in the sequence

next

public int next()
Returns next element from the sequence

Specified by:
next in interface Sequence
Returns:
next element from the sequence

getSequencesAsIterator

public Iterator<Sequence> getSequencesAsIterator()
Returns sequences list iterator

Returns:
sequences list iterator

toString

public String toString()
Creates a string representing all sequences

Overrides:
toString in class Object
Returns:
a string representing all sequences

compareTo

public int compareTo(Sequence other)
Compares two sequences returning -1, 0 or 1

Specified by:
compareTo in interface Comparable<Sequence>
Parameters:
other - other sequence
Returns:
-1, 0 or 1


Copyright © 2005-2009 Abstract Horizon. All Rights Reserved.