mesquite.categ.lib
Class CategoricalData

java.lang.Object
  extended by mesquite.lib.Listened
      extended by mesquite.lib.Attachable
          extended by mesquite.lib.Associable
              extended by mesquite.lib.AssociableWithSpecs
                  extended by mesquite.lib.FileElement
                      extended by mesquite.lib.characters.CharacterData
                          extended by mesquite.categ.lib.CategoricalData
All Implemented Interfaces:
Annotatable, Commandable, CompatibilityChecker, Doomable, Explainable, FileDirtier, HNode, HTMLDescribable, Identifiable, Listable, Listenable, MesquiteListener, Renamable, Selectionable, Showable, StringLister
Direct Known Subclasses:
MolecularData

public class CategoricalData
extends CharacterData

A subclass of CharacterData for data stored as Categorical sets (e.g, "{0, 2}"). Associated with the CharacterState subclass CategoricalState.


Field Summary
protected static char ANDseparator
           
protected static char[] defaultSymbols
           
protected static char ORseparator
           
protected  java.lang.String puncString
           
protected  char[] symbols
           
 
Fields inherited from class mesquite.lib.characters.CharacterData
COMMENT, defaultInapplicableChar, defaultInventUniqueIDs, defaultMatchChar, defaultMissingChar, defaultRequireChangeAuthority, defaultSaveChangeHistory, EOL, ERROR, interleaved, interleavedLength, inventUniqueIDs, linkedDatas, matrixManager, nAdd, nDel, nMove, numChars, numTaxa, OK, OUTOFBOUNDS, requireChangeAuthority, saveChangeHistory, suppressChecksum, totalCreated, totalDisposed
 
Fields inherited from class mesquite.lib.FileElement
assignedIDNumber, assignedIDString, classesCreated, classesFinalized, countsOfClasses, countsOfClassesDisposed, DIRTY, disposed, doomed, IN_USE, name, totalFinalized
 
Fields inherited from class mesquite.lib.AssociableWithSpecs
SPECSSET_CHANGED
 
Fields inherited from class mesquite.lib.Associable
comment, comments, numParts, rememberDefaultOrder, selected, versionNumber
 
Fields inherited from class mesquite.lib.Listened
allListeners, classes, classesNotified, listeners, listenersRemaining, notifications
 
Fields inherited from interface mesquite.lib.MesquiteListener
ANNOTATION_ADDED, ANNOTATION_CHANGED, ANNOTATION_DELETED, ASSOCIATED_CHANGED, BRANCHES_REARRANGED, BRANCHLENGTHS_CHANGED, COMMAND_CANCELLED, DATA_CHANGED, ELEMENT_CHANGED, ITEMS_ADDED, NAMES_CHANGED, OBJECT_DESTROYED, PARTS_ADDED, PARTS_CHANGED, PARTS_DELETED, PARTS_MOVED, SELECTION_CHANGED, TAXA_SUBSTITUTED, TEXTFIELD_EDITED, UNKNOWN, VALUE_CHANGED
 
Fields inherited from interface mesquite.lib.HNode
MOUSEDOWN, MOUSEEXIT, MOUSEMOVE
 
Fields inherited from interface mesquite.lib.HTMLDescribable
verbose
 
Constructor Summary
CategoricalData(CharMatrixManager manager, int numTaxa, int numChars, Taxa taxa)
           
 
Method Summary
 boolean addParts(int starting, int num)
          Adds num characters after position "starting"; returns true iff successful.
 boolean addTaxa(int starting, int num)
          Adds num taxa after position "starting"; returns true iff successful.
 long calculateChecksum(java.util.zip.CRC32 crc32)
           
 long calculateDataChecksum(int icStart, int icEnd, int itStart, int itEnd, java.util.zip.CRC32 crc32)
           
 CharacterData cloneData()
          clone this CharacterData and return new copy.
 void copyData(CharacterData sourceData)
          copy the basic data.
 boolean deleteParts(int starting, int num)
          Deletes num characters from position "starting"; returns true iff successful.
 boolean deleteTaxa(int starting, int num)
          Deletes num taxa from position "starting"; returns true iff successful.
 void dispose()
          Deletes the file element.
 void equalizeCharacter(CharacterData oData, int oic, int ic)
           
 void examineCheckSum(int icStart, int icEnd, int itStart, int itEnd, java.lang.String warning, MesquiteBoolean warnCheckSum, long originalCheckSum)
           
static DefaultReference findDefaultReference(NameReference paradigm)
           
 long fromChar(char state)
          Given a character, what state set is implied.
 long fromString(int ic, Parser parser, boolean fromEditor, MesquiteInteger resultCode, MesquiteString result)
          Set the state at character ic from the string s, beginning at position pos in the string.
 long getAllStates(int ic)
          returns the set of states in character ic
 long[] getCharacter(int ic)
          extract character ic and return as an array of long's
 CharacterDistribution getCharacterDistribution(int ic)
          return a CharacterDistribution that points to character ic
 CharacterState getCharacterState(CharacterState cs, int ic, int it)
          returns the state of character ic in taxon it
 java.awt.Color getColorOfState(int ic, int istate)
          Returns the color for the given state of character ic.
 java.awt.Color getColorOfState(int ic, int istate, int maxState)
          returns Color for state of character, scaled to maxState (e.g.
 java.awt.Color getColorOfState(int ic, int istate, int maxState, MesquiteColorTable colors)
          returns Color for state of character, scaled to maxState (e.g.
 java.awt.Color getColorOfStates(int ic, int it)
          Gets the color representing state(s) of character ic in taxon it
 java.lang.String getDataTypeName()
          returns the name of the type of data stored
 CharacterModel getDefaultModel(java.lang.String paradigm)
          returns the default character model for the paradigm (e.g., "parsimony") given in the String
 long getDefaultState()
           
static java.lang.String getDefaultStateSymbol(java.lang.Class dataClass, int state)
          gets state symbol for state "state", returned as string.
static java.lang.String getDefaultStateSymbol(int state)
          gets state symbol for state "state", returned as string.
 double[] getFrequencies(boolean includeAmbiguous, boolean ambiguousBasedOnFreq, int it1, int it2)
          returns the maximum possible state
 long[] getLongArray(int icStart, int length, int it, boolean includeGaps)
          returns an array of longs for the cells in taxon it, starting at character icStart, for length "length"
 int getMaxPossibleState()
          returns the maximum possible state
 int getMaxState()
          returns the maximum state in the matrix
 int getMaxState(int ic)
          returns the maximum state in character ic
 int getMaxSymbolDefined()
          returns the maximum symbol defined
 MCharactersDistribution getMCharactersDistribution()
          get matrix and return as StsOfCharacters
 int getNumChars()
          returns number of characters in data matrix
 int getNumChars(boolean notifyIfError)
          returns number of characters in data matrix
 int getNumTaxa()
          returns number of taxa in data matrix
 int getNumTaxa(boolean notifyIfError)
          returns number of taxa in data matrix
 long getState(int ic, int it)
          return stateset in node it and character ic.
 long getState(long[] sequence, int ic)
          return stateset in node it and character ic.
 AttachedNotesVector getStateAnnotationsVector(int ic, int state)
          gets state name of state "state" of character ic
 java.lang.Class getStateClass()
          Indicates the type of character stored
 int[] getStateFrequencyArray(int ic)
          returns an integer array summarizing the frequencies of states of a character.
 java.lang.String getStateFrequencyString(int ic)
          returns a String summarizing the frequencies of states of a character .
 java.lang.String getStateName(int ic, int state)
          gets state name of state "state" of character ic
 java.lang.String getStateNote(int ic, int state)
          gets state name of state "state" of character ic
 long getStateRaw(int ic, int it)
          return stateset in node it and character ic, raw, as in matrix.
 java.lang.String getStatesSummary(int ic)
          returns a String summarizing the states of a character (e.g., "2 states", "0.1-0.9").
 java.lang.String getStateSymbol(int ic, int state)
          gets state symbol for state "state" of character ic, returned as string.
 char getSymbol(int st)
          Get symbol for state st.
 java.lang.String[] getSymbols()
          Get String[] of symbols
 int getTotalBitsInStateSet()
          returns the maximum possible state
 boolean hasStateAnnotations(int ic, int s)
          returns true if state name for state s is available for character ic
 boolean hasStateFootnote(int ic, int s)
          returns true if state name for state s is available for character ic
 boolean hasStateName(int ic, int s)
          returns true if state name for state s is available for character ic
 boolean hasStateNames()
          returns true if state names are available for matrix
 boolean hasStateNames(int ic)
          returns true if state names are available for character ic
 boolean isAcceptableCharForState(char c)
          returns whether a given char is acceptable as the value for a character state
 boolean isAmbiguousOrPolymorphic(int ic, int it)
          returns whether the state of character ic is missing in taxon it
 boolean isInapplicable(int ic, int it)
          returns whether the character ic is inapplicable to taxon it
 boolean isMultistateUncertainty(int ic, int it)
          returns whether the state of character ic is missing in taxon it
 boolean isUnassigned(int ic, int it)
          returns whether the state of character ic is missing in taxon it
 void logMatrix()
          Dump matrix to log
 CharacterData makeCharacterData()
          Return CharacterData object with same number of taxa & characters as this object (but not with any particular data; just so that of same data type)
 CharacterData makeCharacterData(CharMatrixManager manager, Taxa taxa)
          creates an empty CharacterData object of the same data type as CharacterData subclass used, based on CharMatrixManager & Taxa passed.
 CharacterData makeCharacterData(int ntaxa, int nchars)
          Return CharacterData object with passed number of taxa & characters (but not with any particular data; just so that of same data type)
 CharacterDistribution makeCharacterDistribution()
          Return CharacterDistribution object with same number of taxa as this object (but not with any particular data; just so that of same data type)
 CharacterState makeCharacterState()
          creates an empty CharacterState object of the same data type as CharacterData subclass used.
 int maxStateWithDefinition(int ic)
          returns state number for last state scored, with name, with footnote, or with annotation for character ic
 int maxStateWithName(int ic)
          returns state number for last state with name for character ic
 void mergeSecondTaxonIntoFirst(int it1, int it2)
          merges the states for taxon it2 into it1 within this Data object
 void mergeTaxa(int sinkTaxon, boolean[] taxaToMerge)
          merges the states for the taxa recorded in taxaToMerge into taxon it within this Data object
 boolean moveParts(int first, int num, int justAfter)
          move num characters starting at first to just after character justAfter
 boolean moveTaxa(int starting, int num, int justAfter)
          moves num taxa from position "starting" to just after position "justAfter"; returns true iff successful.
protected  boolean notInStorage(int ic, int it)
           
 boolean recodeStates(int ic, long[] rules, int maxState)
          recodes stateA to stateB in character IC
static void registerDefaultModel(java.lang.String paradigm, java.lang.String name)
           
 void reverse(int icStart, int icEnd, int it, boolean reverseTerminalGaps, boolean adjustCellLinked)
          Reverses the data from character icStart to icEnd in taxon it.
 java.lang.String searchData(java.lang.String s, MesquiteString commandResult)
           
 void setInapplicableSymbol(char inapp)
          sets the symbol used for inapplicable character (e.g., gap)
 void setMatrix(MCharactersDistribution states)
          Fills matrix with data from passed StsOfCharacters object.
 void setState(int ic, int it, char c)
          Set stateset in node it and character ic to state indicated by state symbol.
 void setState(int ic, int it, CharacterState cs)
          sets the state of character ic in taxon it from CharacterState cs
 void setState(int ic, int it, long states)
          Set stateset in node it and character ic to states.
 int setState(int ic, int it, Parser parser, boolean fromEditor, MesquiteString result)
          Set the state at character ic and taxon it from the string of the parser, beginning at current position of the parser.
 void setStateAnnotationsVector(int ic, int state, AttachedNotesVector v)
          sets state name of state "state" of character ic to name
 void setStateName(int ic, int state, java.lang.String name)
          sets state name of state "state" of character ic to name
 void setStateNote(int ic, int state, java.lang.String name)
          sets state name of state "state" of character ic to name
 boolean setSymbol(int st, char symbol)
          Set symbol for state st.
 void setSymbolDirect(int st, char symbol)
          Set symbol for state st.
 void setUnassignedSymbol(char mc)
          sets the symbol used for missing data (unassigned) character
 void statesIntoNEXUSStringBuffer(int ic, int it, java.lang.StringBuffer sb)
          appends to buffer string describing the state(s) of character ic in taxon it.
 void statesIntoStringBuffer(int ic, int it, java.lang.StringBuffer sb, boolean forDisplay)
          appends to buffer string describing the state(s) of character ic in taxon it.�
 void statesIntoStringBuffer(int ic, int it, java.lang.StringBuffer sb, boolean forDisplay, boolean includeInapplicable, boolean includeUnassigned)
          appends to buffer string describing the state(s) of character ic in taxon it.�
 void statesIntoStringBufferCore(int ic, long s, java.lang.StringBuffer sb, boolean forDisplay)
          appends to buffer string describing the state(s) of character ic in taxon it.
 void statesIntoStringBufferCore(int ic, long s, java.lang.StringBuffer sb, boolean forDisplay, boolean includeInapplicable, boolean includeUnassigned)
          appends to buffer string describing the state(s) of character ic in taxon it.
 long storeCheckSum(int icStart, int icEnd, int itStart, int itEnd)
           
 boolean swapParts(int first, int second)
          swaps characters first and second
 void tradeStatesBetweenCharacters(int ic, int ic2, int it, boolean adjustCellLinked)
          Trades the states of character ic and ic2 in taxon it.
protected  void tradeStatesBetweenCharactersInternal(int ic, int ic2, int it, boolean adjustCellLinked, boolean adjustDirections)
          Trades the states of character ic and ic2 in taxon it.
 void tradeStatesBetweenTaxa(int ic, int it, int it2)
          trades the states of character ic between taxa it and it2.
 boolean usingShortMatrix()
           
 
Methods inherited from class mesquite.lib.characters.CharacterData
addCharacters, addInLinked, addToBrowserPopup, addToFile, addToLinkageGroup, canAddCharacters, canMoveChars, changed, characterHasName, characterNamesExist, checkCellMoveDistanceAvailable, checkNameLegality, checkTaxaIDs, colorCellsByDefault, compareChecksums, copyCurrentToPreviousOrderInLinked, dataMatches, dataMatches, decrementSuppressHistoryStamp, deleteCharacters, deleteInLinked, deleteUniqueIDs, doAfterNotify, doCommand, entirelyInapplicable, findByUniqueID, firstApplicable, getAnnotation, getBasisTree, getCellContentsDescription, getCellObject, getCellObjectDisplay, getCellObjectsVector, getChangedSinceSave, getCharacterName, getCharacterStateArray, getChecksum, getDarkDefaultCharacterColor, getDataLinkages, getDefaultCharacterColor, getDefaultColumnWidth, getEditorInhibition, getExplanation, getFootnotes, getHColor, getHImage, getHShow, getID, getIDOrderedFullChecksum, getIllustration, getIllustrationPath, getInapplicableSymbol, getIndependentMCharactersDistribution, getInventUniqueIDs, getMatchChar, getMatrixManager, getMaxNumChars, getName, getNameOfCellEntry, getNumCharsIncluded, getOrMakeCellObjects, getSnapshot, getStatesVersion, getStrings, getTaxa, getTaxaInfo, getTypeName, getUnassignedSymbol, getUndoInstructionsAllData, getUniqueID, getUniqueID, getWhichCellObjects, hasTitle, incrementStatesVersion, incrementSuppressHistoryStamp, isCompatible, isCurrentlyIncluded, isLinked, isLinked, isMolecularSequence, lastApplicable, moveCells, moveCharacters, moveInLinked, moveOne, notifyInLinked, okToDispose, pleaseAutoSizeColumns, recordCurrentOrderInLinked, recordPreviousOrderInLinked, resetChangedSinceSave, resignFromLinkageGroup, restoreToPreviousOrderInLinked, setAnnotation, setAutoSizeColumns, setBasisTree, setCellObject, setCellObjectDisplay, setCharacterName, setDirty, setEditorInhibition, setIllustration, setInventUniqueIDs, setMatchChar, setMatrixManager, setName, setUniqueID, setUniqueID, shiftSequence, showList, showMatrix, stampHistoryChange, stampHistoryChange, stampUniqueID, stampUniqueIDs, swapInLinked, thisOrNextApplicableChar, thisOrPreviousApplicableChar, toHTMLStringDescription, toString, toStringsContig, uniquelyNamed
 
Methods inherited from class mesquite.lib.FileElement
deleteMe, doom, fileDirtiedByCommand, finalize, getAssignedID, getAssignedIDNumber, getCIPResIDString, getFile, getFileName, getHDaughters, getHMother, getLastModifiedAuthor, getManager, getNexusBlock, getNumSupplements, getProject, getSupplementName, hNodeAction, hSupplementTouched, isDisposed, isDoomed, okToClose, setAssignedIDNumber, setCIPResIDString, setFile, setManager, setProject, show, showMe, stampLastModifiedAuthor
 
Methods inherited from class mesquite.lib.AssociableWithSpecs
disposing, equalizeParts, getCurrentSpecsSet, getNumSpecsSets, getSpecSetsVector, getSpecSetsVectorVector, getSpecsSet, getSpecsSet, listAssociates, prepareSpecsSetVector, removeSpecsSet, setCurrentSpecsSet, storeSpecsSet
 
Methods inherited from class mesquite.lib.Associable
anyAssociatedObject, anySelected, clearAllAssociatedBits, contiguousSelection, contiguousSelectionOld, copyCurrentToPreviousOrder, deassignAllAssociatedLongs, deassignAssociated, deassignAssociated, deleteJustAdded, deselectAll, equalizeParts, exchangeAssociated, firstSelected, getAnnotation, getAnnotation, getAssociatedBit, getAssociatedBits, getAssociatedDouble, getAssociatedDoubles, getAssociatedLong, getAssociatedLongs, getAssociatedObject, getAssociatedObjects, getDefaultPosition, getDirty, getJustAdded, getNumberAssociatedBits, getNumberAssociatedDoubles, getNumberAssociatedLongs, getNumberAssociatedObjects, getNumberOfParts, getNumberOfSelectableParts, getSelected, getSelectedBits, getVersionNumber, getWhichAssociatedBits, getWhichAssociatedDouble, getWhichAssociatedLong, getWhichAssociatedObject, inBounds, lastSelected, makeAssociatedBits, makeAssociatedDoubles, makeAssociatedLongs, makeAssociatedObjects, numberSelected, numberSelected, readAssociated, recordCurrentOrder, recordDefaultOrder, recordPreviousOrder, removeAssociatedBits, removeAssociatedDoubles, removeAssociatedLongs, removeAssociatedObjects, resetDefaultOrderToCurrent, resetJustAdded, restoreToPreviousOrder, selectAll, setAnnotation, setAnnotation, setAssociatedBit, setAssociatedDouble, setAssociatedLong, setAssociatedObject, setAssociateds, setDefaultPosition, setDirty, setJustAdded, setNumberOfParts, setSelected, transferAssociated, writeAssociated, zeroAllAssociatedDoubles, zeroAllAssociatedLongs, zeroAllAssociatedObjects
 
Methods inherited from class mesquite.lib.Attachable
anyAttachments, attach, attachIfUniqueName, detach, getAttachment, getAttachment, getAttachments, listAttachments, readAttachments, setAttachments, writeAttachments
 
Methods inherited from class mesquite.lib.Listened
addListener, addListenerHighPriority, amIListening, decrementNotifySuppress, getRemainingListeners, incrementNotifySuppress, listListeners, notifyDisposing, notifyListeners, notifyListeners, removeListener, reportListeners, setDumpNotified
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface mesquite.lib.MesquiteListener
disposing
 
Methods inherited from interface mesquite.lib.Annotatable
getAnnotation, setAnnotation
 
Methods inherited from interface mesquite.lib.Listenable
addListener, addListenerHighPriority, amIListening, decrementNotifySuppress, incrementNotifySuppress, listListeners, notifyListeners, removeListener
 

Field Detail

symbols

protected char[] symbols

defaultSymbols

protected static final char[] defaultSymbols

ANDseparator

protected static char ANDseparator

ORseparator

protected static char ORseparator

puncString

protected java.lang.String puncString
Constructor Detail

CategoricalData

public CategoricalData(CharMatrixManager manager,
                       int numTaxa,
                       int numChars,
                       Taxa taxa)
Method Detail

searchData

public java.lang.String searchData(java.lang.String s,
                                   MesquiteString commandResult)
Overrides:
searchData in class CharacterData

usingShortMatrix

public boolean usingShortMatrix()

getDefaultState

public long getDefaultState()

getLongArray

public long[] getLongArray(int icStart,
                           int length,
                           int it,
                           boolean includeGaps)
returns an array of longs for the cells in taxon it, starting at character icStart, for length "length"


dispose

public void dispose()
Description copied from class: FileElement
Deletes the file element. Should typically be called via close() to make sure that the file element is not in use etc.

Overrides:
dispose in class CharacterData

getStateClass

public java.lang.Class getStateClass()
Indicates the type of character stored

Specified by:
getStateClass in class CharacterData

getDataTypeName

public java.lang.String getDataTypeName()
returns the name of the type of data stored

Specified by:
getDataTypeName in class CharacterData

copyData

public void copyData(CharacterData sourceData)
copy the basic data. Does not copy the associated specs sets etc.

Specified by:
copyData in class CharacterData

cloneData

public CharacterData cloneData()
clone this CharacterData and return new copy. Does not clone the associated specs sets etc.

Specified by:
cloneData in class CharacterData

getNumTaxa

public int getNumTaxa()
Description copied from class: CharacterData
returns number of taxa in data matrix

Overrides:
getNumTaxa in class CharacterData

getNumTaxa

public int getNumTaxa(boolean notifyIfError)
Description copied from class: CharacterData
returns number of taxa in data matrix

Overrides:
getNumTaxa in class CharacterData

getNumChars

public int getNumChars()
Description copied from class: CharacterData
returns number of characters in data matrix

Overrides:
getNumChars in class CharacterData

getNumChars

public int getNumChars(boolean notifyIfError)
Description copied from class: CharacterData
returns number of characters in data matrix

Overrides:
getNumChars in class CharacterData

recodeStates

public boolean recodeStates(int ic,
                            long[] rules,
                            int maxState)
recodes stateA to stateB in character IC


swapParts

public boolean swapParts(int first,
                         int second)
swaps characters first and second

Overrides:
swapParts in class CharacterData

moveParts

public boolean moveParts(int first,
                         int num,
                         int justAfter)
move num characters starting at first to just after character justAfter

Overrides:
moveParts in class CharacterData

addParts

public boolean addParts(int starting,
                        int num)
Adds num characters after position "starting"; returns true iff successful.

Overrides:
addParts in class CharacterData

deleteParts

public boolean deleteParts(int starting,
                           int num)
Deletes num characters from position "starting"; returns true iff successful.

Overrides:
deleteParts in class CharacterData

addTaxa

public boolean addTaxa(int starting,
                       int num)
Adds num taxa after position "starting"; returns true iff successful.

Overrides:
addTaxa in class CharacterData

deleteTaxa

public boolean deleteTaxa(int starting,
                          int num)
Deletes num taxa from position "starting"; returns true iff successful.

Overrides:
deleteTaxa in class CharacterData

moveTaxa

public boolean moveTaxa(int starting,
                        int num,
                        int justAfter)
moves num taxa from position "starting" to just after position "justAfter"; returns true iff successful.

Overrides:
moveTaxa in class CharacterData

getSymbols

public java.lang.String[] getSymbols()
Get String[] of symbols


getSymbol

public char getSymbol(int st)
Get symbol for state st.


setSymbolDirect

public void setSymbolDirect(int st,
                            char symbol)
Set symbol for state st. Does not check for duplicate symbols


setSymbol

public boolean setSymbol(int st,
                         char symbol)
Set symbol for state st. Returns whether setting implied duplicate symbol


setInapplicableSymbol

public void setInapplicableSymbol(char inapp)
sets the symbol used for inapplicable character (e.g., gap)

Overrides:
setInapplicableSymbol in class CharacterData

setUnassignedSymbol

public void setUnassignedSymbol(char mc)
sets the symbol used for missing data (unassigned) character

Overrides:
setUnassignedSymbol in class CharacterData

reverse

public void reverse(int icStart,
                    int icEnd,
                    int it,
                    boolean reverseTerminalGaps,
                    boolean adjustCellLinked)
Reverses the data from character icStart to icEnd in taxon it. If reverseTerminalGaps is true, then it reversed the entire stretch; if it is false, it only reverses from the first non-gap to last non-gap in the stretch. If adjustLinks is true, then the linked matrices will also have their cells reversed. adjustLinks should be true in almost all cases, as reversing without it will disrupt linkages between matrices and cause features in Mesquite to fail (e.g., within Chromaseq).


tradeStatesBetweenCharacters

public void tradeStatesBetweenCharacters(int ic,
                                         int ic2,
                                         int it,
                                         boolean adjustCellLinked)
Trades the states of character ic and ic2 in taxon it. Used for sorting by characters or reversing sequences (for example). If adjustCellLinked is true, then linked matrices will also have their cells traded. This should generally be set to true; if you set it to false, then you must trade states of linked matrices yourself. This is the public version; the internal version is used internally to distinguish between the internal call from reverse (which will handle directions otherwise) and external calls (which should do the direction bookkeeping for the user)

Overrides:
tradeStatesBetweenCharacters in class CharacterData

tradeStatesBetweenCharactersInternal

protected void tradeStatesBetweenCharactersInternal(int ic,
                                                    int ic2,
                                                    int it,
                                                    boolean adjustCellLinked,
                                                    boolean adjustDirections)
Trades the states of character ic and ic2 in taxon it. Used for sorting by characters or reversing sequences (for example). If adjustCellLinked is true, then linked matrices will also have their cells traded. This should generally be set to true; if you set it to false, then you must trade states of linked matrices yourself.


tradeStatesBetweenTaxa

public void tradeStatesBetweenTaxa(int ic,
                                   int it,
                                   int it2)
trades the states of character ic between taxa it and it2. Used for reshuffling.

Overrides:
tradeStatesBetweenTaxa in class CharacterData

logMatrix

public void logMatrix()
Dump matrix to log

Specified by:
logMatrix in class CharacterData

setMatrix

public void setMatrix(MCharactersDistribution states)
Fills matrix with data from passed StsOfCharacters object.

Specified by:
setMatrix in class CharacterData

getMCharactersDistribution

public MCharactersDistribution getMCharactersDistribution()
get matrix and return as StsOfCharacters

Specified by:
getMCharactersDistribution in class CharacterData

getCharacterDistribution

public CharacterDistribution getCharacterDistribution(int ic)
return a CharacterDistribution that points to character ic

Specified by:
getCharacterDistribution in class CharacterData

getCharacter

public long[] getCharacter(int ic)
extract character ic and return as an array of long's


makeCharacterDistribution

public CharacterDistribution makeCharacterDistribution()
Return CharacterDistribution object with same number of taxa as this object (but not with any particular data; just so that of same data type)

Specified by:
makeCharacterDistribution in class CharacterData

makeCharacterState

public CharacterState makeCharacterState()
creates an empty CharacterState object of the same data type as CharacterData subclass used.

Specified by:
makeCharacterState in class CharacterData

makeCharacterData

pu