commit
86abc4177e
@ -50,11 +50,7 @@ public class App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isOperator(String s) {
|
public static boolean isOperator(String s) {
|
||||||
if (s.equals("+") || s.equals("-") || s.equals("*")) {
|
return s.equals("+") || s.equals("-") || s.equals("*");
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Expression getOperatorInstance(String s, Expression left,
|
public static Expression getOperatorInstance(String s, Expression left,
|
||||||
|
@ -6,23 +6,16 @@ public enum Action {
|
|||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
|
||||||
String s = "";
|
|
||||||
switch (this) {
|
switch (this) {
|
||||||
case ENEMY:
|
case ENEMY:
|
||||||
s = "spotted enemies";
|
return "spotted enemies";
|
||||||
break;
|
|
||||||
case GOLD:
|
case GOLD:
|
||||||
s = "found gold";
|
return "found gold";
|
||||||
break;
|
|
||||||
case HUNT:
|
case HUNT:
|
||||||
s = "hunted a rabbit";
|
return "hunted a rabbit";
|
||||||
break;
|
|
||||||
case TALE:
|
case TALE:
|
||||||
s = "tells a tale";
|
return "tells a tale";
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return s;
|
return "";
|
||||||
};
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,17 +29,17 @@ public class FileLoader {
|
|||||||
try {
|
try {
|
||||||
BufferedReader br = new BufferedReader(new FileReader(new File(
|
BufferedReader br = new BufferedReader(new FileReader(new File(
|
||||||
this.fileName)));
|
this.fileName)));
|
||||||
String text = "";
|
StringBuilder sb = new StringBuilder();
|
||||||
String line = "";
|
String line;
|
||||||
|
|
||||||
while ((line = br.readLine()) != null) {
|
while ((line = br.readLine()) != null) {
|
||||||
text += line + "\n";
|
sb.append(line).append('\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loaded = true;
|
this.loaded = true;
|
||||||
br.close();
|
br.close();
|
||||||
|
|
||||||
return text;
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user