Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

/magnus/back_end/general/include/Int2.h

Go to the documentation of this file.
00001 /*
00002  *   $Id: Int2.h,v 1.1 1999/11/23 22:31:19 bormotov Exp $
00003  */
00004 
00005 // Copyright (C) 1994 The New York Group Theory Cooperative
00006 // See magnus/doc/COPYRIGHT for the full notice.
00007 
00008 // Contents: Definition and implementation of class Int2
00009 //
00010 // Principal Author: Dmitry Bormotov
00011 //
00012 // Status: temporary
00013 //
00014 // Revision History:
00015 
00016 
00017 #ifndef _Int2_H_
00018 #define _Int2_H_
00019 
00020 
00021 #include "global.h"
00022 
00023 
00024 struct Int2 {
00025 
00026   Int2( ) : v(0) { }
00027 
00028   Int2( int x ) : v(x) { }
00029 
00030   int compare( Int2 x ) const {
00031     if( this->v < x.v ) return -1;
00032     else if( this->v > x.v ) return 1;
00033     else return 0;
00034   }
00035 
00036   friend ostream& operator << ( ostream& ostr, const Int2& i )
00037   {
00038     ostr << i.v;
00039     return ostr;
00040   }
00041 
00042   bool operator == ( const Int2& i ) const { return v == i.v; }
00043 
00044   bool operator != ( const Int2& i ) const { return !(*this == i); }
00045 
00046   Int2 operator - ( ) const { return -v; }
00047 
00048   Int2 operator + ( const Int2& i ) const { return v + i.v; }
00049 
00050   Int2& operator += ( const Int2& i ) { v += i.v; return *this; }
00051 
00052   Int2 operator * ( const Int2& i ) const { return v * i.v; }
00053 
00054   Int2& operator *= ( const Int2& i ) { v *= i.v; return *this; }
00055 
00056   bool operator < ( const Int2& i ) const { return v < i.v; }
00057 
00058   bool operator > ( const Int2& i ) const { return v > i.v; }
00059 
00060   int value( ) const { return v; }
00061 
00062 private:
00063 
00064   int v;
00065 };
00066 
00067 #endif

Generated at Tue Jun 19 09:49:35 2001 for Magnus Classes by doxygen1.2.6 written by Dimitri van Heesch, © 1997-2001