Commit 24a5a4c6 authored by Björn Richerzhagen's avatar Björn Richerzhagen
Browse files

Merge remote-tracking branch 'origin/br/sis-development'

parents c0409a4a 6648810b
/*
* 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.sis;
/**
* Properties that are exclusive to requests (e.g., a tolerable timeout,
* thresholds, etc.). This is implemented in the API to ensure compatibility
* upon interface extensions of the request object.
*
* @author Bjoern Richerzhagen
*
*/
public class SiSRequest implements Cloneable {
/**
* "null" request
*/
public static final SiSRequest NONE = new SiSRequest(SiSInfoProperties.NONE);
private final SiSInfoProperties infoProperties;
public SiSRequest(SiSInfoProperties infoProperties) {
this.infoProperties = infoProperties;
}
/**
* If the request has an attached {@link SiSInfoProperties} object, it is
* returned by this method.
*
* @return {@link SiSInfoProperties} or null.
*/
public SiSInfoProperties getInfoProperties() {
return infoProperties;
}
/*
* TODO define request parameters
*/
/*
* TODO hints on how often this requests will/might occur (esp. if a request
* is executed periodically!).
*/
@Override
public SiSRequest clone() {
return new SiSRequest(infoProperties.clone());
// TODO add inner request parameters, once they are defined!
}
@Override
public String toString() {
return "SiSRequest [" + infoProperties + "]";
}
}
/*
* 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.sis;
/**
* A result-callback (as method calls are non-blocking!) that is to be provided
* by the requesting component.
*
* @author Bjoern Richerzhagen
*
* @param <T>
*/
public interface SiSResultCallback<T> {
/**
* Providing some information, as to why a given request was not answered.
*
* TODO extend this
*
* @author Bjoern Richerzhagen
*
*/
public enum AbortReason {
UNKNOWN, TIMEOUT, NO_DATA
}
/**
* Called, when the request is answered by the SiS. Fires only once.
*
* @param result
*/
public void onResult(T result);
/**
* Called, when the request is aborted by the SiS.
*
* @param reason
*/
public void onAbort(AbortReason reason);
}
/*
* 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.sis.exception;
public class AggregationNotPossibleException extends Exception {
/**
*
*/
private static final long serialVersionUID = 1L;
}
/*
* 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.sis.exception;
/**
* A Derivation is not possible
*
* @author Bjoern Richerzhagen
*
*/
public class DerivationNotPossibleException extends Exception {
private static final long serialVersionUID = 1L;
private final String reason;
public DerivationNotPossibleException() {
this(null);
}
public DerivationNotPossibleException(String reason) {
this.reason = reason;
}
@Override
public String getMessage() {
return (reason != null ? reason : "DerivationNotPossibleException");
}
}
/*
* 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.sis.exception;
/**
* Thrown, if the requested information is not available
*
* @author Bjoern Richerzhagen
*
*/
public class InformationNotAvailableException extends Exception {
private static final long serialVersionUID = 1L;
}
/*
* 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.sis.monitoring;
import de.tudarmstadt.maki.simonstrator.api.component.sis.SiSInfoProperties;
import de.tudarmstadt.maki.simonstrator.api.component.sis.SiSInformationProvider;
import de.tudarmstadt.maki.simonstrator.api.component.sis.SiSRequest;
import de.tudarmstadt.maki.simonstrator.api.component.sis.type.SiSType;
/**
* Interface for controlling/configuring the monitoring components from within
* the SiS. This is used to, e.g., start monitoring a recently requested value.
*
* TODO discuss that with B01 - the SiS will contain (as part of the resolver)
* some logic on determining, when to reconfigure the monitoring system. This
* logic is definitely part of B01-domain-knowledge.
*
* @author Bjoern Richerzhagen
*
*/
public interface MonitoringConfigurationInterface {
/**
* Inform monitoring that it should start collecting a given {@link SiSType}
* according to the requirements specified in the {@link SiSRequest}. This
* can be invoked multiple times, with different {@link SiSRequest}s. How to
* merge requests is then up to the monitoring component.
*
* Once the type is available, the monitoring component should register as a
* {@link SiSInformationProvider}. The {@link SiSInfoProperties}
* should contain the information about expected cost of maintaining that
* state.
*
* @param type
* @param request
*/
public <T> void startCollecting(SiSType<T> type, SiSRequest request);
public <T> void stopCollecting(SiSType<T> type);
}
# SiS and Types
As discussed during the MAKI-Seminar on 3.6.15, nobody in MAKI actually wants to define a taxonomy/ontology/... for metrics and state within MAKI-enabled systems.
For the sake of an integrated SiS and the ability to connect overlays and services to that SiS, we proposed a pragmatical approach to the taxonomy design. Although the current design is desired to be extensible and flexible enough to support all MAKI-needs, this is not mandatory for us. This document aims in providing some help w.r.t. extending and using the taxonomy in your systems.
## SiSTypes and the Graph-API
SiSType extends the IGraphElementProperty-class, enabling SiSTypes to act as annotations within a graph. This allows monitoring to connect node state to the respective node object.
\ No newline at end of file
/*
* 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.sis.type;
import java.util.LinkedHashSet;
import java.util.Set;
import de.tudarmstadt.maki.simonstrator.api.component.sis.SiSInformationConsumer.AggregationFunction;
import de.tudarmstadt.maki.simonstrator.api.component.sis.exception.AggregationNotPossibleException;
/**
* Taxonomy definition for the SiS. Right now, we use a flat identifier space
* and derivation-relations+functions in between those identifiers.
*
* @author Bjoern Richerzhagen
*
* @param <T>
*/
public class SiSType<T extends Object> {
private final Set<SiSTypeDerivation<T>> derivations;
private final SiSTypeAggregation<T> aggregationFunction;
private final Class<T> dataType;
private final String name;
/**
* Singletons!
*
* @param dataType
* @param derivation
*/
protected SiSType(String name, Class<T> dataType,
SiSTypeAggregation<T> aggregationFunction) {
this.name = name;
this.dataType = dataType;
this.derivations = new LinkedHashSet<>();
this.aggregationFunction = aggregationFunction;
}
/**
* Enables non-API projects to add their own derivation functions for the
* given SiSType programmatically. Long-term, those Derivations should make
* it into the API package.
*
* @param derivation
*/
public void addDerivation(SiSTypeDerivation<T> derivation) {
derivations.add(derivation);
}
/**
* Data type. If this is a collection, this method returns the inner type of
* the collection.
*
* @return
*/
public Class<T> getType() {
return dataType;
}
/**
* Determines the "best" derivation for the given available types and
* returns it (or null, if no matching derivation is found...)
*
* FIXME Please note: "best" is currently not defined, we just try one after
* the other in the order they were added until we find a matching one.
* Maybe, one wants to add a weight or utility later-on?
*
* @param availableTypes
* @return matching derivation or null
*/
public SiSTypeDerivation<T> canDerive(Set<SiSType<?>> availableTypes) {
for (SiSTypeDerivation<T> derivation : derivations) {
if (derivation.canDerive(availableTypes)) {
return derivation;
}
}
return null;
}
/**
* Merges two values a and b of the given type.
*
* @param a
* @param b
* @param function
* @return
* @throws AggregationNotPossibleException
*/
public T aggregate(T a, T b, AggregationFunction function)
throws AggregationNotPossibleException {
return aggregationFunction.aggregate(a, b, function);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((name == null) ? 0 : name.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
SiSType<?> other = (SiSType<?>) obj;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
}
@Override
public String toString() {
return "SiS-" + name;
}
}
/*
* 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.sis.type;
import de.tudarmstadt.maki.simonstrator.api.component.sis.SiSInformationConsumer.AggregationFunction;
import de.tudarmstadt.maki.simonstrator.api.component.sis.exception.AggregationNotPossibleException;
public interface SiSTypeAggregation<T extends Object> {
/**
* Merges two values. Definition of a merge is up to the implementing
* function.
*
* @param a
* may be null
* @param b
* may be null
* @return
*/
public T aggregate(T a, T b, AggregationFunction function)
throws AggregationNotPossibleException;
}
/*
* 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.sis.type;
import java.util.Set;
import de.tudarmstadt.maki.simonstrator.api.component.sis.SiSLocalData;
import de.tudarmstadt.maki.simonstrator.api.component.sis.exception.DerivationNotPossibleException;
/**
* Derivation of a target type <strong>T</strong>.
*
* @author Bjoern Richerzhagen
*
* @param <T>
* target type
*/
public interface SiSTypeDerivation<T extends Object> {
/**
* True, if we can derive the target value from any of the available types
*
* @param availableTypes
* @return
*/
public boolean canDerive(Set<SiSType<?>> availableTypes);
/**
* "Magic" method deriving the target value <T> from a number of the input
* types (availableTypes). The actual value of the types has to be retrieved
* via the {@link SiSLocalData} interface provided upon method invocation.
* Ideally, this method implements a number of ways to derive the target
* value - sorted by complexity and expected cost for the host. If the
* locally available types are not sufficient to derive a value, an
* exception is to be thrown.
*
* @param data
* access to the actual data values
* @param availableTypes
* try to derive the target value using only these types.
* @return derived value
*/
public T derive(SiSLocalData data, Set<SiSType<?>> availableTypes)
throws DerivationNotPossibleException;
}
/*
* 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.sis.type;
import java.util.LinkedHashMap;
import java.util.Map;
import de.tudarmstadt.maki.simonstrator.api.Monitor;
import de.tudarmstadt.maki.simonstrator.api.Monitor.Level;
import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.Location;
import de.tudarmstadt.maki.simonstrator.api.component.sis.type.aggregation.AbstractAggregation.AggregationDouble;
/**
* Type registry (e.g., our taxonomy). Dependencies between the flat types are
* defined via {@link SiSTypeDerivation}s that can be added to the individual
* types programmatically. Derivations should become a part of the api
* <strong>iff</strong> their types are also part of the API (e.g.,
* TransitOverlayContact is to specific, but OverlayConteact might at some time
* be added).
*
* @author Bjoern Richerzhagen
*
*/
public final class SiSTypes {
private static final Map<String, SiSType<?>> allTypes = new LinkedHashMap<>();
/**
* [m] Physical distance property (i.e., the distance between two entities).
*/
public static final SiSType<Double> PHY_DISTANCE = create("PHY_DISTANCE",
Double.class, new AggregationDouble());
/**
* [Location] Physical location (coordinates) of an entity
*/
public static final SiSType<Location> PHY_LOCATION = create("PHY_LOCATION",
Location.class, null);
/**
* [none] Just a dummy Test attribute of type double. Do not use in
* production code.
*/
public static final SiSType<Double> TEST_DOUBLE = create("TEST_DOUBLE",
Double.class, new AggregationDouble());
/**
*
* @param name
* @param type
* @param aggregationFunction
* @deprecated Not actually deprecated, just not encouraged. Use this for
* testing new types, but add them to the API once they are
* stable.
*/
@Deprecated
public static <T> void registerType(String name, Class<T> type,
SiSTypeAggregation<T> aggregationFunction) {
Monitor.log(
SiSType.class,
Level.WARN,
"Programmatically registered a type %s with name %s at the SiS. "
+ "\n\tThis functionality is for testing only. "
+ "\n\tPlease consider adding your types to the SiS-API later on.",
type, name);
create(name, type, aggregationFunction);
}
/*
* Static methods to add new types programmatically (for development, as you
* do not need to change the API every time). Long term goal is then to
* include the final versions into the static block above.
*/
/**
* UNSAFE method to retrieve a type that is <strong>not</strong> available
* via the API (e.g., static final members of this class).
*
* @param type
* @param name
* @return
*/
@Deprecated
@SuppressWarnings("unchecked")
public static <T> SiSType<T> getType(String name, Class<T> type) {
return (SiSType<T>) allTypes.get(name);
}
/**
* Internal instantiation of the SiSType
*
* @param name
* @param type
* @param aggregationFunction
* How to aggregate two values of the type?
* @return
*/
private static <T> SiSType<T> create(String name, Class<T> type,
SiSTypeAggregation<T> mergeFunction) {
SiSType<T> sisType = new SiSType<T>(name, type, mergeFunction);
if (allTypes.containsKey(name)) {
throw new AssertionError("Duplicate type with name " + name + "!");
}
allTypes.put(name, sisType);
return sisType;
}
}
/*
* 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.sis.type.aggregation;
import de.tudarmstadt.maki.simonstrator.api.component.sis.SiSInformationConsumer.AggregationFunction;
import de.tudarmstadt.maki.simonstrator.api.component.sis.exception.AggregationNotPossibleException;
import de.tudarmstadt.maki.simonstrator.api.component.sis.type.SiSTypeAggregation;
/**
* Aggregation for flat (non-array) types
*
* @author Bjoern Richerzhagen
*
* @param <T>
*/
public class AbstractAggregation<T> implements SiSTypeAggregation<T> {
@Override
public T aggregate(T a, T b, AggregationFunction function)
throws AggregationNotPossibleException {
switch (function) {
case SUM:
return sum(a, b);
case MAX:
return max(a, b);
case MIN:
return min(a, b);
case AVG:
return avg(a, b);
default:
throw new AggregationNotPossibleException();
}
}
protected T sum(T a, T b) throws AggregationNotPossibleException {
throw new AggregationNotPossibleException();
}
protected T min(T a, T b) throws AggregationNotPossibleException {
throw new AggregationNotPossibleException();
}
protected T max(T a, T b) throws AggregationNotPossibleException {
throw new AggregationNotPossibleException();
}
protected T avg(T a, T b) throws AggregationNotPossibleException {
throw new AggregationNotPossibleException();
}
public static class AggregationDouble extends AbstractAggregation<Double> {
@Override
protected Double sum(Double a, Double b)
throws AggregationNotPossibleException {
return a + b;
}
@Override
protected Double min(Double a, Double b)
throws AggregationNotPossibleException {
return Math.min(a, b);
}
@Override
protected Double max(Double a, Double b)
throws AggregationNotPossibleException {
return Math.max(a, b);
}
}
}
......@@ -22,7 +22,7 @@ package de.tudarmstadt.maki.simonstrator.api.component.topology;
import java.util.Collection;
import de.tudarmstadt.maki.simonstrator.api.common.graph.Node;
import de.tudarmstadt.maki.simonstrator.api.common.graph.INode;
/**
* @author Michael Stein
......@@ -35,7 +35,7 @@ public interface AdaptableTopologyProvider extends TopologyProvider {
* @param topologyIdentifier
* @param node
*/
public void addNeighbor(TopologyID topologyIdentifier, Node node);
public void addNeighbor(TopologyID topologyIdentifier, INode node);
/**
* Removes the given neighbor node for the specified topology. Has no effect
......@@ -44,7 +44,7 @@ public interface AdaptableTopologyProvider extends TopologyProvider {
* @param topologyIdentifier
* @param node
*/
public void removeNeighbor(TopologyID topologyIdentifier, Node node);
public void removeNeighbor(TopologyID topologyIdentifier, INode node);
/**
* Returns the collection of all possible interactions which may be done in
......
......@@ -21,7 +21,8 @@
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;
import de.tudarmstadt.maki.simonstrator.api.common.graph.IEdge;
import de.tudarmstadt.maki.simonstrator.api.common.graph.INodeID;
/**
* Represents an edge operations, which can be either an addition of the given
......@@ -70,12 +71,12 @@ public class OperationalEdge extends DirectedEdge {
private EdgeOperationType type;
public OperationalEdge(DirectedEdge edge, EdgeOperationType type) {
super(edge.getStartNode(), edge.getEndNode(),edge.getWeight());
public OperationalEdge(IEdge edge, EdgeOperationType type) {
super(edge.fromId(), edge.toId(), edge.getProperty(DirectedEdge.WEIGHT));
this.type = type;
}
public OperationalEdge(Node startNode, Node endNode,
public OperationalEdge(INodeID startNode, INodeID endNode,
EdgeOperationType type) {
super(startNode, endNode);
this.type = type;
......@@ -90,13 +91,12 @@ public class OperationalEdge extends DirectedEdge {
}
public DirectedEdge getEdge() {
return new DirectedEdge(this.getStartNode(), this.getEndNode(),
return new DirectedEdge(this.fromId(), this.toId(),
this.getWeight());
}
@Override
public String toString() {
return this.getType() + ": " + this.getStartNode() + " -> "
+ this.getEndNode();
return this.getType() + ": " + this.fromId() + " -> " + this.toId();
}
}
......@@ -22,9 +22,9 @@ package de.tudarmstadt.maki.simonstrator.api.component.topology;
import java.util.Set;
import de.tudarmstadt.maki.simonstrator.api.common.graph.DirectedEdge;
import de.tudarmstadt.maki.simonstrator.api.common.graph.Graph;
import de.tudarmstadt.maki.simonstrator.api.common.graph.Node;
import de.tudarmstadt.maki.simonstrator.api.common.graph.IEdge;
import de.tudarmstadt.maki.simonstrator.api.common.graph.INode;
import de.tudarmstadt.maki.simonstrator.api.component.HostComponent;
/**
......@@ -47,14 +47,14 @@ public interface TopologyProvider extends HostComponent {
*
* @return the node that represents this HostComponent
*/
public Node getNode(TopologyID identifier);
public INode getNode(TopologyID identifier);
/**
* This method provides the 1-hop neighborhood of this TopologyProvider
*
* @param topologyIdentifier
*/
public Set<DirectedEdge> getNeighbors(TopologyID topologyIdentifier);
public Set<IEdge> getNeighbors(TopologyID topologyIdentifier);
/**
* This method provides the complete local view of this topology provider,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment