protected DistinctVariableOnlyDataAtomImpl(AtomPredicate predicate, ImmutableList<Variable> variables) { super(predicate, variables); if (!DataAtomTools.areVariablesDistinct(variables)) { throw new IllegalArgumentException("Variables must be distinct!"); } }
@Override public DataAtom getDataAtom(AtomPredicate predicate, ImmutableList<? extends VariableOrGroundTerm> arguments) { /** * NB: A GroundDataAtom is a DistinctVariableDataAtom */ if(areVariablesDistinct(arguments)) { return getDistinctVariableDataAtom(predicate, arguments); } else if (isVariableOnly(arguments)) { return new VariableOnlyDataAtomImpl(predicate, (ImmutableList<Variable>)(ImmutableList<?>)arguments); } else { return new DataAtomImpl(predicate, arguments); } }
@Override public DistinctVariableDataAtom getDistinctVariableDataAtom(AtomPredicate predicate, ImmutableList<? extends VariableOrGroundTerm> arguments) { if (isVariableOnly(arguments)) { return new DistinctVariableOnlyDataAtomImpl(predicate, (ImmutableList<Variable>)(ImmutableList<?>)arguments); } else if (GroundTermTools.areGroundTerms(arguments)) { return new GroundDataAtomImpl(predicate, (ImmutableList<GroundTerm>)(ImmutableList<?>)arguments); } else { return new NonGroundDistinctVariableDataAtomImpl(predicate, arguments); } }
protected DistinctVariableOnlyDataAtomImpl(AtomPredicate predicate, ImmutableList<Variable> variables) { super(predicate, variables); if (!DataAtomTools.areVariablesDistinct(variables)) { throw new IllegalArgumentException("Variables must be distinct!"); } }
protected NonGroundDistinctVariableDataAtomImpl(AtomPredicate predicate, ImmutableList<? extends VariableOrGroundTerm> arguments) { super(predicate, arguments); if (!DataAtomTools.areVariablesDistinct(arguments)) { throw new IllegalArgumentException("The given variables are not distinct!"); } }
@Override public VariableOnlyDataAtom getVariableOnlyDataAtom(AtomPredicate predicate, ImmutableList<Variable> arguments) { if (areVariablesDistinct(arguments)) { return new DistinctVariableOnlyDataAtomImpl(predicate, arguments); } else { return new VariableOnlyDataAtomImpl(predicate, arguments); } }