DNANoAmbPack (BioJava-1.5-beta API)
Keywords: org.biojava.bio.symbol.DNANoAmbPack class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.biojava.bio.symbol
Class DNANoAmbPack

    java.lang.Object
      org.biojava.bio.symbol.DNANoAmbPack

All Implemented Interfaces:
  Serializable, Packing

    public class DNANoAmbPack

extends Object
implements Packing, Serializable

A `Packing` implementation which handles the DNA alphabet, without any support for ambiguity symbols. In normal use, the only returns values between 0 and 3, and so requires only two bits of storage per symbol.

Since:
  1.3
Author:
  Matthew Pocock, Thomas Down
See Also:
  Serialized Form

Constructor Summary
`DNANoAmbPack(byte placeHolder)` Construct a new packing which returns the specified byte value for unknown Symbols (such as ambiguity symbols).
`DNANoAmbPack(Symbol placeHolderSymbol)` Construct a new packing which translates unknown symbols into the specified symbol.

Method Summary
`FiniteAlphabet` | `getAlphabet()` The FiniteAlphabet this packing is for.
`boolean` | `handlesAmbiguity()` Flag to state if ambiguities are stored.
`byte` | `pack(Symbol sym)` Return a byte representing the packing of a symbol.
`Symbol` | `unpack(byte b)` Return the symbol for a packing.
`byte` | `wordSize()` The number of bits required to pack a symbol.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### DNANoAmbPack

    public DNANoAmbPack(byte placeHolder)

  Construct a new packing which returns the specified byte value for unknown Symbols (such as ambiguity symbols). This might be outside the normal range of return values (0-3), allowing callers to detect ambiguity symbols and ignore them.

### DNANoAmbPack

    public DNANoAmbPack(Symbol placeHolderSymbol)

  Construct a new packing which translates unknown symbols into the specified symbol.

Method Detail

### getAlphabet

    public FiniteAlphabet getAlphabet()

  Description copied from interface: `Packing`
  The FiniteAlphabet this packing is for.

  Specified by:
    `getAlphabet` in interface `Packing`
  Returns:
    the FiniteAlphabet that we can pack

### pack

    public byte pack(Symbol sym)

  Description copied from interface: `Packing`

  Return a byte representing the packing of a symbol. The bits will be from 1 >> 0 through to 1 >> (wordSize - 1).

  Specified by:
    `pack` in interface `Packing`
  Parameters:
    `sym` - the Symbol to pack
  Returns:
    a byte containing the packed symbol

### unpack

    public Symbol unpack(byte b)
                  throws IllegalSymbolException

  Description copied from interface: `Packing`

  Return the symbol for a packing.

  Specified by:
    `unpack` in interface `Packing`
  Parameters:
    `b` - the byte pattern for a Symbol
  Returns:
    the Symbol that was packed
  Throws:
    `IllegalSymbolException` - if the packing doesn't represent a valid Symbol

### wordSize

    public byte wordSize()

  Description copied from interface: `Packing`

  The number of bits required to pack a symbol.

  Specified by:
    `wordSize` in interface `Packing`
  Returns:
    the word size as a byte

### handlesAmbiguity

    public boolean handlesAmbiguity()

  Description copied from interface: `Packing`

  Flag to state if ambiguities are stored.

  Packings are free to either store ambiguity information or to discard it (presumably converting all ambiguities to a standard AtomicSymbol and then packing that). You can check wether ambiguities are handled by calling this method.

  Specified by:
    `handlesAmbiguity` in interface `Packing`
  Returns:
    true if ambiguities are stored, false otherwise

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD