Skip to content

Commit

Permalink
fixes #19
Browse files Browse the repository at this point in the history
The "agents_on" attributes for road is not used anymore in the road skill, so I removed it. You can use "all_agents" to get the list of agents on the road. I removed as well the "unregister" in the road skill that was deprecated (now, unregister has to be used in the driving skill).
  • Loading branch information
ptaillandier committed Mar 15, 2024
1 parent 8a230e2 commit e9f6f59
Showing 1 changed file with 1 addition and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@
* The Class RoadSkill.
*/
@vars ({ @variable (
name = RoadSkill.AGENTS_ON,
type = IType.LIST,
of = IType.LIST,
doc = @doc ("for each lane of the road, the list of agents for each segment")),
@variable (
name = RoadSkill.ALL_AGENTS,
type = IType.LIST,
of = IType.AGENT,
Expand Down Expand Up @@ -116,9 +111,6 @@ public static class NewRoadSkill extends RoadSkill {}
// TODO: rename these two lists?
public static final String ALL_AGENTS = "all_agents";

/** The Constant AGENTS_ON. */
public static final String AGENTS_ON = "agents_on";

/** The Constant SOURCE_NODE. */
public static final String SOURCE_NODE = "source_node";

Expand Down Expand Up @@ -147,31 +139,7 @@ public static class NewRoadSkill extends RoadSkill {}
/** The Constant VEHICLE_ORDERING. */
public static final String VEHICLE_ORDERING = "vehicle_ordering";

/**
* Gets the agents on.
*
* @param agent
* the agent
* @return the agents on
*/
@getter (AGENTS_ON)
public static List getAgentsOn(final IAgent agent) {
return (List) agent.getAttribute(AGENTS_ON);
}

/**
* Sets the agents on.
*
* @param agent
* the agent
* @param agents
* the agents
*/
@setter (AGENTS_ON)
public static void setAgentsOn(final IAgent agent, final List agents) {
agent.setAttribute(AGENTS_ON, agents);
}


/**
* Gets the agents.
*
Expand Down Expand Up @@ -544,28 +512,4 @@ public static boolean register(final IScope scope, final IAgent vehicle, final I
return true;
}

/**
* Prim unregister.
*
* @param scope
* the scope
* @throws GamaRuntimeException
* the gama runtime exception
*/
@action (
name = "unregister",
args = { @arg (
name = "agent",
type = IType.AGENT,
optional = false,
doc = @doc ("the agent to unregister on the road.")) },
doc = @doc (
value = "unregister the agent on the road",
examples = { @example ("do unregister agent: the_driver;") },
deprecated = "use the `unregister` action in advanced_driving skill instead"))
@Deprecated
public boolean primUnregister(final IScope scope) throws GamaRuntimeException {
IAgent driver = (IAgent) scope.getArg("agent", IType.AGENT);
return DrivingSkill.unregister(scope, driver);
}
}

0 comments on commit e9f6f59

Please sign in to comment.