Commit d158f144 authored by Thibaut Démare's avatar Thibaut Démare

Fix the 'return' keyword used with a custom keyword

parent 66280f79
...@@ -41,6 +41,7 @@ public class IKeywordGSAdditional implements IKeyword { ...@@ -41,6 +41,7 @@ public class IKeywordGSAdditional implements IKeyword {
public static final String NODE_ID_TO = "gs_node_id_to"; public static final String NODE_ID_TO = "gs_node_id_to";
public static final String PORT = "gs_port"; public static final String PORT = "gs_port";
public static final String RECEIVERID = "gs_receiver_id"; public static final String RECEIVERID = "gs_receiver_id";
public static final String RETURN = "gs_return";
public static final String SENDERID = "gs_sender_id"; public static final String SENDERID = "gs_sender_id";
public static final String STEP_NUMBER = "gs_step_number"; public static final String STEP_NUMBER = "gs_step_number";
} }
...@@ -21,7 +21,7 @@ import org.graphstream.gama.extension.IKeywordGSAdditional; ...@@ -21,7 +21,7 @@ import org.graphstream.gama.extension.IKeywordGSAdditional;
@symbol(name = IKeywordGSAdditional.WAIT_STEP, kind = ISymbolKind.SINGLE_STATEMENT, with_sequence = false) @symbol(name = IKeywordGSAdditional.WAIT_STEP, kind = ISymbolKind.SINGLE_STATEMENT, with_sequence = false)
@inside(kinds = { ISymbolKind.BEHAVIOR, ISymbolKind.SINGLE_STATEMENT }) @inside(kinds = { ISymbolKind.BEHAVIOR, ISymbolKind.SINGLE_STATEMENT })
@facets(value = { @facet(name = IKeywordGSAdditional.RECEIVERID, type = IType.STRING, optional = false), @facets(value = { @facet(name = IKeywordGSAdditional.RECEIVERID, type = IType.STRING, optional = false),
@facet(name = IKeyword.RETURN, type = IType.NEW_TEMP_ID, optional = false)}) @facet(name = IKeywordGSAdditional.RETURN, type = IType.NEW_TEMP_ID, optional = false)})
public class WaitStepStatement extends AbstractStatement implements IStatement{ public class WaitStepStatement extends AbstractStatement implements IStatement{
final IExpression receiverid; final IExpression receiverid;
...@@ -30,14 +30,14 @@ public class WaitStepStatement extends AbstractStatement implements IStatement{ ...@@ -30,14 +30,14 @@ public class WaitStepStatement extends AbstractStatement implements IStatement{
public WaitStepStatement(IDescription desc) { public WaitStepStatement(IDescription desc) {
super(desc); super(desc);
receiverid = getFacet(IKeywordGSAdditional.RECEIVERID); receiverid = getFacet(IKeywordGSAdditional.RECEIVERID);
returnVal = getLiteral(IKeyword.RETURN); returnVal = getLiteral(IKeywordGSAdditional.RETURN);
} }
@Override @Override
protected Object privateExecuteIn(IScope scope) throws GamaRuntimeException { protected Object privateExecuteIn(IScope scope) throws GamaRuntimeException {
String r = (String)(receiverid.value(scope)); String r = (String)(receiverid.value(scope));
GSReceiver receiver = GSManager.getReceiver(r); GSReceiver receiver = GSManager.getReceiver(r);
Double step = receiver.waitStep(); Float step = new Float(receiver.waitStep());
// and we return the attribute list // and we return the attribute list
scope.setVarValue(returnVal, step); scope.setVarValue(returnVal, step);
return step; return step;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment