Yosokumo::PredictorBlock Class Reference

Represents a block of Predictors. More...

#include <PredictorBlock.h>

Inheritance diagram for Yosokumo::PredictorBlock:
Inheritance graph
[legend]
Collaboration diagram for Yosokumo::PredictorBlock:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PredictorBlock ()
 Initializes a newly created PredictorBlock object with default attributes.
 PredictorBlock (std::string id)
 Initializes a newly created PredictorBlock object with a study identifier.
 PredictorBlock (std::vector< Predictor >::iterator begin, std::vector< Predictor >::iterator end)
 Initializes a newly created PredictorBlock object with the predictor vector specified by the input parameters.
 PredictorBlock (std::list< Predictor >::iterator begin, std::list< Predictor >::iterator end)
 Initializes a newly created PredictorBlock object with the predictor list specified by the input parameters.
 PredictorBlock (std::string id, std::vector< Predictor >::iterator begin, std::vector< Predictor >::iterator end)
 Initializes a newly created PredictorBlock object with the study identifier and the predictor vector specified by the input parameters.
 PredictorBlock (std::string id, std::list< Predictor >::iterator begin, std::list< Predictor >::iterator end)
 Initializes a newly created PredictorBlock object with the study identifier and the predictor list specified by the input parameters.
virtual ~PredictorBlock ()
 Destructor.
void addPredictor (const Predictor &predictor)
 Add a Predictor to the block.
bool addPredictors (std::vector< Predictor >::iterator begin, std::vector< Predictor >::iterator end)
 Add a collection of Predictors to the block.
bool addPredictors (std::list< Predictor >::iterator begin, std::list< Predictor >::iterator end)
 Add a collection of Predictors to the block.
bool removePredictors (uint64_t numPredictorsToRemove)
 Remove predictors from the end of the block.
Predictor getPredictor (uint64_t index) const
 Return a predictor from the block.
void clearPredictors ()
 Remove all predictors from the block.
uint64_t size () const
 Return the number of predictors in the block.
bool isEmpty () const
 Return true if the block contains no predictors.
virtual std::string toString ()
 Return a string representation of this PredictorBlock.

Private Member Functions

 PredictorBlock (const PredictorBlock &rhs)
 Copy constructor - NOT IMPLEMENTED.
PredictorBlockoperator= (const PredictorBlock &rhs)
 Assignment operator - NOT IMPLEMENTED.

Detailed Description

Represents a block of Predictors.

Definition at line 20 of file PredictorBlock.h.


Constructor & Destructor Documentation

PredictorBlock::PredictorBlock (  ) 

Initializes a newly created PredictorBlock object with default attributes.

Definition at line 9 of file PredictorBlock.cpp.

References Yosokumo::Block::PREDICTOR, and Yosokumo::Block::setType().

PredictorBlock::PredictorBlock ( std::string  id  ) 

Initializes a newly created PredictorBlock object with a study identifier.

Parameters:
id a study identifier for the block.

Definition at line 14 of file PredictorBlock.cpp.

References Yosokumo::Block::PREDICTOR, and Yosokumo::Block::setType().

PredictorBlock::PredictorBlock ( std::vector< Predictor >::iterator  begin,
std::vector< Predictor >::iterator  end 
)

Initializes a newly created PredictorBlock object with the predictor vector specified by the input parameters.

Parameters:
begin an iterator specifying the beginning of the predictor vector.
end an iterator specifying the end of the predictor vector.

Definition at line 19 of file PredictorBlock.cpp.

References addPredictors(), Yosokumo::Block::PREDICTOR, and Yosokumo::Block::setType().

PredictorBlock::PredictorBlock ( std::list< Predictor >::iterator  begin,
std::list< Predictor >::iterator  end 
)

Initializes a newly created PredictorBlock object with the predictor list specified by the input parameters.

Parameters:
begin an iterator specifying the beginning of the predictor list.
end an iterator specifying the end of the predictor list.

Definition at line 27 of file PredictorBlock.cpp.

References addPredictors(), Yosokumo::Block::PREDICTOR, and Yosokumo::Block::setType().

PredictorBlock::PredictorBlock ( std::string  id,
std::vector< Predictor >::iterator  begin,
std::vector< Predictor >::iterator  end 
)

Initializes a newly created PredictorBlock object with the study identifier and the predictor vector specified by the input parameters.

Parameters:
id a study identifier for the block.
begin an iterator specifying the beginning of the predictor vector.
end an iterator specifying the end of the predictor vector.

Definition at line 35 of file PredictorBlock.cpp.

References addPredictors(), Yosokumo::Block::PREDICTOR, and Yosokumo::Block::setType().

PredictorBlock::PredictorBlock ( std::string  id,
std::list< Predictor >::iterator  begin,
std::list< Predictor >::iterator  end 
)

Initializes a newly created PredictorBlock object with the study identifier and the predictor list specified by the input parameters.

Parameters:
id a study identifier for the block.
begin an iterator specifying the beginning of the predictor list.
end an iterator specifying the end of the predictor list.

Definition at line 44 of file PredictorBlock.cpp.

References addPredictors(), Yosokumo::Block::PREDICTOR, and Yosokumo::Block::setType().

PredictorBlock::~PredictorBlock (  )  [virtual]

Destructor.

Definition at line 53 of file PredictorBlock.cpp.

Yosokumo::PredictorBlock::PredictorBlock ( const PredictorBlock rhs  )  [private]

Copy constructor - NOT IMPLEMENTED.


Member Function Documentation

void PredictorBlock::addPredictor ( const Predictor predictor  ) 

Add a Predictor to the block.

The predictor parameter is appended to the end of the predictor sequence.

Parameters:
predictor the Predictor to add to the block.

Definition at line 58 of file PredictorBlock.cpp.

References Yosokumo::Block::predictorSequence.

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

bool PredictorBlock::addPredictors ( std::list< Predictor >::iterator  begin,
std::list< Predictor >::iterator  end 
)

Add a collection of Predictors to the block.

The Predictors in the list specified by the parameters are appended to the end of the predictor sequence.

Parameters:
begin an iterator specifying the beginning of the predictor list to add to the block.
end an iterator specifying the end of the predictor list to add to the block.
Returns:
true if and only if the predictor sequence changes.

Definition at line 72 of file PredictorBlock.cpp.

References Yosokumo::Block::predictorSequence.

bool PredictorBlock::addPredictors ( std::vector< Predictor >::iterator  begin,
std::vector< Predictor >::iterator  end 
)

Add a collection of Predictors to the block.

The Predictors in the vector specified by the parameters are appended to the end of the predictor sequence.

Parameters:
begin an iterator specifying the beginning of the predictor vector to add to the block.
end an iterator specifying the end of the predictor vector to add to the block.
Returns:
true if and only if the predictor sequence changes.

Definition at line 63 of file PredictorBlock.cpp.

References Yosokumo::Block::predictorSequence.

Referenced by PredictorBlock().

void PredictorBlock::clearPredictors (  ) 

Remove all predictors from the block.

After a call of this method, the sequence is empty, i.e., it contains no predictors.

Definition at line 103 of file PredictorBlock.cpp.

References Yosokumo::Block::predictorSequence.

Referenced by removePredictors().

Predictor PredictorBlock::getPredictor ( uint64_t  index  )  const

Return a predictor from the block.

This makes it possible to iterate over all predictors in the sequence like this:

   for (uint64_t i = 0;  i < predictorSequence.size();  ++i)
   {
       Predictor c = predictorSequence.getPredictor(i)
       process predictor c
   }
 
Parameters:
index specifying the predictor of the 0-based block.
Returns:
the Predictor at the location specified by the index.

Definition at line 97 of file PredictorBlock.cpp.

References Yosokumo::Block::predictorSequence.

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

bool PredictorBlock::isEmpty (  )  const

Return true if the block contains no predictors.

Returns:
true if the block contains no predictors. false otherwise.

Definition at line 113 of file PredictorBlock.cpp.

References Yosokumo::Block::predictorSequence.

Referenced by removePredictors().

PredictorBlock& Yosokumo::PredictorBlock::operator= ( const PredictorBlock rhs  )  [private]

Assignment operator - NOT IMPLEMENTED.

bool PredictorBlock::removePredictors ( uint64_t  numPredictorsToRemove  ) 

Remove predictors from the end of the block.

The specified number of predictors are removed from the end of the predictor sequence.

Parameters:
numPredictorsToRemove is the number of predictors to remove from the end of the block. If this value is zero no predictors are removed. If this value exceeds the number of predictors in the block, then all predictors are removed.
Returns:
true if and only if the sequence is changed.

Definition at line 81 of file PredictorBlock.cpp.

References clearPredictors(), isEmpty(), Yosokumo::Block::predictorSequence, and size().

uint64_t PredictorBlock::size (  )  const

Return the number of predictors in the block.

Returns:
the number of predictors in the block.

Definition at line 108 of file PredictorBlock.cpp.

References Yosokumo::Block::predictorSequence.

Referenced by Yosokumo::YosokumoProtobuf::makeProtobufBlockFromBlock(), removePredictors(), and toString().

std::string PredictorBlock::toString (  )  [virtual]

Return a string representation of this PredictorBlock.

Returns:
the string representation of this PredictorBlock.

Reimplemented from Yosokumo::Block.

Definition at line 119 of file PredictorBlock.cpp.

References getPredictor(), Yosokumo::Block::getStudyIdentifier(), Yosokumo::Block::getType(), and size().

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