proj home

Files   Classes   Functions   Hierarchy  

rpngreaterthan Class Reference

#include <rpnfunc.h>

Inheritance diagram for rpngreaterthan:
Collaboration diagram for rpngreaterthan:

List of all members.

Public Member Functions

 rpngreaterthan ()
 rpngreaterthan (deque< rpnbase * > &ds, bool const evaluate=true)
 ~rpngreaterthan ()
rpnbasecopy () const
void visit (deque< rpnbase * > &ds, rpnreal &n)
void visit (deque< rpnbase * > &ds, rpninteger &n)
string const name () const
void eval (deque< rpnbase * > &ds)


Detailed Description

Definition at line 777 of file rpnfunc.h.


Constructor & Destructor Documentation

rpngreaterthan::rpngreaterthan (  )  [inline]

Definition at line 781 of file rpnfunc.h.

Referenced by copy().

00781 {}

rpngreaterthan::rpngreaterthan ( deque< rpnbase * > &  ds,
bool const   evaluate = true 
)

Definition at line 2159 of file rpnfunc.cpp.

References eval().

02160 {
02161   if (evaluate)
02162     eval(ds);
02163   else
02164     ds.push_front(this);
02165 }

rpngreaterthan::~rpngreaterthan (  )  [inline]

Definition at line 783 of file rpnfunc.h.

00783 {}


Member Function Documentation

rpnbase * rpngreaterthan::copy (  )  const [virtual]

Reimplemented from rpnfunction.

Definition at line 2167 of file rpnfunc.cpp.

References rpngreaterthan().

02168 {
02169   return new rpngreaterthan();
02170 }

void rpngreaterthan::eval ( deque< rpnbase * > &  ds  )  [virtual]

Reimplemented from rpnfunction.

Definition at line 2172 of file rpnfunc.cpp.

References rpnbase::accept(), and rpnbase::dec().

Referenced by rpngreaterthan().

02173 {
02174   if (ds.size()>1)
02175     ds[0]->accept(ds,*this);
02176 
02177   dec();
02178 }

string const rpngreaterthan::name (  )  const [inline, virtual]

Reimplemented from rpnfunction.

Definition at line 789 of file rpnfunc.h.

00789 { return string(">"); }

void rpngreaterthan::visit ( deque< rpnbase * > &  ds,
rpninteger n 
) [virtual]

Reimplemented from rpnfunction.

Definition at line 2201 of file rpnfunc.cpp.

References rpnbase::dec(), rpnbase::isinteger(), rpnbase::isreal(), and rpninteger::num.

02202 {
02203   rpnbase* x0 = ds.front();
02204   ds.pop_front();
02205   rpnbase* x1 = ds.front();
02206   ds.pop_front();
02207 
02208   if ( x1->isreal())
02209   {
02210     new rpninteger(ds, ((rpnreal*)x1)->num > n.num );
02211   }
02212   else
02213   if ( x1->isinteger())
02214   {
02215     new rpninteger(ds, ((rpninteger*)x1)->num > n.num );
02216   }
02217 
02218   x0->dec();
02219   x1->dec();
02220 }

void rpngreaterthan::visit ( deque< rpnbase * > &  ds,
rpnreal n 
) [virtual]

Reimplemented from rpnfunction.

Definition at line 2180 of file rpnfunc.cpp.

References rpnbase::dec(), rpnbase::isinteger(), rpnbase::isreal(), and rpnreal::num.

02181 {
02182   rpnbase* x0 = ds.front();
02183   ds.pop_front();
02184   rpnbase* x1 = ds.front();
02185   ds.pop_front();
02186 
02187   if ( x1->isinteger())
02188   {
02189     new rpninteger(ds, ((rpninteger*)x1)->num > n.num );
02190   }
02191   else
02192   if (x1->isreal())
02193   {
02194     new rpninteger(ds, ((rpnreal*)x1)->num > n.num );
02195   }
02196 
02197   x0->dec();
02198   x1->dec();
02199 }


The documentation for this class was generated from the following files:

Generated on Fri Mar 4 00:50:14 2011 for Chelton Evans Source by  doxygen 1.5.8