Commit af3f2cc6 authored by Julian Zobel's avatar Julian Zobel
Browse files

Attraction Point Monitoring for eval

parent d28bebc4
/*
* 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.impl.topology.movement.modularosm.attraction;
import de.tudarmstadt.maki.simonstrator.api.component.core.MonitorComponent.Analyzer;
import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.AttractionPoint;
public interface AttractionPointMonitor extends Analyzer {
public void addedAttractionPoint(AttractionPoint ap);
public void removedAttractionPoint(AttractionPoint ap);
}
......@@ -100,7 +100,7 @@ public class CsvAttractionGenerator implements IAttractionGenerator {
}
AttractionPoint ap = new AttractionPointImpl("AP"+i, new PositionVector(x, y));
ap.setRadius(radius);
attractionPoints.add(ap);
addAttractionPoint(ap);
i++;
entrySuccessfullyRead = true;
......@@ -127,7 +127,7 @@ public class CsvAttractionGenerator implements IAttractionGenerator {
AttractionPoint ap = new AttractionPointImpl("AP"+i, new PositionVector(x, y));
ap.setRadius(r);
attractionPoints.add(ap);
addAttractionPoint(ap);
i++;
entrySuccessfullyRead = true;
......
......@@ -22,7 +22,7 @@ package de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction;
import java.util.LinkedList;
import java.util.List;
import de.tudarmstadt.maki.simonstrator.api.Monitor;
import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.AttractionPoint;
/**
......@@ -37,4 +37,21 @@ public interface IAttractionGenerator {
public List<AttractionPoint> getAttractionPoints();
default void removeAttractionPoint(AttractionPoint ap) {
if(Monitor.hasAnalyzer(AttractionPointMonitor.class)) {
Monitor.getOrNull(AttractionPointMonitor.class).removedAttractionPoint(ap);
}
attractionPoints.remove(ap);
}
default void addAttractionPoint(AttractionPoint ap) {
if(Monitor.hasAnalyzer(AttractionPointMonitor.class)) {
Monitor.getOrNull(AttractionPointMonitor.class).addedAttractionPoint(ap);
}
attractionPoints.add(ap);
}
}
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