|
@@ -25,7 +25,7 @@ import java.io.FileWriter;
|
25
|
25
|
import java.io.File;
|
26
|
26
|
import java.util.Scanner;
|
27
|
27
|
import java.io.IOException;
|
28
|
|
-import java.util.ArrayList;
|
|
28
|
+import java.util.LinkedList;
|
29
|
29
|
|
30
|
30
|
/**
|
31
|
31
|
* A helper class that loads animations from a file or saves them to one.
|
|
@@ -39,14 +39,14 @@ public class AnimationUtility {
|
39
|
39
|
private static String lastError = null;
|
40
|
40
|
|
41
|
41
|
/**
|
42
|
|
- * Read a file, return ArrayList with all animations in the file.
|
|
42
|
+ * Read a file, return LinkedList with all animations in the file.
|
43
|
43
|
* @param path Path of file
|
44
|
|
- * @return Populated ArrayList
|
|
44
|
+ * @return Populated LinkedList
|
45
|
45
|
* @throws Excpetion When something goes wrong with the Scanner...
|
46
|
46
|
*/
|
47
|
|
- public static ArrayList<Animation> readFile(String path) throws Exception {
|
|
47
|
+ public static LinkedList<Animation> readFile(String path) throws Exception {
|
48
|
48
|
Scanner sc = new Scanner(new File(path));
|
49
|
|
- ArrayList<Animation> animations = new ArrayList<Animation>();
|
|
49
|
+ LinkedList<Animation> animations = new LinkedList<Animation>();
|
50
|
50
|
|
51
|
51
|
do {
|
52
|
52
|
Animation tmp = readAnimation(sc);
|
|
@@ -63,12 +63,12 @@ public class AnimationUtility {
|
63
|
63
|
}
|
64
|
64
|
|
65
|
65
|
/**
|
66
|
|
- * Write a file with all Animations of an ArrayList
|
|
66
|
+ * Write a file with all Animations of an LinkedList
|
67
|
67
|
* @param path Path to write to
|
68
|
|
- * @param animations ArrayList with all animations to be saved
|
|
68
|
+ * @param animations LinkedList with all animations to be saved
|
69
|
69
|
* @see AnimationUtility#getLastError() getLastError()
|
70
|
70
|
*/
|
71
|
|
- public static void writeFile(String path, ArrayList<Animation> animations) {
|
|
71
|
+ public static void writeFile(String path, LinkedList<Animation> animations) {
|
72
|
72
|
File f = new File(path);
|
73
|
73
|
if (f.exists()) {
|
74
|
74
|
try {
|
|
@@ -102,7 +102,7 @@ public class AnimationUtility {
|
102
|
102
|
/**
|
103
|
103
|
* Get the last error that occured while writing
|
104
|
104
|
* @return Text of the exception that occured
|
105
|
|
- * @see AnimationUtility#writeFile(String, ArrayList) writeFile()
|
|
105
|
+ * @see AnimationUtility#writeFile(String, LinkedList) writeFile()
|
106
|
106
|
*/
|
107
|
107
|
public static String getLastError() {
|
108
|
108
|
String tmp = lastError;
|