mesquite.categ.lib
Class CategoricalHistory

java.lang.Object
  extended by mesquite.lib.characters.CharacterStates
      extended by mesquite.categ.lib.CategoricalStates
          extended by mesquite.categ.lib.CategoricalDistribution
              extended by mesquite.categ.lib.CategoricalAdjustable
                  extended by mesquite.categ.lib.CategoricalHistory
All Implemented Interfaces:
AdjustableDistribution, CharacterDistribution, CharacterHistory, CharacterStatesHolder, Listable, Renamable, WithStringDetails
Direct Known Subclasses:
DNACharacterHistory, ProteinCharacterHistory

public class CategoricalHistory
extends CategoricalAdjustable
implements CharacterHistory


Field Summary
 
Fields inherited from class mesquite.categ.lib.CategoricalAdjustable
numNodes, states
 
Fields inherited from class mesquite.categ.lib.CategoricalStates
allStates, enforcedMaxState, extraFrequencies, extraFrequencyColors, extraFrequencyNames, frequencies, maxFound, maxState, minFound, minState
 
Fields inherited from class mesquite.lib.characters.CharacterStates
characterNumber, data, totalCreated
 
Constructor Summary
CategoricalHistory(Taxa taxa)
           
CategoricalHistory(Taxa taxa, int numNodes)
           
 
Method Summary
 void addInternodeEvent(int node, CategInternodeEvent event)
           
 CharacterHistory adjustSize(Tree tree)
          Get the information about states occurring in this object for a legend.
 CharacterHistory clone(CharacterHistory s)
          set the passed history to be a clone of this one (should be renamed to setToClone!); if passed s is not null, place the clone there (so as to avoid creating new object)
 void deassignStates()
          set all states to missing (unassigned)
 int getColorsAtNode(int node, ColorDistribution colors, MesquiteColorTable stateColors, boolean showWeights)
          places into the already instantiated ColorDistribution the colors at the node, and returns the number of colors.
 ColorEventVector getColorSequenceAtNode(int node, MesquiteColorTable colorTable)
          returns the vector of ColorEvents in order, e.g.
 int getColorsOfState(CharacterState state, ColorDistribution colors, MesquiteColorTable colorTable)
          places into the already instantiated ColorDistribution the colors corresponding to the CharacterState, and returns the number of colors.
 MesquiteColorTable getColorTable(MesquiteColorTable colorTable)
           
 java.awt.Color getDefaultColor(int maxState, int istate)
          Places into ColorDistribution the colors at the node, and returns the number of colors.
 CategInternodeEvent getInternodeEvent(int node, int i)
           
 java.util.Vector getInternodeHistoryVector(int node)
           
 int getLegendStates(java.awt.Color[] cs, java.lang.String[] stateNames, java.awt.Point[] tableMappings, MesquiteColorTable stateColors)
          Get the information about states occurring in this object for a legend.
 int getNumberOfEvents(int node)
           
 CharacterDistribution getObservedStates()
          Returns the states in the terminal taxa (used if History is reconstruction)
 CharacterDistribution getStatesAtTips(Tree tree)
          Returns a new object indicating the states at the tips (used whether or not History is reconstruction)
 CharacterHistory makeHistory(Tree tree)
           
 void polymorphToUncertainties(int N, Tree tree)
           
 void prepareColors(Tree tree, int drawnRoot)
          Must be called before colors for states are used (e.g., before a tree is shaded).
 void prepareInternodeHistories()
           
 void setObservedStates(CharacterDistribution observed)
          Sets the states in the terminal taxa (used if History is reconstruction)
 java.lang.String toString(int node, java.lang.String lineEnding)
          returns string describing character states at node
 
Methods inherited from class mesquite.categ.lib.CategoricalAdjustable
adjustSize, getNumNodes, getNumTaxa, getState, setCharacterState, setState, setStates, setWatchPoint, tradeStatesBetweenTaxa
 
Methods inherited from class mesquite.categ.lib.CategoricalDistribution
adjustHistorySize, fullSet, getAdjustableClone, getMaxState, hasInapplicable, hasInapplicable, hasMissing, hasMissing, hasMultipleStatesInTaxon, hasMultipleStatesInTaxon, isBinary, isBinary, isBinaryCombinable, isBinaryNoMissing, isConstant, isConstant, makeAdjustable
 
Methods inherited from class mesquite.categ.lib.CategoricalStates
copyExtraFrequencies, copyFrequencies, disposeExtraFrequencies, disposeFrequencies, extraFrequenciesExist, firstIsGreater, frequenciesExist, getAllStates, getAllStates, getCharacterDataClass, getCharacterState, getCharacterState, getDataTypeName, getDefaultModel, getExtraFrequencies, getExtraFrequency, getExtraFrequencyColors, getExtraFrequencyNames, getExtraNumFreqCategories, getFrequencies, getFrequency, getNumFreqCategories, getSetFromFrequencies, getStateClass, isInapplicable, isUnassigned, isUncertain, logStates, setExtraFrequencies, setExtraFrequency, setExtraFrequencyColors, setExtraFrequencyNames, setFrequencies, setFrequency, setNumExtraFreqCategories, setNumFreqCategories, statesEqual, toString
 
Methods inherited from class mesquite.lib.characters.CharacterStates
checkIllegalNode, getName, getParentCharacter, getParentData, getTaxa, makeCharacterState, setName, setParentCharacter, setParentData, setTaxa, toExternal, toInternal, toStringWithDetails
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface mesquite.lib.characters.AdjustableDistribution
adjustSize, setCharacterState, setParentCharacter, setParentData, tradeStatesBetweenTaxa
 
Methods inherited from interface mesquite.lib.characters.CharacterStatesHolder
firstIsGreater, getCharacterDataClass, getCharacterState, getCharacterState, getDefaultModel, getNumNodes, getNumTaxa, getParentCharacter, getParentData, getStateClass, getTaxa, isInapplicable, isUnassigned, isUncertain, logStates, statesEqual, toStringWithDetails
 
Methods inherited from interface mesquite.lib.Listable
getName
 
Methods inherited from interface mesquite.lib.Renamable
setName
 

Constructor Detail

CategoricalHistory

public CategoricalHistory(Taxa taxa,
                          int numNodes)

CategoricalHistory

public CategoricalHistory(Taxa taxa)
Method Detail

deassignStates

public void deassignStates()
set all states to missing (unassigned)

Specified by:
deassignStates in interface AdjustableDistribution
Overrides:
deassignStates in class CategoricalAdjustable

prepareInternodeHistories

public void prepareInternodeHistories()

getInternodeHistoryVector

public java.util.Vector getInternodeHistoryVector(int node)

getNumberOfEvents

public int getNumberOfEvents(int node)

getInternodeEvent

public CategInternodeEvent getInternodeEvent(int node,
                                             int i)

addInternodeEvent

public void addInternodeEvent(int node,
                              CategInternodeEvent event)

toString

public java.lang.String toString(int node,
                                 java.lang.String lineEnding)
returns string describing character states at node

Specified by:
toString in interface CharacterStatesHolder
Overrides:
toString in class CategoricalStates

clone

public CharacterHistory clone(CharacterHistory s)
set the passed history to be a clone of this one (should be renamed to setToClone!); if passed s is not null, place the clone there (so as to avoid creating new object)

Specified by:
clone in interface CharacterHistory

getStatesAtTips

public CharacterDistribution getStatesAtTips(Tree tree)
Returns a new object indicating the states at the tips (used whether or not History is reconstruction)

Specified by:
getStatesAtTips in interface CharacterHistory

getObservedStates

public CharacterDistribution getObservedStates()
Returns the states in the terminal taxa (used if History is reconstruction)

Specified by:
getObservedStates in interface CharacterHistory

setObservedStates

public void setObservedStates(CharacterDistribution observed)
Sets the states in the terminal taxa (used if History is reconstruction)

Specified by:
setObservedStates in interface CharacterHistory

prepareColors

public void prepareColors(Tree tree,
                          int drawnRoot)
Must be called before colors for states are used (e.g., before a tree is shaded). Goes through all nodes to find states present, to set minima and maxima and record all states present. This allows the color range to be known before colors for particular states are requested by a tree shade, for example.

Specified by:
prepareColors in interface CharacterHistory

getColorTable

public MesquiteColorTable getColorTable(MesquiteColorTable colorTable)
Specified by:
getColorTable in interface CharacterHistory

getColorsOfState

public int getColorsOfState(CharacterState state,
                            ColorDistribution colors,
                            MesquiteColorTable colorTable)
places into the already instantiated ColorDistribution the colors corresponding to the CharacterState, and returns the number of colors. Uses default colors. Mode is MesquiteColorTable.GRAYSCALE, COLORS, COLORS_NO_BW, or DEFAULT (default depends on subclass)

Specified by:
getColorsOfState in interface CharacterHistory

getDefaultColor

public java.awt.Color getDefaultColor(int maxState,
                                      int istate)
Places into ColorDistribution the colors at the node, and returns the number of colors. Uses passed stateColors as color key. If null is passed, uses color system of parent data (using maxState of this StsOfCharcter) or, if there is not parent data object, the default colors. * public int getColorsAtNode(int node, ColorDistribution colors,MesquiteColorTable stateColors, boolean showWeights) { return getColorsAtNode(node, colors, stateColors, showWeights, MesquiteColorTable.DEFAULT); }


getColorsAtNode

public int getColorsAtNode(int node,
                           ColorDistribution colors,
                           MesquiteColorTable stateColors,
                           boolean showWeights)
Description copied from interface: CharacterHistory
places into the already instantiated ColorDistribution the colors at the node, and returns the number of colors. Uses color table passed.

Specified by:
getColorsAtNode in interface CharacterHistory

getColorSequenceAtNode

public ColorEventVector getColorSequenceAtNode(int node,
                                               MesquiteColorTable colorTable)
returns the vector of ColorEvents in order, e.g. for stochastic character mapping. Return null if none

Specified by:
getColorSequenceAtNode in interface CharacterHistory

getLegendStates

public int getLegendStates(java.awt.Color[] cs,
                           java.lang.String[] stateNames,
                           java.awt.Point[] tableMappings,
                           MesquiteColorTable stateColors)
Get the information about states occurring in this object for a legend. Colors and state names of states are place in the passed array. The colors for states are taken from the passed MesquiteColorTable.

Specified by:
getLegendStates in interface CharacterHistory

adjustSize

public CharacterHistory adjustSize(Tree tree)
Get the information about states occurring in this object for a legend. Colors and state names of states are place in the passed array.* public int getLegendStates(Color[] cs, String[] stateNames, int mode) { return getLegendStates(cs, stateNames, null, mode); } /*.......................................... CategoricalHistory ..................................................

Specified by:
adjustSize in interface CharacterHistory

makeHistory

public CharacterHistory makeHistory(Tree tree)

polymorphToUncertainties

public void polymorphToUncertainties(int N,
                                     Tree tree)