View Javadoc

1   package SteeringProperties;
2   
3   import XMLSteeringProperties.XMLForcePoint;
4   
5   /**
6    * The class which defines one segment of the force-function. It says which value has the force at the concrete distance - and which value is to the next segment.
7    * @author Marki
8    */
9   public class ForcePoint {
10  
11      /**Distance of the agent's location from the target location.*/
12      public int distance;
13  
14      /**The value of the force-function at the distance distance.*/
15      public int forceValue;
16      
17      /**If it's false, the continuing segment has 0 value of the force. Otherwise it has the value computed from this and next boundary.*/
18      public boolean continues;
19  
20      public ForcePoint(int distance, int forceValue, boolean continues) {
21          this.distance = distance;
22          this.forceValue = forceValue;
23          this.continues = continues;
24      }
25  
26      public ForcePoint(XMLForcePoint xml) {
27          this.distance = xml.distance;
28          this.forceValue = xml.forceValue;
29          this.continues = xml.continues;
30      }
31  
32      public ForcePoint(ForcePoint fPoint) {
33          this.distance = fPoint.distance;
34          this.forceValue = fPoint.forceValue;
35          this.continues = fPoint.continues;
36      }
37  
38      public String getSpecialText() {
39          String result = "";
40          result += "    * Distance: " + distance + "\n";
41          result += "    * Value: " + forceValue + "\n";
42          result += "    * Continues: " + continues + "\n";
43          return result;
44      }
45  
46      public XMLForcePoint getXMLForcePoint() {
47          XMLForcePoint xmlForce = new XMLForcePoint();
48          xmlForce.distance = distance;
49          xmlForce.forceValue = forceValue;
50          xmlForce.continues = continues;
51          return xmlForce;
52      }
53  }