/** * Remove an object consumer. * @param node The consumer node. */ public void removeObjectConsumer(IObjectConsumerNode node) { assert !inited; typenodes.remove(((TypeNode)node).getObjectType()); }
/** * Add a new type node. * @param type The type node. * @param context the build context. */ protected void addTypeNode(OAVObjectType type, BuildContext context) { assert type!=null : "***" + context; // Create new type node, if necessary INode node = context.getRootNode().getTypeNode(type); if(node==null) { node = new TypeNode(context.getRootNode().getNextNodeId(), type); connectRight(context.getRootNode(), node, context); } context.setLastAlphaNode(node); }
tn.modifyObject(id, attr, oldvalue, newvalue, state, mem, agenda);
clone.typenodes.put(type, getTypeNode(type).clone());
/** * Add a new type node. * @param type The type node. * @param context the build context. */ protected void addTypeNode(OAVObjectType type, BuildContext context) { assert type!=null : "***" + context; // Create new type node, if necessary INode node = context.getRootNode().getTypeNode(type); if(node==null) { node = new TypeNode(context.getRootNode().getNextNodeId(), type); connectRight(context.getRootNode(), node, context); } context.setLastAlphaNode(node); }
tn.modifyObject(id, attr, oldvalue, newvalue, state, mem, agenda);
clone.typenodes.put(type, getTypeNode(type).clone());
/** * Remove an object consumer. * @param node The consumer node. */ public void removeObjectConsumer(IObjectConsumerNode node) { assert !inited; typenodes.remove(((TypeNode)node).getObjectType()); }
/** * Add an object consumer node. * @param node A new consumer node. */ public void addObjectConsumer(IObjectConsumerNode node) { assert !inited; if(node instanceof TypeNode) { if(typenodes.put(((TypeNode)node).getObjectType(), node)!=null) throw new RuntimeException("Type node already present in network: "+node); } else if(node instanceof InitialFactNode) { if(initialfact!=null) throw new RuntimeException("Initial fact node already present in network: "+node); initialfact = (InitialFactNode)node; } else { throw new RuntimeException("Rete node only allows type or initial fact node children: "+node); } relevants = null; // Will be recalculated on next access; }
/** * Add an object consumer node. * @param node A new consumer node. */ public void addObjectConsumer(IObjectConsumerNode node) { assert !inited; if(node instanceof TypeNode) { if(typenodes.put(((TypeNode)node).getObjectType(), node)!=null) throw new RuntimeException("Type node already present in network: "+node); } else if(node instanceof InitialFactNode) { if(initialfact!=null) throw new RuntimeException("Initial fact node already present in network: "+node); initialfact = (InitialFactNode)node; } else { throw new RuntimeException("Rete node only allows type or initial fact node children: "+node); } relevants = null; // Will be recalculated on next access; }
/** * Get the set of matching type nodes for a (sub)type. * @param type The object type. * @return The set of type nodes for that object type. */ protected Set getTypeNodes(OAVObjectType type) { Set ret = (Set)typenodesets.get(type); if(ret==null) { synchronized(this) { ret = (Set)typenodesets.get(type); if(ret==null) { ret = new HashSet(); for(Iterator it=typenodes.values().iterator(); it.hasNext(); ) { TypeNode tnode = (TypeNode)it.next(); if(type.isSubtype(tnode.getObjectType())) ret.add(tnode); } typenodesets.put(type, ret); } } } return ret; }
/** * Get the set of matching type nodes for a (sub)type. * @param type The object type. * @return The set of type nodes for that object type. */ protected Set getTypeNodes(OAVObjectType type) { Set ret = (Set)typenodesets.get(type); if(ret==null) { synchronized(this) { ret = (Set)typenodesets.get(type); if(ret==null) { ret = new HashSet(); for(Iterator it=typenodes.values().iterator(); it.hasNext(); ) { TypeNode tnode = (TypeNode)it.next(); if(type.isSubtype(tnode.getObjectType())) ret.add(tnode); } typenodesets.put(type, ret); } } } return ret; }
ret.put("Object type:", n.getObjectType().getName());