
scenarioTWO.data.depTime Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bushfire-tutorial Show documentation
Show all versions of bushfire-tutorial Show documentation
Application using JACK-MATSim integration
The newest version!
/*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
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 scenarioTWO.data;
import aos.jack.jak.core.Jak;
import aos.jack.jak.event.EventRecipient;
import aos.jack.jak.beliefset.ClosedWorld;
import aos.jack.jak.beliefset.ClosedWorldCursor;
import aos.jack.jak.beliefset.BeliefSetCursor;
import aos.jack.jak.beliefset.BeliefSetException;
import aos.jack.jak.beliefset.Tuple;
import aos.jack.jak.beliefset.BeliefSet;
import aos.jack.jak.logic.ChoicePoint;
import aos.jack.jak.logic.Variable;
import aos.jack.jak.cursor.Cursor;
import aos.jack.jak.cursor.BeliefState;
import aos.jack.plugin.view.rt.CleanupCursor;
import java.lang.Exception;
import java.lang.Object;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class depTime extends aos.jack.jak.beliefset.ClosedWorld {
final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger("");
static public scenarioTWO.data.depTime__Tuple __hole = new scenarioTWO.data.depTime__Tuple(true);
public scenarioTWO.data.depTime__Tuple[][] __tables;
public double getDepartureTime(java.lang.String id)
{
double deptime = -1.0;
try {
deptime = getAgentDepTime(id);
}
catch (java.lang.Exception e) {
java.lang.System.out.println("unable to get time left to evac, returning -1.0 ");
}
return deptime;
}
public boolean attach(aos.jack.jak.event.EventRecipient __h)
{
java.lang.Object __o = __h;
if (!super.attach(__h))
return false;
return true;
}
public aos.jack.jak.beliefset.BeliefSetCursor getDepTime(java.lang.String __v0, aos.jack.jak.logic.DoubleVariable __v1)
throws aos.jack.jak.beliefset.BeliefSetException
{
scenarioTWO.data.depTime__Tuple __t = new scenarioTWO.data.depTime__Tuple();
scenarioTWO.data.depTime.__Cursor __c = new scenarioTWO.data.depTime.__Cursor(__t);
__t.agentID = __v0;
if (!__v1.check_unifiable(java.lang.Double.TYPE))
throw new aos.jack.jak.beliefset.BeliefSetException("depTime:getDepTime:IO: arg 1 deptime Incorrect Variable type");
if (__v1.isGround()) {
try {
__t.deptime = __v1.as_double();
}
catch (java.lang.Exception e) {
throw new aos.jack.jak.beliefset.BeliefSetException("depTime:getDepTime:IO: got " + e.toString());
}
}
else
__c.deptime = __v1;
__c.init(0,this);
return __c;
}
double getAgentDepTime(java.lang.String id)
throws aos.jack.jak.beliefset.BeliefSetException
{
scenarioTWO.data.depTime.__complex_1 __c = new scenarioTWO.data.depTime.__complex_1(id);
try {
return __c.__complex_1_getAgentDepTime();
}
catch (java.lang.Exception __e) {
throw new aos.jack.jak.beliefset.BeliefSetException("getAgentDepTime got exception " + __e);
}
}
public int keyIndex()
{
return 0;
}
public int fullIndex()
{
return 0;
}
public int nIndexes()
{
return 1;
}
public aos.jack.jak.beliefset.Tuple newTuple()
{
return new scenarioTWO.data.depTime__Tuple();
}
public aos.jack.jak.beliefset.Tuple getTuple(int t, int l)
{
return __tables[t][l];
}
public aos.jack.jak.beliefset.Tuple[] newTable(int t)
{
return new scenarioTWO.data.depTime__Tuple[t];
}
public aos.jack.jak.beliefset.Tuple[][] newTables(int t)
{
return new scenarioTWO.data.depTime__Tuple[t][];
}
public aos.jack.jak.beliefset.Tuple[] getTable(int t)
{
return __tables[t];
}
public aos.jack.jak.beliefset.Tuple[][] getTables()
{
return __tables;
}
public void setTables(aos.jack.jak.beliefset.Tuple[][] t)
{
__tables = (scenarioTWO.data.depTime__Tuple[][]) t;
}
public aos.jack.jak.beliefset.BeliefSetCursor newCursor(aos.jack.jak.beliefset.Tuple __t)
{
if (__t instanceof scenarioTWO.data.depTime__Tuple)
return new scenarioTWO.data.depTime.__Cursor((scenarioTWO.data.depTime__Tuple) __t);
return null;
}
public void add(java.lang.String __v0, double __v1)
throws aos.jack.jak.beliefset.BeliefSetException
{
add(__v0,__v1,aos.jack.jak.cursor.Cursor.TRUE);
}
public void add(java.lang.String __v0, double __v1, aos.jack.jak.cursor.BeliefState __d)
throws aos.jack.jak.beliefset.BeliefSetException
{
scenarioTWO.data.depTime__Tuple __t = new scenarioTWO.data.depTime__Tuple();
__t.agentID = __v0;
__t.deptime = __v1;
super.assertTuple(__t,__d);
}
public void remove(java.lang.String __v0, double __v1)
throws aos.jack.jak.beliefset.BeliefSetException
{
remove(__v0,__v1,aos.jack.jak.cursor.Cursor.TRUE);
}
public void remove(java.lang.String __v0, double __v1, aos.jack.jak.cursor.BeliefState __d)
throws aos.jack.jak.beliefset.BeliefSetException
{
scenarioTWO.data.depTime__Tuple __t = new scenarioTWO.data.depTime__Tuple();
__t.agentID = __v0;
__t.deptime = __v1;
super.retractTuple(__t,__d);
}
public depTime()
{
}
public depTime(java.lang.String n)
{
super();
read(n);
}
class __Cursor extends aos.jack.jak.beliefset.ClosedWorldCursor {
public scenarioTWO.data.depTime__Tuple __tuple = null;
public aos.jack.jak.logic.Variable agentID;
public aos.jack.jak.logic.Variable deptime;
public __Cursor()
{
__tuple = __hole;
}
public __Cursor(scenarioTWO.data.depTime__Tuple __t)
{
super();
__tuple = __t;
}
public int match(int __ti, int __st, int __c, boolean __k, int __ind)
{
scenarioTWO.data.depTime__Tuple[] __tab = __tables[__ti];
scenarioTWO.data.depTime__Tuple __t;
int __sz = __tab.length;
int __i;
if ((aos.jack.jak.core.Jak.debugging & aos.jack.jak.core.Jak.LOG_DB) != 0) {
aos.jack.jak.core.Jak.log.log("depTime__Tuple:match:" + __ti + ":" + __st + ":" + __c + ":" + __k + ":" + __ind);
aos.jack.jak.core.Jak.log.log("Tuple=" + __tuple);
aos.jack.jak.core.Jak.log.log("Outputs are");
aos.jack.jak.core.Jak.log.log(" agentID:" + agentID);
aos.jack.jak.core.Jak.log.log(" deptime:" + deptime);
}
for (__i = __st; __c > 0; __i = (__i + 1) % __sz, __c-- ) {
__t = __tab[__i];
if (__t == null) {
if (__ind < 0)
continue;
return -1;
}
if (__t == __hole)
continue;
if (__t.isFree) {
__tab[__i] = __hole;
continue;
}
if ((aos.jack.jak.core.Jak.debugging & aos.jack.jak.core.Jak.LOG_DB) != 0)
aos.jack.jak.core.Jak.log.log("t" + __i + ":" + __t);
try {
if (cp != null)
cp.backtrack();
if (agentID == null) {
if (!__tuple.agentID.equals(__t.agentID))
continue;
}
else {
if (!agentID.unify(__t.agentID))
continue;
}
if (__k)
return __i;
if (deptime == null) {
if (__tuple.deptime != __t.deptime)
continue;
}
else {
if (!deptime.unify(__t.deptime))
continue;
}
}
catch (java.lang.Exception e) {
continue;
}
return __i;
}
return -1;
}
public int hash(int __i)
{
return (__tuple == null?0:__tuple.hash(__i));
}
public aos.jack.jak.logic.ChoicePoint getChoicePoint()
{
if (agentID != null)
return agentID.getEnv().newChoicePoint();
if (deptime != null)
return deptime.getEnv().newChoicePoint();
return null;
}
public boolean isKeyGround()
{
if (agentID != null)
return false;
return true;
}
}
class __complex_1 extends aos.jack.plugin.view.rt.CleanupCursor {
java.lang.String id;
aos.jack.jak.logic.DoubleVariable __local_2;
aos.jack.jak.cursor.Cursor __local_3;
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 (getDepTime(id,__local_2));
}
case 1:
{
return (__local_3 = (aos.jack.jak.beliefset.BeliefSetCursor) (genCursor(0)));
}
}
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 __complex_1(java.lang.String id)
{
super();
this.id = id;
}
double __complex_1_getAgentDepTime()
throws java.lang.Exception
{
__local_2 = (aos.jack.jak.logic.DoubleVariable) new_variable(java.lang.Double.TYPE);
genCursor(1);
__local_3.next();
// System.out.println($dep.getValue());
return __local_2.getValue();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy