Пример #1
0
 public override TrsTermBase CreateCopyAndReplaceSubTerm(TrsTermBase termToReplace, TrsTermBase replacementTerm)
 {
     TrsTermProduct product = new TrsTermProduct(new List<TrsTermBase>());
       foreach (var term in TermList)
       {
     if (term.Equals(termToReplace)) product.TermList.Add(replacementTerm);
     else product.TermList.Add(term.CreateCopyAndReplaceSubTerm(termToReplace, replacementTerm));
       }
       return product;
 }
Пример #2
0
        public override bool Equals(object other)
        {
            TrsTermProduct otherTp = other as TrsTermProduct;

            if (otherTp == null || otherTp.TermList.Count != TermList.Count)
            {
                return(false);
            }
            bool retVal = true;

            for (int i = 0; i < otherTp.TermList.Count; i++)
            {
                retVal = retVal && TermList[i].Equals(otherTp.TermList[i]);
            }
            return(retVal);
        }
Пример #3
0
        public override TrsTermBase CreateCopyAndReplaceSubTerm(TrsTermBase termToReplace, TrsTermBase replacementTerm)
        {
            TrsTermProduct product = new TrsTermProduct(new List <TrsTermBase>());

            foreach (var term in TermList)
            {
                if (term.Equals(termToReplace))
                {
                    product.TermList.Add(replacementTerm);
                }
                else
                {
                    product.TermList.Add(term.CreateCopyAndReplaceSubTerm(termToReplace, replacementTerm));
                }
            }
            return(product);
        }
Пример #4
0
        protected override TrsTermBase ApplySubstitution(Substitution substitution)
        {
            TrsTermProduct product = new TrsTermProduct(new List <TrsTermBase>());

            foreach (var term in TermList)
            {
                if (term.Equals(substitution.Variable))
                {
                    product.TermList.Add(substitution.SubstitutionTerm);
                }
                else
                {
                    product.TermList.Add(term.ApplySubstitutions(new [] { substitution }));
                }
            }
            return(product);
        }
Пример #5
0
 public static TrsTermProduct Convert(this AstTermProduct astIn)
 {
     List<TrsTermBase> termList = new List<TrsTermBase>(astIn.TermList.Select(t => ConvertAstTermBase(t)).Cast<TrsTermBase>());
       var trsTermProduct = new TrsTermProduct(termList, astIn);
       return trsTermProduct;
 }
Пример #6
0
 protected override TrsTermBase ApplySubstitution(Substitution substitution)
 {
     TrsTermProduct product = new TrsTermProduct(new List<TrsTermBase>());
       foreach (var term in TermList)
       {
     if (term.Equals(substitution.Variable)) product.TermList.Add(substitution.SubstitutionTerm);
     else product.TermList.Add(term.ApplySubstitutions(new [] { substitution }));
       }
       return product;
 }