uk.ac.man.bioinf.sequence.types
Class EmptySequenceType

java.lang.Object
  |
  +--uk.ac.man.bioinf.sequence.types.EmptySequenceType
All Implemented Interfaces:
SequenceType

public class EmptySequenceType
extends Object
implements SequenceType

EmptySequenceType.java Created: Tue Aug 1 17:22:00 2000

Version:
$Id: EmptySequenceType.java,v 1.2 2001/04/11 17:04:43 lord Exp $
Author:
Phillip Lord

Field Summary
static EmptySequenceType INSTANCE
           
 
Method Summary
 Element getElementForInt(int index)
          The inverse of the method getIntForElement.
 Element[] getElements()
          Returns all the elements available in this sequence type.
static SequenceType getInstance()
           
 int getIntForElement(Element element)
          This method is present as a performance enhancement.
 String getName()
          Returns the human readable form of this sequence type.
 boolean isElement(char element)
          Returns a boolean as to whether the specified element is part of this sequence type.
 boolean isElement(char[] elements)
          Returns a boolean as to whether the specified elements are part of this sequence type.
 boolean isElement(Element element)
          Returns a boolean as to whether the specified element is part of this sequence type.
 boolean isElement(Element[] elements)
          Returns a boolean as to whether the specified elements are part of this sequence type.
 int size()
          Returns the number of elements in this sequence type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSTANCE

public static final EmptySequenceType INSTANCE
Method Detail

getInstance

public static SequenceType getInstance()

size

public int size()
Description copied from interface: SequenceType
Returns the number of elements in this sequence type.

Specified by:
size in interface SequenceType
Returns:
the number of elements

getIntForElement

public int getIntForElement(Element element)
Description copied from interface: SequenceType
This method is present as a performance enhancement. For every Element this method should return a unique and repeatable int, starting at 0 and ending at size() - 1 for all possible Elements. This enables the Element to be used as an index for an array which in turn allows implementation of efficient look up tables, rather than using a hashtable.

Specified by:
getIntForElement in interface SequenceType
Parameters:
element - the element
Returns:
a int

getElementForInt

public Element getElementForInt(int index)
Description copied from interface: SequenceType
The inverse of the method getIntForElement.

Specified by:
getElementForInt in interface SequenceType
Parameters:
index - a value of type 'int'
Returns:
a value of type 'Element'

getElements

public Element[] getElements()
Description copied from interface: SequenceType
Returns all the elements available in this sequence type. This array should be freely modifiable, and changes should not percolate backwards iunto the internal data of the sequence type.

Specified by:
getElements in interface SequenceType
Returns:
the elements

getName

public String getName()
Description copied from interface: SequenceType
Returns the human readable form of this sequence type.

Specified by:
getName in interface SequenceType
Returns:
the name

isElement

public boolean isElement(char element)
Description copied from interface: SequenceType
Returns a boolean as to whether the specified element is part of this sequence type.

Specified by:
isElement in interface SequenceType
Parameters:
element - the element
Returns:
whether an element

isElement

public boolean isElement(Element element)
Description copied from interface: SequenceType
Returns a boolean as to whether the specified element is part of this sequence type.

Specified by:
isElement in interface SequenceType
Parameters:
element - the element
Returns:
whether an element

isElement

public boolean isElement(char[] elements)
Description copied from interface: SequenceType
Returns a boolean as to whether the specified elements are part of this sequence type.

Specified by:
isElement in interface SequenceType
Parameters:
elements - the elements
Returns:
whether elements

isElement

public boolean isElement(Element[] elements)
Description copied from interface: SequenceType
Returns a boolean as to whether the specified elements are part of this sequence type.

Specified by:
isElement in interface SequenceType
Parameters:
elements - the elements
Returns:
whether elements