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

Add the 'remove node attribute' command

parent 488b2d86
...@@ -66,6 +66,9 @@ global { ...@@ -66,6 +66,9 @@ global {
// Remove edge attribute // Remove edge attribute
gs_remove_edge_attribute gs_sender_id:"test1" gs_edge_id:"edge1" gs_attribute_name:"string"; gs_remove_edge_attribute gs_sender_id:"test1" gs_edge_id:"edge1" gs_attribute_name:"string";
// Remove edge attribute
gs_remove_node_attribute gs_sender_id:"test1" gs_node_id:"node1" gs_attribute_name:"string";
// Step // Step
gs_step gs_sender_id:"test1" gs_step_number:3; gs_step gs_sender_id:"test1" gs_step_number:3;
......
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_ATTRIBUTE, 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),
@facet(name = IKeywordGSAdditional.ATTRIBUTE_NAME, type = IType.STRING, optional = false)})
public class RemoveNodeAttributeStatement extends AbstractStatement implements IStatement{
final IExpression senderid;
final IExpression nodeid;
final IExpression attname;
public RemoveNodeAttributeStatement(IDescription desc) {
super(desc);
senderid = getFacet(IKeywordGSAdditional.SENDERID);
nodeid = getFacet(IKeywordGSAdditional.NODE_ID);
attname = getFacet(IKeywordGSAdditional.ATTRIBUTE_NAME);
}
@Override
protected Object privateExecuteIn(IScope scope) throws GamaRuntimeException {
String s = (String)(senderid.value(scope));
String eid = (String)(nodeid.value(scope));
String an = (String)(attname.value(scope));
GSSender sender = GSManager.getSender(s);
sender.sendNodeAttributeRemoved(eid, an);
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