RMOL Logo Get Revenue Management Optimisation Library at SourceForge.net. Fast, secure and Free Open Source software downloads

Demand.cpp

Go to the documentation of this file.
00001 // //////////////////////////////////////////////////////////////////////
00002 // Import section
00003 // //////////////////////////////////////////////////////////////////////
00004 #include <rmol/bom/Demand.hpp>
00005 
00006 namespace RMOL {
00007 
00008   // //////////////////////////////////////////////////////////////////////
00009   Demand::Demand () :
00010     _yieldRange (FldYieldRange()),
00011     _distributionParameters (FldDistributionParameters()) {
00012   }
00013 
00014   // //////////////////////////////////////////////////////////////////////
00015   Demand::Demand (const Demand& iDemand) :
00016     _yieldRange (iDemand.getYieldRange()),
00017     _distributionParameters (iDemand.getDistributionParameters()) {
00018   }
00019 
00020   // //////////////////////////////////////////////////////////////////////
00021   Demand::Demand (const FldDistributionParameters& iDistributionParameters,
00022                   const FldYieldRange& iYieldRange) :
00023     _yieldRange (iYieldRange),
00024     _distributionParameters (iDistributionParameters) {
00025   }
00026 
00027   // //////////////////////////////////////////////////////////////////////
00028   Demand::~Demand() {
00029   }
00030 
00031   // //////////////////////////////////////////////////////////////////////
00032   const std::string Demand::describeShortKey() const {
00033     std::ostringstream oStr;
00034     oStr << _yieldRange;
00035     return oStr.str();
00036   }
00037   
00038   // //////////////////////////////////////////////////////////////////////
00039   const std::string Demand::describeKey() const {
00040     return describeShortKey();
00041   }
00042 
00043   // //////////////////////////////////////////////////////////////////////
00044   std::string Demand::toString() const {
00045     std::ostringstream oStr;
00046     oStr << describeShortKey() << ", ";
00047     oStr << _distributionParameters;
00048     return oStr.str();
00049   }   
00050 
00051   // //////////////////////////////////////////////////////////////////////
00052   void Demand::toStream (std::ostream& ioOut) const {
00053     ioOut << toString();
00054   }
00055   
00056   // //////////////////////////////////////////////////////////////////////
00057   void Demand::fromStream (std::istream& ioIn) {
00058   }
00059   
00060   // //////////////////////////////////////////////////////////////////////
00061   const std::string Demand::shortDisplay() const {
00062     std::ostringstream oStr;
00063     oStr << describeKey();
00064     oStr << ", distribution parameters = " << _distributionParameters
00065          << std::endl;
00066     return oStr.str();
00067   }
00068   
00069   // //////////////////////////////////////////////////////////////////////
00070   const std::string Demand::display() const {
00071     std::ostringstream oStr;
00072     oStr << shortDisplay();
00073     return oStr.str();
00074   }
00075 
00076   // //////////////////////////////////////////////////////////////////////
00077   double Demand::getUpperYield() const {
00078     return _yieldRange.getUpperYield();
00079   }
00080 
00081   // //////////////////////////////////////////////////////////////////////
00082   double Demand::getAverageYield() const {
00083     return _yieldRange.getAverageYield();
00084   }
00085 
00086   // //////////////////////////////////////////////////////////////////////
00087   double Demand::getLowerYield() {
00088     return _yieldRange.getLowerYield();
00089   }
00090 
00091   // //////////////////////////////////////////////////////////////////////
00092   double Demand::getMean() const {
00093     return _distributionParameters.getMean();
00094   }
00095 
00096   // //////////////////////////////////////////////////////////////////////
00097   double Demand::getStandardDeviation() const {
00098     return _distributionParameters.getStandardDeviation();
00099   }
00100 
00101   // //////////////////////////////////////////////////////////////////////
00102   double Demand::getVariance() const {
00103     return _distributionParameters.getVariance();
00104   }
00105 
00106   // //////////////////////////////////////////////////////////////////////
00107   void Demand::setMean (const double iMean) {
00108     _distributionParameters.setMean (iMean);
00109   }
00110 
00111   // /////////////////////////////////////////////////////////////////////
00112   void Demand::setSD (const double iSD) {
00113     _distributionParameters.setStandardDeviation (iSD);
00114   }
00115 }
SourceForge Logo

Generated on Fri Jul 30 21:53:39 2010 for RMOL by Doxygen 1.6.1