@Override public Expression clone() { List<Term> newTerms = new ArrayList<>(); for (Term term: getTerms()) { newTerms.add(term.clone()); } return new ExpressionImpl(getFunctionSymbol(), newTerms); }
@Override public Function clone() { ArrayList<Term> copyTerms = new ArrayList<Term>(terms.size()); for (Term term: terms) { copyTerms.add(term.clone()); } FunctionalTermImpl clone = new FunctionalTermImpl(getFunctionSymbol(), copyTerms); clone.identifier = identifier; clone.string = string; clone.rehash = rehash; return clone; }
@Override public Expression clone() { List<Term> newTerms = new ArrayList<>(); for (Term term: getTerms()) { newTerms.add(term.clone()); } return new ExpressionImpl(getFunctionSymbol(), newTerms); }
@Override public Function clone() { ArrayList<Term> copyTerms = new ArrayList<Term>(terms.size()); for (Term term: terms) { copyTerms.add(term.clone()); } FunctionalTermImpl clone = new FunctionalTermImpl(getFunctionSymbol(), copyTerms); clone.identifier = identifier; clone.string = string; clone.rehash = rehash; return clone; }
private Function getFreshAtom(Function a, String suffix) { List<Term> termscopy = new ArrayList<>(a.getArity()); for (Term t : a.getTerms()) { if (t instanceof Variable) { Variable v = (Variable)t; termscopy.add(termFactory.getVariable(v.getName() + suffix)); } else termscopy.add(t.clone()); } return termFactory.getFunction(a.getFunctionSymbol(), termscopy); }
private Term getFreshTerm(Term term, int suff) { Term newTerm; if (term instanceof Variable) { Variable variable = (Variable) term; newTerm = termFactory.getVariable(variable.getName() + "_" + suff); } else if (term instanceof Function) { Function functionalTerm = (Function) term; List<Term> innerTerms = functionalTerm.getTerms(); List<Term> newInnerTerms = new LinkedList<>(); for (int j = 0; j < innerTerms.size(); j++) { Term innerTerm = innerTerms.get(j); newInnerTerms.add(getFreshTerm(innerTerm, suff)); } Predicate newFunctionSymbol = functionalTerm.getFunctionSymbol(); Function newFunctionalTerm = termFactory.getFunction(newFunctionSymbol, newInnerTerms); newTerm = newFunctionalTerm; } else if (term instanceof Constant) { newTerm = term.clone(); } else { throw new RuntimeException("Unsupported term: " + term); } return newTerm; }
private Term getFreshTerm(Term term, int suff) { Term newTerm; if (term instanceof Variable) { Variable variable = (Variable) term; newTerm = TERM_FACTORY.getVariable(variable.getName() + "_" + suff); } else if (term instanceof Function) { Function functionalTerm = (Function) term; List<Term> innerTerms = functionalTerm.getTerms(); List<Term> newInnerTerms = new LinkedList<>(); for (int j = 0; j < innerTerms.size(); j++) { Term innerTerm = innerTerms.get(j); newInnerTerms.add(getFreshTerm(innerTerm, suff)); } Predicate newFunctionSymbol = functionalTerm.getFunctionSymbol(); Function newFunctionalTerm = TERM_FACTORY.getFunction(newFunctionSymbol, newInnerTerms); newTerm = newFunctionalTerm; } else if (term instanceof Constant) { newTerm = term.clone(); } else { throw new RuntimeException("Unsupported term: " + term); } return newTerm; }
FunctionalTermImpl fclone = (FunctionalTermImpl)t.clone(); boolean innerchanges = applySingletonSubstitution(fclone, substitution); if (innerchanges)
FunctionalTermImpl fclone = (FunctionalTermImpl)t.clone(); boolean innerchanges = applySingletonSubstitution(fclone, substitution); if (innerchanges)
newTerm = renameVariables((Function) term, attributes, idfac); else if (term instanceof Constant) newTerm = term.clone(); else throw new RuntimeException("Unknown term type: " + term);
newTerm = renameVariables((Function) term, attributes, idfac); else if (term instanceof Constant) newTerm = term.clone(); else throw new RuntimeException("Unknown term type: " + term);
Term parameter = function.getTerm(1); if (parameter instanceof Variable) { return TERM_FACTORY.getTypedTerm(parameter.clone(), COL_TYPE.STRING);