summaryrefslogtreecommitdiff
path: root/sources/scalac/atree/ATestOp.java
blob: 1d90f5ba0e1376ddcbd773eded60d63e3457f8da (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*     ____ ____  ____ ____  ______                                     *\
**    / __// __ \/ __// __ \/ ____/    SOcos COmpiles Scala             **
**  __\_ \/ /_/ / /__/ /_/ /\_ \       (c) 2002, LAMP/EPFL              **
** /_____/\____/\___/\____/____/                                        **
\*                                                                      */

// $Id$

package scalac.atree;

import scalac.util.Debug;

/** This class represents a test operation. */
public class ATestOp {

    //########################################################################
    // Public Cases

    /** An equality test */
    public case EQ;

    /** A non-equality test */
    public case NE;

    /** A less-than test */
    public case LT;

    /** A greater-than-or-equal test */
    public case GE;

    /** A less-than-or-equal test */
    public case LE;

    /** A greater-than test */
    public case GT;

    //########################################################################
    // Public Methods

    /** Returns the negation of this operation. */
    public ATestOp negate() {
        switch (this) {
        case EQ: return NE;
        case NE: return EQ;
        case LT: return GE;
        case GE: return LT;
        case LE: return GT;
        case GT: return LE;
        default: throw Debug.abort("unknown case", this);
        }
    }

    /** Returns a string representation of this operation. */
    public String toString() {
        switch (this) {
        case EQ: return "EQ";
        case NE: return "NE";
        case LT: return "LT";
        case GE: return "GE";
        case LE: return "LE";
        case GT: return "GT";
        default: throw Debug.abort("unknown case", this);
        }
    }

    //########################################################################
}