BAPS/packing/BP/Vessel.h

00001 /**********************************************************************
00002  *
00003  * Filename    : Vessel.h
00004  * Author      : Chen Li Wen
00005  *
00006  * Version     : 1.0
00007  * Date        : July 15, 1998
00008  *
00009  * Description : Interface file for class Vessel. 
00010  *
00011  * Reference   : nil
00012  *
00013  * Notes       : nil
00014  *
00015  * Changes     : Change function names. ---CLW, June 7, 1998.
00016  *               Add in functions to compare two Vessel objects.
00017  *                                      ---CLW, July 15, 1998.
00018  *               Add in functions to various comparing.
00019  *                                      ---CLW, August 5, 1998.
00020  *               Add in functions to compare packing space.
00021  *                                      ---CLW, September 3, 1998.
00022  *
00023  * Copyright   : Copyright (c) 1998
00024  *               All rights reserved by
00025  *               Resource Allocation and Scheduling Group
00026  *               Department of Computer Science
00027  *               School of Computing
00028  *               National University of Singapore
00029  *
00030  **********************************************************************/
00031 
00032 
00033 #ifndef __VESSEL_H__
00034 #define __VESSEL_H__
00035 
00036 
00037 #include "PackDef.h"
00038 #include "BAPBase.h"
00039 
00040 
00041 // Class inherited from BAPBase class.
00042 class Vessel
00043 {
00044    public:
00045       // Class constructors
00046       // This constructor will create a dummy vessel with length 0
00047       Vessel();
00048       // Create vessel with given parameters
00049       Vessel(int aID, int aLength = 0, int aArriveTime = 0, 
00050              int aDepartureTime = 0, Bool aStatus = FALSE, 
00051              int aWharfMark = -1, int aNumTimeZones = 0, 
00052              int aBigDensity = 0, int aAverageDensity = 0);
00053       // Copy constructor
00054       Vessel(const Vessel& aVessel);
00055 
00056       // Class destructor
00057       ~Vessel();
00058       
00059       // Assignment operator =
00060       Vessel& operator=(const Vessel& aVessel);
00061 
00062       // Debugger function.
00063       void Print(int aWidth = 1, int aDetail = 0) const;
00064 
00065       // Access functions.
00066       int  GetVesID() const;
00067       int  GetVesLength() const;
00068       int  GetVirtualLength() const;
00069       int  GetArriveTime() const;
00070       Bool GetPackStatus() const;
00071       int  GetBigDensity() const;
00072       int  GetPackingSpace() const;
00073       int  GetDepartureTime() const;
00074       int  GetAverageDensity() const;
00075       int  GetNumberTimeZones() const;
00076       int  GetWharfMarkAssignedTo() const;
00077       int  GetVirtualWharfMark() const;
00078 
00079       // Modification functions.
00080       void SetVesID(int aID);
00081       void SetVesLength(int aLength);
00082       void SetVirtualLength(int aVirtualLength);
00083       void SetArriveTime(int aArriveTime);
00084       void SetPackStatus(Bool aStatus);
00085       void SetBigDensity(int aBigDensity);
00086       void SetDepartureTime(int aDepartureTime);
00087       void SetAverageDensity(int aAverageDensity);
00088       void SetNumberTimeZones(int aNumTimeZones);
00089       void SetWharfMarkAssignedTo(int aWharfMark);
00090       void SetVirtualWharfMark(int aVirtualWharfMark);
00091 
00092       // Functions for comparing, input and output.
00093       
00094       // Default compare function
00095       // Non-increasing length
00096       friend int 
00097          compare(const Vessel& Lhs, const Vessel& Rhs);
00098       
00099       // Compare by vessel ID
00100       friend int 
00101          Comp_VesID_Increase(const Vessel& Lhs, const Vessel& Rhs);
00102       friend int 
00103          Comp_VesID_Decrease(const Vessel& Lhs, const Vessel& Rhs);
00104          
00105       // Compare by vessel length
00106       friend int 
00107          Comp_Length_Increase(const Vessel& Lhs, const Vessel& Rhs);
00108       friend int 
00109          Comp_Length_Decrease(const Vessel& Lhs, const Vessel& Rhs);
00110          
00111       // Compare by vessel wharfmark assigned.
00112       friend int 
00113          Comp_WharfMark_Increase(const Vessel& Lhs, const Vessel& Rhs);
00114       friend int 
00115          Comp_WharfMark_Decrease(const Vessel& Lhs, const Vessel& Rhs);
00116          
00117       // Compare by vessel arrive time
00118       friend int 
00119          Comp_ArriveTime_Increase(const Vessel& Lhs, const Vessel& Rhs);
00120       friend int 
00121          Comp_ArriveTime_Decrease(const Vessel& Lhs, const Vessel& Rhs);
00122          
00123       // Compare by vessel depart time
00124       friend int 
00125          Comp_DepartTime_Increase(const Vessel& Lhs, const Vessel& Rhs);
00126       friend int 
00127          Comp_DepartTime_Decrease(const Vessel& Lhs, const Vessel& Rhs);
00128          
00129       // Compare by density of the busiest Time Zone covered by vessel
00130       friend int 
00131          Comp_BigDensity_Increase(const Vessel& Lhs, const Vessel& Rhs);
00132       friend int 
00133          Comp_BigDensity_Decrease(const Vessel& Lhs, const Vessel& Rhs);   
00134          
00135       // Compare by average density of Time Zones covered by vessel
00136       friend int 
00137          Comp_AverageDensity_Increase(const Vessel& Lhs, const Vessel& Rhs);
00138       friend int 
00139          Comp_AverageDensity_Decrease(const Vessel& Lhs, const Vessel& Rhs);
00140          
00141       // Compare by number of Time Zones covered by vessel
00142       friend int 
00143          Comp_NumberTimeZone_Increase(const Vessel& Lhs, const Vessel& Rhs);
00144       friend int 
00145          Comp_NumberTimeZone_Decrease(const Vessel& Lhs, const Vessel& Rhs);
00146 
00147       // Compare by packing space   
00148       friend int 
00149          Comp_PackingSpace_Increase(const Vessel& Lhs, const Vessel& Rhs);
00150       friend int 
00151          Comp_PackingSpace_Decrease(const Vessel& Lhs, const Vessel& Rhs);
00152       
00153       // Compare by duration
00154       friend int 
00155          Comp_Duration_Increase(const Vessel& Lhs, const Vessel& Rhs);
00156       friend int
00157          Comp_Duration_Decrease(const Vessel& Lhs, const Vessel& Rhs);
00158 
00159       // Input and output operator overloadding          
00160       friend ostream& operator<<(ostream& aOutput, const Vessel& aVessel);
00161       friend istream& operator>>(istream& aInput, Vessel& aVessel);
00162 
00163       // Check whether two vessels are overlapped
00164       friend Bool
00165          IsOverlap(const Vessel& Lhs, const Vessel& Rhs);
00166 
00167 
00168       // For Gergov's 
00169       friend int
00170          Comp_Gerg(const Vessel& Lhs, const Vessel& Rhs);
00171 
00172       // Logical operators
00173       friend Bool
00174          operator==(const Vessel& Lhs, const Vessel& Rhs);
00175 
00176    private:
00177       // Private attributes.
00178       int  mID;
00179       int  mLength;
00180       int  mArriveTime;
00181       int  mDepartureTime;
00182       Bool mStatus;
00183       int  mWharfMark;
00184       int  mNumTimeZones;
00185       int  mBigDensity;
00186       int  mAverageDensity;
00187 
00188       // For use of Gergov's Algorithm
00189       int mVirtualLength;
00190       int mVirtualWharfMark;
00191 };
00192 
00193 
00194 #endif

Generated on Tue Sep 9 15:40:10 2008 for BAP by  doxygen 1.5.3