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

Areas for Attraction Points

Group Forming bugfix: now correctly disables group movement
parent ff821148
......@@ -20,19 +20,11 @@
package de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction;
import java.lang.annotation.Annotation;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Random;
import org.jboss.logging.annotations.Pos;
import org.jboss.logging.annotations.Transform;
import de.tud.kom.p2psim.impl.topology.movement.modularosm.IAttractionBasedMovementAnalyzer;
import de.tud.kom.p2psim.impl.topology.movement.modularosm.ISocialGroupMovementAnalyzer;
import de.tud.kom.p2psim.impl.topology.util.PositionVector;
import de.tudarmstadt.maki.simonstrator.api.Monitor;
import de.tudarmstadt.maki.simonstrator.api.Randoms;
import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.IAttractionPoint;
import de.tudarmstadt.maki.simonstrator.api.util.XMLConfigurableConstructor;
......@@ -53,13 +45,13 @@ public class AttractionPoint extends BasicAttractionPoint {
protected long pauseTimeMax = -1;
protected double weight = 0;
protected double radius = 0;
protected double area = 1;
@XMLConfigurableConstructor({ "name", "x", "y" })
public AttractionPoint(String name, double x, double y) {
this(name, new PositionVector(x, y));
}
public AttractionPoint(String name, PositionVector posVec) {
super(name, posVec);
......@@ -81,7 +73,11 @@ public class AttractionPoint extends BasicAttractionPoint {
this.weight = weight;
this.radius = radius;
this.setPauseTime(pauseTimeMin, pauseTimeMax);
this.setPauseTime(pauseTimeMin, pauseTimeMax);
if(radius > 0) {
this.area = Math.PI * Math.pow(radius, 2);
}
}
@Override
......@@ -189,4 +185,8 @@ public class AttractionPoint extends BasicAttractionPoint {
public String toString() {
return getName() + " (" + getX() + ", " + getY() + ")" + " <" + getRadius() + "> ";
}
public double getArea() {
return area;
}
}
......@@ -138,6 +138,11 @@ public abstract class AbstractGroupForming implements IGroupFormingBehavior {
stayDuration.put(host.getHost().getId(), new Tuple<Long, Long>(0L, Time.getCurrentTime()));
}
if(!enableGroups) {
return;
}
for(int g = 0; g < maxNumberOfGroups; g++) {
long delay = Math.max(Time.MINUTE, (long) ((rand.nextDouble() * (Time.MINUTE * 45) + Time.MINUTE)));
//System.out.println("("+g+") Init Group Formation Time " + Time.getFormattedTime(delay) );
......
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