Yosokumo::Specimen Class Reference

A row of values. More...

#include <Specimen.h>

Collaboration diagram for Yosokumo::Specimen:
Collaboration graph
[legend]

List of all members.

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.
Specimenoperator= (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< CellcellSequence
 A sequence of cells.

Detailed Description

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:

Author:
Roger House
Version:
0.9

Definition at line 31 of file Specimen.h.


Member Enumeration Documentation

Provides a logical delete facility.

The default value is ACTIVE.

Enumerator:
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.


Constructor & Destructor Documentation

Specimen::Specimen (  ) 

Initializes a newly created Specimen object with default values:

  • key - 0
  • status - ACTIVE
  • weight - 1
  • predictand - EmptyValue
  • cell sequence - empty

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:

  • status - ACTIVE
  • weight - 1
  • predictand - EmptyValue
  • cell sequence - empty
Parameters:
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:

  • status - ACTIVE
  • weight - 1
  • predictand - EmptyValue
Parameters:
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:

  • status - ACTIVE
  • weight - 1
  • predictand - EmptyValue
Parameters:
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:

  • status - ACTIVE
  • weight - 1
Parameters:
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:

  • status - ACTIVE
  • weight - 1
Parameters:
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.

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.

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.

Parameters:
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.


Member Function Documentation

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.

Parameters:
cell the Cell to add to the cell sequence.

Definition at line 195 of file Specimen.cpp.

References cellSequence.

Referenced by Yosokumo::YosokumoProtobuf::makeSpecimenFromProtobufSpecimen().

bool Specimen::addCells ( std::list< Cell >::iterator  begin,
std::list< Cell >::iterator  end 
)

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.

Parameters:
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.
Returns:
true if and only if the cell sequence changes.

Definition at line 213 of file Specimen.cpp.

bool Specimen::addCells ( std::vector< Cell >::iterator  begin,
std::vector< Cell >::iterator  end 
)

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.

Parameters:
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.
Returns:
true if and only if the cell sequence changes.

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
   }
 
Parameters:
index specifying which cell of the sequence to return. 0-based.
Returns:
the 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.

Returns:
the predictand of this specimen.

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.

Returns:
the key of this specimen, which is the unique identification of the specimen.

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.

Returns:
the status of this specimen.

Definition at line 165 of file Specimen.cpp.

Referenced by Yosokumo::YosokumoProtobuf::makeProtobufSpecimenFromSpecimen(), and toString().

uint64_t Specimen::getWeight (  )  const

Return the specimen weight.

Returns:
the weight of this specimen.

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.

Returns:
true if the sequence contains no cells. false otherwise.

Definition at line 254 of file Specimen.cpp.

References cellSequence.

Referenced by removeCells().

Specimen & Specimen::operator= ( const Specimen rhs  ) 

Assignment operator - assign one Specimen to another.

Parameters:
rhs the righthand side of the assignment.
Returns:
a reference to 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.

Parameters:
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.
Returns:
true if and only if the sequence is changed.

Definition at line 223 of file Specimen.cpp.

References cellSequence, clearCells(), isEmpty(), and size().

void Specimen::setPredictand ( Value  v  ) 

Set the specimen predictand.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Returns:
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.

Returns:
the string representation of this 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().


Member Data Documentation

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=().

Definition at line 57 of file Specimen.h.

Referenced by operator=().

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=().


The documentation for this class was generated from the following files:
Generated on Mon May 13 09:19:12 2013 for C++ Yosokumo API by  doxygen 1.6.3