pnuts.lang
Interface Numeric

All Known Implementing Classes:
Complex, Quantity, Fraction

public interface Numeric

In Pnuts, arithmetic operations for objects implements this interface causes a call of the corresponding methods in this interface. See Pnuts Language Specification for details.


Field Summary
static int EQUAL
           
static int LEFT_IS_BIGGER
           
static int NOT_EQUAL
           
static int RIGHT_IS_BIGGER
           
 
Method Summary
 java.lang.Object add(java.lang.Object obj)
          adds the value of parameter to itself
 int compareTo(java.lang.Object o)
          compare the object with the parameter.
 java.lang.Object divide(java.lang.Object obj)
          divides itself by the value of parameter
 java.lang.Object inverse()
          inverts itself
 java.lang.Object multiply(java.lang.Object o)
          multiplies itself with the value of parameter
 java.lang.Object negate()
          negates itself by the value of parameter
 java.lang.Object subtract(java.lang.Object obj)
          subtracts the value of parameter from the object
 

Field Detail

NOT_EQUAL

public static final int NOT_EQUAL

LEFT_IS_BIGGER

public static final int LEFT_IS_BIGGER

RIGHT_IS_BIGGER

public static final int RIGHT_IS_BIGGER

EQUAL

public static final int EQUAL
Method Detail

add

public java.lang.Object add(java.lang.Object obj)
adds the value of parameter to itself

subtract

public java.lang.Object subtract(java.lang.Object obj)
subtracts the value of parameter from the object

multiply

public java.lang.Object multiply(java.lang.Object o)
multiplies itself with the value of parameter

divide

public java.lang.Object divide(java.lang.Object obj)
divides itself by the value of parameter

negate

public java.lang.Object negate()
negates itself by the value of parameter

inverse

public java.lang.Object inverse()
inverts itself

compareTo

public int compareTo(java.lang.Object o)
compare the object with the parameter. returns one of the followings: NOT_EQUAL, LEFT_IS_BIGGER, RIGHT_IS_BIGGER, EQUAL