Пример #1
0
        public virtual void clear()
        {
            IEnumerator amitr = alphaMemories.Values.GetEnumerator();

            while (amitr.MoveNext())
            {
                IAlphaMemory am = (IAlphaMemory)amitr.Current;
                am.clear();
            }
            alphaMemories.Clear();
            // aggressivley Clear the memories
            IEnumerator blitr = betaLeftMemories.Values.GetEnumerator();

            while (blitr.MoveNext())
            {
                Object bval = blitr.Current;
                if (bval is IGenericMap <Object, Object> )
                {
                    IGenericMap <Object, Object> lmem = (IGenericMap <Object, Object>)bval;
                    // now iterate over the betamemories
                    IEnumerator bmitr = lmem.Keys.GetEnumerator();
                    while (bmitr.MoveNext())
                    {
                        Index indx = (Index)bmitr.Current;
                        indx.clear();
                    }
                    lmem.Clear();
                }
            }
            betaLeftMemories.Clear();
            IEnumerator britr = betaRightMemories.Values.GetEnumerator();

            while (britr.MoveNext())
            {
                Object val = britr.Current;
                if (val is HashedAlphaMemoryImpl)
                {
                    ((HashedAlphaMemoryImpl)val).clear();
                }
                else if (val is TemporalHashedAlphaMem)
                {
                    ((TemporalHashedAlphaMem)val).clear();
                }
                else
                {
                    IGenericMap <IFact, IFact> mem = (IGenericMap <IFact, IFact>)val;
                    mem.Clear();
                }
            }
            betaRightMemories.Clear();
            terminalMemories.Clear();
            root.clear();
            focusStack.Clear();
            //contexts.Clear();
            agenda.clear();
            main.clear();
            currentModule.clear();
            addModule(main);
        }
Пример #2
0
 /// <summary>
 /// Clear will set the rule to null and call Index.Clear
 /// </summary>
 public void clear()
 {
     index.clear();
     theRule = null;
 }