protected GroundExpressionImpl(Expression expression) { super(expression); if (!GroundTermTools.isGroundTerm(expression)) { throw new IllegalArgumentException("Non-ground boolean expression given to build a ground expression!"); } }
public static VariableOrGroundTerm convertIntoVariableOrGroundTerm(Term term) { if (term instanceof Variable) { return (Variable) term; } else if (GroundTermTools.isGroundTerm(term)) { return GroundTermTools.castIntoGroundTerm(term); } else { throw new IllegalArgumentException("Not a variable nor a ground term: " + term); } }
public static VariableOrGroundTerm convertIntoVariableOrGroundTerm(Term term) { if (term instanceof Variable) { return (Variable) term; } else if (GroundTermTools.isGroundTerm(term)) { return GroundTermTools.castIntoGroundTerm(term); } else { throw new IllegalArgumentException("Not a variable nor a ground term: " + term); } }
@Override public ImmutableExpression getImmutableExpression(Expression expression) { if (GroundTermTools.isGroundTerm(expression)) { return new GroundExpressionImpl(expression); } else { return new NonGroundExpressionImpl(expression); } }
@Override public ImmutableFunctionalTerm getImmutableFunctionalTerm(Function functionalTerm) { if (GroundTermTools.isGroundTerm(functionalTerm)) { return new GroundFunctionalTermImpl(functionalTerm); } else { return new NonGroundFunctionalTermImpl(functionalTerm); } }
if (isGroundTerm(sourceFunctionalTerm)) { if (sourceFunctionalTerm.equals(targetFunctionalTerm)) { return Optional.of(EMPTY_SUBSTITUTION);
else if (isGroundTerm(term)) { Variable newVariable = projectedVariableGenerator.generateNewVariable(); newArgument = newVariable;
else if (isGroundTerm(term)) { Variable newVariable = projectedVariableGenerator.generateNewVariable(); newArgument = newVariable;
@Override public ImmutableExpression getImmutableExpression(Expression expression) { if (GroundTermTools.isGroundTerm(expression)) { return new GroundExpressionImpl(expression.getFunctionSymbol(), (ImmutableList<? extends GroundTerm>)(ImmutableList<?>)convertTerms(expression)); } else { return new NonGroundExpressionImpl(expression.getFunctionSymbol(), convertTerms(expression)); } }