/** * Create an OAV state. */ protected static IOAVState createState() { return OAVStateFactory.createOAVState(hanoi_type_model); // return new JenaOAVState(); }
/** Construct a test model */ public ObjectInspectorTreeModelTest() { super(OAVStateFactory.createOAVState(null)); this.root = new ObjectInspectorNode(super.root,String.class,"default-name","default"); this.inspectors = new ArrayList(); }
/** * Main for testing. * @param args */ public static void main(String[] args) { IOAVState state = OAVStateFactory.createOAVState(null); OAVLongIdGenerator gen = new OAVLongIdGenerator(); for(long i=0;; i++) { Object id = gen.createId(state, null); if(i%1000000==0) System.out.println(i+": "+id); } }
/** * Main for testing. * @param args */ public static void main(String[] args) { IOAVState state = OAVStateFactory.createOAVState(null); OAVLongIdGenerator gen = new OAVLongIdGenerator(); for(long i=0;; i++) { Object id = gen.createId(state, null); if(i%1000000==0) System.out.println(i+": "+id); } }
/** * Create the state containing all possible combinations. */ public static IOAVState createState() { String[] names = new String[]{"Fred", "Joe", "Bob", "Tom"}; String[] colors = new String[]{"red", "blue", "plaid", "orange"}; Integer[] positions = new Integer[]{Integer.valueOf(1), Integer.valueOf(2), Integer.valueOf(3), Integer.valueOf(4)}; IOAVState state = OAVStateFactory.createOAVState(golfing_type_model); for(int i=0; i<names.length; i++) { for(int j=0; j<colors.length; j++) { for(int k=0; k<positions.length; k++) { Object golfer = state.createRootObject(golfer_type); state.setAttributeValue(golfer, golfer_has_name, names[i]); state.setAttributeValue(golfer, golfer_has_color, colors[j]); state.setAttributeValue(golfer, golfer_has_position, positions[k]); } } } return state; }
/** * Create a component instance. * @param adapter The component adapter. * @param model The component model. * @param config The name of the configuration (or null for default configuration) * @param arguments The arguments for the agent as name/value pairs. * @param parent The parent component (if any). * @return An instance of a component. */ public Tuple2<IComponentInstance, IComponentAdapter> createComponentInstance(IComponentDescription desc, IComponentAdapterFactory factory, OAVAgentModel amodel, String config, Map<String, Object> arguments, IExternalAccess parent, RequiredServiceBinding[] bindings, boolean copy, boolean realtime, IIntermediateResultListener<Tuple2<String, Object>> resultlistener, Future<Void> ret) { // Create type model for agent instance (e.g. holding dynamically loaded java classes). OAVTypeModel tmodel = new OAVTypeModel(desc.getName().getLocalName()+"_typemodel", amodel.getState().getTypeModel().getClassLoader()); // OAVTypeModel tmodel = new OAVTypeModel(model.getName()+"_typemodel", ((OAVAgentModel)model).getTypeModel().getClassLoader()); tmodel.addTypeModel(amodel.getState().getTypeModel()); tmodel.addTypeModel(OAVBDIRuntimeModel.bdi_rt_model); IOAVState state = OAVStateFactory.createOAVState(tmodel); state.addSubstate(amodel.getState()); // BDIInterpreter bdii = new BDIInterpreter(desc, factory, state, amodel, config, arguments, parent, bindings, getPropertyMap(), copy, realtime, resultlistener, ret); BDIInterpreter bdii = new BDIInterpreter(desc, factory, state, amodel, config, arguments, parent, bindings, myprops, copy, realtime, resultlistener, ret); return new Tuple2<IComponentInstance, IComponentAdapter>(bdii, bdii.getAgentAdapter()); }
IOAVState state = OAVStateFactory.createOAVState(tmodel); state.addSubstate(amodel.getState());
public void customResultAvailable(ClassLoader cl) { try { // OAVAgentModel amodel = (OAVAgentModel)model; OAVAgentModel amodel = (OAVAgentModel)loader.loadModel(modelinfo.getFilename(), null, cl, new Object[]{modelinfo.getResourceIdentifier(), root}); // Create type model for agent instance (e.g. holding dynamically loaded java classes). OAVTypeModel tmodel = new OAVTypeModel(desc.getName().getLocalName()+"_typemodel", amodel.getState().getTypeModel().getClassLoader()); // OAVTypeModel tmodel = new OAVTypeModel(model.getName()+"_typemodel", ((OAVAgentModel)model).getTypeModel().getClassLoader()); tmodel.addTypeModel(amodel.getState().getTypeModel()); tmodel.addTypeModel(OAVBDIRuntimeModel.bdi_rt_model); IOAVState state = OAVStateFactory.createOAVState(tmodel); state.addSubstate(amodel.getState()); // BDIInterpreter bdii = new BDIInterpreter(desc, factory, state, amodel, config, arguments, parent, bindings, getPropertyMap(), copy, realtime, resultlistener, init); BDIInterpreter bdii = new BDIInterpreter(desc, factory, state, amodel, config, arguments, parent, bindings, myprops, copy, realtime, resultlistener, init); ret.setResult(new Tuple2<IComponentInstance, IComponentAdapter>(bdii, bdii.getAgentAdapter())); } catch(Exception e) { ret.setException(e); } } });
IOAVState state = OAVStateFactory.createOAVState(helloworld_type_model); // Create the production memory. Rulebase rb = new Rulebase();
IOAVState state = OAVStateFactory.createOAVState(helloworld_type_model); // Create the production memory. Rulebase rb = new Rulebase();
final OAVAttributeType fibo_has_sequence = fibo_type.createAttributeType("fibo_has_sequence", OAVJavaType.java_integer_type); IOAVState state = OAVStateFactory.createOAVState(fibonacci_type_model); // Create the production memory. Rulebase rb = new Rulebase(); RuleSystem rete = new RuleSystem(state, rb, new RetePatternMatcherFunctionality(rb), new PriorityAgenda());
final IOAVState state = OAVStateFactory.createOAVState(typemodel);
final OAVJavaType fibo_type = fibonacci_type_model.createJavaType(FibonacciNumber.class, OAVJavaType.KIND_BEAN); IOAVState state = OAVStateFactory.createOAVState(fibonacci_type_model); // Create the production memory. Rulebase rb = new Rulebase();
IPatternMatcherFunctionality pf = new RetePatternMatcherFunctionality(rb); RuleSystem system = new RuleSystem(OAVStateFactory.createOAVState(blocksworld_type_model), rb, pf); system.init();