|
|
|
@ -13,7 +13,6 @@ import java.util.regex.Pattern; |
|
|
|
|
import javax.imageio.ImageIO; |
|
|
|
|
|
|
|
|
|
public class LoveLiveReader extends Reader{ |
|
|
|
|
final static int REGION_PADDING = 32; |
|
|
|
|
List<Box> extraRegions = new ArrayList<>(); |
|
|
|
|
static int lastJump=0; |
|
|
|
|
public LoveLiveReader(){ |
|
|
|
@ -250,68 +249,7 @@ public class LoveLiveReader extends Reader{ |
|
|
|
|
//System.out.println(data[2]);
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
String interpretOutput(String[] jp_data,String[] en_data) { |
|
|
|
|
//[6, 0, 218, 0, 218, 48, 6, 48, 32 5 4 1 5, 0.9670235803680689]
|
|
|
|
|
//For each data point we want to first see if it's within the correct rectangular bounds and from there parse it as such.
|
|
|
|
|
double[] accuracy = new double[readRegions.size()]; |
|
|
|
|
String[] finalData = new String[readRegions.size()]; |
|
|
|
|
for (int i=0;i<finalData.length;i++) { |
|
|
|
|
finalData[i]=""; |
|
|
|
|
} |
|
|
|
|
for (int i=0;i<en_data.length;i+=10) { |
|
|
|
|
int spacing=0; |
|
|
|
|
for (int j=0;j<readRegions.size();j++) { |
|
|
|
|
int midpoint=(Integer.parseInt(en_data[i+1])+Integer.parseInt(en_data[i+5]))/2; |
|
|
|
|
if (midpoint>=spacing&&midpoint<=spacing+readRegions.get(j).h+REGION_PADDING |
|
|
|
|
/*&&accuracy[j]<Double.parseDouble(en_data[i+9]) Only for jp string testing.*/) { |
|
|
|
|
System.out.print("["); |
|
|
|
|
for (int k=0;k<10;k++) { |
|
|
|
|
if (k!=0) { |
|
|
|
|
System.out.print(","); |
|
|
|
|
} |
|
|
|
|
System.out.print(en_data[i+k]); |
|
|
|
|
} |
|
|
|
|
System.out.print("]"); |
|
|
|
|
System.out.println(" belongs to region "+j+"."); |
|
|
|
|
finalData[j]=finalData[j]+"\n"+en_data[i+8]; |
|
|
|
|
accuracy[j]=Double.parseDouble(en_data[i+9]); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
spacing+=readRegions.get(j).h+REGION_PADDING; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
for (int i=0;i<jp_data.length;i+=10) { |
|
|
|
|
int spacing=0; |
|
|
|
|
for (int j=0;j<readRegions.size();j++) { |
|
|
|
|
int midpoint=(Integer.parseInt(jp_data[i+1])+Integer.parseInt(jp_data[i+5]))/2; |
|
|
|
|
if (midpoint>=spacing&&midpoint<=spacing+readRegions.get(j).h+REGION_PADDING |
|
|
|
|
&&accuracy[j]<Double.parseDouble(jp_data[i+9])) { |
|
|
|
|
System.out.print("JP["); |
|
|
|
|
for (int k=0;k<10;k++) { |
|
|
|
|
if (k!=0) { |
|
|
|
|
System.out.print(","); |
|
|
|
|
} |
|
|
|
|
System.out.print(jp_data[i+k]); |
|
|
|
|
} |
|
|
|
|
System.out.print("]"); |
|
|
|
|
System.out.println(" belongs to region "+j+"."); |
|
|
|
|
if (accuracy[j]!=0) { |
|
|
|
|
finalData[j]=""; |
|
|
|
|
} |
|
|
|
|
finalData[j]=finalData[j]+"\n"+jp_data[i+8]; |
|
|
|
|
accuracy[j]=0; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
spacing+=readRegions.get(j).h+REGION_PADDING; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
System.out.println(Arrays.toString(finalData)); |
|
|
|
|
interpretResults(finalData); |
|
|
|
|
return null; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void interpretResults(String[] finalData) { |
|
|
|
|
void interpretResults(String[] finalData) { |
|
|
|
|
for (int i=0;i<finalData.length;i++) { |
|
|
|
|
String[] splitter = finalData[i].split(Pattern.quote("\n")); |
|
|
|
|
switch (i) { |
|
|
|
|