A row of values. More...
#include <Specimen.h>
Public Types | |
enum | Status { ACTIVE, INACTIVE } |
Provides a logical delete facility. More... | |
Public Member Functions | |
Specimen () | |
Initializes a newly created Specimen object with default values: | |
Specimen (uint64_t key) | |
Initializes a newly created Specimen object with key specified by the input parameter. | |
Specimen (uint64_t key, std::vector< Cell >::iterator begin, std::vector< Cell >::iterator end) | |
Initializes a newly created Specimen object with key and cell sequence as specified by the input parameters. | |
Specimen (uint64_t key, std::list< Cell >::iterator begin, std::list< Cell >::iterator end) | |
Initializes a newly created Specimen object with key and cell sequence as specified by the input parameters. | |
Specimen (uint64_t key, Value predictand, std::vector< Cell >::iterator begin, std::vector< Cell >::iterator end) | |
Initializes a newly created Specimen object with key, predictand, and cell sequence as specified by the input parameters. | |
Specimen (uint64_t key, Value predictand, std::list< Cell >::iterator begin, std::list< Cell >::iterator end) | |
Initializes a newly created Specimen object with key, predictand, and cell sequence as specified by the input parameters. | |
Specimen (uint64_t key, Status status, uint64_t weight, Value predictand, std::vector< Cell >::iterator begin, std::vector< Cell >::iterator end) | |
Initializes a newly created Specimen object with # attributes specified by the input parameters. | |
Specimen (uint64_t key, Status status, uint64_t weight, Value predictand, std::list< Cell >::iterator begin, std::list< Cell >::iterator end) | |
Initializes a newly created Specimen object with # attributes specified by the input parameters. | |
Specimen (const Specimen &rhs) | |
Copy constructor - initializes a newly created Specimen object with a copy of another Specimen object. | |
virtual | ~Specimen () |
Destructor - destroy a Specimen object. | |
Specimen & | operator= (const Specimen &rhs) |
Assignment operator - assign one Specimen to another. | |
void | setSpecimenKey (uint64_t key) |
Set the specimen key. | |
uint64_t | getSpecimenKey () const |
Return the specimen key. | |
void | setStatus (Status s) |
Set the specimen status. | |
Status | getStatus () const |
Return the specimen status. | |
void | setWeight (uint64_t w) |
Set the specimen weight. | |
uint64_t | getWeight () const |
Return the specimen weight. | |
void | setPredictand (Value v) |
Set the specimen predictand. | |
Value | getPredictand () const |
Return the specimen predictand. | |
void | addCell (const Cell &cell) |
Add a Cell to the cell sequence. | |
bool | addCells (std::vector< Cell >::iterator begin, std::vector< Cell >::iterator end) |
Add a collection of Cell to the cell sequence. | |
bool | addCells (std::list< Cell >::iterator begin, std::list< Cell >::iterator end) |
Add a collection of Cells to the cell sequence. | |
bool | removeCells (uint64_t numCellsToRemove) |
Remove cells from the end of the sequence. | |
Cell | getCell (int index) const |
Return a cell from the cell sequence. | |
void | clearCells () |
Remove all cells from the sequence. | |
uint64_t | size () const |
Return the number of cells in the sequence. | |
bool | isEmpty () const |
Return true if the sequence contains no cells. | |
std::string | toString () const |
Return a string representation of this Specimen . | |
Private Attributes | |
uint64_t | key |
Status | status |
uint64_t | weight |
Value | predictand |
std::vector< Cell > | cellSequence |
A sequence of cells. |
A row of values.
Other terminology that is sometimes used: An observation, a record, an example, or an instance. These are the primary characteristics of a Specimen
:
Cells
containing the values of the row Definition at line 31 of file Specimen.h.
Provides a logical delete facility.
The default value is ACTIVE
.
ACTIVE |
the specimen is active, i.e., it should be considered when constructing the model. |
INACTIVE |
the specimen is inactive, i.e., it should not be considered when constructing the model. |
Definition at line 38 of file Specimen.h.
Specimen::Specimen | ( | ) |
Initializes a newly created Specimen
object with default values:
Definition at line 13 of file Specimen.cpp.
References ACTIVE, setPredictand(), setSpecimenKey(), setStatus(), and setWeight().
Specimen::Specimen | ( | uint64_t | key | ) |
Initializes a newly created Specimen
object with key specified by the input parameter.
Other attributes are set to default values:
key | the key of the specimen. |
Definition at line 21 of file Specimen.cpp.
References ACTIVE, setPredictand(), setSpecimenKey(), setStatus(), and setWeight().
Specimen::Specimen | ( | uint64_t | key, | |
std::vector< Cell >::iterator | begin, | |||
std::vector< Cell >::iterator | end | |||
) |
Initializes a newly created Specimen
object with key and cell sequence as specified by the input parameters.
Other attributes are set to default values:
key | the key of the specimen. | |
begin | an iterator specifying the beginning of a cell vector. | |
end | an iterator specifying the end of a cell vector. |
Definition at line 30 of file Specimen.cpp.
References ACTIVE.
Specimen::Specimen | ( | uint64_t | key, | |
std::list< Cell >::iterator | begin, | |||
std::list< Cell >::iterator | end | |||
) |
Initializes a newly created Specimen
object with key and cell sequence as specified by the input parameters.
Other attributes are set to default values:
key | the key of the specimen. | |
begin | an iterator specifying the beginning of a cell list. | |
end | an iterator specifying the end of a cell list. |
Definition at line 44 of file Specimen.cpp.
References ACTIVE.
Specimen::Specimen | ( | uint64_t | key, | |
Value | predictand, | |||
std::vector< Cell >::iterator | begin, | |||
std::vector< Cell >::iterator | end | |||
) |
Initializes a newly created Specimen
object with key, predictand, and cell sequence as specified by the input parameters.
Other attributes are set to default values:
key | the key of the specimen. | |
predictand | the predictand of the specimen. | |
begin | an iterator specifying the beginning of a cell vector. | |
end | an iterator specifying the end of a cell vector. |
Definition at line 58 of file Specimen.cpp.
References ACTIVE.
Specimen::Specimen | ( | uint64_t | key, | |
Value | predictand, | |||
std::list< Cell >::iterator | begin, | |||
std::list< Cell >::iterator | end | |||
) |
Initializes a newly created Specimen
object with key, predictand, and cell sequence as specified by the input parameters.
Other attributes are set to default values:
key | the key of the specimen. | |
predictand | the predictand of the specimen. | |
begin | an iterator specifying the beginning of a cell list. | |
end | an iterator specifying the end of a cell list. |
Definition at line 73 of file Specimen.cpp.
References ACTIVE.
Specimen::Specimen | ( | uint64_t | key, | |
Status | status, | |||
uint64_t | weight, | |||
Value | predictand, | |||
std::vector< Cell >::iterator | begin, | |||
std::vector< Cell >::iterator | end | |||
) |
Initializes a newly created Specimen
object with # attributes specified by the input parameters.
key | the key of the specimen. | |
status | the status of the specimen. | |
weight | the weight of the specimen. | |
predictand | the predictand of the specimen. | |
begin | an iterator specifying the beginning of a cell vector. | |
end | an iterator specifying the end of a cell vector. |
Definition at line 88 of file Specimen.cpp.
Specimen::Specimen | ( | uint64_t | key, | |
Status | status, | |||
uint64_t | weight, | |||
Value | predictand, | |||
std::list< Cell >::iterator | begin, | |||
std::list< Cell >::iterator | end | |||
) |
Initializes a newly created Specimen
object with # attributes specified by the input parameters.
key | the key of the specimen. | |
status | the status of the specimen. | |
weight | the weight of the specimen. | |
predictand | the predictand of the specimen. | |
begin | an iterator specifying the beginning of a cell list. | |
end | an iterator specifying the end of a cell list. |
Definition at line 105 of file Specimen.cpp.
Specimen::Specimen | ( | const Specimen & | rhs | ) |
Copy constructor - initializes a newly created Specimen
object with a copy of another Specimen
object.
rhs | the Specimen to make a copy of. |
Definition at line 121 of file Specimen.cpp.
References operator=().
Specimen::~Specimen | ( | ) | [virtual] |
Destructor - destroy a Specimen
object.
Definition at line 126 of file Specimen.cpp.
void Specimen::addCell | ( | const Cell & | cell | ) |
Add a Cell
to the cell sequence.
The Cell
parameter is appended to the end of the cell sequence.
cell | the Cell to add to the cell sequence. |
Definition at line 195 of file Specimen.cpp.
References cellSequence.
Referenced by Yosokumo::YosokumoProtobuf::makeSpecimenFromProtobufSpecimen().
Add a collection of Cells
to the cell sequence.
The Cells
in the list specified by the parameters are appended to the end of the cell sequence.
begin | an iterator specifying the beginning of the cell list to add to the block. | |
end | an iterator specifying the end of the cell list to add to the block. |
Definition at line 213 of file Specimen.cpp.
Add a collection of Cell
to the cell sequence.
The Cells
in the vector specified by the parameters are appended to the end of the cell sequence.
begin | an iterator specifying the beginning of the cell vector to add to the block. | |
end | an iterator specifying the end of the cell vector to add to the block. |
Definition at line 202 of file Specimen.cpp.
Referenced by operator=().
void Specimen::clearCells | ( | ) |
Remove all cells from the sequence.
After a call of this method, the sequence is empty, i.e., it contains no cells.
Definition at line 244 of file Specimen.cpp.
References cellSequence.
Referenced by removeCells().
Cell Specimen::getCell | ( | int | index | ) | const |
Return a cell from the cell sequence.
This makes it possible to iterate over all cells in the sequence like this:
for (int i = 0; i < cellSequence.size(); ++i) { Cell c = cellSequence.getCell(i) process cell c }
index | specifying which cell of the sequence to return. 0-based. |
Cell
at the location specified by the index. Definition at line 239 of file Specimen.cpp.
References cellSequence.
Referenced by Yosokumo::YosokumoProtobuf::makeProtobufSpecimenFromSpecimen(), and toString().
Value Specimen::getPredictand | ( | ) | const |
Return the specimen predictand.
Definition at line 187 of file Specimen.cpp.
Referenced by Yosokumo::YosokumoProtobuf::makeBlockFromProtobufBlock(), and Yosokumo::YosokumoProtobuf::makeProtobufSpecimenFromSpecimen().
uint64_t Specimen::getSpecimenKey | ( | ) | const |
Return the specimen key.
Definition at line 154 of file Specimen.cpp.
Referenced by Yosokumo::YosokumoProtobuf::makeBlockFromProtobufBlock(), Yosokumo::YosokumoProtobuf::makeProtobufSpecimenFromSpecimen(), and toString().
Specimen::Status Specimen::getStatus | ( | ) | const |
Return the specimen status.
Definition at line 165 of file Specimen.cpp.
Referenced by Yosokumo::YosokumoProtobuf::makeProtobufSpecimenFromSpecimen(), and toString().
uint64_t Specimen::getWeight | ( | ) | const |
Return the specimen weight.
Definition at line 176 of file Specimen.cpp.
Referenced by Yosokumo::YosokumoProtobuf::makeProtobufSpecimenFromSpecimen(), and toString().
bool Specimen::isEmpty | ( | ) | const |
Return true
if the sequence contains no cells.
true
if the sequence contains no cells. false
otherwise. Definition at line 254 of file Specimen.cpp.
References cellSequence.
Referenced by removeCells().
Assignment operator - assign one Specimen
to another.
rhs | the righthand side of the assignment. |
this
Specimen. Definition at line 129 of file Specimen.cpp.
References addCells(), cellSequence, key, predictand, status, and weight.
Referenced by Specimen().
bool Specimen::removeCells | ( | uint64_t | numCellsToRemove | ) |
Remove cells from the end of the sequence.
The specified number of cells are removed from the end of the cell sequence.
numCellsToRemove | is the number of cells to remove from the end of the sequence. If this value is zero, no cells are removed. If this value exceeds the number of cells in the sequence, then all cells are removed. |
Definition at line 223 of file Specimen.cpp.
References cellSequence, clearCells(), isEmpty(), and size().
void Specimen::setPredictand | ( | Value | v | ) |
Set the specimen predictand.
v | the predictand to assign to this specimen. |
Definition at line 182 of file Specimen.cpp.
Referenced by Yosokumo::YosokumoProtobuf::makeSpecimenFromProtobufSpecimen(), and Specimen().
void Specimen::setSpecimenKey | ( | uint64_t | key | ) |
Set the specimen key.
key | the key to assign to this specimen. This is the unique identification of the specimen. It must be positive. |
Definition at line 149 of file Specimen.cpp.
Referenced by Yosokumo::YosokumoProtobuf::makeSpecimenFromProtobufSpecimen(), and Specimen().
void Specimen::setStatus | ( | Status | s | ) |
Set the specimen status.
s | the status to assign to this specimen. |
Definition at line 160 of file Specimen.cpp.
Referenced by Yosokumo::YosokumoProtobuf::makeSpecimenFromProtobufSpecimen(), and Specimen().
void Specimen::setWeight | ( | uint64_t | w | ) |
Set the specimen weight.
w | the weight to assign to this specimen. |
Definition at line 171 of file Specimen.cpp.
Referenced by Yosokumo::YosokumoProtobuf::makeSpecimenFromProtobufSpecimen(), and Specimen().
uint64_t Specimen::size | ( | ) | const |
Return the number of cells in the sequence.
Definition at line 249 of file Specimen.cpp.
References cellSequence.
Referenced by Yosokumo::YosokumoProtobuf::makeProtobufSpecimenFromSpecimen(), removeCells(), and toString().
std::string Specimen::toString | ( | ) | const |
Return a string representation of this Specimen
.
Specimen
. Definition at line 262 of file Specimen.cpp.
References getCell(), getSpecimenKey(), getStatus(), getWeight(), size(), Yosokumo::Cell::toString(), and Yosokumo::Value::toString().
Referenced by Yosokumo::SpecimenBlock::toString().
std::vector<Cell> Yosokumo::Specimen::cellSequence [private] |
A sequence of cells.
Definition at line 69 of file Specimen.h.
Referenced by addCell(), clearCells(), getCell(), isEmpty(), operator=(), removeCells(), and size().
uint64_t Yosokumo::Specimen::key [private] |
Definition at line 54 of file Specimen.h.
Referenced by operator=().
Value Yosokumo::Specimen::predictand [private] |
Definition at line 57 of file Specimen.h.
Referenced by operator=().
Status Yosokumo::Specimen::status [private] |
Definition at line 55 of file Specimen.h.
Referenced by operator=().
uint64_t Yosokumo::Specimen::weight [private] |
Definition at line 56 of file Specimen.h.
Referenced by operator=().