yarrgts = getYarrgTimestamp();
}
- AccessibleTable t = findMarketTable();
- if(t == null) {
+ AccessibleTable accesstable = findMarketTable();
+ if(accesstable == null) {
error("Market table not found! Please open the Buy/Sell Commodities interface.");
return;
}
- if(t.getAccessibleRowCount() == 0) {
+ if(accesstable.getAccessibleRowCount() == 0) {
error("No data found, please wait for the table to have data first!");
return;
}
latch.await(2, java.util.concurrent.TimeUnit.SECONDS);
}
- ArrayList<ArrayList<String>> data = getData(t);
+ String headings_expected[] = new String[]
+ { "Commodity", "Trading outlet", "Buy price", "Will buy", "Sell price", "Will sell" };
+ ArrayList<ArrayList<String>> headers = getData(accesstable.getAccessibleColumnHeader());
+ if (headers.size() != 1) {
+ error("Table headings not one row! " + headers.toString());
+ return;
+ }
+ if (headers.get(0).size() != 6) {
+ error("Table headings not six columns! " + headers.toString());
+ return;
+ }
+ for (int col=0; col<headings_expected.length; col++) {
+ String expd = headings_expected[col];
+ String got = headers.get(0).get(col);
+ if (expd.compareTo(got) != 0) {
+ error("Table heading for column "+col
+ +" is not \""+expd+"\" but \""+got+"\".\n\n"
+ +"Please do not reorder the table when using this tool.");
+ return;
+ }
+ }
+
+ ArrayList<ArrayList<String>> data = getData(accesstable);
if (uploadToYarrg && yarrgts != null) {
pm.setNote("Yarrg: Preparing data");