Re: Passing "<", ">", "=", etc as an argument to a method?

From: Stewart Gordon (smjg_1998_at_yahoo.com)
Date: 11/28/03


Date: Fri, 28 Nov 2003 16:50:10 +0000

While it was 28/11/03 1:37 am throughout the UK, Anthony Borla sprinkled
little black dots on a white screen, and they fell thus:

<snip>
> if (relationalOp.equals("<"))
> doLessThan(value1, value2)
> else if (relationalOp.equals("="))
> doEquals(value1, value2)
> ...

Why not make relationalOp a number, and save the overhead of doing
string comparison?

Define

        final static int EQ = 1;
        final static int GT = 2;
        final static int GTEQ = 3;
        final static int LT = 4;
        final static int LTEQ = 5;
        final static int NOTEQ = 6;

and pass these values in.

Stewart.

-- 
My e-mail is valid but not my primary mailbox, aside from its being the 
unfortunate victim of intensive mail-bombing at the moment.  Please keep 
replies on the 'group where everyone may benefit.


Relevant Pages

  • Re: Using pointers in Java
    ... little black dots on a white screen, ... unfortunate victim of intensive mail-bombing at the moment. ...
    (comp.lang.java)
  • Re: Not STL newsgroup... Where?
    ... little black dots on a white screen, ... My e-mail is valid but not my primary mailbox, ... unfortunate victim of intensive mail-bombing at the moment. ...
    (comp.lang.cpp)
  • Re: petition to retire Fortran
    ... Madhusudan Singh wrote: ... unfortunate victim of intensive mail-bombing at the moment. ...
    (comp.lang.fortran)
  • Re: overloading ! operator for factorial
    ... sprinkled little black dots on a white screen, ... > would implement them for int. ... the dot product of vectors, particularly if you want to implement cross ...
    (comp.lang.cpp)
  • Re: Exes
    ... little black dots on a white screen, ... My e-mail is valid but not my primary mailbox. ... Please keep replies on ...
    (comp.lang.java)