Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gs-gama
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
graphstream
gs-gama
Commits
d917f604
Commit
d917f604
authored
Feb 09, 2014
by
Thibaut Démare
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the 'add receiver' command
parent
0273e27d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
0 deletions
+56
-0
src/org/graphstream/gama/extension/IKeywordGSAdditional.java
src/org/graphstream/gama/extension/IKeywordGSAdditional.java
+2
-0
src/org/graphstream/gama/extension/receiver/AddReceiverStatement.java
...hstream/gama/extension/receiver/AddReceiverStatement.java
+54
-0
No files found.
src/org/graphstream/gama/extension/IKeywordGSAdditional.java
View file @
d917f604
...
...
@@ -21,6 +21,7 @@ public class IKeywordGSAdditional implements IKeyword {
public
static
final
String
REMOVE_NODE_ATTRIBUTE
=
"gs_remove_node_attribute"
;
public
static
final
String
STEP
=
"gs_step"
;
//Receiver command
public
static
final
String
ADD_RECEIVER
=
"gs_add_receiver"
;
public
static
final
String
GET_EDGE_ATTRIBUTE
=
"gs_get_edge_attribute"
;
public
static
final
String
GET_NODE_ATTRIBUTE
=
"gs_get_node_attribute"
;
public
static
final
String
GET_GRAPH_ATTRIBUTE
=
"gs_get_graph_attribute"
;
...
...
@@ -28,6 +29,7 @@ public class IKeywordGSAdditional implements IKeyword {
public
static
final
String
FLUSH
=
"gs_flush"
;
// Facets associated to a command
public
static
final
String
ATTRIBUTE_FILTER
=
"gs_attribute_name"
;
public
static
final
String
ATTRIBUTE_NAME
=
"gs_attribute_name"
;
public
static
final
String
ATTRIBUTE_VALUE
=
"gs_attribute_value"
;
public
static
final
String
EDGE_ID
=
"gs_edge_id"
;
...
...
src/org/graphstream/gama/extension/receiver/AddReceiverStatement.java
0 → 100644
View file @
d917f604
package
org.graphstream.gama.extension.receiver
;
import
java.util.HashSet
;
import
java.util.Set
;
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
.
ADD_RECEIVER
,
kind
=
ISymbolKind
.
SINGLE_STATEMENT
,
with_sequence
=
false
)
@inside
(
kinds
=
{
ISymbolKind
.
BEHAVIOR
,
ISymbolKind
.
SINGLE_STATEMENT
})
@facets
(
value
=
{
@facet
(
name
=
IKeywordGSAdditional
.
RECEIVERID
,
type
=
IType
.
STRING
,
optional
=
false
),
@facet
(
name
=
IKeywordGSAdditional
.
HOST
,
type
=
IType
.
STRING
,
optional
=
false
),
@facet
(
name
=
IKeywordGSAdditional
.
PORT
,
type
=
IType
.
INT
,
optional
=
false
),
@facet
(
name
=
IKeywordGSAdditional
.
ATTRIBUTE_FILTER
,
type
=
IType
.
LIST
,
optional
=
true
)})
public
class
AddReceiverStatement
extends
AbstractStatement
implements
IStatement
{
final
IExpression
receiverid
;
final
IExpression
host
;
final
IExpression
port
;
final
IExpression
filter
;
public
AddReceiverStatement
(
IDescription
desc
)
{
super
(
desc
);
receiverid
=
getFacet
(
IKeywordGSAdditional
.
RECEIVERID
);
host
=
getFacet
(
IKeywordGSAdditional
.
HOST
);
port
=
getFacet
(
IKeywordGSAdditional
.
PORT
);
filter
=
getFacet
(
IKeywordGSAdditional
.
ATTRIBUTE_FILTER
);
}
@Override
protected
Object
privateExecuteIn
(
IScope
scope
)
throws
GamaRuntimeException
{
String
r
=
(
String
)(
receiverid
.
value
(
scope
));
String
h
=
(
String
)(
host
.
value
(
scope
));
int
p
=
(
Integer
)(
port
.
value
(
scope
));
Set
filterSet
=
new
HashSet
((
msi
.
gama
.
util
.
GamaList
)
filter
.
value
(
scope
));
if
(
filterSet
.
size
()
==
0
)
filterSet
=
null
;
GSManager
.
addReceiver
(
r
,
h
,
p
,
filterSet
);
return
null
;
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment