summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <lekensteyn@gmail.com>2013-11-29 00:38:06 +0100
committerPeter Wu <lekensteyn@gmail.com>2013-11-29 00:38:06 +0100
commitf8aff0fd8c258d8c716775ef2587e9b92070b3a1 (patch)
tree525f514af974c86d2dca2acedcc4b06a2bf88511
parent7604a15a1797f51a78132fc0ffbdc95a857d77c8 (diff)
download2iv60-robots-f8aff0fd8c258d8c716775ef2587e9b92070b3a1.tar.gz
Refactor: move RaceTrack outside RaceTrack
The comments "The X-track is selected" are moved after the "if (...) {" because it does not belong to the previous condition statements.
-rw-r--r--src/RaceTrack.java68
-rw-r--r--src/RobotRace.java68
2 files changed, 68 insertions, 68 deletions
diff --git a/src/RaceTrack.java b/src/RaceTrack.java
new file mode 100644
index 0000000..969d636
--- /dev/null
+++ b/src/RaceTrack.java
@@ -0,0 +1,68 @@
+
+import robotrace.Vector;
+
+/**
+ * Implementation of a race track that is made from Bezier segments.
+ */
+class RaceTrack {
+
+ /**
+ * Array with control points for the O-track.
+ */
+ private Vector[] controlPointsOTrack;
+
+ /**
+ * Array with control points for the L-track.
+ */
+ private Vector[] controlPointsLTrack;
+
+ /**
+ * Array with control points for the C-track.
+ */
+ private Vector[] controlPointsCTrack;
+
+ /**
+ * Array with control points for the custom track.
+ */
+ private Vector[] controlPointsCustomTrack;
+
+ /**
+ * Constructs the race track, sets up display lists.
+ */
+ public RaceTrack() {
+ // code goes here ...
+ }
+
+ /**
+ * Draws this track, based on the selected track number.
+ */
+ public void draw(int trackNr) {
+
+ // The test track is selected
+ if (0 == trackNr) {
+ // code goes here ...
+ } else if (1 == trackNr) { // The O-track is selected
+ // code goes here ...
+ } else if (2 == trackNr) { // The L-track is selected
+ // code goes here ...
+ } else if (3 == trackNr) { // The C-track is selected
+ // code goes here ...
+ } else if (4 == trackNr) { // The custom track is selected
+ // code goes here ...
+ }
+ }
+
+ /**
+ * Returns the position of the curve at 0 <= {@code t} <= 1.
+ */
+ public Vector getPoint(double t) {
+ return Vector.O; // <- code goes here
+ }
+
+ /**
+ * Returns the tangent of the curve at 0 <= {@code t} <= 1.
+ */
+ public Vector getTangent(double t) {
+ return Vector.O; // <- code goes here
+ }
+}
diff --git a/src/RobotRace.java b/src/RobotRace.java
index 61edd34..8a197b7 100644
--- a/src/RobotRace.java
+++ b/src/RobotRace.java
@@ -388,74 +388,6 @@ public class RobotRace extends Base {
}
/**
- * Implementation of a race track that is made from Bezier segments.
- */
- private class RaceTrack {
-
- /** Array with control points for the O-track. */
- private Vector[] controlPointsOTrack;
-
- /** Array with control points for the L-track. */
- private Vector[] controlPointsLTrack;
-
- /** Array with control points for the C-track. */
- private Vector[] controlPointsCTrack;
-
- /** Array with control points for the custom track. */
- private Vector[] controlPointsCustomTrack;
-
- /**
- * Constructs the race track, sets up display lists.
- */
- public RaceTrack() {
- // code goes here ...
- }
-
- /**
- * Draws this track, based on the selected track number.
- */
- public void draw(int trackNr) {
-
- // The test track is selected
- if (0 == trackNr) {
- // code goes here ...
-
- // The O-track is selected
- } else if (1 == trackNr) {
- // code goes here ...
-
- // The L-track is selected
- } else if (2 == trackNr) {
- // code goes here ...
-
- // The C-track is selected
- } else if (3 == trackNr) {
- // code goes here ...
-
- // The custom track is selected
- } else if (4 == trackNr) {
- // code goes here ...
-
- }
- }
-
- /**
- * Returns the position of the curve at 0 <= {@code t} <= 1.
- */
- public Vector getPoint(double t) {
- return Vector.O; // <- code goes here
- }
-
- /**
- * Returns the tangent of the curve at 0 <= {@code t} <= 1.
- */
- public Vector getTangent(double t) {
- return Vector.O; // <- code goes here
- }
-
- }
-
- /**
* Implementation of the terrain.
*/
private class Terrain {