Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Simonstrator
API
Commits
c0ffc4b4
Commit
c0ffc4b4
authored
Mar 01, 2016
by
Roland Kluge
Browse files
Add Graph#getEdges to allow for multi edges
parent
5099ee44
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/de/tudarmstadt/maki/simonstrator/api/common/graph/BasicGraph.java
View file @
c0ffc4b4
...
...
@@ -22,6 +22,7 @@ package de.tudarmstadt.maki.simonstrator.api.common.graph;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.HashSet
;
...
...
@@ -327,6 +328,17 @@ public class BasicGraph implements Graph {
return
null
;
}
@Override
public
Collection
<
IEdge
>
getEdges
(
INodeID
from
,
INodeID
to
)
{
final
List
<
IEdge
>
resultSet
=
new
ArrayList
<>();
for
(
IEdge
edge
:
edges
)
{
if
(
edge
.
toId
().
equals
(
to
)
&&
edge
.
fromId
().
equals
(
from
))
{
resultSet
.
add
(
edge
);
}
}
return
resultSet
;
}
@Override
public
IEdge
getEdge
(
EdgeID
edgeID
)
{
return
this
.
edgesById
.
get
(
edgeID
);
...
...
src/de/tudarmstadt/maki/simonstrator/api/common/graph/Graph.java
View file @
c0ffc4b4
...
...
@@ -231,7 +231,7 @@ public interface Graph extends Cloneable {
public
INode
getNode
(
INodeID
nodeId
);
/**
* Returns
th
e edge (if present) between from and to, null otherwise
* Returns
som
e edge (if present) between from and to, null otherwise
*
* @param from
* @param to
...
...
@@ -239,6 +239,15 @@ public interface Graph extends Cloneable {
*/
public
IEdge
getEdge
(
INodeID
from
,
INodeID
to
);
/**
* Returns all edges (if present) between from and to, null otherwise
*
* @param from
* @param to
* @return edge or null
*/
Collection
<
IEdge
>
getEdges
(
INodeID
from
,
INodeID
to
);
/**
* Returns the edge with the given ID.
*
...
...
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