/** * Get a unique rulename for a given rulename. * @param rb The rulebase. * @param rulename The rulename. * @return The (possibly modified) rulename. */ public static String getUniqueRuleName(IRulebase rb, String rulename) { int count = 1; String suffix = ""; Rule testrule = new Rule(rulename+suffix, null, null); while(rb.getRules().contains(testrule)) { suffix = "_"+count; testrule = new Rule(rulename+suffix, null, null); } return testrule.getName(); } }
/** * Get a unique rulename for a given rulename. * @param rb The rulebase. * @param rulename The rulename. * @return The (possibly modified) rulename. */ public static String getUniqueRuleName(IRulebase rb, String rulename) { int count = 1; String suffix = ""; Rule testrule = new Rule(rulename+suffix, null, null); while(rb.getRules().contains(testrule)) { suffix = "_"+count; testrule = new Rule(rulename+suffix, null, null); } return testrule.getName(); } }
/** * Create rule "all done". */ public IRule createAllDoneRule() { // ;;; ******** // ;;; all_done // ;;; ******** // // (defrule all_done // (context (state print_results)) // => // (halt)) ObjectCondition ad = new ObjectCondition(Manners.context_type); ad.addConstraint(new LiteralConstraint(Manners.context_has_state, "print_results")); IAction action = new IAction() { public void execute(IOAVState state, IVariableAssignments assignments) { System.out.println("TERMINATED!!!"); } }; return new Rule("all done", ad, action); } }
/** * Terminate agent rule. * Terminates the agent and removes it from the platform. */ protected static Rule createTerminateAgentRule() { ObjectCondition ragentcon = new ObjectCondition(OAVBDIRuntimeModel.agent_type); ragentcon.addConstraint(new BoundConstraint(null, new Variable("?ragent", OAVBDIRuntimeModel.agent_type))); ragentcon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.agent_has_state, OAVBDIRuntimeModel.AGENTLIFECYCLESTATE_TERMINATED)); IAction action = new IAction() { public void execute(IOAVState state, IVariableAssignments assignments) { Object ragent = assignments.getVariableValue("?ragent"); cleanupAgent(state, ragent); } }; Rule agent_terminating = new Rule("agent_terminated", ragentcon, action); return agent_terminating; }
/** * Create the goal failed rule (when no plans available). * (state = nocandidates, recur = false) */ protected static Rule createGoalFailedRule() { Variable rgoal = new Variable("?rgoal", OAVBDIRuntimeModel.goal_type); ObjectCondition goalcon = new ObjectCondition(OAVBDIRuntimeModel.goal_type); goalcon.addConstraint(new BoundConstraint(null, rgoal)); goalcon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.processableelement_has_state, OAVBDIRuntimeModel.PROCESSABLEELEMENT_NOCANDIDATES)); goalcon.addConstraint(new LiteralConstraint(new OAVAttributeType[]{OAVBDIRuntimeModel.element_has_model, OAVBDIMetaModel.goal_has_recur}, Boolean.FALSE)); Rule goal_failed = new Rule("goal_failed", goalcon, GOAL_FAILED); return goal_failed; }
/** * Reactivate a plan when goal cleanup is finished. */ public static Rule createPlanInstanceCleanupFinishedRule() { Variable rplan = new Variable("?rplan", OAVBDIRuntimeModel.plan_type); ObjectCondition plancon = new ObjectCondition(OAVBDIRuntimeModel.plan_type); plancon.addConstraint(new BoundConstraint(null, rplan)); plancon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.plan_has_subgoals, null)); plancon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.plan_has_processingstate, OAVBDIRuntimeModel.PLANPROCESSINGTATE_GOALCLEANUP)); IAction action = new IAction() { public void execute(IOAVState state, IVariableAssignments assignments) { Object rplan = assignments.getVariableValue("?rplan"); state.setAttributeValue(rplan, OAVBDIRuntimeModel.plan_has_processingstate, OAVBDIRuntimeModel.PLANPROCESSINGTATE_READY); } }; Rule planinstance_goalcleanupfinished = new Rule("planinstance_goalcleanupfinished", plancon, action); return planinstance_goalcleanupfinished; }
/** * Cleanup rule for removing change events. */ protected static Rule createRemoveChangeEventRule() { Variable ragent = new Variable("?ragent", OAVBDIRuntimeModel.agent_type); Variable changeevent = new Variable("?changeevent", OAVBDIRuntimeModel.changeevent_type); ObjectCondition changecon = new ObjectCondition(OAVBDIRuntimeModel.changeevent_type); changecon.addConstraint(new BoundConstraint(null, changeevent)); ObjectCondition ragentcon = new ObjectCondition(OAVBDIRuntimeModel.agent_type); ragentcon.addConstraint(new BoundConstraint(null, ragent)); ragentcon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.agent_has_changeevents, changeevent, IOperator.CONTAINS)); IAction action = new IAction() { public void execute(IOAVState state, IVariableAssignments assignments) { Object changeevent = assignments.getVariableValue("?changeevent"); Object ragent = assignments.getVariableValue("?ragent"); state.removeAttributeValue(ragent, OAVBDIRuntimeModel.agent_has_changeevents, changeevent); // System.err.println("removing: "+changeevent+", "+BDIInterpreter.getInterpreter(state).getAgentAdapter().getComponentIdentifier()); } }; Rule rule = new Rule("changeevent_remove", new AndCondition(new ICondition[]{changecon, ragentcon}), action); return rule; }
/** * Create performgoal processing rule. */ protected static Rule createPerformgoalProcessingRule() { Variable rgoal = new Variable("?rgoal", OAVBDIRuntimeModel.goal_type); ObjectCondition goalcon = new ObjectCondition(OAVBDIRuntimeModel.goal_type); goalcon.addConstraint(new BoundConstraint(null, rgoal)); goalcon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.goal_has_lifecyclestate, OAVBDIRuntimeModel.GOALLIFECYCLESTATE_ACTIVE)); goalcon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.goal_has_processingstate, OAVBDIRuntimeModel.GOALPROCESSINGSTATE_IDLE)); goalcon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.element_has_model, OAVBDIMetaModel.performgoal_type, IOperator.INSTANCEOF)); ObjectCondition capacon = new ObjectCondition(OAVBDIRuntimeModel.capability_type); capacon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.capability_has_goals, rgoal, IOperator.CONTAINS)); Rule performgoal_processing = new Rule("performgoal_processing", new AndCondition(new ICondition[]{goalcon, capacon}), GOAL_PROCESSING); return performgoal_processing; }
/** * Create achievegoal processing rule. */ protected static Rule createAchievegoalProcessingRule() { Variable rgoal = new Variable("?rgoal", OAVBDIRuntimeModel.goal_type); ObjectCondition goalcon = new ObjectCondition(OAVBDIRuntimeModel.goal_type); goalcon.addConstraint(new BoundConstraint(null, rgoal)); goalcon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.goal_has_lifecyclestate, OAVBDIRuntimeModel.GOALLIFECYCLESTATE_ACTIVE)); goalcon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.goal_has_processingstate, OAVBDIRuntimeModel.GOALPROCESSINGSTATE_IDLE)); goalcon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.element_has_model, OAVBDIMetaModel.achievegoal_type, IOperator.INSTANCEOF)); ObjectCondition capcon = new ObjectCondition(OAVBDIRuntimeModel.capability_type); capcon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.capability_has_goals, rgoal, IOperator.CONTAINS)); Rule achievegoal_processing = new Rule("achievegoal_processing", new AndCondition(new ICondition[]{goalcon, capcon}), GOAL_PROCESSING); return achievegoal_processing; }
/** * Create querygoal processing rule. */ protected static Rule createQuerygoalProcessingRule() { Variable rgoal = new Variable("?rgoal", OAVBDIRuntimeModel.goal_type); ObjectCondition goalcon = new ObjectCondition(OAVBDIRuntimeModel.goal_type); goalcon.addConstraint(new BoundConstraint(null, rgoal)); goalcon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.goal_has_lifecyclestate, OAVBDIRuntimeModel.GOALLIFECYCLESTATE_ACTIVE)); goalcon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.goal_has_processingstate, OAVBDIRuntimeModel.GOALPROCESSINGSTATE_IDLE)); goalcon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.element_has_model, OAVBDIMetaModel.querygoal_type, IOperator.INSTANCEOF)); ObjectCondition capcon = new ObjectCondition(OAVBDIRuntimeModel.capability_type); capcon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.capability_has_goals, rgoal, IOperator.CONTAINS)); Rule querygoal_processing = new Rule("querygoal_processing", new AndCondition(new ICondition[]{goalcon, capcon}), GOAL_PROCESSING); return querygoal_processing; }
return new Rule("goal_deliberate_deactivation", new AndCondition(new ICondition[]{goalcon, rcapacon}), action);
/** * Trigger plan creation on fact removed event. */ protected static Rule createExternalAccessFactRemovedTriggeredRule() { Variable ea = new Variable("?ea", OAVBDIRuntimeModel.externalaccess_type); Variable wa = new Variable("?wa", OAVBDIRuntimeModel.waitabstraction_type); Variable rel = new Variable("?rel", OAVBDIRuntimeModel.processableelement_type); Variable rpe = new Variable("?rpe", OAVBDIRuntimeModel.changeevent_type); ObjectCondition eacon = new ObjectCondition(OAVBDIRuntimeModel.externalaccess_type); eacon.addConstraint(new BoundConstraint(null, ea)); eacon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.externalaccess_has_waitabstraction, wa)); ObjectCondition changecon = new ObjectCondition(OAVBDIRuntimeModel.changeevent_type); changecon.addConstraint(new BoundConstraint(null, rpe)); changecon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.changeevent_has_type, OAVBDIRuntimeModel.CHANGEEVENT_FACTREMOVED)); changecon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.changeevent_has_element, rel)); ObjectCondition wacon = new ObjectCondition(OAVBDIRuntimeModel.waitabstraction_type); wacon.addConstraint(new BoundConstraint(null, wa)); wacon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.waitabstraction_has_factremoveds, rel, IOperator.CONTAINS)); Rule externalaccess_facttrigger = new Rule("externalaccess_factremovedtrigger", new AndCondition(new ICondition[]{eacon, changecon, wacon}), EXTERNALACCESS_NOTIFY, IPriorityEvaluator.PRIORITY_1); return externalaccess_facttrigger; }
/** * Trigger plan creation on fact changed event. */ protected static Rule createExternalAccessFactChangedTriggeredRule() { Variable ea = new Variable("?ea", OAVBDIRuntimeModel.externalaccess_type); Variable wa = new Variable("?wa", OAVBDIRuntimeModel.waitabstraction_type); Variable rel = new Variable("?rel", OAVBDIRuntimeModel.processableelement_type); Variable rpe = new Variable("?rpe", OAVBDIRuntimeModel.changeevent_type); ObjectCondition eacon = new ObjectCondition(OAVBDIRuntimeModel.externalaccess_type); eacon.addConstraint(new BoundConstraint(null, ea)); eacon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.externalaccess_has_waitabstraction, wa)); ObjectCondition changecon = new ObjectCondition(OAVBDIRuntimeModel.changeevent_type); changecon.addConstraint(new BoundConstraint(null, rpe)); changecon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.changeevent_has_type, OAVBDIRuntimeModel.CHANGEEVENT_FACTCHANGED)); changecon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.changeevent_has_element, rel)); ObjectCondition wacon = new ObjectCondition(OAVBDIRuntimeModel.waitabstraction_type); wacon.addConstraint(new BoundConstraint(null, wa)); wacon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.waitabstraction_has_factchangeds, rel, IOperator.CONTAINS)); Rule externalaccess_facttrigger = new Rule("externalaccess_factchangedtrigger", new AndCondition(new ICondition[]{eacon, changecon, wacon}), EXTERNALACCESS_NOTIFY, IPriorityEvaluator.PRIORITY_1); return externalaccess_facttrigger; }
/** * Create the achievegoal succeeded rule (for goals without target condition). * The goal succeeds, when one plan succeeds. */ protected static Rule createAchievegoalSucceededRule() { Variable rgoal = new Variable("?rgoal", OAVBDIRuntimeModel.goal_type); Variable rplan = new Variable("?rplan", OAVBDIRuntimeModel.plan_type); ObjectCondition goalcon = new ObjectCondition(OAVBDIRuntimeModel.goal_type); goalcon.addConstraint(new BoundConstraint(null, rgoal)); goalcon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.goal_has_finishedplans, rplan, IOperator.CONTAINS)); goalcon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.element_has_model, OAVBDIMetaModel.achievegoal_type, IOperator.INSTANCEOF)); goalcon.addConstraint(new LiteralConstraint(new OAVAttributeType[]{ OAVBDIRuntimeModel.element_has_model, OAVBDIMetaModel.achievegoal_has_targetcondition}, null)); ObjectCondition plancon = new ObjectCondition(OAVBDIRuntimeModel.plan_type); plancon.addConstraint(new BoundConstraint(null, rplan)); plancon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.plan_has_processingstate, OAVBDIRuntimeModel.PLANPROCESSINGTATE_FINISHED)); plancon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.plan_has_lifecyclestate, OAVBDIRuntimeModel.PLANLIFECYCLESTATE_PASSED)); ObjectCondition capcon = new ObjectCondition(OAVBDIRuntimeModel.capability_type); capcon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.capability_has_goals, rgoal, IOperator.CONTAINS)); Rule achievegoal_succeeded = new Rule("achievegoal_succeeded", new AndCondition(new ICondition[]{plancon, goalcon, capcon}), GOAL_SUCCEEDED_PLAN_REMOVE, IPriorityEvaluator.PRIORITY_1); return achievegoal_succeeded; }
/** * Start dropping a goal that is succeeded or failed. */ public static Rule createGoalDroppingRule() { Variable rgoal = new Variable("?rgoal", OAVBDIRuntimeModel.goal_type); Variable mgoal = new Variable("?mgoal", OAVBDIMetaModel.goal_type); ObjectCondition goalcon = new ObjectCondition(OAVBDIRuntimeModel.goal_type); goalcon.addConstraint(new BoundConstraint(null, rgoal)); goalcon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.element_has_model, mgoal)); goalcon.addConstraint(new AndConstraint( new LiteralConstraint(OAVBDIRuntimeModel.goal_has_lifecyclestate, OAVBDIRuntimeModel.GOALLIFECYCLESTATE_DROPPING, IOperator.NOTEQUAL), new LiteralConstraint(OAVBDIRuntimeModel.goal_has_lifecyclestate, OAVBDIRuntimeModel.GOALLIFECYCLESTATE_DROPPED, IOperator.NOTEQUAL))); goalcon.addConstraint(new OrConstraint( new LiteralConstraint(OAVBDIRuntimeModel.goal_has_processingstate, OAVBDIRuntimeModel.GOALPROCESSINGSTATE_SUCCEEDED), new LiteralConstraint(OAVBDIRuntimeModel.goal_has_processingstate, OAVBDIRuntimeModel.GOALPROCESSINGSTATE_FAILED))); // goalcon.addConstraint(new LiteralConstraint(new OAVAttributeType[]{OAVBDIRuntimeModel.element_has_model, OAVAttributeType.OBJECTTYPE}, OAVBDIMetaModel.maintaingoal_type, IOperator.NOTEQUAL)); ObjectCondition capcon = new ObjectCondition(OAVBDIRuntimeModel.capability_type); capcon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.capability_has_goals, rgoal, IOperator.CONTAINS)); // Hack!!! Higher priority required to avoid deliberation activating goal that is already finished in option state (e.g. due to immediately fulfilled target condition) Rule goal_dropping = new Rule("goal_dropping", new AndCondition(new ICondition[]{goalcon, capcon}), GOAL_DROPPING_ACTION, IPriorityEvaluator.PRIORITY_1); return goal_dropping; }
/** * Trigger plan creation on fact added event. */ protected static Rule createExternalAccessFactAddedTriggeredRule() { Variable ea = new Variable("?ea", OAVBDIRuntimeModel.externalaccess_type); Variable wa = new Variable("?wa", OAVBDIRuntimeModel.waitabstraction_type); Variable rel = new Variable("?rel", OAVBDIRuntimeModel.processableelement_type); Variable rpe = new Variable("?rpe", OAVBDIRuntimeModel.changeevent_type); ObjectCondition eacon = new ObjectCondition(OAVBDIRuntimeModel.externalaccess_type); eacon.addConstraint(new BoundConstraint(null, ea)); eacon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.externalaccess_has_waitabstraction, wa)); ObjectCondition changecon = new ObjectCondition(OAVBDIRuntimeModel.changeevent_type); changecon.addConstraint(new BoundConstraint(null, rpe)); changecon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.changeevent_has_type, OAVBDIRuntimeModel.CHANGEEVENT_FACTADDED)); changecon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.changeevent_has_element, rel)); ObjectCondition wacon = new ObjectCondition(OAVBDIRuntimeModel.waitabstraction_type); wacon.addConstraint(new BoundConstraint(null, wa)); wacon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.waitabstraction_has_factaddeds, rel, IOperator.CONTAINS)); Rule externalaccess_facttrigger = new Rule("externalaccess_factaddedtrigger", new AndCondition(new ICondition[]{eacon, changecon, wacon}), EXTERNALACCESS_NOTIFY, IPriorityEvaluator.PRIORITY_1); return externalaccess_facttrigger; }
/** * Create the performgoal finished rule. * A perform goal is finished when not rebuild and last plan finished. */ protected static Rule createPerformgoalFinishedRule() { Variable rgoal = new Variable("?rgoal", OAVBDIRuntimeModel.goal_type); Variable rplan = new Variable("?rplan", OAVBDIRuntimeModel.plan_type); ObjectCondition goalcon = new ObjectCondition(OAVBDIRuntimeModel.goal_type); goalcon.addConstraint(new BoundConstraint(null, rgoal)); goalcon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.processableelement_has_apl, null)); goalcon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.goal_has_lifecyclestate, OAVBDIRuntimeModel.GOALLIFECYCLESTATE_ACTIVE)); goalcon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.goal_has_finishedplans, rplan, IOperator.CONTAINS)); goalcon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.element_has_model, OAVBDIMetaModel.performgoal_type, IOperator.INSTANCEOF)); goalcon.addConstraint(new LiteralConstraint(new OAVAttributeType[]{ OAVBDIRuntimeModel.element_has_model, OAVBDIMetaModel.goal_has_rebuild}, Boolean.FALSE)); ObjectCondition plancon = new ObjectCondition(OAVBDIRuntimeModel.plan_type); plancon.addConstraint(new LiteralConstraint(OAVBDIRuntimeModel.plan_has_processingstate, OAVBDIRuntimeModel.PLANPROCESSINGTATE_FINISHED)); plancon.addConstraint(new BoundConstraint(null, rplan)); ObjectCondition capacon = new ObjectCondition(OAVBDIRuntimeModel.capability_type); capacon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.capability_has_goals, rgoal, IOperator.CONTAINS)); Rule performgoal_finished = new Rule("performgoal_finished", new AndCondition(new ICondition[]{plancon, goalcon, capacon}), GOAL_SUCCEEDED_PLAN_REMOVE, IPriorityEvaluator.PRIORITY_1); // Must have higher priority than recur! return performgoal_finished; }
/** * 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; }
/** * 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; }
wacon.addConstraint(new BoundConstraint(OAVBDIRuntimeModel.waitabstraction_has_messageevents, orig, IOperator.CONTAINS)); Rule ea_trigger = new Rule("externalaccess_messageeventtrigger", new AndCondition(new ICondition[]{eacon, rpecon, capcon, wacon}), EXTERNALACCESS_NOTIFY, IPriorityEvaluator.PRIORITY_1);