public class PackingFactory extends 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.
Constructor and Description |
---|
PackingFactory() |
Modifier and Type | Method and Description |
---|---|
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) |
public PackingFactory()
public static Packing getPacking(FiniteAlphabet alpha, boolean ambiguity) throws IllegalAlphabetException
alpha
- the FiniteAlphabet that will be bit-packedambiguity
- true if the packing should store ambiguity and false
if it can discard ambiguity informationIllegalAlphabetException
- if this combination of alphabet and
ambiguity can not be handledpublic static int primeWord(SymbolList symList, int wordLength, Packing packing) throws IllegalSymbolException
IllegalSymbolException
public static int nextWord(SymbolList symList, int word, int offset, int wordLength, Packing packing) throws IllegalSymbolException
IllegalSymbolException
public static void binary(long val)
public static void binary(int val)
Copyright © 2014 BioJava. All rights reserved.