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
8f8a6871
Commit
8f8a6871
authored
Feb 05, 2014
by
Thibaut Démare
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the 'add edge' command
parent
6da3b779
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
3 deletions
+61
-3
src/org/graphstream/gama/extension/IKeywordGSAdditional.java
src/org/graphstream/gama/extension/IKeywordGSAdditional.java
+3
-0
src/org/graphstream/gama/extension/sender/AddEdgeStatement.java
...g/graphstream/gama/extension/sender/AddEdgeStatement.java
+56
-0
src/org/graphstream/gama/extension/sender/GSSender.java
src/org/graphstream/gama/extension/sender/GSSender.java
+2
-3
No files found.
src/org/graphstream/gama/extension/IKeywordGSAdditional.java
View file @
8f8a6871
...
...
@@ -24,7 +24,10 @@ public class IKeywordGSAdditional implements IKeyword {
public
static
final
String
ATTRIBUTE_VALUE
=
"gs_attribute_value"
;
public
static
final
String
EDGE_ID
=
"gs_edge_id"
;
public
static
final
String
HOST
=
"gs_host"
;
public
static
final
String
IS_DIRECTED
=
"gs_is_directed"
;
public
static
final
String
NODE_ID
=
"gs_node_id"
;
public
static
final
String
NODE_ID_FROM
=
"gs_node_id_from"
;
public
static
final
String
NODE_ID_TO
=
"gs_node_id_to"
;
public
static
final
String
PORT
=
"gs_port"
;
public
static
final
String
SENDERID
=
"gs_sender_id"
;
public
static
final
String
STEP_NUMBER
=
"gs_step_number"
;
...
...
src/org/graphstream/gama/extension/sender/AddEdgeStatement.java
0 → 100644
View file @
8f8a6871
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
.
ADD_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
.
EDGE_ID
,
type
=
IType
.
STRING
,
optional
=
false
),
@facet
(
name
=
IKeywordGSAdditional
.
NODE_ID_FROM
,
type
=
IType
.
STRING
,
optional
=
false
),
@facet
(
name
=
IKeywordGSAdditional
.
NODE_ID_TO
,
type
=
IType
.
STRING
,
optional
=
false
),
@facet
(
name
=
IKeywordGSAdditional
.
IS_DIRECTED
,
type
=
IType
.
BOOL
,
optional
=
false
)})
public
class
AddEdgeStatement
extends
AbstractStatement
implements
IStatement
{
final
IExpression
senderid
;
final
IExpression
edgeid
;
final
IExpression
nodefrom
;
final
IExpression
nodeto
;
final
IExpression
directed
;
public
AddEdgeStatement
(
IDescription
desc
)
{
super
(
desc
);
senderid
=
getFacet
(
IKeywordGSAdditional
.
SENDERID
);
edgeid
=
getFacet
(
IKeywordGSAdditional
.
EDGE_ID
);
nodefrom
=
getFacet
(
IKeywordGSAdditional
.
NODE_ID_FROM
);
nodeto
=
getFacet
(
IKeywordGSAdditional
.
NODE_ID_TO
);
directed
=
getFacet
(
IKeywordGSAdditional
.
IS_DIRECTED
);
}
@Override
protected
Object
privateExecuteIn
(
IScope
scope
)
throws
GamaRuntimeException
{
String
s
=
(
String
)(
senderid
.
value
(
scope
));
String
eid
=
(
String
)(
edgeid
.
value
(
scope
));
String
nfrom
=
(
String
)(
nodefrom
.
value
(
scope
));
String
nto
=
(
String
)(
nodeto
.
value
(
scope
));
boolean
d
=
(
Boolean
)(
edgeid
.
value
(
scope
));
GSSender
sender
=
GSManager
.
getSender
(
s
);
sender
.
sendEdgeAdded
(
eid
,
nfrom
,
nto
,
d
);
return
null
;
}
}
\ No newline at end of file
src/org/graphstream/gama/extension/sender/GSSender.java
View file @
8f8a6871
...
...
@@ -39,9 +39,8 @@ public class GSSender {
nsSender
.
nodeAdded
(
sourceId
,
newEvent
(),
nodeId
);
}
public
void
sendEdgeAdded
(
long
fromId
,
long
toId
,
boolean
directed
)
{
nsSender
.
edgeAdded
(
sourceId
,
newEvent
(),
fromId
+
"_"
+
toId
,
fromId
+
""
,
toId
+
""
,
directed
);
public
void
sendEdgeAdded
(
String
edgeId
,
String
fromId
,
String
toId
,
boolean
directed
)
{
nsSender
.
edgeAdded
(
sourceId
,
newEvent
(),
edgeId
,
fromId
,
toId
,
directed
);
}
public
void
sendNodeRemoved
(
long
nodeId
)
{
...
...
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