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
4418a90d
Commit
4418a90d
authored
Dec 17, 2015
by
Alexander Frömmgen
Browse files
Tossa reverse VariableAssignment
parent
badf8c71
Changes
2
Show whitespace changes
Inline
Side-by-side
pom.xml
View file @
4418a90d
...
@@ -49,6 +49,11 @@
...
@@ -49,6 +49,11 @@
<artifactId>
kryonet
</artifactId>
<artifactId>
kryonet
</artifactId>
<version>
2.22.0-RC1
</version>
<version>
2.22.0-RC1
</version>
</dependency>
</dependency>
<dependency>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava
</artifactId>
<version>
18.0
</version>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
\ No newline at end of file
src/de/tudarmstadt/maki/simonstrator/api/component/topology/VariableAssignment.java
View file @
4418a90d
...
@@ -2,6 +2,10 @@ package de.tudarmstadt.maki.simonstrator.api.component.topology;
...
@@ -2,6 +2,10 @@ package de.tudarmstadt.maki.simonstrator.api.component.topology;
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
com.google.common.collect.BiMap
;
import
com.google.common.collect.HashBiMap
;
import
de.tudarmstadt.maki.simonstrator.api.common.UniqueID
;
import
de.tudarmstadt.maki.simonstrator.api.common.UniqueID
;
import
de.tudarmstadt.maki.simonstrator.api.common.graph.EdgeID
;
import
de.tudarmstadt.maki.simonstrator.api.common.graph.EdgeID
;
...
@@ -13,11 +17,11 @@ import de.tudarmstadt.maki.simonstrator.api.common.graph.INodeID;
...
@@ -13,11 +17,11 @@ import de.tudarmstadt.maki.simonstrator.api.common.graph.INodeID;
*/
*/
public
final
class
VariableAssignment
{
public
final
class
VariableAssignment
{
private
final
Map
<
INodeID
,
INodeID
>
nodeBinding
;
private
final
Bi
Map
<
INodeID
,
INodeID
>
nodeBinding
;
private
final
Map
<
EdgeID
,
EdgeID
>
linkBinding
;
private
final
Map
<
EdgeID
,
EdgeID
>
linkBinding
;
public
VariableAssignment
()
{
public
VariableAssignment
()
{
this
.
nodeBinding
=
new
HashMap
<>
();
this
.
nodeBinding
=
Hash
Bi
Map
.
create
();
this
.
linkBinding
=
new
HashMap
<>();
this
.
linkBinding
=
new
HashMap
<>();
}
}
...
@@ -31,10 +35,18 @@ public final class VariableAssignment {
...
@@ -31,10 +35,18 @@ public final class VariableAssignment {
return
this
.
nodeBinding
.
get
(
variable
);
return
this
.
nodeBinding
.
get
(
variable
);
}
}
public
INodeID
getInverseVariableBinding
(
final
INodeID
variable
)
{
return
this
.
nodeBinding
.
inverse
().
get
(
variable
);
}
public
INodeID
getNodeVariableBinding
(
final
String
key
)
{
public
INodeID
getNodeVariableBinding
(
final
String
key
)
{
return
nodeBinding
.
get
(
INodeID
.
get
(
key
));
return
nodeBinding
.
get
(
INodeID
.
get
(
key
));
}
}
public
Set
<
Map
.
Entry
<
INodeID
,
INodeID
>>
getNodeBindingEntrySet
()
{
return
nodeBinding
.
entrySet
();
}
public
void
bindVariable
(
UniqueID
variable
,
IElement
candidate
)
{
public
void
bindVariable
(
UniqueID
variable
,
IElement
candidate
)
{
if
(
variable
instanceof
INodeID
)
{
if
(
variable
instanceof
INodeID
)
{
this
.
bindNodeVariable
((
INodeID
)
variable
,
(
INodeID
)
candidate
);
this
.
bindNodeVariable
((
INodeID
)
variable
,
(
INodeID
)
candidate
);
...
@@ -129,6 +141,4 @@ public final class VariableAssignment {
...
@@ -129,6 +141,4 @@ public final class VariableAssignment {
+
"]"
;
+
"]"
;
}
}
}
}
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