summaryrefslogtreecommitdiff
path: root/src/bindings/compat/java/src/cvc3/Op.java
blob: 7893d95a50dcb6c3a7fcc935d15d1617e26771ef (plain)
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
package cvc3;

import java.util.*;

public class Op extends Embedded {
    // jni methods
    private static native boolean
	jniEquals(Object Expr1, Object Expr2) throws Cvc3Exception;
    private static native String
	jniToString(Object Expr) throws Cvc3Exception;

    private static native Object
	jniGetExpr(Object op) throws Cvc3Exception;
    private static native boolean
	jniIsNull(Object Op) throws Cvc3Exception;

    /// Constructor

    public Op(Object Op, EmbeddedManager embeddedManager) {
	super(Op, embeddedManager);
    }


    /// API (immutable)

    public boolean equals(Object o) {
	if (this == o) return true;

	if (!(o instanceof Op)) return false;
	boolean result = false;
	try {
	    result = jniEquals(embedded(), ((Embedded)o).embedded());
	} catch (Cvc3Exception e) {
	    assert(false);
	}
	return result;
    } 
 
    // must return the same hash code for two objects if equals returns true
    public int hashCode() {
	try {
	    return getExpr().hashCode();
	} catch (Cvc3Exception e) {
	    assert(false);
	}
	return 0;
    }
    
    public String toString() {
	String result = "";
	try {
	    result = jniToString(embedded());
	} catch (Cvc3Exception e) {
	    assert(false);
	}
	return result;
    }
 
    public ExprMut getExpr() throws Cvc3Exception {
	return new ExprMut(jniGetExpr(embedded()), embeddedManager());
    }

    public boolean isNull() throws Cvc3Exception {
	return jniIsNull(embedded());
    }
}
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback