Exemplo n.º 1
0
        /// <summary>
        /// Subclasses need to implement Clear and make sure all
        /// memories are cleared properly.
        /// </summary>
        /// <param name="mem">The mem.</param>
        public virtual void clear(IWorkingMemory mem)
        {
            IGenericMap <Object, Object> leftmem = (IGenericMap <Object, Object>)mem.getBetaLeftMemory(this);

            leftmem.Clear();
            HashedAlphaMemoryImpl rightmem = (HashedAlphaMemoryImpl)mem.getBetaRightMemory(this);

            rightmem.clear();
        }
Exemplo n.º 2
0
        /// <summary> Clear will Clear the lists
        /// </summary>
        public override void clear(IWorkingMemory mem)
        {
            IGenericMap <Object, Object> leftmem  = (IGenericMap <Object, Object>)mem.getBetaLeftMemory(this);
            HashedAlphaMemoryImpl        rightmem = (HashedAlphaMemoryImpl)mem.getBetaRightMemory(this);
            IEnumerator itr = leftmem.Keys.GetEnumerator();

            // first we iterate over the list for each fact
            // and Clear it.
            while (itr.MoveNext())
            {
                IBetaMemory bmem = (IBetaMemory)leftmem.Get(itr.Current);
                bmem.clear();
            }
            // now that we've cleared the list for each fact, we
            // can Clear the Creshendo.rete.util.Map.
            leftmem.Clear();
            // TODO Clear the right memory
            rightmem.clear();
        }