< prev index next >

src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/GreaterThan.java

Print this page




  46   {
  47     super (">", leftOperand, rightOperand);
  48   } // ctor
  49 
  50   public Object evaluate () throws EvaluationException
  51   {
  52     try
  53     {
  54       Object left = left ().evaluate ();
  55       Object right = right ().evaluate ();
  56       if (left instanceof Boolean)
  57       {
  58         String[] parameters = {Util.getMessage ("EvaluationException.greaterThan"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
  59         throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
  60       }
  61       else
  62       {
  63         Number l = (Number)left;
  64         Number r = (Number)right ().evaluate ();
  65         if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
  66           value (new Boolean (l.doubleValue () > r.doubleValue ()));
  67         else
  68           //daz          value (new Boolean (l.longValue () > r.longValue ()));
  69           value (new Boolean ( ((BigInteger)l).compareTo ((BigInteger)r) > 0));
  70       }
  71     }
  72     catch (ClassCastException e)
  73     {
  74       String[] parameters = {Util.getMessage ("EvaluationException.greaterThan"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
  75       throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
  76     }
  77     return value ();
  78   } // evaluate
  79 } // class GreaterThan


  46   {
  47     super (">", leftOperand, rightOperand);
  48   } // ctor
  49 
  50   public Object evaluate () throws EvaluationException
  51   {
  52     try
  53     {
  54       Object left = left ().evaluate ();
  55       Object right = right ().evaluate ();
  56       if (left instanceof Boolean)
  57       {
  58         String[] parameters = {Util.getMessage ("EvaluationException.greaterThan"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
  59         throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
  60       }
  61       else
  62       {
  63         Number l = (Number)left;
  64         Number r = (Number)right ().evaluate ();
  65         if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
  66           value (Boolean.valueOf (l.doubleValue () > r.doubleValue ()));
  67         else
  68           //daz          value (new Boolean (l.longValue () > r.longValue ()));
  69           value (Boolean.valueOf ( ((BigInteger)l).compareTo ((BigInteger)r) > 0));
  70       }
  71     }
  72     catch (ClassCastException e)
  73     {
  74       String[] parameters = {Util.getMessage ("EvaluationException.greaterThan"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
  75       throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
  76     }
  77     return value ();
  78   } // evaluate
  79 } // class GreaterThan
< prev index next >