BasicAttractionPoint.java 1.4 KB
Newer Older
1
2
package de.tud.kom.p2psim.impl.topology.movement.modularosm.attraction;

3
import de.tud.kom.p2psim.impl.topology.util.PositionVector;
4
import de.tudarmstadt.maki.simonstrator.api.component.sensor.location.AttractionPoint;
5
import de.tudarmstadt.maki.simonstrator.api.util.XMLConfigurableConstructor;
6
7
8
9
10
11
12

/**
 * A basic attraction point, as simple as it can get. Really just a named location
 * without any checks performed.
 */
public class BasicAttractionPoint extends PositionVector implements AttractionPoint
{
13
14
15
    protected String name;
    protected double weight = 0;
    protected double radius = 0;
16

17
    public BasicAttractionPoint(String name, PositionVector pos) {
18
19
20
21
        super(pos);
        this.name = name;
    }

22
23
24
25
26
    @XMLConfigurableConstructor({ "name", "x", "y" })
    public BasicAttractionPoint(String name, double x, double y) {
    	this(name, new PositionVector(x, y));
    }
    
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
    @Override
    public String getName() {
        return name;
    }

    @Override
    public double getWeight() {
        return weight;
    }

    @Override
    public double getRadius() {
        return radius;
    }

    @Override
    public void setWeight(double weight) {
        this.weight = weight;
    }

    @Override
    public void setRadius(double radius) {
        this.radius = radius;
    }

    @Override
    public AttractionPoint clone(String newName) {
        return new BasicAttractionPoint(newName, this);
    }
}