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
51f40559
Commit
51f40559
authored
Feb 10, 2014
by
Thibaut Démare
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add new tests of data transmitted from Graphstream to Gama
parent
1a7e1c74
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
13 deletions
+86
-13
src-gama-test/gama_model/models/test.gaml
src-gama-test/gama_model/models/test.gaml
+57
-13
src-java-test/org/graphstream/gama/tests/Tests.java
src-java-test/org/graphstream/gama/tests/Tests.java
+29
-0
No files found.
src-gama-test/gama_model/models/test.gaml
View file @
51f40559
...
...
@@ -11,6 +11,8 @@ global {
init
{
//
Send
data
//
Clear
all
previous
senders
gs_clear_senders
;
...
...
@@ -98,21 +100,63 @@ global {
//
If
the
previous
command
has
worked
,
the
next
one
should
work
too
//
gs_add_sender
gs_host
:
"localhost"
gs_port
:
2001
gs_sender_id
:
"test1"
;
//
Receive
Data
//
Clear
all
receivers
gs_clear_receivers
;
//
Add
a
new
receiver
gs_add_receiver
gs_receiver_id
:
"test2"
gs_host
:
"localhost"
gs_port
:
3001
;
//
Wait
step
write
"Receiver created. Wait for a signal of new step."
;
float
syncStep
<-
0.0
;
gs_wait_step
gs_receiver_id
:
"test2"
gs_return
:
syncStep
;
//
Get
graph
attribute
(
s
)
list
val
<-
nil
;
gs_get_graph_attribute
gs_receiver_id
:
"test2"
gs_attribute_name
:
"a"
returns
:
val
;
int
i
<-
0
;
loop
while
:
i
<
length
(
val
)
{
write
val
[
i
];
i
<-
i
+
1
;
}
//
Wait
step
syncStep
<-
0.0
;
gs_wait_step
gs_receiver_id
:
"test2"
gs_return
:
syncStep
;
//
Get
node
attribute
(
s
)
gs_get_node_attribute
gs_receiver_id
:
"test2"
gs_node_id
:
"0"
gs_attribute_name
:
"na"
returns
:
val
;
int
i
<-
0
;
loop
while
:
i
<
length
(
val
)
{
write
val
[
i
];
i
<-
i
+
1
;
}
//
Wait
step
syncStep
<-
0.0
;
gs_wait_step
gs_receiver_id
:
"test2"
gs_return
:
syncStep
;
//
Get
edge
attribute
(
s
)
gs_get_edge_attribute
gs_receiver_id
:
"test2"
gs_edge_id
:
"0_1"
gs_attribute_name
:
"ea"
returns
:
val
;
int
i
<-
0
;
loop
while
:
i
<
length
(
val
)
{
write
val
[
i
];
i
<-
i
+
1
;
}
//
Flush
the
given
receiver
gs_flush
gs_receiver_id
:
"test2"
;
}
}
species
Provider
{
experiment
test_gs_extension
type
:
gui
{
aspect
base
{
draw
square
(
1.5
°
km
)
color
:
rgb
([
100
,
0
,
100
])
;
}
}
experiment
test_gs_extension
type
:
gui
{
output
{
display
display_FinalDestinationManager
{
species
Provider
aspect
:
base
;
}
}
}
\ No newline at end of file
src-java-test/org/graphstream/gama/tests/Tests.java
View file @
51f40559
...
...
@@ -4,13 +4,42 @@ import java.io.IOException;
import
java.net.UnknownHostException
;
import
org.graphstream.stream.netstream.NetStreamReceiver
;
import
org.graphstream.stream.netstream.NetStreamSender
;
public
class
Tests
{
public
static
void
main
(
String
[]
args
)
throws
InterruptedException
,
UnknownHostException
,
IOException
{
// Receive event
NetStreamReceiver
receiver
=
new
NetStreamReceiver
(
2001
);
new
SimpleNetStreamViewer
(
receiver
,
true
);
new
SimpleSinkAdapter
(
receiver
);
// Send event
System
.
out
.
println
(
"Press enter and then it will start to send value"
);
System
.
in
.
read
();
NetStreamSender
sender
=
new
NetStreamSender
(
3001
);
long
timeId
=
0
;
System
.
out
.
println
(
"Start sending data."
);
sender
.
stepBegins
(
"foo"
,
timeId
++,
1
);
sender
.
graphAttributeAdded
(
"foo"
,
timeId
++,
"a"
,
1
);
sender
.
graphAttributeAdded
(
"foo"
,
timeId
++,
"a"
,
true
);
sender
.
graphAttributeAdded
(
"foo"
,
timeId
++,
"a"
,
"bar"
);
Integer
[]
array
=
new
Integer
[
3
];
array
[
0
]
=
0
;
array
[
1
]
=
1
;
array
[
2
]
=
2
;
sender
.
graphAttributeAdded
(
"foo"
,
timeId
++,
"a"
,
array
);
sender
.
graphAttributeAdded
(
"foo"
,
0
,
"a"
,
"old"
);
sender
.
stepBegins
(
"foo"
,
timeId
++,
1
);
sender
.
nodeAttributeAdded
(
"foo"
,
timeId
++,
"0"
,
"na"
,
"bar"
);
sender
.
nodeAttributeChanged
(
"foo"
,
timeId
++,
"0"
,
"na"
,
"bar"
,
"newbar"
);
sender
.
stepBegins
(
"foo"
,
timeId
++,
2
);
sender
.
edgeAttributeAdded
(
"foo"
,
timeId
++,
"0_1"
,
"ea"
,
array
);
sender
.
close
();
}
}
\ 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