public void meet(SameTerm sameTerm) {
super.meet(sameTerm);
if (sameTerm.getParentNode() instanceof Filter) {
// SameTerm applies to the filter's argument
Filter filter = (Filter)sameTerm.getParentNode();
ValueExpr leftArg = sameTerm.getLeftArg();
ValueExpr rightArg = sameTerm.getRightArg();
// Verify that vars are bound by filterArg
Set<String> bindingNames = filter.getArg().getBindingNames();
if (leftArg instanceof Var && !bindingNames.contains(((Var)leftArg).getName())
|| rightArg instanceof Var && !bindingNames.contains(((Var)rightArg).getName()))
{
// One or both var(s) are unbound, this expression will never
// return any results
filter.replaceWith(new EmptySet());
return;
}
if (leftArg instanceof Var && rightArg instanceof Var) {
// Rename rightArg to leftArg