3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-11 09:44:43 +00:00

Fixed .equals for AST, FuncDecl, and Sort, and AST.compareTo in Java

Fixes #143
This commit is contained in:
Christoph M. Wintersteiger 2015-07-14 13:09:00 -07:00
parent 5f755a5bd8
commit 1bad614646
3 changed files with 21 additions and 26 deletions

View file

@ -22,10 +22,8 @@ import com.microsoft.z3.enumerations.Z3_ast_kind;
/**
* The abstract syntax tree (AST) class.
**/
public class AST extends Z3Object
public class AST extends Z3Object implements Comparable
{
/* Overloaded operators are not translated. */
/**
* Object comparison.
*
@ -35,7 +33,7 @@ public class AST extends Z3Object
{
AST casted = null;
try
try
{
casted = AST.class.cast(o);
} catch (ClassCastException e)
@ -43,8 +41,13 @@ public class AST extends Z3Object
return false;
}
return this.getNativeObject() == casted.getNativeObject();
}
return
(this == casted) ||
(this != null) &&
(casted != null) &&
(getContext().nCtx() == casted.getContext().nCtx()) &&
(Native.isEqAst(getContext().nCtx(), getNativeObject(), casted.getNativeObject()));
}
/**
* Object Comparison.