@Override public boolean hasSamePredicateAndArity(DataAtom otherAtom) { if (!predicate.equals(otherAtom.getPredicate())) return false; if (getEffectiveArity() != otherAtom.getEffectiveArity()) return false; return true; }
private static ImmutableSubstitution<VariableOrGroundTerm> extractSubstitution(DistinctVariableOnlyDataAtom sourceAtom, DataAtom targetAtom) { if (!sourceAtom.getPredicate().equals(targetAtom.getPredicate())) { throw new IllegalStateException("Incompatible predicates"); } else if (sourceAtom.getEffectiveArity() != targetAtom.getEffectiveArity()) { throw new IllegalStateException("Different arities"); } ImmutableMap<Variable, VariableOrGroundTerm> newMap = FunctionalTools.zip( sourceAtom.getArguments(), (ImmutableList<VariableOrGroundTerm>) targetAtom.getArguments()).stream() .collect(ImmutableCollectors.toMap()); return SUBSTITUTION_FACTORY.getSubstitution(newMap); }
private ImmutableSubstitution<VariableOrGroundTerm> extractSubstitution(DistinctVariableOnlyDataAtom sourceAtom, DataAtom targetAtom) { if (!sourceAtom.getPredicate().equals(targetAtom.getPredicate())) { throw new IllegalStateException("Incompatible predicates"); } else if (sourceAtom.getEffectiveArity() != targetAtom.getEffectiveArity()) { throw new IllegalStateException("Different arities"); } ImmutableMap<Variable, VariableOrGroundTerm> newMap = FunctionalTools.zip( sourceAtom.getArguments(), (ImmutableList<VariableOrGroundTerm>) targetAtom.getArguments()).stream() .collect(ImmutableCollectors.toMap()); return substitutionFactory.getSubstitution(newMap); } }