BooleanTerm extends HashSet<BooleanVar> { @Override public int hashCode() { if (this == FALSE) { return Boolean.FALSE.hashCode(); } else if (this == TRUE) { return Boolean.TRUE.hashCode(); } return super.hashCode(); } 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 testHashCode() { assertEquals(Boolean.FALSE.hashCode(), BooleanTerm.FALSE.hashCode()); assertEquals(Boolean.TRUE.hashCode(), BooleanTerm.TRUE.hashCode()); assertEquals(new BooleanTerm("A*!B").hashCode(), new BooleanTerm("!B*A").hashCode()); assertNotSame(new BooleanTerm("A*!B").hashCode(), new BooleanTerm("B*A").hashCode()); }