Commit 61beb21e authored by Thibaut Démare's avatar Thibaut Démare

Add the 'add node' command

parent ccbaa5be
......@@ -43,8 +43,8 @@ public class GSSender {
nsSender.edgeAdded(sourceId, newEvent(), edgeId, fromId, toId, directed);
}
public void sendNodeRemoved(long nodeId) {
nsSender.nodeRemoved(sourceId, newEvent(), nodeId + "");
public void sendNodeRemoved(String nodeId) {
nsSender.nodeRemoved(sourceId, newEvent(), nodeId);
}
public void sendEdgeRemoved(String edgeId) {
......
package org.graphstream.gama.extension.sender;
import msi.gama.precompiler.ISymbolKind;
import msi.gama.precompiler.GamlAnnotations.facet;
import msi.gama.precompiler.GamlAnnotations.facets;
import msi.gama.precompiler.GamlAnnotations.inside;
import msi.gama.precompiler.GamlAnnotations.symbol;
import msi.gama.runtime.IScope;
import msi.gama.runtime.exceptions.GamaRuntimeException;
import msi.gaml.descriptions.IDescription;
import msi.gaml.expressions.IExpression;
import msi.gaml.statements.AbstractStatement;
import msi.gaml.statements.IStatement;
import msi.gaml.types.IType;
import org.graphstream.gama.extension.GSManager;
import org.graphstream.gama.extension.IKeywordGSAdditional;
@symbol(name = IKeywordGSAdditional.REMOVE_NODE, kind = ISymbolKind.SINGLE_STATEMENT, with_sequence = false)
@inside(kinds = { ISymbolKind.BEHAVIOR, ISymbolKind.SINGLE_STATEMENT })
@facets(value = { @facet(name = IKeywordGSAdditional.SENDERID, type = IType.STRING, optional = false),
@facet(name = IKeywordGSAdditional.NODE_ID, type = IType.STRING, optional = false)})
public class RemoveNodeStatement extends AbstractStatement implements IStatement{
final IExpression senderid;
final IExpression nodeid;
public RemoveNodeStatement(IDescription desc) {
super(desc);
senderid = getFacet(IKeywordGSAdditional.SENDERID);
nodeid = getFacet(IKeywordGSAdditional.NODE_ID);
}
@Override
protected Object privateExecuteIn(IScope scope) throws GamaRuntimeException {
String s = (String)(senderid.value(scope));
String eid = (String)(nodeid.value(scope));
GSSender sender = GSManager.getSender(s);
sender.sendNodeRemoved(eid);
return null;
}
}
\ No newline at end of file
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