![JAR search and dependency download from the Maven repository](/logo.png)
io.github.agentsoz.abmjack.env.GenericActPlan Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of abm-jack Show documentation
Show all versions of abm-jack Show documentation
Allows the use of JACK (aosgrp.com/products/jack) as the underlying BDI system
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
This code is generated by JAC version 5.6 by
Agent Oriented Software. http://www.agent-software.com.au
DO NOT ALTER THIS CODE AND DO NOT REMOVE THIS COMMENT
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*/
package io.github.agentsoz.abmjack.env;
/*
* #%L
* BDI-ABM Integration Package
* %%
* Copyright (C) 2014 - 2016 by its authors. See AUTHORS file.
* %%
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Lesser Public License for more details.
*
* You should have received a copy of the GNU General Lesser Public
* License along with this program. If not, see
* .
* #L%
*/
import aos.jack.jak.plan.Plan;
import aos.jack.jak.plan.PlanFSM;
import aos.jack.jak.plan.ExMap;
import aos.jack.jak.agent.NameSpace;
import aos.jack.jak.event.Event;
import aos.jack.jak.task.Task;
import aos.jack.jak.core.Generator;
import aos.jack.jak.logic.Signature;
import io.github.agentsoz.bdiabm.data.ActionContent.State;
import java.lang.Object;
import aos.jack.jak.cursor.Cursor;
import aos.jack.jak.fsm.FSM;
import aos.jack.jak.core.Jak;
/**
*
* @author Alex Lutman
*
*/
public class GenericActPlan extends aos.jack.jak.plan.Plan {
public io.github.agentsoz.abmjack.env.GenericActGoal genericactgoal_h;
public io.github.agentsoz.abmjack.env.ActionList ActionData_dat;
private static aos.jack.jak.plan.ExMap[] __exMap_body;
private static java.lang.String[] __tt__body = {
"io/github/agentsoz/abmjack/env/GenericActPlan.plan",
"body",
"40",
"41",
"42",
"43",
"44",
"46",
"38"};
private final static java.lang.String[] __planVariableNames = {
"genericactgoal_h",
"ActionData_dat"};
private final static java.lang.String[] __planVariableTypes = {
"io.github.agentsoz.abmjack.env.GenericActGoal",
"io.github.agentsoz.abmjack.env.ActionList"};
private final static java.lang.String[] __reasoningMethods = {
"body"};
public java.lang.String getDocumentation()
{
return "/**\n * \n * @author Alex Lutman\n *\n */\n";
}
public GenericActPlan()
{
}
private GenericActPlan(aos.jack.jak.task.Task __t, io.github.agentsoz.abmjack.env.GenericActPlan __env)
{
__agent = __env.__agent;
__ns = __env.__ns;
__planTask = __t;
__logic = __t.logic;
genericactgoal_h = __env.genericactgoal_h;
ActionData_dat = __env.ActionData_dat;
}
public boolean init_sentinel(aos.jack.jak.agent.NameSpace __a)
{
genericactgoal_h = (io.github.agentsoz.abmjack.env.GenericActGoal) __a.findEvent("io.github.agentsoz.abmjack.env.GenericActGoal");
if (genericactgoal_h == null) {
warning("GenericActGoal genericactgoal_h: is not found in the capability/agent this plan comes from");
return false;
}
ActionData_dat = (io.github.agentsoz.abmjack.env.ActionList) lookupNamedObject("ActionData_dat","io.github.agentsoz.abmjack.env.ActionList",0);
if (ActionData_dat == null) {
warning("ActionList ActionData_dat: is not found in the capability/agent this plan comes from");
return false;
}
return true;
}
public aos.jack.jak.plan.Plan freeze()
{
return this;
}
public aos.jack.jak.plan.Plan unfreeze()
{
return this;
}
public java.lang.Object genObject(int __index)
{
switch (__index) {
}
aos.jack.jak.core.Jak.error("illegal Object Construction");
return null;
}
public aos.jack.jak.cursor.Cursor genCursor(int __index)
throws java.lang.Exception
{
switch (__index) {
}
aos.jack.jak.core.Jak.error("illegal Cursor Construction");
return null;
}
public aos.jack.jak.fsm.FSM genFSM(int __index)
throws java.lang.Exception
{
switch (__index) {
}
aos.jack.jak.core.Jak.error("illegal FSM Construction");
return null;
}
public boolean testCondition(int __index)
throws java.lang.Exception
{
switch (__index) {
}
aos.jack.jak.core.Jak.error("illegal test Construction");
return false;
}
public aos.jack.jak.plan.PlanFSM body()
{
return new io.github.agentsoz.abmjack.env.GenericActPlan.__bodyFSM();
}
private GenericActPlan(io.github.agentsoz.abmjack.env.GenericActGoal __ev, aos.jack.jak.task.Task __t, io.github.agentsoz.abmjack.env.GenericActPlan __env)
{
this(__t,__env);
this.genericactgoal_h = __ev;
}
protected aos.jack.jak.logic.Signature eventSignature(int __log)
{
return genericactgoal_h.getSignature(__log);
}
public java.lang.String handledEvent()
{
return "io.github.agentsoz.abmjack.env.GenericActGoal";
}
public boolean __relevant(aos.jack.jak.event.Event __e)
{
return __ns.isEnabled();
}
public aos.jack.jak.plan.Plan createPlan(aos.jack.jak.event.Event __e, aos.jack.jak.task.Task __t)
{
if (!(__e instanceof io.github.agentsoz.abmjack.env.GenericActGoal))
return null;
io.github.agentsoz.abmjack.env.GenericActGoal __e1 = (io.github.agentsoz.abmjack.env.GenericActGoal) __e;
return new io.github.agentsoz.abmjack.env.GenericActPlan(__e1,__t,this);
}
public java.lang.String[] variableNames()
{
return __planVariableNames;
}
public java.lang.String[] variableTypes()
{
return __planVariableTypes;
}
public java.lang.Object getVariable(int n)
{
switch (n) {
case 0:
{
return aos.util.ToObject.box(genericactgoal_h);
}
case 1:
{
return aos.util.ToObject.box(ActionData_dat);
}
default:
{
throw new java.lang.IndexOutOfBoundsException("Plan " + this + " does not have variable number " + n);
}
}
}
public java.lang.String[] reasoningMethods()
{
return mergeReasoningMethods(__reasoningMethods,super.reasoningMethods());
}
public aos.jack.jak.cursor.Cursor context()
{
try {
return (((true)?aos.jack.jak.cursor.Cursor.trueCursor:aos.jack.jak.cursor.Cursor.falseCursor));
}
catch (java.lang.Exception e) {
e.printStackTrace();
return aos.jack.jak.cursor.Cursor.falseCursor;
}
}
class __bodyFSM extends aos.jack.jak.plan.PlanFSM implements aos.jack.jak.core.Generator {
private int __breakLevel = 0;
public int run(int __status)
throws java.lang.Throwable
{
do {
try {
if (__tothrow != null)
throw __tothrow;
if ((aos.jack.jak.core.Jak.debugging & aos.jack.jak.core.Jak.LOG_PLANS) != 0)
aos.util.logging.LogMsg.log(this,aos.jack.jak.core.Jak.LOG_PLANS,__task + "-GenericActPlan.body:" + java.lang.Integer.toString(__state));
if (__task.nsteps > 0) {
__task.nsteps-- ;
if (__task.nsteps == 0)
agent.changeFocus();
}
if (__state < 10) {
__status = super.stdrun(io.github.agentsoz.abmjack.env.GenericActPlan.this,__status);
if (__status != CONTINUE || agent.changing_focus)
return __status;
continue;
}
__curstate = __state;
switch (__state) {
default:
{
aos.jack.jak.core.Jak.error("GenericActPlan.body: Illegal state");
return FAILED_STATE;
}
//* (40) genericactgoal_h.am.packageAction(getAgent().getBasename(), genericactgoal_h.actionID, genericactgoal_h.parameters);
case 10:
{
__breakLevel = 0;
__state = 11;
genericactgoal_h.am.packageAction(getAgent().getBasename(),genericactgoal_h.actionID,genericactgoal_h.parameters);
break;
}
//* (41) @waitFor(new GenericActionStateCursor(ActionData_dat, genericactgoal_h.actionID));
case 11:
{
__task.push(new aos.jack.jak.fsm.WaitForFSM(getAgent(),__task,this,0));
__state = -__state;
__subtask_pass = 12;
__subtask_fail = 4;
return SUBTASK;
}
//* (42) genericactgoal_h.parameters = ActionData_dat.getParameters(genericactgoal_h.actionID);
case 12:
{
__state = 13;
genericactgoal_h.parameters = ActionData_dat.getParameters(genericactgoal_h.actionID);
break;
}
//* (43) if(ActionData_dat.getState(genericactgoal_h.actionID).equals(State.PASSED)) {
case 13:
{
if (ActionData_dat.getState(genericactgoal_h.actionID).equals(io.github.agentsoz.bdiabm.data.ActionContent.State.PASSED))
__state = 14;
else
__state = 15;
break;
}
//* (44) true;
case 14:
{
__breakLevel = 2;
if (true)
__state = 16;
else
throw planfailed;
break;
}
//* (46) false;
case 15:
{
__breakLevel = 2;
if (false)
__state = 16;
else
throw planfailed;
break;
}
//* (38) body()
case 16:
{
if (__pending == null)
__state = PASSED_STATE;
__tothrow = __pending;
break;
}
}
}
catch (java.lang.Throwable e) {
handleException(e,__exMap_body);
}
}
while (!agent.changing_focus);
return CONTINUE;
}
public java.lang.String methodName()
{
return "body";
}
__bodyFSM()
{
}
public java.lang.String stateInfo()
{
int n = __curstate;
java.lang.String file = __tt__body[0];
java.lang.String method = __tt__body[1];
if (n < 0)
n = -n;
n -= (10 - 2);
java.lang.String line = (n < 2)?"??":__tt__body[n];
return file + ":" + line + " " + method + " [" + __curstate + "]";
}
public java.lang.Object genObject(int __index)
{
switch (__index) {
}
aos.jack.jak.core.Jak.error("illegal Object Construction");
return null;
}
public aos.jack.jak.cursor.Cursor genCursor(int __index)
throws java.lang.Exception
{
switch (__index) {
case 0:
{
return (new io.github.agentsoz.abmjack.env.GenericActionStateCursor(ActionData_dat,genericactgoal_h.actionID));
}
}
aos.jack.jak.core.Jak.error("illegal Cursor Construction");
return null;
}
public aos.jack.jak.fsm.FSM genFSM(int __index)
throws java.lang.Exception
{
switch (__index) {
}
aos.jack.jak.core.Jak.error("illegal FSM Construction");
return null;
}
public boolean testCondition(int __index)
throws java.lang.Exception
{
switch (__index) {
}
aos.jack.jak.core.Jak.error("illegal test Construction");
return false;
}
public aos.jack.jak.plan.Plan getPlan()
{
return io.github.agentsoz.abmjack.env.GenericActPlan.this;
}
protected aos.jack.jak.fsm.FSM fail()
{
return getPlan().fail();
}
protected aos.jack.jak.fsm.FSM pass()
{
return getPlan().pass();
}
public void enter()
{
__trace = agent.trace("io.github.agentsoz.abmjack.env.GenericActPlan.body");
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy