From: <qua...@us...> - 2010-08-16 07:55:45
|
Revision: 270 http://stdair.svn.sourceforge.net/stdair/?rev=270&view=rev Author: quannaus Date: 2010-08-16 07:55:36 +0000 (Mon, 16 Aug 2010) Log Message: ----------- [dev] Implemented a sale. Modified Paths: -------------- trunk/stdair/stdair/basic/BasConst.cpp trunk/stdair/stdair/basic/BasConst_Inventory.hpp trunk/stdair/stdair/basic/BasConst_TravelSolution.hpp trunk/stdair/stdair/bom/BookingClass.cpp trunk/stdair/stdair/bom/BookingClass.hpp trunk/stdair/stdair/bom/FlightDate.cpp trunk/stdair/stdair/bom/FlightDate.hpp trunk/stdair/stdair/bom/Inventory.cpp trunk/stdair/stdair/bom/Inventory.hpp trunk/stdair/stdair/bom/LegCabin.cpp trunk/stdair/stdair/bom/LegCabin.hpp trunk/stdair/stdair/bom/ReachableUniverse.cpp trunk/stdair/stdair/bom/SegmentCabin.cpp trunk/stdair/stdair/bom/SegmentCabin.hpp trunk/stdair/stdair/bom/SegmentCabinContent.cpp trunk/stdair/stdair/bom/SegmentCabinContent.hpp trunk/stdair/stdair/bom/SegmentPathPeriod.cpp Modified: trunk/stdair/stdair/basic/BasConst.cpp =================================================================== --- trunk/stdair/stdair/basic/BasConst.cpp 2010-08-13 18:56:29 UTC (rev 269) +++ trunk/stdair/stdair/basic/BasConst.cpp 2010-08-16 07:55:36 UTC (rev 270) @@ -142,6 +142,9 @@ /** Default availability. */ const Availability_T DEFAULT_AVAILABILITY = 0.0; + /** Maximal offered capacity in a cabin. */ + const Availability_T MAXIMAL_AVAILABILITY = 9999.0; + /** Default boolean for censorship flag given the status of availability for BookingClass. */ const CensorshipFlag_T DEFAULT_CLASS_CENSORSHIPFLAG = false; @@ -226,11 +229,11 @@ // //////// Travel Solutions /////// - /** Default Minimum connection time. */ - const Duration_T DEFAULT_MINIMUM_CONNECTION_TIME (0, 30, 0); + /** Default Minimal connection time. */ + const Duration_T DEFAULT_MINIMAL_CONNECTION_TIME (0, 30, 0); - /** Default maximum connection time. */ - const Duration_T DEFAULT_MAXIMUM_CONNECTION_TIME (24, 0, 0); + /** Default maximal connection time. */ + const Duration_T DEFAULT_MAXIMAL_CONNECTION_TIME (24, 0, 0); /** Default Matching Indicator value. */ const MatchingIndicator_T DEFAULT_MATCHING_INDICATOR (0.0); @@ -249,14 +252,14 @@ /** Default Bid-Price Vector. */ const BidPriceVector_T DEFAULT_BID_PRICE_VECTOR = std::vector<BidPrice_T>(); - /** Maximum number of legs linked to a single flight-date. + /** Maximal number of legs linked to a single flight-date. <br>Note that the number of derived segments is n*(n+1)/2 if n is the number of legs. */ - const unsigned short MAXIMUM_NUMBER_OF_LEGS_IN_FLIGHT = 7; + const unsigned short MAXIMAL_NUMBER_OF_LEGS_IN_FLIGHT = 7; - /** Maximum number of segments linked to a single O&D + /** Maximal number of segments linked to a single O&D (Origin & Destination). */ - const unsigned short MAXIMUM_NUMBER_OF_SEGMENTS_IN_OND = 3; + const unsigned short MAXIMAL_NUMBER_OF_SEGMENTS_IN_OND = 3; // ////////// BomManager-related constants /////////// Modified: trunk/stdair/stdair/basic/BasConst_Inventory.hpp =================================================================== --- trunk/stdair/stdair/basic/BasConst_Inventory.hpp 2010-08-13 18:56:29 UTC (rev 269) +++ trunk/stdair/stdair/basic/BasConst_Inventory.hpp 2010-08-16 07:55:36 UTC (rev 270) @@ -16,14 +16,17 @@ /** Default Bid-Price Vector. */ extern const BidPriceVector_T DEFAULT_BID_PRICE_VECTOR; - /** Maximum number of legs linked to a single flight-date. + /** Maximal number of legs linked to a single flight-date. <br>Note that the number of derived segments is n*(n+1)/2 if n is the number of legs. */ - extern const unsigned short MAXIMUM_NUMBER_OF_LEGS_IN_FLIGHT; + extern const unsigned short MAXIMAL_NUMBER_OF_LEGS_IN_FLIGHT; - /** Maximum number of segments linked to a single O&D + /** Maximal number of segments linked to a single O&D (Origin & Destination). */ - extern const unsigned short MAXIMUM_NUMBER_OF_SEGMENTS_IN_OND; + extern const unsigned short MAXIMAL_NUMBER_OF_SEGMENTS_IN_OND; + + /** Maximal offered capacity in a cabin. */ + extern const Availability_T MAXIMAL_AVAILABILITY; } #endif // __STDAIR_BAS_BASCONST_INVENTORY_HPP Modified: trunk/stdair/stdair/basic/BasConst_TravelSolution.hpp =================================================================== --- trunk/stdair/stdair/basic/BasConst_TravelSolution.hpp 2010-08-13 18:56:29 UTC (rev 269) +++ trunk/stdair/stdair/basic/BasConst_TravelSolution.hpp 2010-08-16 07:55:36 UTC (rev 270) @@ -16,11 +16,11 @@ /** Default distance value (kilometers). */ extern const Distance_T DEFAULT_DISTANCE_VALUE; - /** Default Minimum connection time. */ - extern const Duration_T DEFAULT_MINIMUM_CONNECTION_TIME; + /** Default Minimal connection time. */ + extern const Duration_T DEFAULT_MINIMAL_CONNECTION_TIME; - /** Default maximum connection time. */ - extern const Duration_T DEFAULT_MAXIMUM_CONNECTION_TIME; + /** Default maximal connection time. */ + extern const Duration_T DEFAULT_MAXIMAL_CONNECTION_TIME; /** Null time duration (in boost::time_duration unit).*/ extern const Duration_T NULL_BOOST_TIME_DURATION; Modified: trunk/stdair/stdair/bom/BookingClass.cpp =================================================================== --- trunk/stdair/stdair/bom/BookingClass.cpp 2010-08-13 18:56:29 UTC (rev 269) +++ trunk/stdair/stdair/bom/BookingClass.cpp 2010-08-16 07:55:36 UTC (rev 270) @@ -58,6 +58,11 @@ return _structure.getParent().getParent(). getParent().getParent().getKey().getAirlineCode(); } + + // //////////////////////////////////////////////////////////////////// + void BookingClass::sell (const NbOfBookings_T& iNbOfBookings) { + _nbOfBookings += iNbOfBookings; + } } Modified: trunk/stdair/stdair/bom/BookingClass.hpp =================================================================== --- trunk/stdair/stdair/bom/BookingClass.hpp 2010-08-13 18:56:29 UTC (rev 269) +++ trunk/stdair/stdair/bom/BookingClass.hpp 2010-08-16 07:55:36 UTC (rev 270) @@ -69,6 +69,10 @@ at any level). */ const std::string describeKey() const; + // ////////////// Business Methodes ///////////////// + /** Register a sale. */ + void sell (const NbOfBookings_T&); + protected: /** Constructors are private so as to force the usage of the Factory layer. */ Modified: trunk/stdair/stdair/bom/FlightDate.cpp =================================================================== --- trunk/stdair/stdair/bom/FlightDate.cpp 2010-08-13 18:56:29 UTC (rev 269) +++ trunk/stdair/stdair/bom/FlightDate.cpp 2010-08-16 07:55:36 UTC (rev 270) @@ -80,7 +80,12 @@ // //////////////////////////////////////////////////////////////////// SegmentDate* FlightDate::getSegmentDate (const SegmentDateKey_T& iKey) const { - return _structure.getChildPtr<SegmentDate> (iKey.toString() ); + return _structure.getChildPtr<SegmentDate> (iKey.toString()); } + + // //////////////////////////////////////////////////////////////////// + SegmentDate* FlightDate::getSegmentDate (const std::string& iKey) const { + return _structure.getChildPtr<SegmentDate> (iKey); + } } Modified: trunk/stdair/stdair/bom/FlightDate.hpp =================================================================== --- trunk/stdair/stdair/bom/FlightDate.hpp 2010-08-13 18:56:29 UTC (rev 269) +++ trunk/stdair/stdair/bom/FlightDate.hpp 2010-08-16 07:55:36 UTC (rev 270) @@ -74,6 +74,7 @@ given SegmentDate key. <br>If not existing, return the NULL pointer. */ SegmentDate* getSegmentDate (const SegmentDateKey_T&) const; + SegmentDate* getSegmentDate (const std::string&) const; public: // /////////// Display support methods ///////// Modified: trunk/stdair/stdair/bom/Inventory.cpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.cpp 2010-08-13 18:56:29 UTC (rev 269) +++ trunk/stdair/stdair/bom/Inventory.cpp 2010-08-16 07:55:36 UTC (rev 270) @@ -78,6 +78,12 @@ } // //////////////////////////////////////////////////////////////////// + FlightDate* Inventory:: + getFlightDate (const std::string& iKey) const { + return _structure.getChildPtr<FlightDate> (iKey); + } + + // //////////////////////////////////////////////////////////////////// FlightPeriod* Inventory:: getFlightPeriod (const FlightPeriodKey_T& iKey) const { return _structure.getChildPtr<FlightPeriod> (iKey.toString()); Modified: trunk/stdair/stdair/bom/Inventory.hpp =================================================================== --- trunk/stdair/stdair/bom/Inventory.hpp 2010-08-13 18:56:29 UTC (rev 269) +++ trunk/stdair/stdair/bom/Inventory.hpp 2010-08-16 07:55:36 UTC (rev 270) @@ -101,6 +101,7 @@ given flight number and flight date (FlightDate key). <br>If not existing, return the NULL pointer. */ FlightDate* getFlightDate (const FlightDateKey_T&) const; + FlightDate* getFlightDate (const std::string&) const; /** Retrieve, if existing, the FlightPeriod corresponding to the given flight number and flight period (FlightPeriod key). Modified: trunk/stdair/stdair/bom/LegCabin.cpp =================================================================== --- trunk/stdair/stdair/bom/LegCabin.cpp 2010-08-13 18:56:29 UTC (rev 269) +++ trunk/stdair/stdair/bom/LegCabin.cpp 2010-08-16 07:55:36 UTC (rev 270) @@ -52,6 +52,12 @@ oStr << _structure.describeParentKey() << ", " << describeShortKey(); return oStr.str(); } + + // //////////////////////////////////////////////////////////////////// + void LegCabin::updateFromReservation (const NbOfBookings_T& iNbOfBookings) { + _commitedSpace += iNbOfBookings; + _availabilityPool = _offeredCapacity - _commitedSpace; + } } Modified: trunk/stdair/stdair/bom/LegCabin.hpp =================================================================== --- trunk/stdair/stdair/bom/LegCabin.hpp 2010-08-13 18:56:29 UTC (rev 269) +++ trunk/stdair/stdair/bom/LegCabin.hpp 2010-08-16 07:55:36 UTC (rev 270) @@ -72,6 +72,11 @@ at any level). */ const std::string describeKey() const; + public: + // /////////// Business methods ////////// + /** Register a sale. */ + void updateFromReservation (const NbOfBookings_T&); + protected: /** Constructors are private so as to force the usage of the Factory layer. */ Modified: trunk/stdair/stdair/bom/ReachableUniverse.cpp =================================================================== --- trunk/stdair/stdair/bom/ReachableUniverse.cpp 2010-08-13 18:56:29 UTC (rev 269) +++ trunk/stdair/stdair/bom/ReachableUniverse.cpp 2010-08-16 07:55:36 UTC (rev 270) @@ -76,7 +76,7 @@ addSegmentPathPeriod (const SegmentPathPeriod& iSegmentPathPeriod) { const NbOfSegments_T& lNbOfSegments = iSegmentPathPeriod.getNbOfSegments (); assert (lNbOfSegments > 0 - && lNbOfSegments <= MAXIMUM_NUMBER_OF_SEGMENTS_IN_OND); + && lNbOfSegments <= MAXIMAL_NUMBER_OF_SEGMENTS_IN_OND); // If needed, initialise the list of lists with empty fixed-length // segment path period lists. Modified: trunk/stdair/stdair/bom/SegmentCabin.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabin.cpp 2010-08-13 18:56:29 UTC (rev 269) +++ trunk/stdair/stdair/bom/SegmentCabin.cpp 2010-08-16 07:55:36 UTC (rev 270) @@ -65,10 +65,25 @@ } // //////////////////////////////////////////////////////////////////// + LegCabinList_T SegmentCabin::getLegCabinList () const { + return _structure.getChildrenHolder<LegCabin>(); + } + + // //////////////////////////////////////////////////////////////////// + LegCabinMap_T SegmentCabin::getLegCabinMap () const { + return _structure.getChildrenHolder<LegCabin>(); + } + + // //////////////////////////////////////////////////////////////////// BookingClass* SegmentCabin:: getBookingClass (const ClassCode_T& iClassCode) const { return _structure.getChildPtr<BookingClass> (iClassCode); } + + // //////////////////////////////////////////////////////////////////// + void SegmentCabin::updateFromReservation (const NbOfBookings_T& iNbOfBookings){ + _commitedSpace += iNbOfBookings; + } } Modified: trunk/stdair/stdair/bom/SegmentCabin.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabin.hpp 2010-08-13 18:56:29 UTC (rev 269) +++ trunk/stdair/stdair/bom/SegmentCabin.hpp 2010-08-16 07:55:36 UTC (rev 270) @@ -60,6 +60,8 @@ /** Get a list or map of a children type for iteration methods. */ BookingClassList_T getBookingClassList () const; BookingClassMap_T getBookingClassMap () const; + LegCabinList_T getLegCabinList () const; + LegCabinMap_T getLegCabinMap () const; /** Retrieve, if existing, the BookingClass corresponding to the given class code. @@ -82,6 +84,11 @@ /** Get a string describing the whole key (differentiating two objects at any level). */ const std::string describeKey() const; + + public: + // /////////// Business methods ////////// + /** Register a sale. */ + void updateFromReservation (const NbOfBookings_T&); protected: /** Constructors are private so as to force the usage of the Factory Modified: trunk/stdair/stdair/bom/SegmentCabinContent.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabinContent.cpp 2010-08-13 18:56:29 UTC (rev 269) +++ trunk/stdair/stdair/bom/SegmentCabinContent.cpp 2010-08-16 07:55:36 UTC (rev 270) @@ -19,11 +19,7 @@ _commitedSpace (DEFAULT_COMMITED_SPACE), _availabilityPool (DEFAULT_AVAILABILITY), _bidPriceVector (DEFAULT_BID_PRICE_VECTOR), - _currentBidPrice (DEFAULT_BID_PRICE), - _cabinRevenue (DEFAULT_REVENUE_VALUE), - _cabinAverageFare (DEFAULT_FARE_VALUE), - _cabinUnitRevenue (DEFAULT_REVENUE_VALUE), - _cabinRPK (DEFAULT_DISTANCE_VALUE) { + _currentBidPrice (DEFAULT_BID_PRICE) { } // //////////////////////////////////////////////////////////////////// Modified: trunk/stdair/stdair/bom/SegmentCabinContent.hpp =================================================================== --- trunk/stdair/stdair/bom/SegmentCabinContent.hpp 2010-08-13 18:56:29 UTC (rev 269) +++ trunk/stdair/stdair/bom/SegmentCabinContent.hpp 2010-08-16 07:55:36 UTC (rev 270) @@ -54,26 +54,6 @@ return _availabilityPool; } - /** Get the total cabin revenue. */ - const Revenue_T& getRevenue () const { - return _cabinRevenue; - } - - /** Get the cabin average fare. */ - const Fare_T& getAverageFare() const { - return _cabinAverageFare; - } - - /** Get the unit revenue value for this cabin. */ - const Revenue_T& getUnitRevenue () const { - return _cabinUnitRevenue; - } - - /** Get the Revenue Passanger Kilometer for this cabin. */ - const Distance_T& getRPK() const { - return _cabinRPK; - } - /** Retrive the current Bid-Price. */ const BidPrice_T& getCurrentBidPrice () const { return _currentBidPrice; @@ -111,26 +91,6 @@ _availabilityPool = iAvailabilityPool; } - /** Set the revenue amount. */ - void setRevenue (const Revenue_T& iCabinRevenue) { - _cabinRevenue = iCabinRevenue; - } - - /** Set the average cabin fare. */ - void setAverageCabinFare(Fare_T iCAFare) { - _cabinAverageFare = iCAFare; - } - - /** Set the Revenue Passanger Kilometer. */ - void setRPK (const Distance_T& iCabinRPK) { - _cabinRPK = iCabinRPK; - } - - /** Set the Unit Revenue. */ - void setUnitRevenue (const Revenue_T& iCabinURevenue) { - _cabinUnitRevenue = iCabinURevenue; - } - public: // /////////// Display support methods ///////// /** Dump a Business Object into an output stream. @@ -181,18 +141,6 @@ /** Current BidPrice. */ BidPrice_T _currentBidPrice; - - /** Total amount of money earned with cabin bookings. */ - Revenue_T _cabinRevenue; - - /** Value of the average fare of this cabin.*/ - Fare_T _cabinAverageFare; - - /** Value of the Unit Revenue (Revenue/ASK). */ - Revenue_T _cabinUnitRevenue; - - /** Value of the Revenue Passanger Kilometer for this cabin.*/ - Distance_T _cabinRPK; }; } Modified: trunk/stdair/stdair/bom/SegmentPathPeriod.cpp =================================================================== --- trunk/stdair/stdair/bom/SegmentPathPeriod.cpp 2010-08-13 18:56:29 UTC (rev 269) +++ trunk/stdair/stdair/bom/SegmentPathPeriod.cpp 2010-08-16 07:55:36 UTC (rev 270) @@ -184,7 +184,7 @@ // can connect to a flight in the next day. if (lNextBoardingTime >= lLastOffTime) { const Duration_T lStopTime = lNextBoardingTime - lLastOffTime; - if (lStopTime < DEFAULT_MINIMUM_CONNECTION_TIME) { + if (lStopTime < DEFAULT_MINIMAL_CONNECTION_TIME) { return oSegmentPathPeriodKey; } else { // Calulcate the date offset of the next segment compare to @@ -216,7 +216,7 @@ } else { const Duration_T lStopTime = lNextBoardingTime - lLastOffTime + Duration_T (24, 0, 0); - if (lStopTime < DEFAULT_MINIMUM_CONNECTION_TIME) { + if (lStopTime < DEFAULT_MINIMAL_CONNECTION_TIME) { return oSegmentPathPeriodKey; } else { // Calulcate the date offset of the next segment compare to This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |