01: /*
02: * @(#)Numeric.java 1.2 04/12/06
03: *
04: * Copyright (c) 1997-2003 Sun Microsystems, Inc. All Rights Reserved.
05: *
06: * See the file "LICENSE.txt" for information on usage and redistribution
07: * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
08: */
09: package pnuts.lang;
10:
11: /**
12: * In Pnuts, arithmetic operations for objects implements this interface causes
13: * a call of the corresponding methods in this interface. See <a
14: * href="http://pnuts.org/doc/lang.html#sugar">Pnuts Language Specification </a>
15: * for details.
16: *
17: * @version 1.1
18: * @author Toyokazu Tomatsu
19: */
20: public interface Numeric {
21: /**
22: * Adds the value of parameter to itself
23: */
24: Object add(Object obj);
25:
26: /**
27: * Subtracts the value of parameter from the object
28: */
29: Object subtract(Object obj);
30:
31: /**
32: * Multiplies itself with the value of parameter
33: */
34: Object multiply(Object o);
35:
36: /**
37: * Divides itself by the value of parameter
38: */
39: Object divide(Object obj);
40:
41: /**
42: * Negates itself by the value of parameter
43: */
44: Object negate();
45:
46: /**
47: * Inverts itself
48: */
49: Object inverse();
50:
51: /**
52: * Compares the object with the parameter. returns one of the followings:
53: * NOT_EQUAL, LEFT_IS_BIGGER, RIGHT_IS_BIGGER, EQUAL
54: */
55: int compareTo(Object o); // >, <, <=, >=, ==, !=
56:
57: int NOT_EQUAL = 2;
58:
59: int LEFT_IS_BIGGER = 1;
60:
61: int RIGHT_IS_BIGGER = -1;
62:
63: int EQUAL = 0;
64: }
|