ArrayList<ArrayList<String>> data = getData(t);
if (uploadToYarrg && yarrgts != null) {
- pm.setNote("Preparing data for Yarrg");
+ pm.setNote("Yarrg: Preparing data");
pm.setProgress(10);
StringBuilder yarrgsb = new StringBuilder();
yarrgdata = yarrgsb.toString();
- pm.setNote("Uploading to Yarrg");
+ pm.setNote("Yarrg: Uploading");
if (islandName != null) {
doneyarrg = runYarrg(yarrgts, oceanName, islandName, yarrgdata);
}
}
- pm.setNote("Getting stall names");
- pm.setProgress(20);
- if(pm.isCanceled()) {
+ if (uploadToPCTB) {
+ pm.setNote("PCTB: Getting stall names");
+ pm.setProgress(20);
+ if(pm.isCanceled()) {
return;
- }
- TreeSet<Offer> buys = new TreeSet<Offer>();
- TreeSet<Offer> sells = new TreeSet<Offer>();
- LinkedHashMap<String,Integer> stallMap = getStallMap(data);
- pm.setProgress(40);
- pm.setNote("Sorting offers");
- if(pm.isCanceled()) {
+ }
+ TreeSet<Offer> buys = new TreeSet<Offer>();
+ TreeSet<Offer> sells = new TreeSet<Offer>();
+ LinkedHashMap<String,Integer> stallMap = getStallMap(data);
+ pm.setProgress(40);
+ pm.setNote("PCTB: Sorting offers");
+ if(pm.isCanceled()) {
return;
- }
- // get commod map
+ }
+ // get commod map
- HashMap<String,Integer> commodMap = getCommodMap();
- if(commodMap == null) {
+ HashMap<String,Integer> commodMap = getCommodMap();
+ if(commodMap == null) {
return;
- }
- int[] offerCount = getBuySellMaps(data,buys,sells,stallMap,commodMap);
- //println(buys.toString());
- //System.out.println(sells);
- //System.out.println("\n\n\n"+buys);
-
- if (uploadToPCTB) {
- ByteArrayOutputStream outStream = new ByteArrayOutputStream();
- pm.setProgress(60);
- pm.setNote("Sending data");
- if(pm.isCanceled()) {
- return;
- }
- GZIPOutputStream out = new GZIPOutputStream(outStream);
- //FileOutputStream out = new FileOutputStream(new File("output.text"));
- DataOutputStream dos = new DataOutputStream(out);
- dos.writeBytes("005y\n");
- dos.writeBytes(stallMap.size()+"\n");
- dos.writeBytes(getAbbrevStallList(stallMap));
- writeBuySellOffers(buys,sells,offerCount,out);
- out.finish();
- InputStream in = sendInitialData(new ByteArrayInputStream(outStream.toByteArray()));
- if (in == null) return;
- pm.setProgress(80);
- if(pm.isCanceled()) {
- return;
- }
- pm.setNote("Waiting for PCTB...");
- donepctb = finishUpload(in);
+ }
+ int[] offerCount = getBuySellMaps(data,buys,sells,stallMap,commodMap);
+ //println(buys.toString());
+ //System.out.println(sells);
+ //System.out.println("\n\n\n"+buys);
+
+ ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+ pm.setProgress(60);
+ pm.setNote("PCTB: Sending data");
+ if(pm.isCanceled()) {
+ return;
+ }
+ GZIPOutputStream out = new GZIPOutputStream(outStream);
+ //FileOutputStream out = new FileOutputStream(new File("output.text"));
+ DataOutputStream dos = new DataOutputStream(out);
+ dos.writeBytes("005y\n");
+ dos.writeBytes(stallMap.size()+"\n");
+ dos.writeBytes(getAbbrevStallList(stallMap));
+ writeBuySellOffers(buys,sells,offerCount,out);
+ out.finish();
+ InputStream in = sendInitialData(new ByteArrayInputStream(outStream.toByteArray()));
+ if (in == null) return;
+ pm.setProgress(80);
+ if(pm.isCanceled()) {
+ return;
+ }
+ pm.setNote("PCTB: Waiting ...");
+ donepctb = finishUpload(in);
}
pm.setProgress(100);