OAVObjectType optype = ((Variable)params.get(i)).getType(); if(!(optype instanceof OAVJavaType))
OAVObjectType optype = ((Variable)params.get(i)).getType(); if(!(optype instanceof OAVJavaType))
throw new RuntimeException("Type must not be null."); OAVObjectType otype = var.getType();
throw new RuntimeException("Type must not be null."); OAVObjectType otype = var.getType();
ObjectCondition condcon = new ObjectCondition(cond.getType()); condcon.addConstraint(new BoundConstraint(null, cond)); condcon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.java_externalcondition_type.getAttributeType("true"), Boolean.TRUE)); ObjectCondition rplancon = new ObjectCondition(rplan.getType()); rplancon.addConstraint(new BoundConstraint(null, rplan)); ObjectCondition capcon = new ObjectCondition(rcapa.getType()); capcon.addConstraint(new BoundConstraint(null, rcapa)); capcon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.capability_has_plans, rplan, IOperator.CONTAINS));
/** * Rule to abort a plan when the corresponding goal was deactivated. */ public static Rule createPlanInstanceAbortRule() { Variable rgoal = new Variable("?rgoal", OAVBDIRuntimeModel.goal_type); Variable rplan = new Variable("?rplan", OAVBDIRuntimeModel.plan_type); Variable rcapa = new Variable("?rcapa", OAVBDIRuntimeModel.capability_type); ObjectCondition goalcon = new ObjectCondition(rgoal.getType()); goalcon.addConstraint(new BoundConstraint(null, rgoal)); goalcon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.goal_has_processingstate, OAVBDIRuntimeModel.GOALPROCESSINGSTATE_INPROCESS, IOperator.NOTEQUAL)); ObjectCondition plancon = new ObjectCondition(rplan.getType()); plancon.addConstraint(new BoundConstraint(null, rplan)); plancon.addConstraint(new OrConstraint( new LiteralConstraint(OAVBDIRuntimeModel.plan_has_lifecyclestate, OAVBDIRuntimeModel.PLANLIFECYCLESTATE_NEW), new LiteralConstraint(OAVBDIRuntimeModel.plan_has_lifecyclestate, OAVBDIRuntimeModel.PLANLIFECYCLESTATE_BODY))); plancon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.plan_has_reason, rgoal)); ObjectCondition capcon = new ObjectCondition(rcapa.getType()); capcon.addConstraint(new BoundConstraint(null, rcapa)); capcon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.capability_has_plans, rplan, IOperator.CONTAINS)); Rule abort_plan = new Rule("planinstance_abort", new AndCondition(new ICondition[]{goalcon, plancon, capcon}), PLAN_ABORT); return abort_plan; }
ObjectCondition rgoalcon = new ObjectCondition(rgoal.getType()); rgoalcon.addConstraint(new BoundConstraint(null, rgoal)); rgoalcon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.element_has_model, model)); ObjectCondition capcon2 = new ObjectCondition(rcapa.getType()); capcon2.addConstraint(new BoundConstraint(null, rcapa)); capcon2.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.capability_has_goals, rgoal, IOperator.CONTAINS)); ObjectCondition parcon = new ObjectCondition(parvar.getType()); parcon.addConstraint(new BoundConstraint(null, parvar)); parcon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.parameter_has_name, pname));
Variable rplan = new Variable("?rplan", OAVBDIRuntimeModel.plan_type); ObjectCondition ragentcon = new ObjectCondition(ragent.getType()); ragentcon.addConstraint(new BoundConstraint(null, ragent)); ragentcon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.agent_has_state, OAVBDIRuntimeModel.AGENTLIFECYCLESTATE_TERMINATING)); ObjectCondition rgoalcon = new ObjectCondition(rgoal.getType()); rgoalcon.addConstraint(new BoundConstraint(null, rgoal)); ObjectCondition rcapacon1 = new ObjectCondition(rcapa.getType()); rcapacon1.addConstraint(new BoundConstraint(null, rcapa)); rcapacon1.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.capability_has_goals, rgoal, IOperator.CONTAINS)); ObjectCondition rplancon = new ObjectCondition(rplan.getType()); rplancon.addConstraint(new BoundConstraint(null, rplan)); ObjectCondition rcapacon2 = new ObjectCondition(rcapa.getType()); rcapacon2.addConstraint(new BoundConstraint(null, rcapa)); rcapacon2.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.capability_has_plans, rplan, IOperator.CONTAINS));
/** * Create the goal drop rule. * Drop a dropping goal when all plans are removed. */ protected static Rule createGoalDropRule() { Variable rgoal = new Variable("?rgoal", OAVBDIRuntimeModel.goal_type); Variable rplans = new Variable("$?rplans", OAVBDIRuntimeModel.plan_type, true, false); Variable rcapa = new Variable("?rcapa", OAVBDIRuntimeModel.capability_type); ObjectCondition goalcon = new ObjectCondition(rgoal.getType()); goalcon.addConstraint(new BoundConstraint(null, rgoal)); goalcon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.goal_has_lifecyclestate, OAVBDIRuntimeModel.GOALLIFECYCLESTATE_DROPPING)); ObjectCondition capcon = new ObjectCondition(rcapa.getType()); capcon.addConstraint(new BoundConstraint(null, rcapa)); capcon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.capability_has_goals, rgoal, IOperator.CONTAINS)); capcon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.capability_has_plans, rplans)); ObjectCondition plancon = new ObjectCondition(OAVBDIRuntimeModel.plan_type); plancon.addConstraint(new BoundConstraint(null, rplans, IOperator.CONTAINS)); plancon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.plan_has_processingstate, OAVBDIRuntimeModel.PLANPROCESSINGTATE_FINISHED, IOperator.NOTEQUAL)); plancon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.plan_has_reason, rgoal)); NotCondition notplancon = new NotCondition(plancon); Rule goal_drop = new Rule("goal_drop", new AndCondition(new ICondition[]{goalcon, capcon, notplancon}), GOAL_DROP_ACTION); return goal_drop; }
Variable ragent = new Variable("?ragent", OAVBDIRuntimeModel.agent_type); ObjectCondition actioncon = new ObjectCondition(com.getType()); actioncon.addConstraint(new BoundConstraint(null, com));
type = var.getType(); valuesource = context.getBoundConstraint(var).getValueSource(); context.pushCondition(context.getConstrainableCondition(var));
ObjectCondition rpecon = new ObjectCondition(rpe.getType()); rpecon.addConstraint(new BoundConstraint(null, rpe)); rpecon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.processableelement_has_apl, apl)); ObjectCondition capcon = new ObjectCondition(rcapa.getType()); capcon.addConstraint(new BoundConstraint(null, rcapa)); capcon.addConstraint(new OrConstraint(new IConstraint[] ObjectCondition planconwa = new ObjectCondition(rplan.getType()); planconwa.addConstraint(new BoundConstraint(null, rplan)); ObjectCondition candconpi = new ObjectCondition(candpi.getType()); candconpi.addConstraint(new BoundConstraint(null, candpi)); candconpi.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.plancandidate_has_plan, rplan)); ObjectCondition aplconpi = new ObjectCondition(apl.getType()); aplconpi.addConstraint(new BoundConstraint(null, apl)); aplconpi.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.apl_has_planinstancecandidates, candpi, IOperator.CONTAINS)); ObjectCondition aplconpi2 = new ObjectCondition(apl.getType()); aplconpi2.addConstraint(new BoundConstraint(null, apl)); aplconpi2.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.apl_has_waitqueuecandidates, null, IOperator.NOTEQUAL)); ObjectCondition planconwq = new ObjectCondition(rplan.getType()); planconwq.addConstraint(new BoundConstraint(null, rplan)); ObjectCondition aplconwc = new ObjectCondition(apl.getType()); aplconwc.addConstraint(new BoundConstraint(null, apl)); aplconwc.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.apl_has_waitqueuecandidates, candwq, IOperator.CONTAINS));
ObjectCondition wqcon = new ObjectCondition(rpe.getType()); wqcon.addConstraint(new BoundConstraint(null, rpe)); wqcon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.element_has_model, mpe));
rpe, IOperator.CONTAINS)); ObjectCondition agentcon = new ObjectCondition(ragent.getType()); agentcon.addConstraint(new BoundConstraint(null, ragent));
rpe, IOperator.CONTAINS)); ObjectCondition agentcon = new ObjectCondition(ragent.getType()); agentcon.addConstraint(new BoundConstraint(null, ragent));
rpe, IOperator.CONTAINS)); ObjectCondition agentcon = new ObjectCondition(ragent.getType()); agentcon.addConstraint(new BoundConstraint(null, ragent));