uk.ac.man.bioinf.sequence
Interface SequenceType

All Known Subinterfaces:
ComplexSequenceType
All Known Implementing Classes:
AbstractComplexSequenceType, AbstractSequenceType, DefaultComplexSequenceType, EmptySequenceType

public interface SequenceType

SequenceType.java An interface to represent the type of a sequence (e.g: Protein, DNA). Created: Fri Feb 25 20:12:45 2000

Version:
$Id: SequenceType.java,v 1.7 2001/05/08 17:47:31 lord Exp $
Author:
J Selley

Method Summary
 Element getElementForInt(int index)
          The inverse of the method getIntForElement.
 Element[] getElements()
          Returns all the elements available in this sequence type.
 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.
 

Method Detail

size

public int size()
Returns the number of elements in this sequence type.

Returns:
the number of elements

getIntForElement

public int getIntForElement(Element element)
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)
The inverse of the method getIntForElement.

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

getElements

public Element[] getElements()
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.

Returns:
the elements

getName

public String getName()
Returns the human readable form of this sequence type.

Returns:
the name

isElement

public boolean isElement(char element)
Returns a boolean as to whether the specified element is part of this sequence type.

Parameters:
element - the element
Returns:
whether an element

isElement

public boolean isElement(Element element)
Returns a boolean as to whether the specified element is part of this sequence type.

Parameters:
element - the element
Returns:
whether an element

isElement

public boolean isElement(char[] elements)
Returns a boolean as to whether the specified elements are part of this sequence type.

Parameters:
elements - the elements
Returns:
whether elements

isElement

public boolean isElement(Element[] elements)
Returns a boolean as to whether the specified elements are part of this sequence type.

Parameters:
elements - the elements
Returns:
whether elements