/** * Get a tuple. * Returns an existing tuple from the cache, if present. * Otherwise a new one is created. */ public Tuple getTuple(IOAVState state, Tuple left, Object right) { return new Tuple(state, left, right); // Tuple ret; // Map lefties = (Map)tuplememory.get(left); // if(lefties==null) // { // lefties = new WeakHashMap(); // tuplememory.put(left, lefties); // ret = new Tuple(left, right); // lefties.put(right, ret); // } // else // { // ret = (Tuple)lefties.get(right); // if(ret==null) // { // ret = new Tuple(left, right); // lefties.put(right, ret); // } // } // return ret; }
/** * Get a tuple. * Returns an existing tuple from the cache, if present. * Otherwise a new one is created. */ public Tuple getTuple(IOAVState state, Tuple left, Object right) { return new Tuple(state, left, right); // Tuple ret; // Map lefties = (Map)tuplememory.get(left); // if(lefties==null) // { // lefties = new WeakHashMap(); // tuplememory.put(left, lefties); // ret = new Tuple(left, right); // lefties.put(right, ret); // } // else // { // ret = (Tuple)lefties.get(right); // if(ret==null) // { // ret = new Tuple(left, right); // lefties.put(right, ret); // } // } // return ret; }
/** * Initialize the pattern matcher. * Called before the agenda is accessed * to perform any initialization, if necessary. */ public void init(IOAVState state, ReteMemory mem, AbstractAgenda agenda) { this.initial_fact_tuple = new Tuple(state, null, INITIAL_FACT); this.initial_fact_mem = Collections.singletonList(initial_fact_tuple); ITupleConsumerNode[] tcon = tconsumers; for(int i=0; tcon!=null && i<tcon.length; i++) tcon[i].addTuple(initial_fact_tuple, state, mem, agenda); }
/** * Initialize the pattern matcher. * Called before the agenda is accessed * to perform any initialization, if necessary. */ public void init(IOAVState state, ReteMemory mem, AbstractAgenda agenda) { this.initial_fact_tuple = new Tuple(state, null, INITIAL_FACT); this.initial_fact_mem = Collections.singletonList(initial_fact_tuple); ITupleConsumerNode[] tcon = tconsumers; for(int i=0; tcon!=null && i<tcon.length; i++) tcon[i].addTuple(initial_fact_tuple, state, mem, agenda); }