1 package SteeringProperties;
2
3 import SteeringStuff.SteeringType;
4 import java.io.Serializable;
5
6
7
8
9
10 public abstract class SteeringProperties implements Serializable {
11
12
13
14
15
16
17
18 public enum BehaviorType {BASIC, ADVANCED, OWN};
19
20
21 protected SteeringType type;
22
23
24 protected boolean active;
25
26
27 protected double weight;
28
29
30 protected BehaviorType behaviorType;
31
32 public SteeringProperties(SteeringType type) {
33 this.type = type;
34 active = false;
35 weight = 1;
36 behaviorType = BehaviorType.OWN;
37 }
38
39 public SteeringProperties(SteeringType type, BehaviorType behaviorType) {
40 this.type = type;
41 active = false;
42 weight = 1;
43 this.behaviorType = behaviorType;
44 }
45
46 public SteeringProperties(SteeringType type, boolean active, double weight) {
47 this.type = type;
48 this.active = active;
49 this.weight = weight;
50 behaviorType = BehaviorType.OWN;
51 }
52
53 public SteeringProperties(SteeringType type, boolean active, double weight, BehaviorType behaviorType) {
54 this.type = type;
55 this.active = active;
56 this.weight = weight;
57 this.behaviorType = behaviorType;
58 }
59
60 public SteeringType getType() {
61 return type;
62 }
63
64 public void setType(SteeringType type) {
65 this.type = type;
66 }
67
68 public boolean isActive() {
69 return active;
70 }
71
72 public void setActive(boolean active) {
73 this.active = active;
74 }
75
76 public double getWeight() {
77 return weight;
78 }
79
80 public void setWeight(double weight) {
81 this.weight = weight;
82 }
83
84 public BehaviorType getBehaviorType() {
85 return behaviorType;
86 }
87
88 public void setBehaviorType(BehaviorType behaviorType) {
89 if (this.behaviorType != behaviorType && behaviorType != BehaviorType.OWN) {
90 setNewBehaviorType(behaviorType);
91 }
92 this.behaviorType = behaviorType;
93 }
94
95 public String getText() {
96 String text = "* " + type.getName() + "\n";
97 text += " * Weight: " + weight + "\n";
98 text += getSpecialText();
99 return text;
100 }
101
102 protected abstract void setNewBehaviorType(BehaviorType behaviorType);
103
104 public abstract void setProperties(SteeringProperties newProperties);
105
106 public abstract String getSpecialText();
107 }