mirror of
https://github.com/Z3Prover/z3
synced 2025-06-15 02:16:16 +00:00
Proper idiomatic isEquals implementation.
This commit is contained in:
parent
92bb984305
commit
56db1867ef
1 changed files with 6 additions and 9 deletions
|
@ -49,17 +49,14 @@ public class Symbol extends Z3Object
|
||||||
return getKind() == Z3_symbol_kind.Z3_STRING_SYMBOL;
|
return getKind() == Z3_symbol_kind.Z3_STRING_SYMBOL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean equals(Object o)
|
public boolean equals(Object o)
|
||||||
{
|
{
|
||||||
Symbol casted = null;
|
if (o == null) return false;
|
||||||
try {
|
if (o == this) return true;
|
||||||
casted = Symbol.class.cast(o);
|
if (o.getClass() != this.getClass()) return false;
|
||||||
}
|
Symbol other = (Symbol) o;
|
||||||
catch (ClassCastException e) {
|
return this.getNativeObject() == other.getNativeObject();
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return this.getNativeObject() == casted.getNativeObject();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue