Trim python array down for Java array parsing

Co-authored-by: sigonasr2 <sigonasr2@gmail.com>
main
sigonasr2, Sig, Sigo 2 years ago
parent af48607bd9
commit a7304ba139
  1. 44
      ArcadeReader.java

@ -2,7 +2,9 @@ import java.io.IOException;
import java.io.InputStreamReader;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Pattern;
import java.awt.image.BufferedImage;
public class ArcadeReader {
@ -77,13 +79,35 @@ class Box{
}
class LoveLiveReader extends Reader{
LoveLiveReader(){
readRegions.add(new Box(10,10,24,24));
readRegions.add(new Box(10,40,24,24));
readRegions.add(new Box(10,70,24,24));
readRegions.add(new Box(10,10,24,24)); //score[0]
readRegions.add(new Box(10,40,24,24)); //rank[1]
readRegions.add(new Box(10,70,24,24)); //notes[2]
readRegions.add(new Box(10,70,24,24)); //notes[3]
readRegions.add(new Box(10,70,24,24)); //notes[4]
readRegions.add(new Box(10,70,24,24)); //notes[5]
readRegions.add(new Box(10,70,24,24)); //notes[6]
readRegions.add(new Box(10,70,24,24)); //notes[7]
readRegions.add(new Box(10,70,24,24)); //notes[8]
readRegions.add(new Box(10,70,24,24)); //difficulty[9]
readRegions.add(new Box(10,70,24,24)); //title[10]
readRegions.add(new Box(10,70,24,24)); //pct[11]
readRegions.add(new Box(10,70,24,24)); //maxcombo[12]
readRegions.add(new Box(10,70,24,24)); //other...[13]
}
void interpretBoxes(Path img){
String dataString = readAllBoxes(img);
System.out.println(dataString);
String[] data = dataString.split(Pattern.quote("\n"));
String[] ja_data = data[0].split(Pattern.quote(")"));
String[] en_data = data[2].split(Pattern.quote(")"));
trimAllData(ja_data);
trimAllData(en_data);
System.out.println(Arrays.toString(ja_data));
System.out.println(Arrays.toString(en_data));
for (int i=0;i<readRegions.size();i++) {
}
//System.out.println(data[0]);
//System.out.println(data[2]);
}
}
abstract class Reader{
@ -119,4 +143,16 @@ abstract class Reader{
}
return "";
}
void trimAllData(String[] data) {
StringBuilder sb = new StringBuilder();
for (int i=0;i<data.length;i++) {
sb.delete(0,sb.length());
for (int j=0;j<data[i].length();j++) {
if (data[i].charAt(j)!='['&&data[i].charAt(j)!='('&&data[i].charAt(j)!=')'&&data[i].charAt(j)!=']') {
sb.append(data[i].charAt(j));
}
}
data[i]=sb.toString();
}
}
}

Loading…
Cancel
Save