MemoryStateChange (MemoryStateChange history, DfaVariableValue var, Relation relation) { if (relation.myRelationType == RelationType.NE && relation.myCounterpart.getDfType() instanceof DfConstantType) { return history.findRelation(var, rel -> rel.equals(relation) || rel.myRelationType == RelationType.EQ && rel.myCounterpart.getDfType() instanceof DfConstantType, true); } MemoryStateChange exact = history.findRelation(var, rel -> rel.myCounterpart == relation.myCounterpart && relation.myRelationType.equals(rel.myRelationType), true); if (exact != null) { return exact; } return history.findRelation(var, rel -> rel.myCounterpart == relation.myCounterpart && relation.myRelationType.isSubRelation(rel.myRelationType), true); }