NEXUS CLASS LIBRARY home | classes | functions

Class NxsDiscreteDatum


class NxsDiscreteMatrix

Data Members


Member Functions

CopyFrom, NxsDiscreteDatum, ~NxsDiscreteDatum

Class Description

Class for holding discrete states in a matrix. Note that there is no way to access the variables of this class since they are all private and there are no public access functions. This class is designed to be manipulated by the class NxsDiscreteMatrix , which is the only class that has been designated a friend of NxsDiscreteDatum. The variable states is NULL if there is missing data, and non-NULL for any other state. If states is non-NULL, the first cell is used to store the number of states. This will be 0 if the state is the gap state, 1 if the state is unambiguous and nonpolymorphic (and not the gap state of course), and 2 or higher if there is either polymorphism or uncertainty. If polymorphism or uncertainty apply, it becomes necessary to store information about which of these two situations holds. Thus, the last cell in the array is set to either 1 (polymorphism) or 0 (uncertainty). While a little complicated, this scheme has the following benefits:

Supposing the gap symbol is '-', the missing data symbol is '?', and the symbols list is "ACGT", the following table shows the status of the states variable under several different possible data matrix entries:
 Matrix entry        states array
      ?              NULL
      -              [0]
      G              [1][2]
 (AG) polymorphic    [2][0][2][1]
 {AG} ambiguous      [2][0][2][0]

Key to symbols and colors

public, protected, private, A = abstract, C = constructor, D = destructor, I = inline, S = static, V = virtual, F = friend


Data Members
     unsigned   *states
holds information about state for a single taxon-character combination


Member Functions
    void   CopyFrom(const NxsDiscreteDatum &other)
Makes this NxsDiscreteDatum object an exact copy of other. Useful for dealing with matchchar symbols in a matrix.
C     NxsDiscreteDatum()
Sets states to NULL.
D     ~NxsDiscreteDatum()
Deletes memory associated with states (if any was allocated).