org.biojava.bio.symbol
Class PackingFactory

java.lang.Object
  extended byorg.biojava.bio.symbol.PackingFactory

public class PackingFactory
extends java.lang.Object

A factory that is used to maintain associations between alphabets and preferred bit-packings for them.

There are many ways to pack the symbols for an alphabet as binary. Different applications will wish to have different representations for reasons such as integration with external formats, whether to store ambiguity or not and what algorithms may be used on the bit-packed representation. Also, it has utility methods to arrange the bit-strings for symbols within a Java int primitive.

Author:
Matthew Pocock, Thomas Down

Constructor Summary
PackingFactory()
           
 
Method Summary
static void binary(int val)
           
static void binary(long val)
           
static Packing getPacking(FiniteAlphabet alpha, boolean ambiguity)
          Get the default packing for an alphabet.
static int nextWord(SymbolList symList, int word, int offset, int wordLength, Packing packing)
           
static int primeWord(SymbolList symList, int wordLength, Packing packing)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PackingFactory

public PackingFactory()
Method Detail

getPacking

public static Packing getPacking(FiniteAlphabet alpha,
                                 boolean ambiguity)
                          throws IllegalAlphabetException
Get the default packing for an alphabet.

Parameters:
alpha - the FiniteAlphabet that will be bit-packed
ambiguity - true if the packing should store ambiguity and false if it can discard ambiguity information
Throws:
IllegalAlphabetException

primeWord

public static int primeWord(SymbolList symList,
                            int wordLength,
                            Packing packing)
                     throws IllegalSymbolException
Throws:
IllegalSymbolException

nextWord

public static int nextWord(SymbolList symList,
                           int word,
                           int offset,
                           int wordLength,
                           Packing packing)
                    throws IllegalSymbolException
Throws:
IllegalSymbolException

binary

public static void binary(long val)

binary

public static void binary(int val)