From e9f6f59a81fe36e21eaaa9251ccf868018c7264e Mon Sep 17 00:00:00 2001 From: ptaillandier Date: Fri, 15 Mar 2024 09:53:44 +0700 Subject: [PATCH] fixes #19 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). --- .../extension/traffic/driving/RoadSkill.java | 58 +------------------ 1 file changed, 1 insertion(+), 57 deletions(-) diff --git a/gama.extension.traffic/src/gama/extension/traffic/driving/RoadSkill.java b/gama.extension.traffic/src/gama/extension/traffic/driving/RoadSkill.java index 6483127329..ba1eae6ddd 100644 --- a/gama.extension.traffic/src/gama/extension/traffic/driving/RoadSkill.java +++ b/gama.extension.traffic/src/gama/extension/traffic/driving/RoadSkill.java @@ -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, @@ -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"; @@ -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. * @@ -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); - } }