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

initialized clean Simonstrator-PeerfactSim.KOM-repository to FINALLY get rid...

initialized clean Simonstrator-PeerfactSim.KOM-repository to FINALLY get rid of huge blob objects and ancient history that is not relevant to the simonstrator-branch of PeerfactSim.KOM
parents
/*
* Copyright (c) 2005-2011 KOM - Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.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.tud.kom.p2psim.api.storage;
import de.tudarmstadt.maki.simonstrator.api.common.UniqueID;
/**
* All specific documents in the application layer and overlay layer should be a
* subtype of this interface.
*
* @author Sebastian Kaune <kaune@kom.tu-darmstadt.de>
* @author Konstantin Pussep <pussep@kom.tu-darmstadt.de>
* @version 1.0, 11/25/2007
*
* @deprecated Apps and app-related code is now part of the runner-project.
* Documents should be defined by the overlay/Service type
*/
public interface Document {
/**
* Documents can have three different stats: empty, partial and complete
*
* @author Sebastian Kaune
*
*/
public enum State {
/**
* The document is empty if only its OverlayKey is known.
*/
EMPTY,
/**
* The document state becomes partial if some chunks have been
* downloaded
*/
PARTIAL,
/**
* The document is complete if all chunks are available
*/
COMPLETE
}
/**
* Assigns the OverlayKey <code>key</code> to a given document
*
* @param key
*/
public void setKey(UniqueID key);
/**
* Returns the OverlayKey of a given document
*
* @return the appropriate OverlayKey
*/
public UniqueID getKey();
/**
* Sets the size of a given document
*
* @param newSize
* the size in bytes
*/
public void setSize(long newSize);
/**
* Returns the size in bytes of a given document
*
* @return the document size in bytes
*/
public long getSize();
/**
* Returns the popularity of a given document
*
* @return the popularity of the document
*/
public int getPopularity();
/**
* Assigns a popularity to a given document
*
* @param popularity
* the popularity of the document
*/
public void setPopularity(int popularity);
/**
* Changes the state of a given document
*
* @param state
* the new state
*/
public void setState(State state);
/**
* Returns the state of a given document
*
* @return the state of the document
*/
public State getState();
}
/*
* Copyright (c) 2005-2011 KOM - Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.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.tud.kom.p2psim.api.storage;
/**
* Should be used to create documents according to some distribution with some
* popularity.
*
* Currently, it's under construction.
*
* @author Sebastian Kaune <kaune@kom.tu-darmstadt.de>
* @author Konstantin Pussep <pussep@kom.tu-darmstadt.de>
* @version 1.0, 11/25/2007
*
* @deprecated unused, will be removed in later versions
*/
public interface DocumentFactory {
// FIXME methods to be defined -> volunteers wanted !
}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
-->
</head>
<body bgcolor="white">
Documents and local storage for documents
</body>
</html>
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.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.tud.kom.p2psim.api.topology;
import de.tud.kom.p2psim.api.linklayer.mac.PhyType;
import de.tud.kom.p2psim.api.topology.obstacles.ObstacleModel;
import de.tud.kom.p2psim.api.topology.social.SocialView;
import de.tud.kom.p2psim.api.topology.views.TopologyView;
import de.tud.kom.p2psim.api.topology.waypoints.WaypointModel;
import de.tud.kom.p2psim.impl.topology.PositionVector;
/**
* We provide a global Topology-Object (ie. this object is only created once in
* the simulator and holds all hosts). The topology is just maintaining the
* places of the hosts as well as obstacles. Connectivity is maintained by the
* corresponding {@link TopologyView}.
*
* @author Bjoern Richerzhagen
* @version 1.0, 21.02.2012
*/
public interface Topology {
/**
* This Position Vector contains the upper bounds for each dimension used in
* the Topology. This information is needed by placement and movement models
*
* @return
*/
public PositionVector getWorldDimensions();
/**
* Add an obstacle to the Topology
*
* @param obstacle
*/
/* public void addObstacle(Obstacle obstacle); */
/**
* Add a host to the topology. Hosts are added at the very beginning of the
* simulation, later additions are not supported.
*
* @param comp
*/
public void addComponent(TopologyComponent comp);
/**
* Set the waypoint model that describes the (preferred) movements
*
* @param model
*/
public void setWaypointModel(WaypointModel model);
/**
* Set the obstacle model that describes obstacles placed in the world
*
* @param model
*/
public void setObstacleModel(ObstacleModel model);
/**
* Ensure that if a new topologyListener is added, it is first of all
* informed of <b>all components</b> and <b>all obstacles already added</b>!
*
* @param listener
*/
public void addTopologyListener(TopologyListener listener);
/**
*
* @param listener
*/
public void removeTopologyListener(TopologyListener listener);
/**
* Add a global {@link TopologyView}, this will also register it as a
* {@link TopologyListener}
*
* @param tView
*/
public void addTopologyView(TopologyView tView);
/**
* Returns the {@link TopologyView} for the given {@link PhyType}
*
* @param phy
* @return
*/
public TopologyView getTopologyView(PhyType phy);
/**
* Adds a global {@link SocialView}, this will also register it as a
* {@link TopologyListener}. Also, the identifier from {@link SocialView} is
* used to access a {@link SocialView}.
*
* @param sView
* The {@link SocialView}, which should be added
*/
public void addSocialView(SocialView sView);
/**
* Gets the {@link SocialView} for the given identifier.
*
* @param id
* The identifier of the SocialView.
* @return The {@link SocialView} or <code>null</code> if the identifier not
* exists
*/
public SocialView getSocialView(String id);
/**
* Should be called after all hosts are generated! This will be initialize
* the {@link SocialView}s for all possible Hosts. A multiple call should be
* do nothing!
*/
public void initializeSocial();
/**
* Gets the WaypointModel, which is configured (Please note, that must not
* be the final configured WaypointModel!)
*
* @return
*/
public WaypointModel getWaypointModel();
/**
* Gets the ObstacleModel, which is configured (Please note, that must not
* be the final configured ObstacleModel!)
*
* @return
* */
public ObstacleModel getObstacleModel();
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.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.tud.kom.p2psim.api.topology;
import de.tud.kom.p2psim.api.common.Position;
import de.tud.kom.p2psim.api.common.SimHostComponent;
import de.tud.kom.p2psim.api.energy.EnergyComponent;
import de.tud.kom.p2psim.api.topology.movement.MovementListener;
import de.tud.kom.p2psim.api.topology.movement.MovementSupported;
import de.tud.kom.p2psim.api.topology.views.TopologyView;
/**
* One component for each host, holding the position. These are maintained
* inside a {@link Topology} which exists globally. They also include a
* reference to the topology.
*
* @author Bjoern Richerzhagen
* @version 1.0, 21.02.2012
*/
public interface TopologyComponent extends SimHostComponent, MovementSupported,
MovementListener {
/**
* Abstract QoS-Classes for the Accuracy of the position. Implementation
* depends on the {@link EnergyComponent}
*
* @author Bjoern Richerzhagen
* @version 1.0, 26.02.2012
*/
public static enum PositionAccuracy {
HIGH, MEDIUM, LOW
}
/**
* This uses an {@link EnergyComponent} for position retrieving (ie a GPS).
* A call might trigger energy consumption and the result will in most cases
* not be 100% accurate. Use this in your application if you want to add
* another layer of realism.
*
* @param accuracy
* a QoS-Class for the accuracy
* @return An estimate of the current position
*/
public Position getPosition(PositionAccuracy accuracy);
/**
* Returns the Topology-Object that provides access to {@link TopologyView}s
*
* @return
*/
public Topology getTopology();
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.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.tud.kom.p2psim.api.topology;
import de.tud.kom.p2psim.api.topology.obstacles.ObstacleModel;
import de.tud.kom.p2psim.api.topology.waypoints.WaypointModel;
/**
* Notifies interested parties of changes in the topology.
*
* @author Bjoern Richerzhagen
* @version 1.0, 21.02.2012
*/
public interface TopologyListener {
/**
*
* @param comp
*/
public void addedComponent(TopologyComponent comp);
/**
*
* @param comp
*/
/* public void addedObstacle(Obstacle obstacle); */
/**
*
* @param model
*/
public void changedWaypointModel(WaypointModel model);
/**
*
* @param model
*/
public void changedObstacleModel(ObstacleModel model);
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.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.tud.kom.p2psim.api.topology.movement;
/**
* Per-Instance movement information stored within the
* MovementSupported-Instance.
*
* @author Bjoern Richerzhagen
* @version 1.0, 05/10/2011
*/
public interface MovementInformation {
// implementation is up to the movement model!
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.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.tud.kom.p2psim.api.topology.movement;
/**
* All interested parties can register themselves as a {@link MovementListener}
* with a {@link MovementModel}. In most cases it will be sufficient to use the
* provided callback in the {@link MovementSupported}-component rather than to
* implement this listener.
*
* @author Bjoern Richerzhagen
* @version 1.0, 03.03.2012
*/
public interface MovementListener {
/**
* As most {@link MovementModel}s are round-based we add this callback. It
* is triggered after all componentMoved-Calls are triggered for this round.
* If a model is not round based, it will trigger this method every time a
* component moves
*/
public void afterComponentsMoved();
/**
* Triggered, after the respective component moved.
*
* @param comp
*/
public void afterComponentMoved(MovementSupported comp);
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.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.tud.kom.p2psim.api.topology.movement;
import de.tud.kom.p2psim.api.topology.TopologyComponent;
/**
* A movement model for a group of {@link TopologyComponent}s. The movement
* model interacts with the topology to move hosts and to react to obstacles, if
* needed.
*
* @author Bjoern Richerzhagen
* @version 1.0, 21.02.2012
*/
public interface MovementModel {
/**
* Add a {@link MovementSupported} component to this movement model
*
* @param comp
*/
public void addComponent(MovementSupported comp);
/**
* Adds a {@link MovementListener} to this {@link MovementModel}
*
* @param listener
*/
public void addMovementListener(MovementListener listener);
/**
* removes a listener
*
* @param listener
*/
public void removeMovementListener(MovementListener listener);
/**
* If you want to trigger the movement periodically, set this to a time
*
* @param time
*/
public void setTimeBetweenMoveOperations(long time);
}
/*
* Copyright (c) 2005-2011 KOM - Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.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.tud.kom.p2psim.api.topology.movement;
import de.tud.kom.p2psim.impl.topology.PositionVector;
/**
* Identifier for Components or Applications that support movement. If for
* instance a Device should be moved it has to extend this class and will be
* notified upon each change of its position.
*
* @author Bjoern Richerzhagen
* @version 1.0, 04/25/2011
*/
public interface MovementSupported {
/**
* Callback, if the position of this MovementSupported-Instance changed in
* this round (this is preferred over registering the MovementComponent as a
* {@link MovementListener})
*/
public void positionChanged();
/**
* Generic position, this allows us to use the GNP or other models that
* support the Position-Interface. This call does not consume any energy,
* even if a Positioning-Device is specified in the EnergyModel. It should
* not be used inside an Application, as the more sophisticated way is to
* add a GPS-Component to the EnergyModel and call getEstimatedPosition()
*
* <b>This is used in high-performance calculations inside the TopologyViews
* and should therefore NOT return copies but the object instance to prevent
* fetching the object after each movement!</b>
*
* @return
*/
public PositionVector getRealPosition();
/**
* Has to return true, if movement is possible (for example Net Layer is
* online).
*
* @return
*/
public boolean movementActive();
/**
* Adds a listener that is called upon node movement
*
* @param listener
*/
public void addMovementListener(MovementListener listener);
/**
* Removes the movement listener
*
* @param listener
*/
public void removeMovementListener(MovementListener listener);
/**
* Adds a {@link PositionListener} to this movementSupported. If the Host
* reaches the Position, which is given through the listener, then will be
* triggered the listener
*
* @param listener
* The listener, which will be triggered.
*/
public void addPositionListener(PositionListener listener);
/**
* Removes the Listener from this MovementSupported Object.
*
* @param listener
* The listener, which should be removed.
*/
public void removePositionListener(PositionListener listener);
/**
* Gets the minimum movement speed of this movable component.
*
* @return The minimum movement speed
*/
public double getMinMovementSpeed();
/**
* Gets the maximum movement speed of this movable component.
*
* @return The maximum movement speed
*/
public double getMaxMovementSpeed();
/**
* Gets a movement speed between min and max movement speed. This will be
* randomly calculated!
*
* @return A random movement speed between min and max movement speed.
*/
public double getMovementSpeed();
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.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.tud.kom.p2psim.api.topology.movement;
import de.tud.kom.p2psim.impl.topology.PositionVector;
/**
* This is the Listener for a Position. The method reached Position will be
* called, if the given Position and radius is reached. This mean, the position
* of the host is in the radius of the specified Position.
*
* @author Christoph Muenker
* @version 1.0, 28.06.2013
*/
public interface PositionListener {
/**
* Specified the Position, which is listen
*
* @return The position, to which is listen
*/
public PositionVector getPosition();
/**
* Specified the radius, for to the position, at when the listener should be
* called.
*
* @return the radius
*/
public double getRadius();
/**
* Will be called, if the specified position is reached.
*/
public void reachedPosition();
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.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.tud.kom.p2psim.api.topology.movement;
import java.awt.Graphics2D;
public interface VisualizableMovementModel {
public void drawOverlay(Graphics2D g2);
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.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.tud.kom.p2psim.api.topology.movement.local;
import de.tud.kom.p2psim.api.topology.movement.MovementSupported;
import de.tud.kom.p2psim.api.topology.obstacles.ObstacleModel;
import de.tud.kom.p2psim.api.topology.waypoints.WaypointModel;
import de.tud.kom.p2psim.impl.topology.PositionVector;
import de.tud.kom.p2psim.impl.util.Either;
/**
* This interface provides method definitions for the implementation of a local
* movement strategy used by the abstract waypoint movement model.
*
* @author Fabio Zöllner
* @version 1.0, 09.04.2012
*/
public interface LocalMovementStrategy {
public double getMovementSpeed(MovementSupported ms);
public void setWaypointModel(WaypointModel model);
public void setObstacleModel(ObstacleModel model);
public void setScaleFactor(double scaleFactor);
/**
* This method is called by the abstract waypoint movement model to
* determine the next position on the way to the specified destination.
*
* Return value: - Left new PositionVector with the next position - Right
* true: The destination has been reached false: Do nothing.
*
* @param comp
* @param destination
* @return Either the new position or Boolean (true) if no further position
* can be calculated
*/
public Either<PositionVector, Boolean> nextPosition(MovementSupported comp,
PositionVector destination);
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.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.tud.kom.p2psim.api.topology.obstacles;
import java.util.List;
import com.vividsolutions.jts.geom.Geometry;
import de.tud.kom.p2psim.api.common.Position;
import de.tud.kom.p2psim.api.topology.views.TopologyView;
import de.tud.kom.p2psim.impl.topology.PositionVector;
/**
* An obstacle (Hosts can not run through them, and communication may be either
* impossible or at least disturbed by them).
*
* It makes use of {@link PositionVector} instead of {@link Position} as it is
* only used within a Topology where we operate solely with PositionVectors.
*
* Just a thought: you might implement a Class that acts as a obstacle
* (representing a whole scenario of obstacles) and a movement-model at the same
* time to add trace-parsing behavior to PeerfactSim.
*
* @author Bjoern Richerzhagen
* @version 1.0, 21.02.2012
*/
public interface Obstacle {
/**
* This method checks if the line defined by the two points intersects the
* Obstacle.
*
* @param l
* @return
*/
public boolean intersectsWith(PositionVector a, PositionVector b);
/**
* Length of the intersection of the line with the obstacle
*
* @param a
* @param b
* @return
*/
public double totalIntersectionLength(PositionVector a, PositionVector b);
/**
* Depending on the Obstacle (material...) you might return a damping factor
*
* @return damping factor between 0 and 1.0, where 1.0 expresses total loss
* of the signal. The {@link TopologyView} has to interpret this
* value - this method does not imply any additional meaning to the
* value.
*/
public double dampingFactor();
public boolean contains(Geometry createPoint);
public Geometry getGeometry();
/**
* Return the vertices of the underlying structure or a close
* approximation.
*
* @return
*/
public List<PositionVector> getVertices();
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.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.tud.kom.p2psim.api.topology.obstacles;
import java.awt.Color;
import java.util.List;
import java.util.Map;
import de.tud.kom.p2psim.api.topology.waypoints.WaypointModel;
import de.tud.kom.p2psim.impl.topology.PositionVector;
import de.tud.kom.p2psim.impl.util.Tuple;
public interface ObstacleModel {
public void setWorldDimensions(PositionVector worldDimensions);
public void addListener(ObstacleModelListener listener);
public void removeListener(ObstacleModelListener listener);
public List<Obstacle> getObstacles();
public void generateObstacles();
public Map<Tuple<String, String>, Color> getObstacleColors();
public void setWaypointModel(WaypointModel model);
public boolean contains(PositionVector loc);
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.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.tud.kom.p2psim.api.topology.obstacles;
public interface ObstacleModelListener {
public void addedObstacle(Obstacle obstacle);
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.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.tud.kom.p2psim.api.topology.placement;
import de.tud.kom.p2psim.api.topology.Topology;
import de.tud.kom.p2psim.api.topology.TopologyComponent;
import de.tud.kom.p2psim.api.topology.obstacles.Obstacle;
import de.tud.kom.p2psim.impl.topology.PositionVector;
import de.tud.kom.p2psim.impl.topology.TopologyFactory;
/**
* Strategies and Distributions that place hosts in a {@link Topology}. These
* may be either statistically or based on input such as a csv of coordinates.
* Furthermore, they may support {@link Obstacle}s by placing hosts only on free
* areas.
*
* @author Bjoern Richerzhagen
* @version 1.0, 26.02.2012
*/
public interface PlacementModel {
/**
* Register a component with the {@link PlacementModel}. This allows the
* model to gain a full view of the number of hosts before placing them
* (interesting for grid-like distributions). Placement itself is done as
* soon as the addedComponent-Callback in the TopologyListener for this
* Model fired.
*
* This method is used in the {@link TopologyFactory}
*
* @param component
* @return
*/
public void addComponent(TopologyComponent comp);
/**
* Retrieve the Position-Vector for this component.
*
* @param comp
*/
public PositionVector place(TopologyComponent comp);
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.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.tud.kom.p2psim.api.topology.social;
import java.util.List;
import java.util.Map;
import java.util.Set;
import de.tud.kom.p2psim.api.common.SimHost;
import de.tud.kom.p2psim.api.topology.TopologyListener;
/**
* This interface contains the View for the Social Graph. It has the interface
* to request the structure of the social graph. Additionally it contains the
* activity and the interactions of the nodes, which can be used to fill a
* workload generator. With activity, we mean the activity of the user. This is
* a value between 0 and 1. The interactions is a edge weight, which represents
* the interactions between the nodes. The value for the interactions is between
* 0 and 1.<br>
* Further, it exists the possibility to derive the community Structure of the
* social graph. For this, the nodes will be split in clusters.
*
* <p>
* NOTE: The social connections must <b>not</b> be directional. It is possible
* that many links are undirected!
*
* <p>
* ATTENTION: It is possible to create multiple Social graph Views (for example,
* one for Application and one for Mobility Model). It is not possible to create
* different {@link SocialView}s for different Host Groups, with the same
* identifier, because the using Component doesn't know the right component for
* the host.
*
* @author Christoph Muenker
* @version 1.0, 06.06.2013
*/
public interface SocialView extends TopologyListener {
/**
* Initialize the Social Graph. In the most cases, the Social Graph needs
* the number of available hosts. But this is only possible, after all Hosts
* are created and added through the {@link TopologyListener}.
*/
public void initialize();
/**
* Gets an identifier for this Social View. This can be used to find the
* right SocialView.
*
* @return The identifier for this Social View
*/
public String getIdentifier();
/**
* Checks the social view, if the host was registered!
*
* @param host
* The host, which should be checked
* @return <code>true</code> if the host is added to this view, otherwise
* <code>false</code>
*/
public boolean isHostInView(SimHost host);
/**
* Gets the social neighbors to the Host.
*
* @param host
* The host, to which the social neighbors should be found.
* @return A list of {@link Host}s, which are connected with the given host.
* If the host not exists in the graph, then will be returned
* <code>null</code>.
*/
public List<SimHost> getNeighbors(SimHost host);
/**
* Is the Host x with the Host y connected? Note, that y must not be
* connected with x, because the connections can be unidirectional!
*
* @param x
* The host x
* @param y
* The host y
* @return <code>true</code> if it exists a link between x and y, otherwise
* <code>false</code>;
*/
public boolean isXWithYConnected(SimHost x, SimHost y);
/**
* Gets the Communities Clusters for all Hosts. A host is only in one
* cluster!
*
* @return A Set of Clusters, which contains a Set of {@link Host}s.
*/
public Set<Set<SimHost>> getClusters();
/**
* Gets the Cluster with {@link Host}s, in which the given host is.
*
* @param host
* The host that belongs to the requested cluster.
* @return A Set of Hosts, which are all in the same Cluster. The given host
* is in this Set. If the host doesn't exists in the graph, then
* will be returned null.
*/
public Set<SimHost> getCluster(SimHost host);
/**
* Check are the two given hosts in the same cluster.
*
* @param x
* The Host x
* @param y
* The Host y
* @return <code>true</code> if x and y are in the same cluster, otherwise
* <code>false</code>;
*/
public boolean isInSameCluster(SimHost x, SimHost y);
/**
* Gets the activity for a host. This activity is a value between 0 and 1.
* The activity is only a factor.
*
* @param host
* A host, for which the activity is requested.
* @return A value between 0 and 1. If the host doesn't exist in the graph,
* then will be returned 0.
*/
public double getActivity(SimHost host);
/**
* Gets to a host, the interactions. This mean, that to every neighbor
* exists a factor with a value between 0 and 1, which describes the
* interaction between them.
*
* @param host
* The host, for which are the interactions is requested.
* @return A Map with all neighbors and the interaction between the host and
* a neighbor. If the host doesn't exist in the graph, then will be
* returned <code>null</code>.
*/
public Map<SimHost, Double> getInteractions(SimHost host);
/**
* Gets the interaction between host x and host y. If there are no
* neighbors, then is the value 0.
* <p>
* NOTE: The call (x,y) can produce an other value as (y,x)!
*
* @param x
* The host x.
* @param y
* The host y.
* @return A value between 0 and 1. If one host not exist in the graph, then
* will be returned 0.
*/
public double getInteractionBetween(SimHost x, SimHost y);
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.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.tud.kom.p2psim.api.topology.views;
import de.tud.kom.p2psim.api.linklayer.mac.MacAddress;
import de.tud.kom.p2psim.api.linklayer.mac.MacLayer;
/**
*
* @author Bjoern Richerzhagen
* @version 1.0, 24.07.2012
*/
public interface DropRateDeterminator {
/**
* Called for each host that is added to the TopologyView
*
* @param mac
*/
public void onMacAdded(MacLayer mac, TopologyView viewParent);
/**
* Return the drop-rate between 0.0 and 1.0
*
* @param view
* This object can be used to access advanced information such as
* Positions. If you make extensive use of them, consider
* implementing a cache to speed up the calculations.
* @param source
* @param destination
* @return
*/
public double getDropRate(TopologyView view, MacAddress source,
MacAddress destination);
}
/*
* Copyright (c) 2005-2010 KOM – Multimedia Communications Lab
*
* This file is part of PeerfactSim.KOM.
*
* PeerfactSim.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.tud.kom.p2psim.api.topology.views;
import de.tud.kom.p2psim.api.linklayer.mac.MacAddress;
import de.tud.kom.p2psim.api.linklayer.mac.MacLayer;
/**
* An implementation of this interface is passed to each topology view. It
* determines how latencys are calculated (this could be distance based, based
* on some kind of CDF or just static)
*
* @author Bjoern Richerzhagen
* @version 1.0, 01.06.2012
*/
public interface LatencyDeterminator {
/**
* Called for each host that is added to the TopologyView
*
* @param mac
*/
public void onMacAdded(MacLayer mac, TopologyView viewParent);
/**
* Return the latency in Simulator units between source and destination.
* This method is called once for every link, as soon as it is created and
* everytime it is updated (depends on the TopologyView)
*
* @param view
* This object can be used to access advanced information such as
* Positions. If you make extensive use of them, consider
* implementing a cache to speed up the calculations.
* @param source
* @param destination
* @return
*/
public long getLatency(TopologyView view, MacAddress source,
MacAddress destination);
}
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