public virtual void addNewPartialMatch(IHashIndex index, IFact fact) { IGenericMap <object, object> matches = CollectionFactory.newMap(); matches.Put(fact, fact); memory.Put(index, matches); }
public virtual int addNewPartialMatch(IHashIndex index, IFact fact) { IGenericMap<object, object> matches = CollectionFactory.newMap(); matches.Put(fact, fact); memory.Put(index, matches); return 1; }
/// <summary> Remove a partial match from the memory /// </summary> public virtual int removePartialMatch(IHashIndex index, IFact fact) { IGenericMap <Object, Object> list = (IGenericMap <Object, Object>)memory[index]; list.Remove(fact); if (list.Count == 0) { memory.Remove(index); } counter--; return(list.Count); }
public virtual int count(IHashIndex index) { IGenericMap <Object, Object> list = (IGenericMap <Object, Object>)memory[index]; if (list != null) { return(list.Count); } else { return(0); } }
public virtual bool isPartialMatch(IHashIndex index, IFact fact) { IGenericMap <Object, Object> list = (IGenericMap <Object, Object>)memory[index]; if (list != null) { return(list.ContainsKey(fact)); } else { return(false); } }
/// <summary> Return an GetEnumerator of the values /// </summary> public virtual IEnumerator iterator(IHashIndex index) { IGenericMap <Object, Object> list = (IGenericMap <Object, Object>)memory.Get(index); if (list != null) { return(list.Values.GetEnumerator()); } else { return(null); } }
/// <summary> addPartialMatch stores the fact with the factId as the /// key. /// </summary> public virtual void addPartialMatch(IHashIndex index, IFact fact) { IGenericMap <Object, Object> matches = (IGenericMap <Object, Object>)memory[index]; if (matches == null) { addNewPartialMatch(index, fact); } else { matches.Put(fact, fact); } counter++; }
/// <summary> addPartialMatch stores the fact with the factId as the /// key. /// </summary> public virtual int addPartialMatch(IHashIndex index, IFact fact) { IGenericMap<Object, Object> matches = (IGenericMap<Object, Object>) memory.Get(index); int count = 0; if (matches == null) { count = addNewPartialMatch(index, fact); } else { matches.Put(fact, fact); count = matches.Count; } counter++; return count; }
/// <summary> addPartialMatch stores the fact with the factId as the /// key. /// </summary> public virtual int addPartialMatch(IHashIndex index, IFact fact) { IGenericMap <Object, Object> matches = (IGenericMap <Object, Object>)memory.Get(index); int count = 0; if (matches == null) { count = addNewPartialMatch(index, fact); } else { matches.Put(fact, fact); count = matches.Count; } counter++; return(count); }
/// <summary> Return an GetEnumerator of the values /// </summary> public virtual IEnumerator iterator(IHashIndex index) { IGenericMap <Object, Object> list = (IGenericMap <Object, Object>)memory[index]; if (list != null) { // we have to create a new Creshendo.rete.util.List<Object> with the values // so the GetEnumerator will work correctly. if we didn't // do this, we might Get a NullPointerException or a // possibly a concurrent modification exception, since // the node could be still iterating over the facts // as stale facts are removed. System.Collections.Generic.List <Object> rlist = new System.Collections.Generic.List <Object>(list.Values); return(rlist.GetEnumerator()); } else { return(null); } }
/// <summary> Remove a partial match from the memory /// </summary> public virtual int removePartialMatch(IHashIndex index, IFact fact) { IGenericMap<Object, Object> list = (IGenericMap<Object, Object>) memory.Get(index); if (list != null) { list.Remove(fact); if (list.Count == 0) { memory.Remove(index); } counter--; return list.Count; } else { return 0; } }
/// <summary> Return an GetEnumerator of the values /// </summary> public virtual IEnumerator iterator(IHashIndex index) { IGenericMap<Object, Object> list = (IGenericMap<Object, Object>) memory.Get(index); if (list != null) { return list.Values.GetEnumerator(); } else { return null; } }
public virtual bool isPartialMatch(IHashIndex index, IFact fact) { IGenericMap<Object, Object> list = (IGenericMap<Object, Object>) memory.Get(index); if (list != null) { return list.ContainsKey(fact); } else { return false; } }
public virtual int count(IHashIndex index) { IGenericMap<Object, Object> list = (IGenericMap<Object, Object>) memory.Get(index); if (list != null) { return list.Count; } else { return 0; } }