Package pal.datatype
Class DataType.Utils
- java.lang.Object
-
- pal.datatype.DataType.Utils
-
- Enclosing interface:
- DataType
public static final class DataType.Utils extends java.lang.Object
Some useful methods for implmenting classes and for DataType users
-
-
Constructor Summary
Constructors Constructor Description Utils()
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods 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 sequencestatic 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 sequencestatic 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 sequencestatic char[]
getChars(int[] sequence, char unknownChar, char gapChar, DataType dt)
For converting a sequence of ints representing states to an array of charsstatic char[]
getChars(int[] sequence, DataType dt)
For converting a sequence of ints representing states to an array of charsstatic DataType
getInstance(int typeID)
create object according to this codestatic char[]
getPreferredChars(char[] sequence, DataType dt)
Converts a sequence of characters to the preferred form for a data typestatic char[]
getPreferredChars(char[] sequence, DataType dt, boolean specialDots)
Converts a sequence of characters to the preferred form for a data typestatic 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 typestatic 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 sequencestatic 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 sequencestatic 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 statesstatic 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 sequencestatic 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 statesstatic java.lang.String
toString(DataType dt, int[] states)
For converting an array of states into a String of characters, based on a DataType
-
-
-
Method Detail
-
isSuggestedGap
public static final 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.
-
getInstance
public static DataType getInstance(int typeID)
create object according to this code- Parameters:
typeID
- selected data type- Returns:
- DataType object
-
isGap
public static final boolean isGap(DataType d, char c)
Deprecated.use DataType.isGapChar()- Returns:
- true if the character represents a gap in the sequence.
-
getPreferredChars
public static final char[] getPreferredChars(char[] sequence, DataType dt)
Converts a sequence of characters to the preferred form for a data type
-
getPreferredChars
public static final char[] getPreferredChars(char[] sequence, DataType dt, boolean specialDots)
Converts a sequence of characters to the preferred form for a data type- Parameters:
specialDots
- if true then the dot (period) '.' is used even if it is not the prefered character by the data type
-
getPreferredChars
public static final 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)
-
getPreferredChars
public static final 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- Parameters:
specialDots
- if true then the dot (period) '.' is used even if it is not the prefered character by the data type
-
getByteStates
public static final 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
-
getByteStates
public static final 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
-
getStates
public static final 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- Parameters:
unknownState
- ensures that the state representation is set to this value (like -1)
-
getStates
public static final 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
-
getStates
public static final 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
-
getStates
public static final 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
-
getChars
public static final 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- Parameters:
unknownChar
- The character uses for unknown statesgapChar
- the character to use for gap states (may be the same as the unknownChar)
-
getChars
public static final char[] getChars(int[] sequence, char unknownChar, char gapChar, DataType dt)
For converting a sequence of ints representing states to an array of chars- Parameters:
unknownChar
- The character uses for unknown statesgapChar
- the character to use for gap states (may be the same as the unknownChar)
-
getChars
public static final char[] getChars(int[] sequence, DataType dt)
For converting a sequence of ints representing states to an array of chars
-
toString
public static final java.lang.String toString(DataType dt, int[] states)
For converting an array of states into a String of characters, based on a DataType
-
reverseSequence
public static final void reverseSequence(int[] sequence)
Reverses an array of states- Parameters:
sequence
- the sequence of states
-
leftAlignSequence
public static final 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)- Parameters:
sequence
- the base sequencedt
- the datatype of the sequence states
-
-