Main Page | Class Hierarchy | Alphabetical List | Data Structures | File List | Data Fields | Globals

MRAcrange.h File Reference

#include <iostream.h>
#include "BufferBase.h"
#include "MRAclevel.h"

Include dependency graph for MRAcrange.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Data Structures

class  MRAcrange

Functions

bool connected (MRAcrange, MRAcrange)
bool contains (MRAcrange, MRAcrange)
MRAcrange Difference (MRAcrange, MRAcrange)
bool disjoint (MRAcrange, MRAcrange)
bool equal (MRAcrange, MRAcrange)
bool interior (MRAcrange, MRAcrange)
MRAcrange Intersection (MRAcrange, MRAcrange)
MRAcrange operator * (MRAcrange lhs, MRAcrange rhs)
bool operator!= (MRAcrange lhs, MRAcrange rhs)
MRAcrange operator+ (MRAcrange lhs, MRAcrange rhs)
MRAcrange operator- (MRAcrange lhs, MRAcrange rhs)
bool operator< (MRAcrange lhs, MRAcrange rhs)
ostream & operator<< (ostream &os, MRAcrange &crange)
BufferBaseoperator<< (BufferBase &buffer, MRAcrange &crange)
bool operator<= (MRAcrange lhs, MRAcrange rhs)
bool operator== (MRAcrange lhs, MRAcrange rhs)
bool operator> (MRAcrange lhs, MRAcrange rhs)
bool operator>= (MRAcrange lhs, MRAcrange rhs)
istream & operator>> (istream &is, MRAcrange &crange)
BufferBaseoperator>> (BufferBase &buffer, MRAcrange &crange)
MRAcrange Union (MRAcrange, MRAcrange)


Function Documentation

bool connected MRAcrange  ,
MRAcrange 
 

Definition at line 51 of file MRAcrange.cpp.

References MRAcrange.cmax, MRAcrange.cmin, MRAcrange.good(), and MRAcrange.is_empty().

00052 {
00053    if ( !lhs.good() || !rhs.good() || !lhs || !rhs ) return false;
00054    if ( lhs.is_empty() || rhs.is_empty() ) return false;
00055    if ( lhs <= rhs || lhs >= rhs ) return true;
00056    if ( int(lhs.cmin) <= int(rhs.cmin) && int(lhs.cmax) >= int(rhs.cmin) - 1 ) 
00057       return true;
00058    if ( int(lhs.cmax) >= int(rhs.cmax) && int(lhs.cmin) <= int(rhs.cmax) + 1 ) 
00059       return true;
00060    return false;
00061 }

bool contains MRAcrange  ,
MRAcrange 
 

Definition at line 29 of file MRAcrange.cpp.

References MRAcrange.cmax, MRAcrange.cmin, MRAcrange.good(), and MRAcrange.is_empty().

00030 {
00031    if ( !lhs.good() || !rhs.good() || !lhs || !rhs ) return false;
00032    if ( rhs.is_empty() ) return true;
00033    if ( lhs.is_empty() ) return false;
00034    if ( int(rhs.cmin) < int(lhs.cmin) || int(rhs.cmax) > int(lhs.cmax) ) 
00035       return false;
00036    return true;
00037 }

MRAcrange Difference MRAcrange  ,
MRAcrange 
 

Definition at line 115 of file MRAcrange.cpp.

References MRAcrange.clrstate(), MRAcrange.cmax, MRAcrange.cmin, disjoint(), MRAcrange.good(), interior(), MRAcrange.is_empty(), MRAcrange.set_empty(), and MRAcrange.setstate().

00116 {
00117    MRAcrange crange;
00118    if ( !lhs.good() || !rhs.good() || !lhs || !rhs ) {
00119       crange.clrstate(MRAcrange::goodbit);
00120       crange.setstate(MRAcrange::failbit);
00121    } else if ( lhs.is_empty() ) {
00122       crange = lhs;
00123    } else if ( rhs.is_empty() ) {
00124       crange = rhs;
00125    } else if ( disjoint( lhs, rhs ) ) {
00126       crange = lhs;
00127    } else if ( lhs == rhs ) {
00128       crange.set_empty();
00129    } else if ( lhs < rhs ) {
00130       crange.set_empty();
00131    } else if ( interior( lhs, rhs) ) {
00132       crange.clrstate(MRAcrange::goodbit);
00133       crange.setstate(MRAcrange::failbit);
00134       crange.setstate(MRAcrange::fragbit);
00135    } else {
00136       if ( interior( rhs, lhs ) ) {
00137          crange = lhs;
00138          crange.clrstate(MRAcrange::goodbit);
00139          crange.setstate(MRAcrange::failbit);
00140          crange.setstate(MRAcrange::fragbit);
00141       } else {
00142          crange = lhs; 
00143          if ( int(rhs.cmin) > int(lhs.cmin) ) crange.cmax = rhs.cmin - 1;
00144          if ( int(rhs.cmax) < int(lhs.cmax) ) crange.cmin = rhs.cmax + 1;
00145       }
00146    } 
00147    return crange;
00148 }

bool disjoint MRAcrange  ,
MRAcrange 
 

Definition at line 39 of file MRAcrange.cpp.

References MRAcrange.cmax, MRAcrange.cmin, MRAcrange.good(), and MRAcrange.is_empty().

00040 {
00041    if ( !lhs.good() || !rhs.good() || !lhs || !rhs ) return false;
00042    if ( lhs.is_empty() || rhs.is_empty() ) return false;
00043    if ( lhs <= rhs || lhs >= rhs ) return false;
00044    if ( int(lhs.cmin) < int(rhs.cmin) && int(lhs.cmax) < int(rhs.cmin) ) 
00045       return true;
00046    if ( int(lhs.cmin) > int(rhs.cmax) && int(lhs.cmax) > int(rhs.cmax) ) 
00047       return true;
00048    return false;
00049 }

bool equal MRAcrange  ,
MRAcrange 
 

Definition at line 21 of file MRAcrange.cpp.

References MRAcrange._state, MRAcrange.cmax, and MRAcrange.cmin.

00022 {
00023    if ( lhs._state != rhs._state ) return false;
00024    if ( lhs.cmin != rhs.cmin ) return false;
00025    if ( lhs.cmax != rhs.cmax ) return false;
00026    return true;
00027 }

bool interior MRAcrange  ,
MRAcrange 
 

Definition at line 63 of file MRAcrange.cpp.

References MRAcrange.cmax, MRAcrange.cmin, disjoint(), MRAcrange.good(), and MRAcrange.is_empty().

00064 {
00065    if ( !lhs.good() || !rhs.good() || !lhs || !rhs ) return false;
00066    if ( lhs.is_empty() || rhs.is_empty() ) return false;
00067    if ( lhs >= rhs || disjoint( lhs, rhs ) ) return false;
00068    if ( int(lhs.cmin) <= int(rhs.cmin) || int(lhs.cmax) >= int(rhs.cmax) ) 
00069       return false;
00070    return true;
00071 }

MRAcrange Intersection MRAcrange  ,
MRAcrange 
 

Definition at line 95 of file MRAcrange.cpp.

References MRAcrange.clrstate(), MRAcrange.cmax, MRAcrange.cmin, disjoint(), MRAcrange.good(), MRAcrange.is_empty(), MRAcrange.set_empty(), and MRAcrange.setstate().

00096 {
00097    MRAcrange crange;
00098    if ( !lhs.good() || !rhs.good() || !lhs || !rhs ) {
00099       crange.clrstate(MRAcrange::goodbit);
00100       crange.setstate(MRAcrange::failbit);
00101    } else if ( lhs.is_empty() ) {
00102       crange = lhs;
00103    } else if ( rhs.is_empty() ) {
00104       crange = rhs;
00105    } else if ( disjoint( lhs, rhs ) ) {
00106       crange.set_empty();
00107    } else {
00108       crange = lhs;
00109       if ( int(rhs.cmin) > int(crange.cmin) ) crange.cmin = rhs.cmin;
00110       if ( int(rhs.cmax) < int(crange.cmax) ) crange.cmax = rhs.cmax;
00111    } 
00112    return crange;
00113 }

MRAcrange operator * MRAcrange  lhs,
MRAcrange  rhs
 

Definition at line 165 of file MRAcrange.h.

References Intersection().

00166 {
00167    return Intersection( lhs, rhs );
00168 }

bool operator!= MRAcrange  lhs,
MRAcrange  rhs
 

Definition at line 117 of file MRAcrange.h.

References equal().

00118 {
00119    return !equal( rhs, lhs );
00120 }

MRAcrange operator+ MRAcrange  lhs,
MRAcrange  rhs
 

Definition at line 157 of file MRAcrange.h.

References Union().

00158 {
00159    return Union( lhs, rhs );
00160 }

MRAcrange operator- MRAcrange  lhs,
MRAcrange  rhs
 

Definition at line 173 of file MRAcrange.h.

References Difference().

00174 {
00175    return Difference( lhs, rhs );
00176 }

bool operator< MRAcrange  lhs,
MRAcrange  rhs
 

Definition at line 125 of file MRAcrange.h.

References contains().

00126 {
00127    return contains( rhs, lhs ) && lhs != rhs;
00128 }

ostream& operator<< ostream &  os,
MRAcrange crange
 

Definition at line 411 of file MRAcrange.h.

References MRAcrange.read().

00412 {
00413    crange.read(os);
00414    return os;
00415 }

BufferBase& operator<< BufferBase buffer,
MRAcrange crange
 

Definition at line 397 of file MRAcrange.h.

References MRAcrange.read().

00398 {
00399    crange.read(buffer);
00400    return buffer;
00401 }

bool operator<= MRAcrange  lhs,
MRAcrange  rhs
 

Definition at line 137 of file MRAcrange.h.

References contains().

00138 {
00139    return contains( rhs, lhs );
00140 }

bool operator== MRAcrange  lhs,
MRAcrange  rhs
 

Definition at line 111 of file MRAcrange.h.

References equal().

00112 {
00113    return equal( rhs, lhs );
00114 }

bool operator> MRAcrange  lhs,
MRAcrange  rhs
 

Definition at line 131 of file MRAcrange.h.

References contains().

00132 {
00133    return contains( lhs, rhs ) && lhs != rhs;
00134 }

bool operator>= MRAcrange  lhs,
MRAcrange  rhs
 

Definition at line 143 of file MRAcrange.h.

References contains().

00144 {
00145    return contains( lhs, rhs );
00146 }

istream& operator>> istream &  is,
MRAcrange crange
 

Definition at line 404 of file MRAcrange.h.

References MRAcrange.write().

00405 {
00406    crange.write(is);
00407    return is;
00408 }

BufferBase& operator>> BufferBase buffer,
MRAcrange crange
 

Definition at line 390 of file MRAcrange.h.

References MRAcrange.write().

00391 {
00392    crange.write(buffer);
00393    return buffer;
00394 }

MRAcrange Union MRAcrange  ,
MRAcrange 
 

Definition at line 73 of file MRAcrange.cpp.

References MRAcrange.clrstate(), MRAcrange.cmax, MRAcrange.cmin, connected(), MRAcrange.good(), MRAcrange.is_empty(), and MRAcrange.setstate().

00074 {
00075    MRAcrange crange;
00076    if ( !lhs.good() || !rhs.good() || !lhs || !rhs ) {
00077       crange.clrstate(MRAcrange::goodbit);
00078       crange.setstate(MRAcrange::failbit);
00079    } else if ( rhs.is_empty() ) {
00080       crange = lhs;
00081    } else if ( lhs.is_empty() ) {
00082       crange = rhs;
00083    } else if ( !connected( lhs, rhs ) ) {
00084       crange.clrstate(MRAcrange::goodbit);
00085       crange.setstate(MRAcrange::failbit);
00086       crange.setstate(MRAcrange::fragbit);
00087    } else {
00088       crange = lhs;
00089       if ( int(rhs.cmin) < int(crange.cmin) ) crange.cmin = rhs.cmin;
00090       if ( int(rhs.cmax) > int(crange.cmin) ) crange.cmax = rhs.cmax;
00091    } 
00092    return crange;
00093 }


Generated on Mon May 31 21:40:15 2004 for SR2k4 Assembler by doxygen 1.3.6