pal.misc
Class TimeOrderCharacterData

java.lang.Object
  |
  +--pal.misc.TimeOrderCharacterData
All Implemented Interfaces:
BranchLimits, IdGroup, java.io.Serializable

public class TimeOrderCharacterData
extends java.lang.Object
implements java.io.Serializable, BranchLimits, IdGroup

Character data that expresses an order through time.

See Also:
Serialized Form

Field Summary
protected  IdGroup taxa
          the identifier group
protected  int[] timeOrdinals
          Order of times
protected  double[] times
          Actual times of each sample
protected  int units
           
 
Fields inherited from interface pal.misc.BranchLimits
ABSTOL, DEFAULT_LENGTH, FRACDIGITS, MAXARC, MINARC
 
Constructor Summary
protected TimeOrderCharacterData()
          Parameterless constructor for superclasses.
  TimeOrderCharacterData(IdGroup taxa, int units)
          Constructor taking only IdGroup.
  TimeOrderCharacterData(int numSeqsPerSample, int numSamples, double timeBetweenSamples, int units)
          Constructs a TimeOrderCharacterData.
 
Method Summary
static TimeOrderCharacterData clone(TimeOrderCharacterData tocd)
          Returns a clone of the specified TimeOrderCharacterData
 double[] getCopyOfTimes()
          Returns a copy of the times in the form of an array.
 double getHeight(int taxon, double rate)
          NOTE: currently assumes times exist!
 int getIdCount()
          Returns the number of identifiers in this group
 Identifier getIdentifier(int i)
          Returns the ith identifier.
 IdGroup getIdGroup()
          Deprecated. TimeOrderCharacterData now implements IdGroup
 java.lang.String getName()
          Returns a name for this character data.
 int getNumChars()
          Returns the number of characters per identifier
 int[] getOrdinals()
          Gets ordinals.
 int getSampleCount()
          Returns the number of unique times in this data.
 double getTime(int taxon)
           
 int getTimeOrdinal(int taxon)
           
 double[] getUniqueTimeArray()
          Returns an ordered vector of unique times in this time order character data.
 double[][] getUniqueTimeMatrix()
          Returns a matrix of times between samples.
 int getUnits()
           
 boolean hasTimes()
           
 void removeTimes()
          Remove time character data.
 TimeOrderCharacterData scale(double rate, int newUnits)
           
 void setIdentifier(int i, Identifier ident)
          Sets the ith identifier.
 void setName(java.lang.String name)
          Sets the name of this character data.
 void setOrdinals(int[] ordinals)
          Sets ordinals.
 void setOrdinals(TimeOrderCharacterData tocd)
          Set time ordinals from another TimeOrderCharacterData.
 void setOrdinals(TimeOrderCharacterData tocd, IdGroup standard, boolean doTimes)
          Set time ordinals from another TimeOrderCharacterData.
 void setTimes(double[] times, int units)
          Sets the times, and works out what the ordinals should be.
 void setTimes(double[] times, int units, boolean recalculateOrdinals)
          Sets the times.
 void setTimesAndOrdinals(TimeOrderCharacterData tocd)
           
 void shuffleTimes()
           
 TimeOrderCharacterData subset(IdGroup staxa)
          Extracts a subset of a TimeOrderCharacterData.
 java.lang.String toString()
          Returns a string representation of this time order character data.
 int whichIdNumber(java.lang.String name)
          returns the index of the identifier with the given name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

timeOrdinals

protected int[] timeOrdinals
Order of times

times

protected double[] times
Actual times of each sample

taxa

protected IdGroup taxa
the identifier group

units

protected int units
Constructor Detail

TimeOrderCharacterData

protected TimeOrderCharacterData()
Parameterless constructor for superclasses.

TimeOrderCharacterData

public TimeOrderCharacterData(IdGroup taxa,
                              int units)
Constructor taking only IdGroup. Beware! This constructor does not initialize any time ordinals or times.

TimeOrderCharacterData

public TimeOrderCharacterData(int numSeqsPerSample,
                              int numSamples,
                              double timeBetweenSamples,
                              int units)
Constructs a TimeOrderCharacterData.
Method Detail

clone

public static TimeOrderCharacterData clone(TimeOrderCharacterData tocd)
Returns a clone of the specified TimeOrderCharacterData

subset

public TimeOrderCharacterData subset(IdGroup staxa)
Extracts a subset of a TimeOrderCharacterData.

getUnits

public int getUnits()

setTimes

public void setTimes(double[] times,
                     int units)
Sets the times, and works out what the ordinals should be.

setTimes

public void setTimes(double[] times,
                     int units,
                     boolean recalculateOrdinals)
Sets the times.
Parameters:
recalculateOrdinals - true if ordinals should be recalculated from the times.

scale

public TimeOrderCharacterData scale(double rate,
                                    int newUnits)

setOrdinals

public void setOrdinals(int[] ordinals)
Sets ordinals.

getOrdinals

public int[] getOrdinals()
Gets ordinals.

getCopyOfTimes

public double[] getCopyOfTimes()
Returns a copy of the times in the form of an array.

removeTimes

public void removeTimes()
Remove time character data.

setOrdinals

public void setOrdinals(TimeOrderCharacterData tocd)
Set time ordinals from another TimeOrderCharacterData. Select ordinals by matching names.
Parameters:
tocd - to take ordinals from.

setTimesAndOrdinals

public void setTimesAndOrdinals(TimeOrderCharacterData tocd)

setOrdinals

public void setOrdinals(TimeOrderCharacterData tocd,
                        IdGroup standard,
                        boolean doTimes)
Set time ordinals from another TimeOrderCharacterData. Select ordinals by matching names.
Parameters:
tocd - to take ordinals from
idgroup - use these labels to match indices in given tocd.
doTimes - if set then sets times as well

getNumChars

public int getNumChars()
Returns the number of characters per identifier

getName

public java.lang.String getName()
Returns a name for this character data.

setName

public void setName(java.lang.String name)
Sets the name of this character data.

getTime

public double getTime(int taxon)

getHeight

public double getHeight(int taxon,
                        double rate)
NOTE: currently assumes times exist!

getTimeOrdinal

public int getTimeOrdinal(int taxon)

hasTimes

public boolean hasTimes()

getUniqueTimeArray

public double[] getUniqueTimeArray()
Returns an ordered vector of unique times in this time order character data.

getUniqueTimeMatrix

public double[][] getUniqueTimeMatrix()
Returns a matrix of times between samples. A sample is any set of identifiers that have the same times.

getSampleCount

public int getSampleCount()
Returns the number of unique times in this data. A sample is any set of identifiers that have the same times.

toString

public java.lang.String toString()
Returns a string representation of this time order character data.
Overrides:
toString in class java.lang.Object

shuffleTimes

public void shuffleTimes()

getIdentifier

public Identifier getIdentifier(int i)
Description copied from interface: IdGroup
Returns the ith identifier.
Specified by:
getIdentifier in interface IdGroup

setIdentifier

public void setIdentifier(int i,
                          Identifier ident)
Description copied from interface: IdGroup
Sets the ith identifier.
Specified by:
setIdentifier in interface IdGroup

getIdCount

public int getIdCount()
Description copied from interface: IdGroup
Returns the number of identifiers in this group
Specified by:
getIdCount in interface IdGroup

whichIdNumber

public int whichIdNumber(java.lang.String name)
Description copied from interface: IdGroup
returns the index of the identifier with the given name.
Specified by:
whichIdNumber in interface IdGroup

getIdGroup

public IdGroup getIdGroup()
Deprecated. TimeOrderCharacterData now implements IdGroup

Return id group of this alignment.