spki
Class Sequence

java.lang.Object
  |
  +--spki.BaseObj
        |
        +--spki.Sequence

public class Sequence
extends BaseObj
implements SeqDefValue, SeqEntry

SPKI Sequence class.

Formal definition:

 <sequence>:: "(" "sequence" <seq-ent>* ")" ;
 

Version:
$Id: Sequence.java,v 1.5 2002/06/30 07:33:38 tep Exp $
Author:
Tep Narula <tep@win.trlabs.ca>

Field Summary
private static String __ME
          This class's full name.
private  boolean dirty
          Do we need to re-build the SExpression?
private  Vector entries
          List of objects representing sequence entries.
static String SEXP_NAME
          This class S-Expression type name, used by toSExpression() and other methods.
 
Fields inherited from class spki.BaseObj
__ME, cache_sexp, cached_sexp, DEFAULT_HASH_ALG, locked, SEXP_NAME
 
Constructor Summary
Sequence()
          Create an immutable empty Sequence object.
Sequence(SeqEntry entry)
          Create an immutable Sequence object from a single SeqEntry.
Sequence(SeqEntry[] entries)
          Create an immutable Sequence object from an array of SeqEntry.
Sequence(SExpression sexp)
          Create an immutable Sequence object from an S-Expression.
 
Method Summary
private  void add(SeqEntry entry)
          Add an entry.
 SeqEntry getSeqEntry(int index)
          Get an entry with the specified index.
 int getSize()
          Get the number of entries in this object.
 SeqEntry[] toArray()
           
 SExpression toSExpression()
          Build an SExpression representing this object.
 
Methods inherited from class spki.BaseObj
disableSExpressionCaching, enableSExpressionCaching, extractHashAlgId, getCachedSExpression, isLocked, isSListOfType, lock, providerToSPKI, setCachedSExpression, spkiToProvider, toString
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

__ME

private static final String __ME
This class's full name.

SEXP_NAME

public static final String SEXP_NAME
This class S-Expression type name, used by toSExpression() and other methods.
See Also:
toSExpression()

entries

private Vector entries
List of objects representing sequence entries.

dirty

private boolean dirty
Do we need to re-build the SExpression?
See Also:
add(SeqEntry), toSExpression()
Constructor Detail

Sequence

public Sequence()
Create an immutable empty Sequence object. Probably not very useful, but we gotta do whatever the definitions say!
See Also:
Sequence(SExpression), Sequence(SeqEntry[]), Sequence(SeqEntry)

Sequence

public Sequence(SExpression sexp)
         throws SPKIException,
                ParseException
Create an immutable Sequence object from an S-Expression.
See Also:
BaseObj.BaseObj(SExpression)

Sequence

public Sequence(SeqEntry[] entries)
         throws SPKIException
Create an immutable Sequence object from an array of SeqEntry.
Parameters:
entries - array of SeqEntry.
Throws:
SPKIException - if some error occured during creation.

Sequence

public Sequence(SeqEntry entry)
         throws SPKIException
Create an immutable Sequence object from a single SeqEntry.
Parameters:
entry - a SeqEntry.
Throws:
SPKIException - if some error occured during creation.
Method Detail

toSExpression

public SExpression toSExpression()
                          throws SPKIException
Description copied from interface: SPKIObject
Build an SExpression representing this object.
Overrides:
toSExpression in class BaseObj
Tags copied from interface: SPKIObject
Returns:
SExpression object representing this object, or null.
Throws:
SPKIException - if something went wrong during conversion.

getSize

public int getSize()
Get the number of entries in this object.
Returns:
number of entries in this object.

getSeqEntry

public SeqEntry getSeqEntry(int index)
Get an entry with the specified index.
Parameters:
index - index of the entry required.
Returns:
SeqEntry of specified index, or null if such entry doesn't exist.

toArray

public SeqEntry[] toArray()

add

private void add(SeqEntry entry)
          throws IllegalStateException,
                 SPKIException
Add an entry.
Parameters:
entry - SeqEntry containing an entry.
Throws:
IllegalStateException - if the object is immutable.
SPKIException - if something went wrong.
See Also:
Sequence()