/** * Two function application terms are equal if all their arguments are equal and their functions * are equal. */ public boolean equals(Object o) { if (o instanceof FuncAppTerm) { FuncAppTerm other = (FuncAppTerm) o; return ((f.equals(other.getFunction())) && Arrays.equals(args, other.getArgs())); } return false; }
public Term getCanonicalVersion() { if ((f instanceof FixedFunction) && getFreeVars().isEmpty()) { Object value = getValueIfNonRandom(); if (value != null) { Term canonical = getType().getCanonicalTerm(value); if (canonical != null) { return canonical; } } } List<Term> newArgs = new ArrayList<Term>(); for (int i = 0; i < args.length; ++i) { if (args[i] instanceof Term) { Term arg = (Term) args[i]; newArgs.add(arg.getCanonicalVersion()); } } FuncAppTerm canonical = new FuncAppTerm(f, newArgs); canonical.setLocation(location); return canonical; }