public static final class DataType.Utils
extends java.lang.Object
Constructor | Description |
---|---|
Utils() |
Modifier and Type | Method | Description |
---|---|---|
static byte[] |
getByteStates(char[] sequence,
DataType dt) |
For converting a sequence to an array of bytes where each byte represents the
state of the corresponding character in sequence
|
static byte[] |
getByteStates(java.lang.String sequence,
DataType dt) |
For converting a sequence to an array of bytes where each byte represents the
state of the corresponding character in sequence
|
static char[][] |
getChars(int[][] sequences,
char unknownChar,
char gapChar,
DataType dt) |
For converting an array of sequence to arrays of ints where each int represents the
state of the corresponding character in sequence
|
static char[] |
getChars(int[] sequence,
char unknownChar,
char gapChar,
DataType dt) |
For converting a sequence of ints representing states to an array of chars
|
static char[] |
getChars(int[] sequence,
DataType dt) |
For converting a sequence of ints representing states to an array of chars
|
static DataType |
getInstance(int typeID) |
create object according to this code
|
static char[] |
getPreferredChars(char[] sequence,
DataType dt) |
Converts a sequence of characters to the preferred form for a data type
|
static char[] |
getPreferredChars(char[] sequence,
DataType dt,
boolean specialDots) |
Converts a sequence of characters to the preferred form for a data type
|
static java.lang.String |
getPreferredChars(java.lang.String sequence,
DataType dt) |
Converts a sequence of characters to the preferred form for a data type (using Strings)
|
static java.lang.String |
getPreferredChars(java.lang.String sequence,
DataType dt,
boolean specialDots) |
Converts a sequence of characters to the preferred form for a data type (using Strings) * @param specialDots if true then the dot (period) '.' is used even if it is not the prefered character by the data type
|
static int[][] |
getStates(char[][] sequences,
int unknownState,
int gapState,
DataType dt) |
For converting an array of sequence to arrays of ints where each int represents the
state of the corresponding character in sequence
|
static int[][] |
getStates(char[][] sequences,
DataType dt) |
For converting an array of sequence to arrays of ints where each int represents the
state of the corresponding character in sequence
|
static int[] |
getStates(char[] sequence,
int unknownState,
int gapState,
DataType dt) |
For converting a sequence to an array of ints where each int represents the
state of the corresponding character in sequence
Allows user selection of unknown and gap states
|
static int[] |
getStates(char[] sequence,
DataType dt) |
For converting a sequence to an array of ints where each int represents the
state of the corresponding character in sequence
|
static boolean |
isGap(DataType d,
char c) |
Deprecated.
use DataType.isGapChar()
|
static boolean |
isSuggestedGap(char c) |
Useful for implementing classes to check if a character is a suggest gap character
Users of datatypes should query the datatype to see if a character is a gap - not
use this method.
|
static void |
leftAlignSequence(int[] sequence,
DataType dt) |
Realigns a sequence of states so that there are no gaps at the beggining (shifts to the left if necessary)
|
static void |
reverseSequence(int[] sequence) |
Reverses an array of states
|
static java.lang.String |
toString(DataType dt,
int[] states) |
For converting an array of states into a String of characters, based on a
DataType
|
public static final boolean isSuggestedGap(char c)
public static DataType getInstance(int typeID)
typeID
- selected data typepublic static final boolean isGap(DataType d, char c)
public static final char[] getPreferredChars(char[] sequence, DataType dt)
public static final char[] getPreferredChars(char[] sequence, DataType dt, boolean specialDots)
specialDots
- if true then the dot (period) '.' is used even if it is not the prefered character by the data typepublic static final java.lang.String getPreferredChars(java.lang.String sequence, DataType dt)
public static final java.lang.String getPreferredChars(java.lang.String sequence, DataType dt, boolean specialDots)
specialDots
- if true then the dot (period) '.' is used even if it is not the prefered character by the data typepublic static final byte[] getByteStates(java.lang.String sequence, DataType dt)
public static final byte[] getByteStates(char[] sequence, DataType dt)
public static final int[][] getStates(char[][] sequences, int unknownState, int gapState, DataType dt)
unknownState
- ensures that the state representation is set to this value (like -1)public static final int[] getStates(char[] sequence, int unknownState, int gapState, DataType dt)
public static final int[][] getStates(char[][] sequences, DataType dt)
public static final int[] getStates(char[] sequence, DataType dt)
public static final char[][] getChars(int[][] sequences, char unknownChar, char gapChar, DataType dt)
unknownChar
- The character uses for unknown statesgapChar
- the character to use for gap states (may be the same as the unknownChar)public static final char[] getChars(int[] sequence, char unknownChar, char gapChar, DataType dt)
unknownChar
- The character uses for unknown statesgapChar
- the character to use for gap states (may be the same as the unknownChar)public static final char[] getChars(int[] sequence, DataType dt)
public static final java.lang.String toString(DataType dt, int[] states)
public static final void reverseSequence(int[] sequence)
sequence
- the sequence of statespublic static final void leftAlignSequence(int[] sequence, DataType dt)
sequence
- the base sequencedt
- the datatype of the sequence states