예제 #1
0
            // CACHEING CURRENTLY NOT USED
            #region Cacheing
            // Cache -- analogous to asserting a fact, but specifically for cacheing.
            // Cached terms are inserted at the very beginning of the predicate's clause
            // chain, in the order in which they were determined.
            public void Cache(BaseTerm cacheTerm, bool succeeds)
            {
                IO.WriteLine("Cacheing {0}{1}", cacheTerm, succeeds ? null : " :- !, fail");

                CachedClauseNode newCachedClause = new CachedClauseNode(cacheTerm, null, succeeds);

                if (lastCachedClause == null) // about to add the first cached term
                {
                    newCachedClause.NextClause = clauseList;
                    clauseList = newCachedClause;
                }
                else
                {
                    newCachedClause.NextClause  = lastCachedClause.NextClause;
                    lastCachedClause.NextClause = newCachedClause;
                }

                lastCachedClause = newCachedClause;
            }
예제 #2
0
      // CACHEING CURRENTLY NOT USED
      #region Cacheing
      // Cache -- analogous to asserting a fact, but specifically for cacheing.
      // Cached terms are inserted at the very beginning of the predicate's clause
      // chain, in the order in which they were determined.
      public void Cache (BaseTerm cacheTerm, bool succeeds)
      {
        IO.WriteLine ("Cacheing {0}{1}", cacheTerm, succeeds ? null : " :- !, fail");

        CachedClauseNode newCachedClause = new CachedClauseNode (cacheTerm, null, succeeds);

        if (lastCachedClause == null) // about to add the first cached term
        {
          newCachedClause.NextClause = clauseList;
          clauseList = newCachedClause;
        }
        else
        {
          newCachedClause.NextClause = lastCachedClause.NextClause;
          lastCachedClause.NextClause = newCachedClause;
        }

        lastCachedClause = newCachedClause;
      }