BooleanTerm extends HashSet<BooleanVar> { @Override public boolean equals(Object other) { if (this == FALSE && other == TRUE || this == TRUE && other == FALSE) { return false; } return super.equals(other); } private  BooleanTerm();  BooleanTerm(BooleanVar var);  BooleanTerm(Set<BooleanVar> term);  BooleanTerm(String str); boolean isTrue(); boolean isFalse(); BooleanTerm resolveWith(Features features); BooleanTerm resolveWith(Features features, boolean coerceUndefinedToFalse); BooleanTerm andWith(BooleanTerm other); @Override String toString(); @Override boolean add(BooleanVar object); @Override void clear(); @Override boolean remove(Object object); @Override boolean removeAll(Collection<?> collection); @Override boolean addAll(Collection<? extends BooleanVar> collection); @Override boolean retainAll(Collection<?> collection); @Override int hashCode(); @Override boolean equals(Object other); static final BooleanTerm TRUE; static final BooleanTerm FALSE; }
@Test public void testEquals() { assertTrue(BooleanTerm.TRUE.equals(BooleanTerm.TRUE)); assertTrue(BooleanTerm.FALSE.equals(BooleanTerm.FALSE)); assertFalse(BooleanTerm.TRUE.equals(BooleanTerm.FALSE)); assertFalse(BooleanTerm.FALSE.equals(BooleanTerm.TRUE)); assertFalse(BooleanTerm.TRUE.equals(new BooleanTerm("A"))); assertFalse(new BooleanTerm("A").equals(BooleanTerm.TRUE)); assertFalse(BooleanTerm.FALSE.equals(new BooleanTerm("A"))); assertFalse(new BooleanTerm("A").equals(BooleanTerm.FALSE)); assertTrue(new BooleanTerm("A*!B").equals(new BooleanTerm("!B*A"))); assertFalse(new BooleanTerm("A*!B").equals(new BooleanTerm("B*A"))); }