A class for reading NEXUS set objects and storing them in a set of int values. More...
#include <nxssetreader.h>
Public Member Functions | |
NxsSetReader (NxsToken &t, unsigned maxValue, NxsUnsignedSet &iset, NxsBlock &nxsblk, unsigned type) | |
bool | Run () |
Static Public Member Functions | |
static void | ReadSetDefinition (NxsToken &t, const NxsLabelToIndicesMapper &, const char *setType, const char *cmd, NxsUnsignedSet *destination, const NxsUnsignedSet *taboo=NULL) |
Protected Member Functions | |
bool | AddRange (unsigned first, unsigned last, unsigned modulus=0) |
A class for reading NEXUS set objects and storing them in a set of int values.
The NxsUnsignedSet `nxsset' will be cleared, and `nxsset' will be built up as the set is read, with each element in the list storing a member of the set (ranges are stored as individual elements). This class handles set descriptions of the following form: > 4-7 15 20-.; > The above set includes every number from 4 to 7 (inclusive), 15 and every third number from 20 to max, where `max' would ordinarily be set to either the last character (if `settype' is `NxsSetReaderEnumcharset') or the last taxon (if `settype' is `NxsSetReaderEnumtaxset'). If `max' equaled 30, the example above would be stored as follows (remember that internally the numbers are stored with offset 0, even though in the NEXUS data file the numbers always start at 1. > 3, 4, 5, 6, 14, 19, 22, 25, 28 > The following example of how NxsSetReader is used comes from the NxsCharactersBlock::HandleEliminate function: > NxsSetReader(token, ncharTotal, eliminated, *this, NxsSetReader::charset).Run(); > This reads in a set of eliminated characters from a NEXUS data file, storing the resulting set in the data member `eliminated'. In this case `max' is set to `ncharTotal' (the total number of characters), and the block reference is set to the NxsCharactersBlock object, which provides a
Definition at line 49 of file nxssetreader.h.