org.axiondb
Class Sequence

java.lang.Object
  extended by org.axiondb.Sequence
All Implemented Interfaces:
Serializable

public class Sequence
extends Object
implements Serializable

A database sequence. A sequence provides a mechanism for obtaining unique integer values from the database.

Note: If increment value is negative, then the sequence generator is a descending sequence generator; otherwise, it is an ascending sequence generator.

Note: The data type of a sequence generator must be exact numeric with scale 0.

Version:
$Revision: 1.15 $ $Date: 2007/11/13 19:04:02 $
See Also:
Serialized Form

Field Summary
static int RADIX
           
 
Constructor Summary
Sequence()
           
Sequence(String name, DataType type, BigInteger startVal, BigInteger incrementBy, BigInteger maxValue, BigInteger minValue, boolean isCycle)
          Create a sequence with all ANSI 2003 parameters.
Sequence(String name, int startVal)
          Create a sequence starting whose initial value is startVal .
 
Method Summary
 void addSequenceModificationListener(SequenceModificationListener listener)
           
 boolean equals(Object otherobject)
          Returns true iff otherobject is a Sequencewhose name are equal to mine.
 Object evaluate()
          Increment and return the next value in this sequence.
 Object getCuurentValue()
           
 DataType getDataType()
           
 BigInteger getIncrementBy()
           
 BigInteger getMaxValue()
           
 BigInteger getMinValue()
           
 String getName()
          Get the name of this sequence.
 Object getValue()
          Get the current value of this sequence.
 int hashCode()
          Returns a hash code in keeping with the standard equals/ hashCodecontract.
 boolean isCycle()
           
 void read(DataInput in)
           
 void write(DataOutput out)
          Writes the given value to the given DataOutput.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

RADIX

public static int RADIX
Constructor Detail

Sequence

public Sequence()

Sequence

public Sequence(String name,
                DataType type,
                BigInteger startVal,
                BigInteger incrementBy,
                BigInteger maxValue,
                BigInteger minValue,
                boolean isCycle)
Create a sequence with all ANSI 2003 parameters.


Sequence

public Sequence(String name,
                int startVal)
Create a sequence starting whose initial value is startVal .

Method Detail

addSequenceModificationListener

public void addSequenceModificationListener(SequenceModificationListener listener)

equals

public boolean equals(Object otherobject)
Returns true iff otherobject is a Sequencewhose name are equal to mine.

Overrides:
equals in class Object

evaluate

public Object evaluate()
                throws AxionException
Increment and return the next value in this sequence.

Throws:
AxionException

getCuurentValue

public Object getCuurentValue()
                       throws AxionException
Throws:
AxionException

getDataType

public DataType getDataType()

getIncrementBy

public BigInteger getIncrementBy()

getMaxValue

public BigInteger getMaxValue()

getMinValue

public BigInteger getMinValue()

getName

public String getName()
Get the name of this sequence.


getValue

public Object getValue()
                throws AxionException
Get the current value of this sequence.

Throws:
AxionException

hashCode

public int hashCode()
Returns a hash code in keeping with the standard equals/ hashCodecontract.

Overrides:
hashCode in class Object

isCycle

public boolean isCycle()

read

public void read(DataInput in)
          throws Exception
Throws:
Exception
See Also:
write(java.io.DataOutput)

write

public void write(DataOutput out)
           throws IOException
Writes the given value to the given DataOutput.

Parameters:
value - the value to write, which must be Sequence
Throws:
IOException