AIMA.Core.Logic.FOL.StandardizeApart.standardizeApart C# (CSharp) Метод

standardizeApart() публичный Метод

public standardizeApart ( Chain chain, StandardizeApartIndexical standardizeApartIndexical ) : Chain
chain AIMA.Core.Logic.FOL.KB.Data.Chain
standardizeApartIndexical StandardizeApartIndexical
Результат AIMA.Core.Logic.FOL.KB.Data.Chain
        public Chain standardizeApart(Chain chain,
                StandardizeApartIndexical standardizeApartIndexical)
        {

            List<Variable> toRename = variableCollector.collectAllVariables(chain);
            Dictionary<Variable, Term> renameSubstitution = new Dictionary<Variable, Term>();

            foreach (Variable var in toRename)
            {
                Variable v = null;
                do
                {
                    v = new Variable(standardizeApartIndexical.getPrefix()
                            + standardizeApartIndexical.getNextIndex());
                    // Ensure the new variable name is not already
                    // accidentally used in the sentence
                } while (toRename.Contains(v));

                renameSubstitution.Add(var, v);
            }

            if (renameSubstitution.Count > 0)
            {
                List<Literal> lits = new List<Literal>();

                foreach (Literal l in chain.getLiterals())
                {
                    AtomicSentence atom = (AtomicSentence)substVisitor.subst(
                            renameSubstitution, l.getAtomicSentence());
                    lits.Add(l.newInstance(atom));
                }

                Chain renamed = new Chain(lits);

                renamed.setProofStep(new ProofStepRenaming(renamed, chain
                        .getProofStep()));

                return renamed;
            }

            return chain;
        }

Same methods

StandardizeApart::standardizeApart ( Clause clause, StandardizeApartIndexical standardizeApartIndexical ) : Clause
StandardizeApart::standardizeApart ( List l1Literals, List l2Literals, StandardizeApartIndexical standardizeApartIndexical ) : Term>.Dictionary
StandardizeApart::standardizeApart ( Sentence aSentence, StandardizeApartIndexical standardizeApartIndexical ) : StandardizeApartResult