int index = text.indexOf(":");
String name = text.substring(0,index);
islandName = name;
- //System.out.println(islandName);
+ // if (dtxt!=null) dtxt.println(islandName);
sidePanel.removePropertyChangeListener(this);
latch.countDown();
}
}
int[] offerCount = getBuySellMaps(data,buys,sells,stallMap,commodMap);
//println(buys.toString());
- //System.out.println(sells);
- //System.out.println("\n\n\n"+buys);
+ // if (dtxt!=null) dtxt.println(sells);
+ // if (dtxt!=null) dtxt.println("\n\n\n"+buys);
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
pm.setProgress(60);
Accessible node1 = window;
Accessible node = descendNodes(node1,new int[] {0,1,0,0,0,0,1,0,0,1,0,0}); // commod market
// commod market: {0,1,0,0,0,0,1,0,0,1,0} {0,1,0,0,0,0,1,0,1,0,0,1,0,0})
- //System.out.println(node);
+ // if (dtxt!=null) dtxt.println(node);
if (!(node instanceof JTable)) {
node = descendNodes(node1,new int[] {0,1,0,0,0,0,1,0,1,0,0,1,0,0}); // commod market
}
if (!(node instanceof JTable)) return null;
AccessibleTable table = node.getAccessibleContext().getAccessibleTable();
- //System.out.println(table);
+ // if (dtxt!=null) dtxt.println(table);
return table;
}
private Accessible descendNodes(Accessible parent, int[] path) {
for(int i=0;i<path.length;i++) {
if (null == (parent = descend(parent, path[i]))) return null;
- //System.out.println(parent.getClass());
+ // if (dtxt!=null) dtxt.println(parent.getClass());
}
return parent;
}
// dtxt.println(xml);
// dtxt.println("<<");
//}
- //System.out.println(xml);
+ // if (dtxt!=null) dtxt.println(xml);
Reader reader = new CharArrayReader(xml.toCharArray());
Document d = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(reader));
NodeList maps = d.getElementsByTagName("CommodMap");
*/
private boolean finishUpload(InputStream in) throws IOException {
String html = readstreamstring(in);
- //System.out.println(html);
+ // if (dtxt!=null) dtxt.println(html);
Matcher m;
Pattern params = Pattern.compile("(?s)<input type=\"hidden\" name=\"action\" value=\"setisland\" />.+?<input type=\"hidden\" name=\"forcereload\" value=\"([^\"]+)\" />.+?<input type=\"hidden\" name=\"filename\" value=\"([^\"]+)\" />");
}
private int calculateArbitrageCommodity(ArrayList<SortedSet<int[]>> arb_bs) {
- //System.out.println("ARBITRAGE?");
+ // if (dtxt!=null) dtxt.println("ARBITRAGE?");
int profit = 0;
SortedSet<int[]> buys = arb_bs.get(0);
SortedSet<int[]> sells = arb_bs.get(1);
int unitprofit = buy[0] - sell[0];
int count = buy[1] < sell[1] ? buy[1] : sell[1];
- //System.out.println(" sell @"+sell[0]+" x"+sell[1]+" buy @"+buy[0]+" x"+buy[1]
+ // if (dtxt!=null) dtxt.println(" sell @"+sell[0]+" x"+sell[1]+" buy @"+buy[0]+" x"+buy[1]
// +" => x"+count+" @"+unitprofit);
if (unitprofit <= 0)
if (buy[1]==0) buys.remove(buy);
if (sell[1]==0) sells.remove(sell);
}
- //System.out.println(" PROFIT "+profit);
+ // if (dtxt!=null) dtxt.println(" PROFIT "+profit);
return profit;
}
for (ArrayList<String> row : data) {
String thiscommod = row.get(0);
- //System.out.println("ROW "+row.toString());
+ // if (dtxt!=null) dtxt.println("ROW "+row.toString());
if (lastcommod == null || !thiscommod.equals(lastcommod)) {
if (lastcommod != null)
arbitrage += calculateArbitrageCommodity(arb_bs);
- //System.out.println("ROW rdy");
+ // if (dtxt!=null) dtxt.println("ROW rdy");
arb_bs = new ArrayList<SortedSet<int[]>>(2);
arb_bs.add(0, new TreeSet<int[]>(compar));
arb_bs.add(1, new TreeSet<int[]>(compar));
- //System.out.println("ROW init");
+ // if (dtxt!=null) dtxt.println("ROW init");
lastcommod = thiscommod;
}
for (int bs = 0; bs < 2; bs++) {
if (pricestr == null)
continue;
int[] entry = new int[2];
- //System.out.println("ROW BS "+bs);
+ // if (dtxt!=null) dtxt.println("ROW BS "+bs);
entry[0] = parseQty(pricestr);
entry[1] = parseQty(row.get(bs*2 + 3));
arb_bs.get(bs).add(entry);