BAPS/packing/BP/IntervalSet.h

00001 /**********************************************************************
00002  *
00003  * Filename    : IntervalSet.h
00004  * Author      : Chen Li Wen
00005  *
00006  * Version     : 1.0
00007  * Date        : 09-28-98
00008  *
00009  * Description : Header file for class IntervalSet. It contains a set 
00010  *               of disjoint intervals and provides some operations.
00011  *               Intervals are sorted by non-decreasing left points.
00012  *
00013  * Reference   : nil
00014  *
00015  * Notes       : nil
00016  *
00017  * Changes     : nil
00018  *
00019  * Copyright   : Copyright (c) 1998
00020  *               All rights reserved by
00021  *               Resource Allocation and Scheduling Group
00022  *               Department of Computer Science
00023  *               School of Computing
00024  *               National University of Singapore
00025  *
00026  **********************************************************************/
00027 
00028 
00029 #ifndef __INTERVAL_SET_H__
00030 #define __INTERVAL_SET_H__
00031 
00032 
00033 #include "Interval.h"
00034 
00035 
00036 #include <LEDA/list.h>
00037 
00038 
00039 class IntervalSet
00040 {
00041    public:
00042 
00043       //
00044       // Constructor of class IntervalSet. It contains
00045       // a set of disjoint intervals.
00046       //
00047       
00048       IntervalSet();
00049       IntervalSet(const list<Interval> & aListOfInterval);
00050       IntervalSet(const IntervalSet & aIntervalSet);
00051       ~IntervalSet();
00052 
00053       
00054       //
00055       // Assignment operator 
00056       //
00057       
00058       IntervalSet & operator=(const IntervalSet & aIntervalSet);
00059 
00060       
00061       //
00062       // Debugger facility
00063       //
00064       
00065       void Print() const;
00066       
00067       
00068       //
00069       // Access methods
00070       //
00071       
00072       int      GetLength() const { return mLength; }
00073       Interval GetInterval(int aIndex) const
00074                { return mListOfInterval.inf(mListOfInterval[aIndex]); }
00075 
00076       
00077       //
00078       // Operations
00079       // For Remove, the interval being removed should
00080       // be in the interval set.
00081       //
00082       
00083       void Insert(Interval & aInterval);
00084       void Remove(Interval & aInterval);
00085 
00086       // 
00087       // Merge two sets of intervals, the result is an IntervalSet.
00088       //
00089       
00090       friend IntervalSet
00091              merge(const IntervalSet & Lhs, const IntervalSet & Rhs);
00092       
00093       friend ostream& 
00094              operator<<(ostream& os, const IntervalSet& aIntervalSet);
00095       friend istream&
00096              operator>>(istream& is, IntervalSet& aIntervalSet);
00097 
00098       
00099    private:
00100       
00101       list<Interval> mListOfInterval;
00102       int            mLength;
00103 };
00104 
00105 
00106 #endif
00107 

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