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
36859856
Commit
36859856
authored
May 12, 2015
by
Björn Richerzhagen
Browse files
Updated graph API to new version from Michael Stein
parent
b1ee87ed
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/de/tudarmstadt/maki/simonstrator/api/component/topology/AdaptableTopologyProvider.java
View file @
36859856
...
...
@@ -20,6 +20,8 @@
package
de.tudarmstadt.maki.simonstrator.api.component.topology
;
import
java.util.Collection
;
import
de.tudarmstadt.maki.simonstrator.api.common.graph.Node
;
/**
...
...
@@ -43,4 +45,34 @@ public interface AdaptableTopologyProvider extends TopologyProvider {
* @param node
*/
public
void
removeNeighbor
(
String
topologyIdentifier
,
Node
node
);
/**
* Returns the collection of all possible interactions which may be done in
* order to adapt the topology. Returns only those actions that can later be
* conducted by this component via the performOperation() method
*
* @param topologyIdentifier
* @param node
*/
public
Collection
<
OperationalEdge
>
getPossibleEdgeOperations
(
String
topologyIdentifier
);
/**
* Performs the given edge operation. Must be one of the operation returned
* by getPossibleEdgeOperations()
*
* @param topologyidentifier
* @param edgeOperation
*/
public
void
performOperation
(
String
topologyidentifier
,
OperationalEdge
edgeOperation
);
/**
* Returns a collection of graph constraints which must be met after
* adapting a given graph.
*
* @return The set of graph constraints which must be met by the
* optimization method.
*/
public
Collection
<
Constraint
>
getGraphConstraints
();
}
src/de/tudarmstadt/maki/simonstrator/api/component/topology/Constraint.java
0 → 100644
View file @
36859856
/*
* Copyright (c) 2005-2010 KOM Multimedia Communications Lab
*
* This file is part of Simonstrator.KOM.
*
* Simonstrator.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package
de.tudarmstadt.maki.simonstrator.api.component.topology
;
import
de.tudarmstadt.maki.simonstrator.api.common.graph.Graph
;
public
interface
Constraint
{
/**
* Checks the graph whether it is conform with the implemented graph
* constraint(s).
*
* @param graphToCheck
* @return
*/
public
boolean
isConform
(
Graph
valueToCheck
);
}
src/de/tudarmstadt/maki/simonstrator/api/component/topology/OperationalEdge.java
0 → 100644
View file @
36859856
/*
* Copyright (c) 2005-2010 KOM Multimedia Communications Lab
*
* This file is part of Simonstrator.KOM.
*
* Simonstrator.KOM is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
*
* PeerfactSim.KOM is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PeerfactSim.KOM. If not, see <http://www.gnu.org/licenses/>.
*
*/
package
de.tudarmstadt.maki.simonstrator.api.component.topology
;
import
de.tudarmstadt.maki.simonstrator.api.common.graph.DirectedEdge
;
import
de.tudarmstadt.maki.simonstrator.api.common.graph.Node
;
/**
* Represents an edge operations, which can be either an addition of the given
* edge or a removal.
*
* @author Julian M. Klomp
*
*/
public
class
OperationalEdge
extends
DirectedEdge
{
/*
* (non-Javadoc)
*
* @see java.lang.Object#hashCode()
*/
@Override
public
int
hashCode
()
{
final
int
prime
=
31
;
int
result
=
super
.
hashCode
();
result
=
prime
*
result
+
((
type
==
null
)
?
0
:
type
.
hashCode
());
return
result
;
}
/*
* (non-Javadoc)
*
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
this
==
obj
)
return
true
;
if
(!
super
.
equals
(
obj
))
return
false
;
if
(
getClass
()
!=
obj
.
getClass
())
return
false
;
OperationalEdge
other
=
(
OperationalEdge
)
obj
;
if
(
type
!=
other
.
type
)
return
false
;
return
true
;
}
public
enum
EdgeOperationType
{
Add
,
Remove
};
private
EdgeOperationType
type
;
public
OperationalEdge
(
DirectedEdge
edge
,
EdgeOperationType
type
)
{
super
(
edge
.
getStartNode
(),
edge
.
getEndNode
(),
edge
.
getWeight
());
this
.
type
=
type
;
}
public
OperationalEdge
(
Node
startNode
,
Node
endNode
,
EdgeOperationType
type
)
{
super
(
startNode
,
endNode
);
this
.
type
=
type
;
}
public
EdgeOperationType
getType
()
{
return
this
.
type
;
}
public
void
setType
(
EdgeOperationType
type
)
{
this
.
type
=
type
;
}
public
DirectedEdge
getEdge
()
{
return
new
DirectedEdge
(
this
.
getStartNode
(),
this
.
getEndNode
(),
this
.
getWeight
());
}
@Override
public
String
toString
()
{
return
this
.
getType
()
+
": "
+
this
.
getStartNode
()
+
" -> "
+
this
.
getEndNode
();
}
}
src/de/tudarmstadt/maki/simonstrator/api/component/topology/TopologyProvider.java
View file @
36859856
...
...
@@ -49,20 +49,26 @@ public interface TopologyProvider extends HostComponent {
*
* @return the node that represents this HostComponent
*/
public
Node
getNode
();
public
Node
getNode
(
String
identifier
);
/**
* This method provides the 1-hop neighborhood of this TopologyProvider
*
* @param topologyIdentifier
*/
public
Set
<
DirectedEdge
>
getNeighbors
();
public
Set
<
DirectedEdge
>
getNeighbors
(
String
topologyIdentifier
);
/**
* This method provides the complete local view of this topology provider,
* i.e., it is not bounded by the 1-hop neighborhood. It depends on the
* concrete implementation how large the local view is.
*/
public
Graph
getLocalView
();
public
Graph
getLocalView
(
String
topologyIdentifier
);
/**
*
* @return the types of topologies provided by the component
*/
public
Iterable
<
String
>
getTopologyIdentifiers
();
}
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