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

java.lang.Object
  |
  +--uk.ac.man.bioinf.sequence.types.AbstractSequenceType
        |
        +--uk.ac.man.bioinf.sequence.types.AbstractEnumeratedSequenceType
All Implemented Interfaces:
SequenceType
Direct Known Subclasses:
DNASequenceType, ProteinSequenceType, RNASequenceType

public class AbstractEnumeratedSequenceType
extends AbstractSequenceType

AbstractEnumeratedSequenceType.java Created: Tue Jun 13 13:20:11 2000

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

Field Summary
 
Fields inherited from class uk.ac.man.bioinf.sequence.types.AbstractSequenceType
elements
 
Constructor Summary
AbstractEnumeratedSequenceType(Element[][] elements, String name)
           
AbstractEnumeratedSequenceType(Element[] elements, String name)
           
 
Method Summary
 Element getElementForInt(int index)
          The inverse of the method getIntForElement.
 int getIntForElement(Element element)
          This method is present as a performance enhancement.
 
Methods inherited from class uk.ac.man.bioinf.sequence.types.AbstractSequenceType
getElements, getName, isElement, isElement, isElement, isElement, size
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractEnumeratedSequenceType

public AbstractEnumeratedSequenceType(Element[] elements,
                                      String name)

AbstractEnumeratedSequenceType

public AbstractEnumeratedSequenceType(Element[][] elements,
                                      String name)
Method Detail

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.

Parameters:
element - the element
Returns:
a int

getElementForInt

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

Parameters:
index - a value of type 'int'
Returns:
a value of type 'Element'