+ Added compare and info commands

This commit is contained in:
Matthew Cech
2019-05-05 16:38:59 -07:00
parent 55411cfe14
commit 3a8306f1e6
9 changed files with 120 additions and 30 deletions
+7 -1
View File
@@ -35,6 +35,12 @@ public class LocStrings extends LocBase
public static String Stub(String toStub)
{
return instance.GetKey(toStub);
return Lookup(toStub);
}
// Won't be picked up when scraping
public static String Lookup(String stubbedPreviously)
{
return instance.GetKey(stubbedPreviously);
}
}
@@ -17,6 +17,8 @@ public class BenchmarkFramework
this.benchmarkCommand = new HashMap<String, BenchmarkCommand>();
RegisterCommand("find", new BenchmarkCommandFind());
RegisterCommand("compare", new BenchmarkCommandCompare());
RegisterCommand("info", new BenchmarkCommandInfo());
}
// Runs a command if possible.
+4 -12
View File
@@ -1,5 +1,7 @@
package core.benchmark;
import utils.StringUtils;
// Lifted from an early iteration of RPGInput
public class BenchmarkInput
{
@@ -17,7 +19,7 @@ public class BenchmarkInput
return;
raw = raw.trim();
int whitespacePos = FindFirstWhitespace(raw);
int whitespacePos = StringUtils.FindFirstWhitespace(raw);
if(whitespacePos == -1)
{
@@ -29,16 +31,6 @@ public class BenchmarkInput
value = raw.substring(whitespacePos).trim();
}
// Finds first whitespace in the string
private int FindFirstWhitespace(String str)
{
for (int i = 0; i < str.length(); ++i)
{
if (Character.isWhitespace(str.charAt(i)))
return i;
}
return -1;
}
}
+3 -13
View File
@@ -1,5 +1,7 @@
package core.rpg;
import utils.StringUtils;
public class RPGInput
{
public String raw;
@@ -16,7 +18,7 @@ public class RPGInput
return;
raw = raw.trim();
int whitespacePos = FindFirstWhitespace(raw);
int whitespacePos = StringUtils.FindFirstWhitespace(raw);
if(whitespacePos == -1)
{
@@ -27,16 +29,4 @@ public class RPGInput
key = raw.substring(0, whitespacePos).trim();
value = raw.substring(whitespacePos).trim();
}
// Finds first whitespace in the string
private int FindFirstWhitespace(String str)
{
for (int i = 0; i < str.length(); ++i)
{
if (Character.isWhitespace(str.charAt(i)))
return i;
}
return -1;
}
}