rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | final private boolean jj_3R_16() { if (jj_scan_token(MOD)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
|
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | final private boolean jj_3R_17() { if (jj_3R_22()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
|
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | final private boolean jj_3R_18() { if (jj_3R_23()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
|
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | final private boolean jj_3R_19() { if (jj_3R_20()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
|
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | final private boolean jj_3R_20() { if (jj_3R_24()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
|
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | final private boolean jj_3R_21() { if (jj_3R_25()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
|
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | } } } | final private boolean jj_3R_22() { Token xsp; xsp = jj_scanpos; if (jj_3R_26()) { jj_scanpos = xsp; if (jj_3_7()) { jj_scanpos = xsp; if (jj_3R_27()) { jj_scanpos = xsp; if (jj_3R_28()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | final private boolean jj_3R_23() { if (jj_3R_24()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
|
if (jj_3R_29()) { | if (jj_scan_token(12)) { | final private boolean jj_3R_24() { Token xsp; xsp = jj_scanpos; if (jj_3R_29()) { jj_scanpos = xsp; if (jj_3R_30()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
if (jj_3R_30()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | if (jj_scan_token(15)) return true; } | final private boolean jj_3R_24() { Token xsp; xsp = jj_scanpos; if (jj_3R_29()) { jj_scanpos = xsp; if (jj_3R_30()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
if (jj_3R_31()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | if (jj_3R_29()) return true; | final private boolean jj_3R_25() { if (jj_3R_31()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
if (jj_3R_32()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | if (jj_3R_30()) return true; | final private boolean jj_3R_26() { if (jj_3R_32()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | final private boolean jj_3R_27() { if (jj_scan_token(LRND)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
|
if (jj_3R_33()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | if (jj_3R_31()) return true; | final private boolean jj_3R_28() { if (jj_3R_33()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
if (jj_scan_token(INDENTIFIER1)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | if (jj_3R_32()) return true; | final private boolean jj_3R_29() { if (jj_scan_token(INDENTIFIER1)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
if (jj_scan_token(INDENTIFIER2)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | Token xsp; xsp = jj_scanpos; if (jj_3R_33()) { jj_scanpos = xsp; if (jj_3R_34()) return true; } | final private boolean jj_3R_30() { if (jj_scan_token(INDENTIFIER2)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
if (jj_3R_34()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | if (jj_scan_token(LSQ)) return true; | final private boolean jj_3R_31() { if (jj_3R_34()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
Token xsp; xsp = jj_scanpos; if (jj_3R_35()) { jj_scanpos = xsp; if (jj_3R_36()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | if (jj_3R_35()) return true; | final private boolean jj_3R_32() { Token xsp; xsp = jj_scanpos; if (jj_3R_35()) { jj_scanpos = xsp; if (jj_3R_36()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
if (jj_scan_token(LSQ)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | if (jj_scan_token(STRING_LITERAL)) return true; | final private boolean jj_3R_33() { if (jj_scan_token(LSQ)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
if (jj_3R_37()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | if (jj_3R_36()) return true; | final private boolean jj_3R_34() { if (jj_3R_37()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
if (jj_scan_token(STRING_LITERAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | if (jj_3R_37()) return true; | final private boolean jj_3R_35() { if (jj_scan_token(STRING_LITERAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
if (jj_3R_38()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | Token xsp; xsp = jj_scanpos; if (jj_scan_token(7)) { jj_scanpos = xsp; if (jj_scan_token(9)) return true; } | final private boolean jj_3R_36() { if (jj_3R_38()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
if (jj_3R_39()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | Token xsp; xsp = jj_scanpos; if (jj_3R_38()) { jj_scanpos = xsp; if (jj_3R_39()) { jj_scanpos = xsp; if (jj_3R_40()) { jj_scanpos = xsp; if (jj_3_6()) return true; } } } | final private boolean jj_3R_37() { if (jj_3R_39()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
Token xsp; xsp = jj_scanpos; if (jj_3R_40()) { jj_scanpos = xsp; if (jj_3R_41()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | if (jj_scan_token(PLUS)) return true; | final private boolean jj_3R_38() { Token xsp; xsp = jj_scanpos; if (jj_3R_40()) { jj_scanpos = xsp; if (jj_3R_41()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
Token xsp; xsp = jj_scanpos; if (jj_3R_42()) { jj_scanpos = xsp; if (jj_3R_43()) { jj_scanpos = xsp; if (jj_3R_44()) { jj_scanpos = xsp; if (jj_3_6()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | if (jj_scan_token(MINUS)) return true; | final private boolean jj_3R_39() { Token xsp; xsp = jj_scanpos; if (jj_3R_42()) { jj_scanpos = xsp; if (jj_3R_43()) { jj_scanpos = xsp; if (jj_3R_44()) { jj_scanpos = xsp; if (jj_3_6()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
if (jj_scan_token(INTEGER_LITERAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | if (jj_scan_token(NOT)) return true; | final private boolean jj_3R_40() { if (jj_scan_token(INTEGER_LITERAL)) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | } | final private boolean jj_3R_9() { Token xsp; xsp = jj_scanpos; if (jj_3_2()) { jj_scanpos = xsp; if (jj_3_3()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | final private boolean jj_3_1() { if (jj_3R_9()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
|
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | final private boolean jj_3_2() { if (jj_3R_10()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
|
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | final private boolean jj_3_3() { if (jj_3R_11()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
|
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | } } } } } | final private boolean jj_3_4() { Token xsp; xsp = jj_scanpos; if (jj_3_5()) { jj_scanpos = xsp; if (jj_3R_12()) { jj_scanpos = xsp; if (jj_3R_13()) { jj_scanpos = xsp; if (jj_3R_14()) { jj_scanpos = xsp; if (jj_3R_15()) { jj_scanpos = xsp; if (jj_3R_16()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | final private boolean jj_3_5() { if (jj_3R_17()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
|
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | final private boolean jj_3_6() { if (jj_3R_17()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
|
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | } | final private boolean jj_3_7() { Token xsp; xsp = jj_scanpos; lookingAhead = true; jj_semLA = (getToken(1).kind == INDENTIFIER1 || getToken(1).kind == INDENTIFIER2) && jep.funTab.containsKey(getToken(1).image); lookingAhead = false; if (!jj_semLA || jj_3R_18()) { jj_scanpos = xsp; if (jj_3R_19()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; } else if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; | final private boolean jj_3_8() { if (jj_3R_9()) return true; if (jj_la == 0 && jj_scanpos == jj_lastpos) return false; return false; } |
|
Home home = homeCreator.homeFactory(alias); Entity entity = entityCreator.entityFactory(home, alias); DefaultEntity defaultEntity = entityCreator.defaultEntityFactory(entity); | Home home = partnerCreator.homeFactory(alias); Entity entity = partnerCreator.entityFactory(home, alias); DefaultEntity defaultEntity = partnerCreator.defaultEntityFactory(entity); | public DefaultEntity createDefaultEntity(String alias) { Home home = homeCreator.homeFactory(alias); Entity entity = entityCreator.entityFactory(home, alias); DefaultEntity defaultEntity = entityCreator.defaultEntityFactory(entity); return defaultEntity; } |
UpdatePrefs.RunningPhexVersion.set( Res.getStr( "Program.Version" ) ); | public void updatePreferences() { // first find out if this is the first time Phex is running... if ( StringUtils.isEmpty( UpdatePrefs.RunningBuildNumber.get() ) ) { // this seems to be the first time phex is running... // in this case we are not updating... we use default values... } UpdatePrefs.RunningBuildNumber.set( Environment.getInstance().getProperty( "build.number" ) ); // TODO save } |
|
new Double(l).doubleValue(), "f", "infusion", new Double(l2).intValue(), 0); | new Double(l).doubleValue(), "infusion", new Double(l2).intValue(), 0); | public Recipe readRecipe(File input) { myRecipe = new Recipe(); // File f = new File(path); FileInputStream in = null; try { in = new FileInputStream(input); } catch (FileNotFoundException e) { e.printStackTrace(); } String s = ""; long l, l2; float fl; int x; try { // read in the name - 82 bytes s = readString(in, 82); Debug.print("Recipe name: " + s); myRecipe.setName(s); // get the various sizes long hopCount = readLong(in); Debug.print("Hop count: " + hopCount); long maltCount = readLong(in); Debug.print("Malt count: " + maltCount); long extraCount = readLong(in); Debug.print("Extra count: " + extraCount); fl = readFloat(in); in.skip(3); Debug.print("Batch size: " + fl); fl = readFloat(in); Debug.print("Wort size: " + fl); myRecipe.setVolUnits("gal"); myRecipe.setPostBoil(fl); in.skip(8); fl = readFloat(in); Debug.print("%effic: " + fl*100); myRecipe.setEfficiency(fl*100); x = readInt(in); Debug.print("Boil time: " + x); myRecipe.setBoilMinutes(x); in.skip(8); // Style s = readString(in, 55); s = readString(in, 55); Debug.print("Style: " + s ); myRecipe.setStyle(s.trim()); // let's skip to start of hops in.skip(921); // lets try to read the hops : 635 bytes for (int i = 0; i < hopCount; i++) { Hop h = new Hop(); s = readString(in, 55); Debug.print(""); Debug.print("Hop name: " + s); h.setName(s); fl = readFloat(in); Debug.print("Alpha: " + fl); h.setAlpha(fl); in.skip(22); x = readInt(in); Debug.print("Form: " + x); in.skip(4); String descr = ""; s = readString(in, 155); Debug.print("Descr: " + s); descr = "Description: " + s.trim() + "\n"; s = readString(in, 55); Debug.print("Origin: " + s); descr += "Origin: " + s.trim() + "\n"; s = readString(in, 155); Debug.print("Use: " + s); descr += "Use: " + s.trim() + "\n"; s = readString(in, 165); Debug.print("Substitutes: " + s); descr += "Substitutes: " + s.trim() + "\n"; h.setDescription(descr); in.skip(9); fl = readFloat(in); Debug.print("Amount: " + fl); h.setAmount(fl); h.setUnits("oz"); x = readInt(in); Debug.print("Min:" + x); h.setMinutes(x); myRecipe.addHop(h); in.skip(5); } // lets try to read the malts for (int i = 0; i < maltCount; i++) { Fermentable m = new Fermentable(); s = readString(in, 55); Debug.print(""); Debug.print("Malt name: " + s); m.setName(s.trim()); s = readString(in, 55); Debug.print("Mfg: " + s); s = readString(in, 55); Debug.print("Origin: " + s); x = readInt(in); String type = ""; switch (x) { case 1 : type = "grain"; break; case 2 : type = "extract"; m.setMashed(false); break; case 3 : type = "sugar"; m.setMashed(false); break; case 4 : type = "other"; } Debug.print("Type: " + type); String type2 = ""; x = readInt(in); switch (x) { case 0 : { if (type.equals("extract")) type2 = "LME"; else if (type.equals("grain") || type.equals("sugar")) type2 = "Mustmash = no"; m.setMashed(false); break; } case 1 : { if (type.equals("extract")) type2 = "DME"; else if (type.equals("grain") || type.equals("sugar")) type2 = "Mustmash = yes"; m.setMashed(true); break; } } Debug.print("Type2: " + type2); fl = readFloat(in); Debug.print("pppg: " + fl); m.setPppg(fl); fl = readFloat(in); Debug.print("srm: " + fl); m.setLov(fl); in.skip(20); String descr = ""; s = readString(in, 155); Debug.print("uses: " + s); descr = "Uses: " + s + "\n"; s = readString(in, 159); Debug.print("comments: " + s); descr += "Comments: " + s + "\n"; m.setDescription(descr); in.skip(12); fl = readFloat(in); Debug.print("amount: " + fl); m.setAmount(fl); m.setUnits("lb"); myRecipe.addMalt(m); in.skip(4); } for (int i = 0; i < extraCount; i++) { Misc m = new Misc(); s = readString(in, 55); Debug.print("Extra: " + s); m.setName(s); String type = ""; x = readInt(in); switch (x) { case 0 : type = "spice"; break; case 1 : type = "fruit"; break; case 2 : type = "coffee"; break; case 3 : type = "other"; break; case 4 : type = "fining"; break; case 5 : type = "herb"; break; } Debug.print("Type: " + type); m.setType(type); l = readLong(in); Debug.print("Time: " + l); String use = ""; x = readInt(in); switch (x) { case 0 : use = "Boil"; break; case 1 : use = "Primary"; break; case 2 : use = "Mash"; break; } Debug.print("Use: " + use); m.setStage(use); in.skip(1); String units = ""; x = readInt(in); switch (x) { case 0 : units = "oz"; break; case 1 : units = "g"; break; case 2 : units = "lb"; break; case 3 : units = "tsp"; break; case 4 : units = "Tbs"; break; case 5 : units = "cups"; break; case 6 : units = "Single"; break; } Debug.print("Units: " + units); m.setUnits(units); fl = readFloat(in); Debug.print("Amount: " + fl); m.setAmount(fl); s = readString(in, 222); Debug.print("Usage: " + s); m.setDescription(s); s = readString(in, 155); Debug.print("Comments: " + s); m.setComments(s); myRecipe.addMisc(m); in.skip(145); } // yeast: 473 Yeast y = new Yeast(); String descr = ""; s = readString(in, 55); Debug.print("Yeast: " + s); descr = s.trim(); s = readString(in, 55); Debug.print("Mfg: " + s); descr = s.trim() + " " + descr; String s2 = readString(in, 25); Debug.print("Num: " + s2); descr = s.trim() + " " + s2.trim() + " " + descr; y.setName(descr); in.skip(2); descr = ""; s = readString(in, 155); Debug.print("Flavour: " + s); descr = "Flavour: " + s.trim() + "\n"; s = readString(in, 159); Debug.print("Comment: " + s); descr += "Comments: " + s.trim() + "\n"; y.setDescription(descr); myRecipe.setYeast(y); in.skip(22); // skip water in.skip(106); // skip ? in.skip(113); // regular mash in.skip(9); for (int j=0; j<5; j++){ l = readLong(in); Debug.print(j + " rest Temp: " + l); l2 = readLong(in); Debug.print(j + "rest Min: " + l2); String stepType="alpha"; switch (j){ case 0 : stepType = "acid"; break; case 1: stepType = "protein"; break; case 2: stepType = "beta"; break; case 3: stepType = "alpha"; break; case 4: stepType = "mashout"; break; } if (l > 0){ myRecipe.mash.addStep(stepType, new Double(l).doubleValue(), new Double(l).doubleValue(), "f", "infusion", new Double(l2).intValue(), 0); } } l = readLong(in); Debug.print("Sparge rest Temp: " + l); l2 = readLong(in); Debug.print("Sparge rest Min: " + l2); // TODO: set sparge time & temp in.skip(5); // notes: s = readString(in, 4028); Debug.print("Notes: " + s); s = readString(in, 4283); Debug.print("Awards: " + s); // skip other stuff in.skip(175); // Custom Mash // in.skip(62); long mashCount = readLong(in); Debug.print("Mash steps: " + mashCount); in.skip(11); for (int i = 0; i < mashCount; i++) { s = readString(in, 253); Debug.print("step: " + s); l = readLong(in); Debug.print("start: " + l); l = readLong(in); Debug.print("end: " + l); l = readLong(in); Debug.print("infuse temp: " + l); l = readLong(in); Debug.print("min: " + l); l = readLong(in); Debug.print("stop time: " + l); in.skip(19); } } catch (Exception e){ e.printStackTrace(); } try { in.close(); } catch (IOException e) { e.printStackTrace(); } return myRecipe; } |
TreeMap<String,ExternalRun> runs = new TreeMap<String,ExternalRun>(reverseComparator); | try { TreeMap<String,ExternalRun> runs = new TreeMap<String,ExternalRun>(reverseComparator); | private void reload() { TreeMap<String,ExternalRun> runs = new TreeMap<String,ExternalRun>(reverseComparator); File[] subdirs = getBuildDir().listFiles(new FileFilter() { public boolean accept(File subdir) { return subdir.isDirectory(); } }); Arrays.sort(subdirs,fileComparator); ExternalRun lastBuild = null; for( File dir : subdirs ) { try { ExternalRun b = new ExternalRun(this,dir,lastBuild); lastBuild = b; runs.put( b.getId(), b ); } catch (IOException e) { e.printStackTrace(); try { Util.deleteRecursive(dir); } catch (IOException e1) { e1.printStackTrace(); // but ignore } } } synchronized(this) { // replace the list with new one atomically. this.runs = runs; reloadingInProgress = false; nextUpdate = System.currentTimeMillis()+1000; } } |
for( File dir : subdirs ) { try { ExternalRun b = new ExternalRun(this,dir,lastBuild); lastBuild = b; runs.put( b.getId(), b ); } catch (IOException e) { e.printStackTrace(); | for( File dir : subdirs ) { | private void reload() { TreeMap<String,ExternalRun> runs = new TreeMap<String,ExternalRun>(reverseComparator); File[] subdirs = getBuildDir().listFiles(new FileFilter() { public boolean accept(File subdir) { return subdir.isDirectory(); } }); Arrays.sort(subdirs,fileComparator); ExternalRun lastBuild = null; for( File dir : subdirs ) { try { ExternalRun b = new ExternalRun(this,dir,lastBuild); lastBuild = b; runs.put( b.getId(), b ); } catch (IOException e) { e.printStackTrace(); try { Util.deleteRecursive(dir); } catch (IOException e1) { e1.printStackTrace(); // but ignore } } } synchronized(this) { // replace the list with new one atomically. this.runs = runs; reloadingInProgress = false; nextUpdate = System.currentTimeMillis()+1000; } } |
Util.deleteRecursive(dir); } catch (IOException e1) { e1.printStackTrace(); | ExternalRun b = new ExternalRun(this,dir,lastBuild); lastBuild = b; runs.put( b.getId(), b ); } catch (IOException e) { e.printStackTrace(); try { Util.deleteRecursive(dir); } catch (IOException e1) { e1.printStackTrace(); } | private void reload() { TreeMap<String,ExternalRun> runs = new TreeMap<String,ExternalRun>(reverseComparator); File[] subdirs = getBuildDir().listFiles(new FileFilter() { public boolean accept(File subdir) { return subdir.isDirectory(); } }); Arrays.sort(subdirs,fileComparator); ExternalRun lastBuild = null; for( File dir : subdirs ) { try { ExternalRun b = new ExternalRun(this,dir,lastBuild); lastBuild = b; runs.put( b.getId(), b ); } catch (IOException e) { e.printStackTrace(); try { Util.deleteRecursive(dir); } catch (IOException e1) { e1.printStackTrace(); // but ignore } } } synchronized(this) { // replace the list with new one atomically. this.runs = runs; reloadingInProgress = false; nextUpdate = System.currentTimeMillis()+1000; } } |
} | private void reload() { TreeMap<String,ExternalRun> runs = new TreeMap<String,ExternalRun>(reverseComparator); File[] subdirs = getBuildDir().listFiles(new FileFilter() { public boolean accept(File subdir) { return subdir.isDirectory(); } }); Arrays.sort(subdirs,fileComparator); ExternalRun lastBuild = null; for( File dir : subdirs ) { try { ExternalRun b = new ExternalRun(this,dir,lastBuild); lastBuild = b; runs.put( b.getId(), b ); } catch (IOException e) { e.printStackTrace(); try { Util.deleteRecursive(dir); } catch (IOException e1) { e1.printStackTrace(); // but ignore } } } synchronized(this) { // replace the list with new one atomically. this.runs = runs; reloadingInProgress = false; nextUpdate = System.currentTimeMillis()+1000; } } |
|
synchronized(this) { | private void reload() { TreeMap<String,ExternalRun> runs = new TreeMap<String,ExternalRun>(reverseComparator); File[] subdirs = getBuildDir().listFiles(new FileFilter() { public boolean accept(File subdir) { return subdir.isDirectory(); } }); Arrays.sort(subdirs,fileComparator); ExternalRun lastBuild = null; for( File dir : subdirs ) { try { ExternalRun b = new ExternalRun(this,dir,lastBuild); lastBuild = b; runs.put( b.getId(), b ); } catch (IOException e) { e.printStackTrace(); try { Util.deleteRecursive(dir); } catch (IOException e1) { e1.printStackTrace(); // but ignore } } } synchronized(this) { // replace the list with new one atomically. this.runs = runs; reloadingInProgress = false; nextUpdate = System.currentTimeMillis()+1000; } } |
|
} finally { | private void reload() { TreeMap<String,ExternalRun> runs = new TreeMap<String,ExternalRun>(reverseComparator); File[] subdirs = getBuildDir().listFiles(new FileFilter() { public boolean accept(File subdir) { return subdir.isDirectory(); } }); Arrays.sort(subdirs,fileComparator); ExternalRun lastBuild = null; for( File dir : subdirs ) { try { ExternalRun b = new ExternalRun(this,dir,lastBuild); lastBuild = b; runs.put( b.getId(), b ); } catch (IOException e) { e.printStackTrace(); try { Util.deleteRecursive(dir); } catch (IOException e1) { e1.printStackTrace(); // but ignore } } } synchronized(this) { // replace the list with new one atomically. this.runs = runs; reloadingInProgress = false; nextUpdate = System.currentTimeMillis()+1000; } } |
|
DefaultEntity defaultEntity = createDefaultEntity(alias); persistDefaultEntity(defaultEntity); if (logger.isDebugEnabled()) { logger.debug("Persisted "+defaultEntity); | Entity entity = findDefaultEntity(); if (entity==null) { DefaultEntity defaultEntity = createDefaultEntity(alias); persistDefaultEntity(defaultEntity); if (logger.isDebugEnabled()) { logger.debug("Persisted "+defaultEntity); } Division defaultDivision = createDefaultDivision(defaultEntity); persistDivision(defaultDivision); if (logger.isDebugEnabled()) { logger.debug("Persisted "+defaultDivision); } return defaultDivision; } else { return partnerDao.findCurrentDivision(entity); | public Division installWithDefaults(String alias) { try { DefaultEntity defaultEntity = createDefaultEntity(alias); persistDefaultEntity(defaultEntity); if (logger.isDebugEnabled()) { logger.debug("Persisted "+defaultEntity); } Division defaultDivision = createDefaultDivision(defaultEntity); persistDivision(defaultDivision); if (logger.isDebugEnabled()) { logger.debug("Persisted "+defaultDivision); } return defaultDivision; } catch (Exception e) { throw new RuntimeException("Installation with defaults failed ", e); } } |
Division defaultDivision = createDefaultDivision(defaultEntity); persistDivision(defaultDivision); if (logger.isDebugEnabled()) { logger.debug("Persisted "+defaultDivision); } return defaultDivision; | public Division installWithDefaults(String alias) { try { DefaultEntity defaultEntity = createDefaultEntity(alias); persistDefaultEntity(defaultEntity); if (logger.isDebugEnabled()) { logger.debug("Persisted "+defaultEntity); } Division defaultDivision = createDefaultDivision(defaultEntity); persistDivision(defaultDivision); if (logger.isDebugEnabled()) { logger.debug("Persisted "+defaultDivision); } return defaultDivision; } catch (Exception e) { throw new RuntimeException("Installation with defaults failed ", e); } } |
|
else return false; | return false; | public boolean test(ASTFunNode node, Node[] children) { if(node.getOperator()==opSet.getMultiply()) { // x * x -> true if(tu.isVariable(children[0]) && tu.isVariable(children[1])) { if(tu.getName(children[0]).equals(tu.getName(children[1]))) return true; else return false; } // x^n * x if(tu.getOperator(children[0]) == opSet.getPower() && tu.isVariable(children[0].jjtGetChild(0)) && tu.isVariable(children[1])) { if(tu.getName(children[0].jjtGetChild(0)).equals(tu.getName(children[1]))) return true; else return false; } if(tu.isVariable(children[0]) && tu.getOperator(children[1]) == opSet.getPower() && tu.isVariable(children[1].jjtGetChild(0))) { if(tu.getName(children[0]).equals(tu.getName(children[1].jjtGetChild(0)))) return true; else return false; } } return false; } |
return queryAssembler( query, values).list(); | if (values instanceof Object[]) { return queryAssembler(query, values).list(); } return this.getHibernateTemplate().find(query, values); | public Collection find(String query, Object values) { if (logger.isDebugEnabled()) { logger.debug("\n Finding object with query "+query); } return queryAssembler( query, values).list(); } |
req.setCharacterEncoding("UTF-8"); | public synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException { if(!Hudson.adminCheck(req,rsp)) return; jobNames.clear(); for (Job job : owner.getJobs()) { if(req.getParameter(job.getName())!=null) jobNames.add(job.getName()); } description = Util.nullify(req.getParameter("description")); owner.save(); rsp.sendRedirect("."); } |
|
kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); | kettleTxt.setPreferredSize(new java.awt.Dimension(30, 20)); | private void initGUI() { try { waterUsePanel = new JPanel(); GridBagLayout waterUsePanelLayout = new GridBagLayout(); waterUsePanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel1 = new JLabel(); waterUsePanel.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("Total Water Used:"); } { jLabel2 = new JLabel(); waterUsePanel.add(jLabel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel2.setText("Used in Mash:"); } { jLabel3 = new JLabel(); waterUsePanel.add(jLabel3, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel3.setText("Absorbed in Mash"); } { jLabel4 = new JLabel(); waterUsePanel.add(jLabel4, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel4.setText("Sparge With:"); } { jLabel5 = new JLabel(); waterUsePanel.add(jLabel5, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel5.setText("To Collect:"); } { jLabel6 = new JLabel(); waterUsePanel.add(jLabel6, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel6.setText("Post Boil:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel11.setText("Final Beer Volume:"); } { totalWaterLbl = new JLabel(); waterUsePanel.add(totalWaterLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalWaterLbl.setText("0"); } { absorbedLbl = new JLabel(); waterUsePanel.add(absorbedLbl, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedLbl.setText("jLabel13"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { usedMashLbl = new JLabel(); waterUsePanel.add(usedMashLbl, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedMashLbl.setText("absorbedUnitsLbl"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { spargeWithLbl = new JLabel(); waterUsePanel.add(spargeWithLbl, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); spargeWithLbl.setText("l"); } { collectUnitsLbl = new JLabel(); waterUsePanel.add(collectUnitsLbl, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); collectUnitsLbl.setText("l"); } { spargeUnitsLbl = new JLabel(); waterUsePanel.add(spargeUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); spargeUnitsLbl.setText("l"); } { absorbedUnitsLbl = new JLabel(); waterUsePanel.add(absorbedUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedUnitsLbl.setText("l"); } { usedInMashUnitsLbl = new JLabel(); waterUsePanel.add(usedInMashUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedInMashUnitsLbl.setText("l"); } { totalUnitsLbl = new JLabel(); waterUsePanel.add(totalUnitsLbl, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalUnitsLbl.setText("l"); } { postBoilUnitsLbl = new JLabel(); waterUsePanel.add(postBoilUnitsLbl, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); postBoilUnitsLbl.setText("l"); } { collectTxt = new JFormattedTextField(); collectTxt.addFocusListener(this); collectTxt.addActionListener(this); waterUsePanel.add(collectTxt, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); collectTxt.setText("l"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { postBoilTxt = new JFormattedTextField(); postBoilTxt.addFocusListener(this); postBoilTxt.addActionListener(this); waterUsePanel.add(postBoilTxt, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); postBoilTxt.setText("l"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } } |
trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); | trubLossTxt.setPreferredSize(new java.awt.Dimension(30, 20)); | private void initGUI() { try { waterUsePanel = new JPanel(); GridBagLayout waterUsePanelLayout = new GridBagLayout(); waterUsePanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel1 = new JLabel(); waterUsePanel.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("Total Water Used:"); } { jLabel2 = new JLabel(); waterUsePanel.add(jLabel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel2.setText("Used in Mash:"); } { jLabel3 = new JLabel(); waterUsePanel.add(jLabel3, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel3.setText("Absorbed in Mash"); } { jLabel4 = new JLabel(); waterUsePanel.add(jLabel4, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel4.setText("Sparge With:"); } { jLabel5 = new JLabel(); waterUsePanel.add(jLabel5, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel5.setText("To Collect:"); } { jLabel6 = new JLabel(); waterUsePanel.add(jLabel6, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel6.setText("Post Boil:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel11.setText("Final Beer Volume:"); } { totalWaterLbl = new JLabel(); waterUsePanel.add(totalWaterLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalWaterLbl.setText("0"); } { absorbedLbl = new JLabel(); waterUsePanel.add(absorbedLbl, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedLbl.setText("jLabel13"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { usedMashLbl = new JLabel(); waterUsePanel.add(usedMashLbl, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedMashLbl.setText("absorbedUnitsLbl"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { spargeWithLbl = new JLabel(); waterUsePanel.add(spargeWithLbl, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); spargeWithLbl.setText("l"); } { collectUnitsLbl = new JLabel(); waterUsePanel.add(collectUnitsLbl, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); collectUnitsLbl.setText("l"); } { spargeUnitsLbl = new JLabel(); waterUsePanel.add(spargeUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); spargeUnitsLbl.setText("l"); } { absorbedUnitsLbl = new JLabel(); waterUsePanel.add(absorbedUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedUnitsLbl.setText("l"); } { usedInMashUnitsLbl = new JLabel(); waterUsePanel.add(usedInMashUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedInMashUnitsLbl.setText("l"); } { totalUnitsLbl = new JLabel(); waterUsePanel.add(totalUnitsLbl, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalUnitsLbl.setText("l"); } { postBoilUnitsLbl = new JLabel(); waterUsePanel.add(postBoilUnitsLbl, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); postBoilUnitsLbl.setText("l"); } { collectTxt = new JFormattedTextField(); collectTxt.addFocusListener(this); collectTxt.addActionListener(this); waterUsePanel.add(collectTxt, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); collectTxt.setText("l"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { postBoilTxt = new JFormattedTextField(); postBoilTxt.addFocusListener(this); postBoilTxt.addActionListener(this); waterUsePanel.add(postBoilTxt, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); postBoilTxt.setText("l"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } } |
miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); | miscLossTxt.setPreferredSize(new java.awt.Dimension(30, 20)); | private void initGUI() { try { waterUsePanel = new JPanel(); GridBagLayout waterUsePanelLayout = new GridBagLayout(); waterUsePanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel1 = new JLabel(); waterUsePanel.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("Total Water Used:"); } { jLabel2 = new JLabel(); waterUsePanel.add(jLabel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel2.setText("Used in Mash:"); } { jLabel3 = new JLabel(); waterUsePanel.add(jLabel3, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel3.setText("Absorbed in Mash"); } { jLabel4 = new JLabel(); waterUsePanel.add(jLabel4, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel4.setText("Sparge With:"); } { jLabel5 = new JLabel(); waterUsePanel.add(jLabel5, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel5.setText("To Collect:"); } { jLabel6 = new JLabel(); waterUsePanel.add(jLabel6, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel6.setText("Post Boil:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel11.setText("Final Beer Volume:"); } { totalWaterLbl = new JLabel(); waterUsePanel.add(totalWaterLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalWaterLbl.setText("0"); } { absorbedLbl = new JLabel(); waterUsePanel.add(absorbedLbl, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedLbl.setText("jLabel13"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { usedMashLbl = new JLabel(); waterUsePanel.add(usedMashLbl, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedMashLbl.setText("absorbedUnitsLbl"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { spargeWithLbl = new JLabel(); waterUsePanel.add(spargeWithLbl, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); spargeWithLbl.setText("l"); } { collectUnitsLbl = new JLabel(); waterUsePanel.add(collectUnitsLbl, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); collectUnitsLbl.setText("l"); } { spargeUnitsLbl = new JLabel(); waterUsePanel.add(spargeUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); spargeUnitsLbl.setText("l"); } { absorbedUnitsLbl = new JLabel(); waterUsePanel.add(absorbedUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedUnitsLbl.setText("l"); } { usedInMashUnitsLbl = new JLabel(); waterUsePanel.add(usedInMashUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedInMashUnitsLbl.setText("l"); } { totalUnitsLbl = new JLabel(); waterUsePanel.add(totalUnitsLbl, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalUnitsLbl.setText("l"); } { postBoilUnitsLbl = new JLabel(); waterUsePanel.add(postBoilUnitsLbl, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); postBoilUnitsLbl.setText("l"); } { collectTxt = new JFormattedTextField(); collectTxt.addFocusListener(this); collectTxt.addActionListener(this); waterUsePanel.add(collectTxt, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); collectTxt.setText("l"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { postBoilTxt = new JFormattedTextField(); postBoilTxt.addFocusListener(this); postBoilTxt.addActionListener(this); waterUsePanel.add(postBoilTxt, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); postBoilTxt.setText("l"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } } |
waterUsePanel.add(absorbedLbl, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedLbl.setText("jLabel13"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); | waterUsePanel.add(absorbedLbl, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedLbl.setText("0"); absorbedLbl.setPreferredSize(new java.awt.Dimension(30, 14)); absorbedLbl.setSize(30, 20); | private void initGUI() { try { waterUsePanel = new JPanel(); GridBagLayout waterUsePanelLayout = new GridBagLayout(); waterUsePanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel1 = new JLabel(); waterUsePanel.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("Total Water Used:"); } { jLabel2 = new JLabel(); waterUsePanel.add(jLabel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel2.setText("Used in Mash:"); } { jLabel3 = new JLabel(); waterUsePanel.add(jLabel3, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel3.setText("Absorbed in Mash"); } { jLabel4 = new JLabel(); waterUsePanel.add(jLabel4, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel4.setText("Sparge With:"); } { jLabel5 = new JLabel(); waterUsePanel.add(jLabel5, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel5.setText("To Collect:"); } { jLabel6 = new JLabel(); waterUsePanel.add(jLabel6, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel6.setText("Post Boil:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel11.setText("Final Beer Volume:"); } { totalWaterLbl = new JLabel(); waterUsePanel.add(totalWaterLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalWaterLbl.setText("0"); } { absorbedLbl = new JLabel(); waterUsePanel.add(absorbedLbl, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedLbl.setText("jLabel13"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { usedMashLbl = new JLabel(); waterUsePanel.add(usedMashLbl, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedMashLbl.setText("absorbedUnitsLbl"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { spargeWithLbl = new JLabel(); waterUsePanel.add(spargeWithLbl, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); spargeWithLbl.setText("l"); } { collectUnitsLbl = new JLabel(); waterUsePanel.add(collectUnitsLbl, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); collectUnitsLbl.setText("l"); } { spargeUnitsLbl = new JLabel(); waterUsePanel.add(spargeUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); spargeUnitsLbl.setText("l"); } { absorbedUnitsLbl = new JLabel(); waterUsePanel.add(absorbedUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedUnitsLbl.setText("l"); } { usedInMashUnitsLbl = new JLabel(); waterUsePanel.add(usedInMashUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedInMashUnitsLbl.setText("l"); } { totalUnitsLbl = new JLabel(); waterUsePanel.add(totalUnitsLbl, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalUnitsLbl.setText("l"); } { postBoilUnitsLbl = new JLabel(); waterUsePanel.add(postBoilUnitsLbl, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); postBoilUnitsLbl.setText("l"); } { collectTxt = new JFormattedTextField(); collectTxt.addFocusListener(this); collectTxt.addActionListener(this); waterUsePanel.add(collectTxt, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); collectTxt.setText("l"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { postBoilTxt = new JFormattedTextField(); postBoilTxt.addFocusListener(this); postBoilTxt.addActionListener(this); waterUsePanel.add(postBoilTxt, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); postBoilTxt.setText("l"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } } |
waterUsePanel.add(usedMashLbl, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedMashLbl.setText("absorbedUnitsLbl"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); | waterUsePanel.add(usedMashLbl, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedMashLbl.setText("0"); usedMashLbl.setPreferredSize(new java.awt.Dimension(30, 14)); usedMashLbl.setSize(30, 14); | private void initGUI() { try { waterUsePanel = new JPanel(); GridBagLayout waterUsePanelLayout = new GridBagLayout(); waterUsePanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel1 = new JLabel(); waterUsePanel.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("Total Water Used:"); } { jLabel2 = new JLabel(); waterUsePanel.add(jLabel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel2.setText("Used in Mash:"); } { jLabel3 = new JLabel(); waterUsePanel.add(jLabel3, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel3.setText("Absorbed in Mash"); } { jLabel4 = new JLabel(); waterUsePanel.add(jLabel4, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel4.setText("Sparge With:"); } { jLabel5 = new JLabel(); waterUsePanel.add(jLabel5, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel5.setText("To Collect:"); } { jLabel6 = new JLabel(); waterUsePanel.add(jLabel6, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel6.setText("Post Boil:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel11.setText("Final Beer Volume:"); } { totalWaterLbl = new JLabel(); waterUsePanel.add(totalWaterLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalWaterLbl.setText("0"); } { absorbedLbl = new JLabel(); waterUsePanel.add(absorbedLbl, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedLbl.setText("jLabel13"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { usedMashLbl = new JLabel(); waterUsePanel.add(usedMashLbl, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedMashLbl.setText("absorbedUnitsLbl"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { spargeWithLbl = new JLabel(); waterUsePanel.add(spargeWithLbl, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); spargeWithLbl.setText("l"); } { collectUnitsLbl = new JLabel(); waterUsePanel.add(collectUnitsLbl, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); collectUnitsLbl.setText("l"); } { spargeUnitsLbl = new JLabel(); waterUsePanel.add(spargeUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); spargeUnitsLbl.setText("l"); } { absorbedUnitsLbl = new JLabel(); waterUsePanel.add(absorbedUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedUnitsLbl.setText("l"); } { usedInMashUnitsLbl = new JLabel(); waterUsePanel.add(usedInMashUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedInMashUnitsLbl.setText("l"); } { totalUnitsLbl = new JLabel(); waterUsePanel.add(totalUnitsLbl, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalUnitsLbl.setText("l"); } { postBoilUnitsLbl = new JLabel(); waterUsePanel.add(postBoilUnitsLbl, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); postBoilUnitsLbl.setText("l"); } { collectTxt = new JFormattedTextField(); collectTxt.addFocusListener(this); collectTxt.addActionListener(this); waterUsePanel.add(collectTxt, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); collectTxt.setText("l"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { postBoilTxt = new JFormattedTextField(); postBoilTxt.addFocusListener(this); postBoilTxt.addActionListener(this); waterUsePanel.add(postBoilTxt, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); postBoilTxt.setText("l"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } } |
collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); | collectTxt.setPreferredSize(new java.awt.Dimension(30, 20)); collectTxt.setSize(30, 20); | private void initGUI() { try { waterUsePanel = new JPanel(); GridBagLayout waterUsePanelLayout = new GridBagLayout(); waterUsePanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel1 = new JLabel(); waterUsePanel.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("Total Water Used:"); } { jLabel2 = new JLabel(); waterUsePanel.add(jLabel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel2.setText("Used in Mash:"); } { jLabel3 = new JLabel(); waterUsePanel.add(jLabel3, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel3.setText("Absorbed in Mash"); } { jLabel4 = new JLabel(); waterUsePanel.add(jLabel4, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel4.setText("Sparge With:"); } { jLabel5 = new JLabel(); waterUsePanel.add(jLabel5, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel5.setText("To Collect:"); } { jLabel6 = new JLabel(); waterUsePanel.add(jLabel6, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel6.setText("Post Boil:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel11.setText("Final Beer Volume:"); } { totalWaterLbl = new JLabel(); waterUsePanel.add(totalWaterLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalWaterLbl.setText("0"); } { absorbedLbl = new JLabel(); waterUsePanel.add(absorbedLbl, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedLbl.setText("jLabel13"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { usedMashLbl = new JLabel(); waterUsePanel.add(usedMashLbl, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedMashLbl.setText("absorbedUnitsLbl"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { spargeWithLbl = new JLabel(); waterUsePanel.add(spargeWithLbl, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); spargeWithLbl.setText("l"); } { collectUnitsLbl = new JLabel(); waterUsePanel.add(collectUnitsLbl, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); collectUnitsLbl.setText("l"); } { spargeUnitsLbl = new JLabel(); waterUsePanel.add(spargeUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); spargeUnitsLbl.setText("l"); } { absorbedUnitsLbl = new JLabel(); waterUsePanel.add(absorbedUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedUnitsLbl.setText("l"); } { usedInMashUnitsLbl = new JLabel(); waterUsePanel.add(usedInMashUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedInMashUnitsLbl.setText("l"); } { totalUnitsLbl = new JLabel(); waterUsePanel.add(totalUnitsLbl, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalUnitsLbl.setText("l"); } { postBoilUnitsLbl = new JLabel(); waterUsePanel.add(postBoilUnitsLbl, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); postBoilUnitsLbl.setText("l"); } { collectTxt = new JFormattedTextField(); collectTxt.addFocusListener(this); collectTxt.addActionListener(this); waterUsePanel.add(collectTxt, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); collectTxt.setText("l"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { postBoilTxt = new JFormattedTextField(); postBoilTxt.addFocusListener(this); postBoilTxt.addActionListener(this); waterUsePanel.add(postBoilTxt, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); postBoilTxt.setText("l"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } } |
postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); | postBoilTxt.setPreferredSize(new java.awt.Dimension(30, 20)); postBoilTxt.setSize(30, 20); | private void initGUI() { try { waterUsePanel = new JPanel(); GridBagLayout waterUsePanelLayout = new GridBagLayout(); waterUsePanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel1 = new JLabel(); waterUsePanel.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("Total Water Used:"); } { jLabel2 = new JLabel(); waterUsePanel.add(jLabel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel2.setText("Used in Mash:"); } { jLabel3 = new JLabel(); waterUsePanel.add(jLabel3, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel3.setText("Absorbed in Mash"); } { jLabel4 = new JLabel(); waterUsePanel.add(jLabel4, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel4.setText("Sparge With:"); } { jLabel5 = new JLabel(); waterUsePanel.add(jLabel5, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel5.setText("To Collect:"); } { jLabel6 = new JLabel(); waterUsePanel.add(jLabel6, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel6.setText("Post Boil:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel11.setText("Final Beer Volume:"); } { totalWaterLbl = new JLabel(); waterUsePanel.add(totalWaterLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalWaterLbl.setText("0"); } { absorbedLbl = new JLabel(); waterUsePanel.add(absorbedLbl, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedLbl.setText("jLabel13"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { usedMashLbl = new JLabel(); waterUsePanel.add(usedMashLbl, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedMashLbl.setText("absorbedUnitsLbl"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { spargeWithLbl = new JLabel(); waterUsePanel.add(spargeWithLbl, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); spargeWithLbl.setText("l"); } { collectUnitsLbl = new JLabel(); waterUsePanel.add(collectUnitsLbl, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); collectUnitsLbl.setText("l"); } { spargeUnitsLbl = new JLabel(); waterUsePanel.add(spargeUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); spargeUnitsLbl.setText("l"); } { absorbedUnitsLbl = new JLabel(); waterUsePanel.add(absorbedUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedUnitsLbl.setText("l"); } { usedInMashUnitsLbl = new JLabel(); waterUsePanel.add(usedInMashUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedInMashUnitsLbl.setText("l"); } { totalUnitsLbl = new JLabel(); waterUsePanel.add(totalUnitsLbl, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalUnitsLbl.setText("l"); } { postBoilUnitsLbl = new JLabel(); waterUsePanel.add(postBoilUnitsLbl, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); postBoilUnitsLbl.setText("l"); } { collectTxt = new JFormattedTextField(); collectTxt.addFocusListener(this); collectTxt.addActionListener(this); waterUsePanel.add(collectTxt, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); collectTxt.setText("l"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { postBoilTxt = new JFormattedTextField(); postBoilTxt.addFocusListener(this); postBoilTxt.addActionListener(this); waterUsePanel.add(postBoilTxt, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); postBoilTxt.setText("l"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } } |
finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); | finalVolTxt.setPreferredSize(new java.awt.Dimension(30, 20)); finalVolTxt.setSize(30, 20); | private void initGUI() { try { waterUsePanel = new JPanel(); GridBagLayout waterUsePanelLayout = new GridBagLayout(); waterUsePanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterUsePanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7, 7, 7, 7}; waterUsePanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterUsePanelLayout.columnWidths = new int[] {7, 7, 7}; waterUsePanel.setLayout(waterUsePanelLayout); BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); this.add(waterUsePanel); waterUsePanel.setBorder(BorderFactory.createTitledBorder(null, "Water Use:", TitledBorder.LEADING, TitledBorder.TOP)); waterUsePanel.setPreferredSize(new java.awt.Dimension(351, 223)); waterLossPanel = new JPanel(); GridBagLayout waterLossPanelLayout = new GridBagLayout(); waterLossPanelLayout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; waterLossPanelLayout.rowHeights = new int[] {7, 7, 7, 7, 7, 7}; waterLossPanelLayout.columnWeights = new double[] {0.1, 0.1, 0.1}; waterLossPanelLayout.columnWidths = new int[] {7, 7, 7}; waterLossPanel.setLayout(waterLossPanelLayout); this.add(waterLossPanel); waterLossPanel.setPreferredSize(new java.awt.Dimension(400, 58)); waterLossPanel.setBorder(BorderFactory.createTitledBorder("Losses:")); { jLabel8 = new JLabel(); waterLossPanel.add(jLabel8, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("Chill Shrinkage:"); } { chillShrinkLbl = new JLabel(); waterLossPanel.add(chillShrinkLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); chillShrinkLbl.setText("l"); } { jLabel7 = new JLabel(); waterLossPanel.add(jLabel7, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Left in Kettle:"); } { kettleTxt = new JFormattedTextField(); waterLossPanel.add(kettleTxt, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); kettleTxt.addFocusListener(this); kettleTxt.addActionListener(this); kettleTxt.setText("1"); kettleTxt.setPreferredSize(new java.awt.Dimension(38, 20)); } { kettleUnitsLbl = new JLabel(); waterLossPanel.add(kettleUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); kettleUnitsLbl.setText("l"); kettleUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel9 = new JLabel(); waterLossPanel.add(jLabel9, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel9.setText("Lost in Trub:"); } { trubLossTxt = new JFormattedTextField(); waterLossPanel.add(trubLossTxt, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); trubLossTxt.addFocusListener(this); trubLossTxt.addActionListener(this); trubLossTxt.setText("jTextField1"); trubLossTxt.setPreferredSize(new java.awt.Dimension(36, 20)); } { trubLossUnitsLbl = new JLabel(); waterLossPanel.add(trubLossUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); trubLossUnitsLbl.setText("l"); trubLossUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel10 = new JLabel(); waterLossPanel.add(jLabel10, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel10.setText("Misc. Losses:"); } { miscLossTxt = new JFormattedTextField(); waterLossPanel.add(miscLossTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); miscLossTxt.addFocusListener(this); miscLossTxt.addActionListener(this); miscLossTxt.setText("jTextField1"); miscLossTxt.setPreferredSize(new java.awt.Dimension(37, 20)); } { miscLosUnitsLbl = new JLabel(); waterLossPanel.add(miscLosUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); miscLosUnitsLbl.setText("l"); miscLosUnitsLbl.setPreferredSize(new java.awt.Dimension(39, 14)); } { jLabel1 = new JLabel(); waterUsePanel.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("Total Water Used:"); } { jLabel2 = new JLabel(); waterUsePanel.add(jLabel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel2.setText("Used in Mash:"); } { jLabel3 = new JLabel(); waterUsePanel.add(jLabel3, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel3.setText("Absorbed in Mash"); } { jLabel4 = new JLabel(); waterUsePanel.add(jLabel4, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel4.setText("Sparge With:"); } { jLabel5 = new JLabel(); waterUsePanel.add(jLabel5, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel5.setText("To Collect:"); } { jLabel6 = new JLabel(); waterUsePanel.add(jLabel6, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel6.setText("Post Boil:"); } { jLabel11 = new JLabel(); waterUsePanel.add(jLabel11, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel11.setText("Final Beer Volume:"); } { totalWaterLbl = new JLabel(); waterUsePanel.add(totalWaterLbl, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalWaterLbl.setText("0"); } { absorbedLbl = new JLabel(); waterUsePanel.add(absorbedLbl, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedLbl.setText("jLabel13"); absorbedLbl.setPreferredSize(new java.awt.Dimension(36, 14)); } { usedMashLbl = new JLabel(); waterUsePanel.add(usedMashLbl, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedMashLbl.setText("absorbedUnitsLbl"); usedMashLbl.setPreferredSize(new java.awt.Dimension(46, 14)); } { spargeWithLbl = new JLabel(); waterUsePanel.add(spargeWithLbl, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); spargeWithLbl.setText("l"); } { collectUnitsLbl = new JLabel(); waterUsePanel.add(collectUnitsLbl, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); collectUnitsLbl.setText("l"); } { spargeUnitsLbl = new JLabel(); waterUsePanel.add(spargeUnitsLbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); spargeUnitsLbl.setText("l"); } { absorbedUnitsLbl = new JLabel(); waterUsePanel.add(absorbedUnitsLbl, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); absorbedUnitsLbl.setText("l"); } { usedInMashUnitsLbl = new JLabel(); waterUsePanel.add(usedInMashUnitsLbl, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); usedInMashUnitsLbl.setText("l"); } { totalUnitsLbl = new JLabel(); waterUsePanel.add(totalUnitsLbl, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalUnitsLbl.setText("l"); } { postBoilUnitsLbl = new JLabel(); waterUsePanel.add(postBoilUnitsLbl, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); postBoilUnitsLbl.setText("l"); } { collectTxt = new JFormattedTextField(); collectTxt.addFocusListener(this); collectTxt.addActionListener(this); waterUsePanel.add(collectTxt, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); collectTxt.setText("l"); collectTxt.setPreferredSize(new java.awt.Dimension(65, 20)); } { postBoilTxt = new JFormattedTextField(); postBoilTxt.addFocusListener(this); postBoilTxt.addActionListener(this); waterUsePanel.add(postBoilTxt, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); postBoilTxt.setText("l"); postBoilTxt.setPreferredSize(new java.awt.Dimension(67, 20)); } { finalVolTxt = new JFormattedTextField(); finalVolTxt.addFocusListener(this); finalVolTxt.addActionListener(this); waterUsePanel.add(finalVolTxt, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); finalVolTxt.setText("jTextField1"); finalVolTxt.setPreferredSize(new java.awt.Dimension(69, 20)); } { finalUnitsLbl = new JLabel(); waterUsePanel.add(finalUnitsLbl, new GridBagConstraints(2, 6, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); finalUnitsLbl.setText("l"); } setPreferredSize(new Dimension(400, 300)); } catch (Exception e) { e.printStackTrace(); } } |
OP_CROSS.setPFMC(new ExteriorProduct()); | OP_CROSS= new XOperator("^^","^",new ExteriorProduct(),XOperator.BINARY+XOperator.RIGHT,((XOperator) OP_CROSS).getPrecedence()); | public MatrixOperatorSet() { super(); OP_ADD.setPFMC(new MAdd()); OP_SUBTRACT.setPFMC(new MSubtract()); // TODO fix commutatitivity for matrix mult. How? OP_MULTIPLY.setPFMC(new MMultiply()); OP_POWER.setPFMC(new MPower()); OP_UMINUS.setPFMC(new MUMinus()); OP_DOT.setPFMC(new MDot()); OP_CROSS.setPFMC(new ExteriorProduct()); OP_ASSIGN.setPFMC(new MAssign()); } |
r.mash.addStep(type, startTemp, endTemp, "F", method, minutes, rampMin); | r.mash.addStep(type, startTemp, endTemp, method, minutes, rampMin); | public void endElement(String namespaceURI, String sName, // simple name String qName // qualified name ) throws SAXException { if (importType == "STRANGEBREW") { if (qName.equalsIgnoreCase("ITEM") && currentList.equalsIgnoreCase("FERMENTABLES")) { m.setDescription(descrBuf); descrBuf = ""; r.addMalt(m); m = null; } else if (qName.equalsIgnoreCase("MALT")) { m.setName(descrBuf); descrBuf = ""; } else if (qName.equalsIgnoreCase("HOP")) { h.setName(descrBuf); descrBuf = ""; } else if (qName.equalsIgnoreCase("ITEM") && currentList.equalsIgnoreCase("HOPS")) { h.setDescription(descrBuf); descrBuf = ""; r.addHop(h); h = null; } else if (qName.equalsIgnoreCase("ITEM") && currentList.equalsIgnoreCase("MISC")) { misc.setDescription(descrBuf); descrBuf = ""; r.addMisc(misc); misc = null; } else if (qName.equalsIgnoreCase("ITEM") && currentList.equalsIgnoreCase("NOTES")) { r.addNote(note); note = null; } else if (qName.equalsIgnoreCase("ITEM") && currentList.equalsIgnoreCase("MASH")) { r.mash.addStep(type, startTemp, endTemp, "F", method, minutes, rampMin); } // there's a problem with having two elements named "NOTES" : else if (qName.equalsIgnoreCase("FERMENTABLS") || qName.equalsIgnoreCase("HOPS") || qName.equalsIgnoreCase("DETAILS") || qName.equalsIgnoreCase("MISC") || (qName.equalsIgnoreCase("NOTES") && !currentList.equalsIgnoreCase("DETAILS")) ) { currentList = ""; } else if (qName.equalsIgnoreCase("NAME") && currentList.equalsIgnoreCase("DETAILS")) { r.setName(buffer); buffer=""; } } else if (importType == "QBREW"){ if (qName.equalsIgnoreCase("GRAIN")){ r.addMalt(m); m = null; } else if (qName.equalsIgnoreCase("HOP")){ r.addHop(h); h = null; } else if (qName.equalsIgnoreCase("title")){ r.setName(buffer); buffer = ""; } } } |
Object incObj = inputs[3]; | public MatrixValueI calcValue(MatrixValueI res, MatrixValueI inputs[]) throws ParseException { Object out; if(inputs.length == 2) { Object lastObj = inputs[1]; Object firstObj = inputs[0]; double last = ((Number) lastObj).doubleValue(); double first = ((Number) firstObj).doubleValue(); double diff = last-first; int steps = 1+(int) diff; out=genRange(first,1.0,steps); } else if(inputs.length == 3) { Object incObj = inputs[2]; Object lastObj = inputs[1]; Object firstObj = inputs[0]; double inc = ((Number) incObj).doubleValue(); double last = ((Number) lastObj).doubleValue(); double first = ((Number) firstObj).doubleValue(); double diff = (last-first)/inc; int steps = 1+(int) diff; out=genRange(first,inc,steps); } else if(inputs.length == 4) { Object stepsObj = inputs[4]; Object incObj = inputs[3]; Object lastObj = inputs[2]; Object firstObj = inputs[0]; int steps = ((Number) stepsObj).intValue(); double last = ((Number) lastObj).doubleValue(); double first = ((Number) firstObj).doubleValue(); double inc = (last-first)/(steps-1); out=genRange(first,inc,steps); } else throw new ParseException("Range:only a maximum of four arguments can be specified"); throw new ParseException("VRange: calcValue not implemented"); } |
|
public Dimensions calcDim(Dimensions l,Dimensions r) | public Dimensions calcDim(Dimensions l,Dimensions r) throws ParseException | public Dimensions calcDim(Dimensions l,Dimensions r) { int lrank = l.rank(); int rrank = r.rank(); switch(lrank) { case 0: // Scaler res return r; case 1: // Vector * ? switch(rrank) { case 0: // Vector * Scaler -> Vector return l; case 1: // Vector * Vector -> Matrix return Dimensions.valueOf(l.getFirstDim(),r.getFirstDim()); case 2: // Vector * Matrix -> Vector if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(r.getLastDim()); else return null; default: // Tensor res //throw new ParseException("Sorry I don't know how to multiply a vector by a tensor"); } break; case 2: // Matrix * ? switch(rrank) { case 0: // Matrix * Scaler -> Matrix return l; case 1: // Matrix * Vector -> Vector if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(l.getFirstDim()); else return null; case 2: // Matrix * Matrix -> Matrix if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(l.getFirstDim(),r.getLastDim()); else return null; default: // Tensor res //throw new ParseException("Sorry I don't know how to multiply a matrix by a tensor"); } break; default: // Tensor res switch(rrank) { case 0: // Scaler res return l;// case 1: // Vector res// throw new ParseException("Sorry I don't know how to multiply a tensor by a vector");// case 2: // Matrix res// throw new ParseException("Sorry I don't know how to multiply a tensor by a matrix");// default: // Tensor res// throw new ParseException("Sorry I don't know how to multiply a tensor by a tensor"); } } return null; } |
else return null; | break; | public Dimensions calcDim(Dimensions l,Dimensions r) { int lrank = l.rank(); int rrank = r.rank(); switch(lrank) { case 0: // Scaler res return r; case 1: // Vector * ? switch(rrank) { case 0: // Vector * Scaler -> Vector return l; case 1: // Vector * Vector -> Matrix return Dimensions.valueOf(l.getFirstDim(),r.getFirstDim()); case 2: // Vector * Matrix -> Vector if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(r.getLastDim()); else return null; default: // Tensor res //throw new ParseException("Sorry I don't know how to multiply a vector by a tensor"); } break; case 2: // Matrix * ? switch(rrank) { case 0: // Matrix * Scaler -> Matrix return l; case 1: // Matrix * Vector -> Vector if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(l.getFirstDim()); else return null; case 2: // Matrix * Matrix -> Matrix if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(l.getFirstDim(),r.getLastDim()); else return null; default: // Tensor res //throw new ParseException("Sorry I don't know how to multiply a matrix by a tensor"); } break; default: // Tensor res switch(rrank) { case 0: // Scaler res return l;// case 1: // Vector res// throw new ParseException("Sorry I don't know how to multiply a tensor by a vector");// case 2: // Matrix res// throw new ParseException("Sorry I don't know how to multiply a tensor by a matrix");// default: // Tensor res// throw new ParseException("Sorry I don't know how to multiply a tensor by a tensor"); } } return null; } |
throw new ParseException("Sorry I don't know how to multiply a vector by a tensor"); | public Dimensions calcDim(Dimensions l,Dimensions r) { int lrank = l.rank(); int rrank = r.rank(); switch(lrank) { case 0: // Scaler res return r; case 1: // Vector * ? switch(rrank) { case 0: // Vector * Scaler -> Vector return l; case 1: // Vector * Vector -> Matrix return Dimensions.valueOf(l.getFirstDim(),r.getFirstDim()); case 2: // Vector * Matrix -> Vector if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(r.getLastDim()); else return null; default: // Tensor res //throw new ParseException("Sorry I don't know how to multiply a vector by a tensor"); } break; case 2: // Matrix * ? switch(rrank) { case 0: // Matrix * Scaler -> Matrix return l; case 1: // Matrix * Vector -> Vector if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(l.getFirstDim()); else return null; case 2: // Matrix * Matrix -> Matrix if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(l.getFirstDim(),r.getLastDim()); else return null; default: // Tensor res //throw new ParseException("Sorry I don't know how to multiply a matrix by a tensor"); } break; default: // Tensor res switch(rrank) { case 0: // Scaler res return l;// case 1: // Vector res// throw new ParseException("Sorry I don't know how to multiply a tensor by a vector");// case 2: // Matrix res// throw new ParseException("Sorry I don't know how to multiply a tensor by a matrix");// default: // Tensor res// throw new ParseException("Sorry I don't know how to multiply a tensor by a tensor"); } } return null; } |
|
return null; | throw new ParseException("Dimensions for multiply do not match: "+l+" "+r); | public Dimensions calcDim(Dimensions l,Dimensions r) { int lrank = l.rank(); int rrank = r.rank(); switch(lrank) { case 0: // Scaler res return r; case 1: // Vector * ? switch(rrank) { case 0: // Vector * Scaler -> Vector return l; case 1: // Vector * Vector -> Matrix return Dimensions.valueOf(l.getFirstDim(),r.getFirstDim()); case 2: // Vector * Matrix -> Vector if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(r.getLastDim()); else return null; default: // Tensor res //throw new ParseException("Sorry I don't know how to multiply a vector by a tensor"); } break; case 2: // Matrix * ? switch(rrank) { case 0: // Matrix * Scaler -> Matrix return l; case 1: // Matrix * Vector -> Vector if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(l.getFirstDim()); else return null; case 2: // Matrix * Matrix -> Matrix if(l.getLastDim() == r.getFirstDim()) return Dimensions.valueOf(l.getFirstDim(),r.getLastDim()); else return null; default: // Tensor res //throw new ParseException("Sorry I don't know how to multiply a matrix by a tensor"); } break; default: // Tensor res switch(rrank) { case 0: // Scaler res return l;// case 1: // Vector res// throw new ParseException("Sorry I don't know how to multiply a tensor by a vector");// case 2: // Matrix res// throw new ParseException("Sorry I don't know how to multiply a tensor by a matrix");// default: // Tensor res// throw new ParseException("Sorry I don't know how to multiply a tensor by a tensor"); } } return null; } |
if(revision.startsWith(e.getKey())) | if(revision.startsWith(e.getKey()) && revision.substring(e.getKey().length()).indexOf('.')==-1) | private String findBranch(String revision) { if(revision==null) return null; // defensive check for (Entry<String,String> e : branches.entrySet()) { if(revision.startsWith(e.getKey())) return e.getValue(); } return null; } |
rsp.sendRedirect(req.getContextPath()+'/'+result.getUrl()+"configure"); | rsp.sendRedirect2(req.getContextPath()+'/'+result.getUrl()+"configure"); | public synchronized Job doCreateJob( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { if(!Hudson.adminCheck(req,rsp)) return null; String name = req.getParameter("name").trim(); String className = req.getParameter("type"); String mode = req.getParameter("mode"); try { checkGoodName(name); } catch (ParseException e) { sendError(e,req,rsp); return null; } if(getJob(name)!=null) { sendError("A job already exists with the name '"+name+"'",req,rsp); return null; } if(mode==null) { rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return null; } Job result; if(mode.equals("newJob")) { if(className==null) { // request forged? rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return null; } try { Class type = Class.forName(className); // redirect to the project config screen result = createProject(type, name); } catch (ClassNotFoundException e) { e.printStackTrace(); rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return null; } } else { Job src = getJob(req.getParameter("from")); if(src==null) { rsp.sendError(HttpServletResponse.SC_BAD_REQUEST); return null; } result = createProject(src.getClass(),name); // copy config Copy cp = new Copy(); cp.setProject(new org.apache.tools.ant.Project()); cp.setTofile(result.getConfigFile()); cp.setFile(src.getConfigFile()); cp.setOverwrite(true); cp.execute(); // reload from the new config result = Job.load(this,result.root); result.nextBuildNumber = 1; // reset the next build number jobs.put(name,result); } rsp.sendRedirect(req.getContextPath()+'/'+result.getUrl()+"configure"); return result; } |
rsp.sendRedirect("./"+v.getUrl()+"configure"); | rsp.sendRedirect2("./"+v.getUrl()+"configure"); | public synchronized void doCreateView( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { if(!Hudson.adminCheck(req,rsp)) return; String name = req.getParameter("name"); try { checkGoodName(name); } catch (ParseException e) { sendError(e, req, rsp); return; } View v = new View(this, name); if(views==null) views = new Vector<View>(); views.add(v); save(); // redirect to the config screen rsp.sendRedirect("./"+v.getUrl()+"configure"); } |
rsp.sendRedirect(req.getContextPath()+"/fingerprint/"+ | rsp.sendRedirect2(req.getContextPath()+"/fingerprint/"+ | public synchronized void doDoFingerprintCheck( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { try { // Create a factory for disk-based file items FileItemFactory factory = new DiskFileItemFactory(); // Create a new file upload handler ServletFileUpload upload = new ServletFileUpload(factory); // Parse the request List<FileItem> items = upload.parseRequest(req); rsp.sendRedirect(req.getContextPath()+"/fingerprint/"+ getDigestOf(items.get(0).getInputStream())+'/'); // if an error occur and we fail to do this, it will still be cleaned up // when GC-ed. for (FileItem item : items) item.delete(); } catch (FileUploadException e) { throw new ServletException(e); // I'm not sure what the implication of this } } |
rsp.sendRedirect(req.getContextPath()+"/"); | rsp.sendRedirect2(req.getContextPath()+"/"); | public synchronized void doLoginEntry( StaplerRequest req, StaplerResponse rsp ) throws IOException { rsp.sendRedirect(req.getContextPath()+"/"); } |
rsp.sendRedirect(req.getContextPath()+"/"); | rsp.sendRedirect2(req.getContextPath()+"/"); | public synchronized void doLogout( StaplerRequest req, StaplerResponse rsp ) throws IOException { HttpSession session = req.getSession(false); if(session!=null) session.invalidate(); rsp.sendRedirect(req.getContextPath()+"/"); } |
rsp.sendRedirect(req.getContextPath()+"/"); | rsp.sendRedirect2(req.getContextPath()+"/"); | public synchronized void doReload( StaplerRequest req, StaplerResponse rsp ) throws IOException { if(!Hudson.adminCheck(req,rsp)) return; load(); rsp.sendRedirect(req.getContextPath()+"/"); } |
result = 37*result+xi; | result = 37*result+yi; | public int hashCode() { int result = 17; long xl = Double.doubleToLongBits(this.re); long yl = Double.doubleToLongBits(this.im); int xi = (int)(xl^(xl>>32)); int yi = (int)(yl^(yl>>32)); result = 37*result+xi; result = 37*result+xi; return result; } |
lblColourValue.setText(SBStringUtils.format(myRecipe.getSrm(), 1)); | lblColourValue.setText(SBStringUtils.format(myRecipe.getColour(), 1)); | public void displayRecipe() { if (myRecipe == null) return; txtName.setText(myRecipe.getName()); brewerNameText.setText(myRecipe.getBrewer()); preBoilText.setValue(new Double(myRecipe.getPreBoilVol(myRecipe.getVolUnits()))); lblSizeUnits.setText(myRecipe.getVolUnits()); postBoilText.setValue(new Double(myRecipe.getPostBoilVol(myRecipe.getVolUnits()))); boilMinText.setText(SBStringUtils.format(myRecipe.getBoilMinutes(), 0)); evapText.setText(SBStringUtils.format(myRecipe.getEvap(), 1)); spnEffic.setValue(new Double(myRecipe.getEfficiency())); spnAtten.setValue(new Double(myRecipe.getAttenuation())); spnOG.setValue(new Double(myRecipe.getEstOg())); spnFG.setValue(new Double(myRecipe.getEstFg())); txtComments.setText(myRecipe.getComments()); lblIBUvalue.setText(SBStringUtils.format(myRecipe.getIbu(), 1)); lblColourValue.setText(SBStringUtils.format(myRecipe.getSrm(), 1)); lblAlcValue.setText(SBStringUtils.format(myRecipe.getAlcohol(), 1)); try { txtDate.setDate(myRecipe.getCreated().getTime()); } catch (PropertyVetoException e) { // TODO Auto-generated catch block e.printStackTrace(); } // setText(SBStringUtils.dateFormat1.format(myRecipe.getCreated().getTime())); Costs = SBStringUtils.myNF.format(myRecipe.getTotalMaltCost()); tblMaltTotalsModel.setDataVector(new String[][]{{"", "", "Totals:", "" + SBStringUtils.format(myRecipe.getTotalMalt(), 1), myRecipe.getMaltUnits(), "" + SBStringUtils.format(myRecipe.getEstOg(), 3), "" + SBStringUtils.format(myRecipe.getSrm(), 1), Costs, "100"}}, new String[]{"", "", "", "", "", "", "", "", ""}); Costs = SBStringUtils.myNF.format(myRecipe.getTotalHopsCost()); tblHopsTotalsModel.setDataVector(new String[][]{{"Totals:", "", "", "" + SBStringUtils.format(myRecipe.getTotalHops(), 1), myRecipe.getHopUnits(), "", "", "" + SBStringUtils.format(myRecipe.getIbu(), 1), Costs}}, new String[]{"", "", "", "", "", "", "", "", ""}); String fileName = "not saved"; if (currentFile != null) { fileName = currentFile.getName(); } fileNameLabel.setText("File: " + fileName); ibuMethodLabel.setText("IBU method: " + myRecipe.getIBUMethod()); alcMethodLabel.setText("Alc method: " + myRecipe.getAlcMethod()); double colour = myRecipe.getSrm(); // convert from ebc if that's our mode: if (myRecipe.getColourMethod().equals("EBC")) { // From Greg Noonan's article at // http://brewingtechniques.com/bmg/noonan.html colour = (colour + 1.2) / 2.65; } if (preferences.getProperty("optRGBMethod").equals("1")) colourPanel.setBackground(Recipe.calcRGB(1, colour, preferences.getIProperty("optRed"), preferences.getIProperty("optGreen"), preferences.getIProperty("optBlue"), preferences.getIProperty("optAlpha"))); else colourPanel.setBackground(Recipe.calcRGB(2, colour, preferences.getIProperty("optRed"), preferences.getIProperty("optGreen"), preferences.getIProperty("optBlue"), preferences.getIProperty("optAlpha"))); // update the panels stylePanel.setStyleData(); costPanel.displayCost(); waterPanel.displayWater(); mashPanel.displayMash(); dilutionPanel.displayDilution(); } |
"" + SBStringUtils.format(myRecipe.getSrm(), 1), | "" + SBStringUtils.format(myRecipe.getColour(), 1), | public void displayRecipe() { if (myRecipe == null) return; txtName.setText(myRecipe.getName()); brewerNameText.setText(myRecipe.getBrewer()); preBoilText.setValue(new Double(myRecipe.getPreBoilVol(myRecipe.getVolUnits()))); lblSizeUnits.setText(myRecipe.getVolUnits()); postBoilText.setValue(new Double(myRecipe.getPostBoilVol(myRecipe.getVolUnits()))); boilMinText.setText(SBStringUtils.format(myRecipe.getBoilMinutes(), 0)); evapText.setText(SBStringUtils.format(myRecipe.getEvap(), 1)); spnEffic.setValue(new Double(myRecipe.getEfficiency())); spnAtten.setValue(new Double(myRecipe.getAttenuation())); spnOG.setValue(new Double(myRecipe.getEstOg())); spnFG.setValue(new Double(myRecipe.getEstFg())); txtComments.setText(myRecipe.getComments()); lblIBUvalue.setText(SBStringUtils.format(myRecipe.getIbu(), 1)); lblColourValue.setText(SBStringUtils.format(myRecipe.getSrm(), 1)); lblAlcValue.setText(SBStringUtils.format(myRecipe.getAlcohol(), 1)); try { txtDate.setDate(myRecipe.getCreated().getTime()); } catch (PropertyVetoException e) { // TODO Auto-generated catch block e.printStackTrace(); } // setText(SBStringUtils.dateFormat1.format(myRecipe.getCreated().getTime())); Costs = SBStringUtils.myNF.format(myRecipe.getTotalMaltCost()); tblMaltTotalsModel.setDataVector(new String[][]{{"", "", "Totals:", "" + SBStringUtils.format(myRecipe.getTotalMalt(), 1), myRecipe.getMaltUnits(), "" + SBStringUtils.format(myRecipe.getEstOg(), 3), "" + SBStringUtils.format(myRecipe.getSrm(), 1), Costs, "100"}}, new String[]{"", "", "", "", "", "", "", "", ""}); Costs = SBStringUtils.myNF.format(myRecipe.getTotalHopsCost()); tblHopsTotalsModel.setDataVector(new String[][]{{"Totals:", "", "", "" + SBStringUtils.format(myRecipe.getTotalHops(), 1), myRecipe.getHopUnits(), "", "", "" + SBStringUtils.format(myRecipe.getIbu(), 1), Costs}}, new String[]{"", "", "", "", "", "", "", "", ""}); String fileName = "not saved"; if (currentFile != null) { fileName = currentFile.getName(); } fileNameLabel.setText("File: " + fileName); ibuMethodLabel.setText("IBU method: " + myRecipe.getIBUMethod()); alcMethodLabel.setText("Alc method: " + myRecipe.getAlcMethod()); double colour = myRecipe.getSrm(); // convert from ebc if that's our mode: if (myRecipe.getColourMethod().equals("EBC")) { // From Greg Noonan's article at // http://brewingtechniques.com/bmg/noonan.html colour = (colour + 1.2) / 2.65; } if (preferences.getProperty("optRGBMethod").equals("1")) colourPanel.setBackground(Recipe.calcRGB(1, colour, preferences.getIProperty("optRed"), preferences.getIProperty("optGreen"), preferences.getIProperty("optBlue"), preferences.getIProperty("optAlpha"))); else colourPanel.setBackground(Recipe.calcRGB(2, colour, preferences.getIProperty("optRed"), preferences.getIProperty("optGreen"), preferences.getIProperty("optBlue"), preferences.getIProperty("optAlpha"))); // update the panels stylePanel.setStyleData(); costPanel.displayCost(); waterPanel.displayWater(); mashPanel.displayMash(); dilutionPanel.displayDilution(); } |
if (myRecipe.getColourMethod().equals("EBC")) { colour = (colour + 1.2) / 2.65; } | public void displayRecipe() { if (myRecipe == null) return; txtName.setText(myRecipe.getName()); brewerNameText.setText(myRecipe.getBrewer()); preBoilText.setValue(new Double(myRecipe.getPreBoilVol(myRecipe.getVolUnits()))); lblSizeUnits.setText(myRecipe.getVolUnits()); postBoilText.setValue(new Double(myRecipe.getPostBoilVol(myRecipe.getVolUnits()))); boilMinText.setText(SBStringUtils.format(myRecipe.getBoilMinutes(), 0)); evapText.setText(SBStringUtils.format(myRecipe.getEvap(), 1)); spnEffic.setValue(new Double(myRecipe.getEfficiency())); spnAtten.setValue(new Double(myRecipe.getAttenuation())); spnOG.setValue(new Double(myRecipe.getEstOg())); spnFG.setValue(new Double(myRecipe.getEstFg())); txtComments.setText(myRecipe.getComments()); lblIBUvalue.setText(SBStringUtils.format(myRecipe.getIbu(), 1)); lblColourValue.setText(SBStringUtils.format(myRecipe.getSrm(), 1)); lblAlcValue.setText(SBStringUtils.format(myRecipe.getAlcohol(), 1)); try { txtDate.setDate(myRecipe.getCreated().getTime()); } catch (PropertyVetoException e) { // TODO Auto-generated catch block e.printStackTrace(); } // setText(SBStringUtils.dateFormat1.format(myRecipe.getCreated().getTime())); Costs = SBStringUtils.myNF.format(myRecipe.getTotalMaltCost()); tblMaltTotalsModel.setDataVector(new String[][]{{"", "", "Totals:", "" + SBStringUtils.format(myRecipe.getTotalMalt(), 1), myRecipe.getMaltUnits(), "" + SBStringUtils.format(myRecipe.getEstOg(), 3), "" + SBStringUtils.format(myRecipe.getSrm(), 1), Costs, "100"}}, new String[]{"", "", "", "", "", "", "", "", ""}); Costs = SBStringUtils.myNF.format(myRecipe.getTotalHopsCost()); tblHopsTotalsModel.setDataVector(new String[][]{{"Totals:", "", "", "" + SBStringUtils.format(myRecipe.getTotalHops(), 1), myRecipe.getHopUnits(), "", "", "" + SBStringUtils.format(myRecipe.getIbu(), 1), Costs}}, new String[]{"", "", "", "", "", "", "", "", ""}); String fileName = "not saved"; if (currentFile != null) { fileName = currentFile.getName(); } fileNameLabel.setText("File: " + fileName); ibuMethodLabel.setText("IBU method: " + myRecipe.getIBUMethod()); alcMethodLabel.setText("Alc method: " + myRecipe.getAlcMethod()); double colour = myRecipe.getSrm(); // convert from ebc if that's our mode: if (myRecipe.getColourMethod().equals("EBC")) { // From Greg Noonan's article at // http://brewingtechniques.com/bmg/noonan.html colour = (colour + 1.2) / 2.65; } if (preferences.getProperty("optRGBMethod").equals("1")) colourPanel.setBackground(Recipe.calcRGB(1, colour, preferences.getIProperty("optRed"), preferences.getIProperty("optGreen"), preferences.getIProperty("optBlue"), preferences.getIProperty("optAlpha"))); else colourPanel.setBackground(Recipe.calcRGB(2, colour, preferences.getIProperty("optRed"), preferences.getIProperty("optGreen"), preferences.getIProperty("optBlue"), preferences.getIProperty("optAlpha"))); // update the panels stylePanel.setStyleData(); costPanel.displayCost(); waterPanel.displayWater(); mashPanel.displayMash(); dilutionPanel.displayDilution(); } |
|
public static void main(String[] args) { | public static void main(final String[] args) { | public static void main(String[] args) { BasicConfigurator.configure(); OpenMap om; if(args.length > 2) { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData", args[2]); } else { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData"); } EventLayer evLayer = new EventLayer(om.getMapBean(), new DepthEventColorizer()); om.setEventLayer(evLayer); evLayer.eventDataChanged(new EQDataEvent(MockEventAccessOperations.createEvents())); StationLayer staLayer = new StationLayer(); om.setStationLayer(staLayer); Station sta = MockStation.createStation(); Station other = MockStation.createOtherStation(); staLayer.stationDataChanged(new StationDataEvent(new Station[] {sta})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(sta, AvailableStationDataEvent.UP)); staLayer.stationDataChanged(new StationDataEvent(new Station[] {other})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(other, AvailableStationDataEvent.DOWN)); JFrame frame = new JFrame("OpenMap Test"); frame.addWindowListener(new Closer()); frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add(om); frame.setSize(640, 480); frame.show(); } |
OpenMap om; | final OpenMap om; | public static void main(String[] args) { BasicConfigurator.configure(); OpenMap om; if(args.length > 2) { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData", args[2]); } else { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData"); } EventLayer evLayer = new EventLayer(om.getMapBean(), new DepthEventColorizer()); om.setEventLayer(evLayer); evLayer.eventDataChanged(new EQDataEvent(MockEventAccessOperations.createEvents())); StationLayer staLayer = new StationLayer(); om.setStationLayer(staLayer); Station sta = MockStation.createStation(); Station other = MockStation.createOtherStation(); staLayer.stationDataChanged(new StationDataEvent(new Station[] {sta})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(sta, AvailableStationDataEvent.UP)); staLayer.stationDataChanged(new StationDataEvent(new Station[] {other})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(other, AvailableStationDataEvent.DOWN)); JFrame frame = new JFrame("OpenMap Test"); frame.addWindowListener(new Closer()); frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add(om); frame.setSize(640, 480); frame.show(); } |
JFrame frame = new JFrame("OpenMap Test"); frame.addWindowListener(new Closer()); | JButton reloadColorTable = new JButton("Reload Table"); final JFrame frame = new JFrame("OpenMap Test"); reloadColorTable.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ETOPOLayer etopo = om.getETOPOLayer(); if(etopo instanceof ColorMapEtopoLayer) { try { ((ColorMapEtopoLayer)etopo).setColorTable(args[2]); om.getMapBean().center(new CenterEvent(this, (float)Math.random(), (float)Math.random())); } catch(FileNotFoundException e1) { e1.printStackTrace(); } catch(IOException e1) { e1.printStackTrace(); } } } }); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); | public static void main(String[] args) { BasicConfigurator.configure(); OpenMap om; if(args.length > 2) { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData", args[2]); } else { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData"); } EventLayer evLayer = new EventLayer(om.getMapBean(), new DepthEventColorizer()); om.setEventLayer(evLayer); evLayer.eventDataChanged(new EQDataEvent(MockEventAccessOperations.createEvents())); StationLayer staLayer = new StationLayer(); om.setStationLayer(staLayer); Station sta = MockStation.createStation(); Station other = MockStation.createOtherStation(); staLayer.stationDataChanged(new StationDataEvent(new Station[] {sta})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(sta, AvailableStationDataEvent.UP)); staLayer.stationDataChanged(new StationDataEvent(new Station[] {other})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(other, AvailableStationDataEvent.DOWN)); JFrame frame = new JFrame("OpenMap Test"); frame.addWindowListener(new Closer()); frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add(om); frame.setSize(640, 480); frame.show(); } |
frame.getContentPane().add(reloadColorTable, BorderLayout.SOUTH); | public static void main(String[] args) { BasicConfigurator.configure(); OpenMap om; if(args.length > 2) { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData", args[2]); } else { om = new OpenMap("edu/sc/seis/fissuresUtil/data/maps/dcwpo-browse", "edu/sc/seis/mapData"); } EventLayer evLayer = new EventLayer(om.getMapBean(), new DepthEventColorizer()); om.setEventLayer(evLayer); evLayer.eventDataChanged(new EQDataEvent(MockEventAccessOperations.createEvents())); StationLayer staLayer = new StationLayer(); om.setStationLayer(staLayer); Station sta = MockStation.createStation(); Station other = MockStation.createOtherStation(); staLayer.stationDataChanged(new StationDataEvent(new Station[] {sta})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(sta, AvailableStationDataEvent.UP)); staLayer.stationDataChanged(new StationDataEvent(new Station[] {other})); staLayer.stationAvailabiltyChanged(new AvailableStationDataEvent(other, AvailableStationDataEvent.DOWN)); JFrame frame = new JFrame("OpenMap Test"); frame.addWindowListener(new Closer()); frame.getContentPane().setLayout(new BorderLayout()); frame.getContentPane().add(om); frame.setSize(640, 480); frame.show(); } |
|
int len = Math.min(names.length,homes.length); | int len; if(names!=null && homes!=null) len = Math.min(names.length,homes.length); else len = 0; | public boolean configure(HttpServletRequest req) { boolean r = true; int i; String[] names = req.getParameterValues("ant_name"); String[] homes = req.getParameterValues("ant_home"); int len = Math.min(names.length,homes.length); AntInstallation[] insts = new AntInstallation[len]; for( i=0; i<len; i++ ) { if(names[i].length()==0) continue; insts[i] = new AntInstallation(names[i],homes[i]); } getProperties().put("installations",insts); save(); return r; } |
if (param1 instanceof Number) | if (param1 instanceof Complex) | public Object sub(Object param1, Object param2) throws ParseException { if (param1 instanceof Number) { if (param2 instanceof Number) { return sub((Number)param1, (Number)param2); } else if (param2 instanceof Complex) { return sub((Number)param1, (Complex)param2); } } else if (param1 instanceof Complex) { if (param2 instanceof Number) { return sub((Complex)param1, (Number)param2); } else if (param2 instanceof Complex) { return sub((Complex)param1, (Complex)param2); } } throw new ParseException("Invalid parameter type"); } |
if (param2 instanceof Number) | if (param2 instanceof Complex) { return sub((Complex)param1, (Complex)param2); } else if( param2 instanceof Number) { return sub((Complex)param1, (Number)param2); } } else if (param1 instanceof Number) { if (param2 instanceof Complex) { return sub((Number)param1, (Complex)param2); } else if (param2 instanceof Number) | public Object sub(Object param1, Object param2) throws ParseException { if (param1 instanceof Number) { if (param2 instanceof Number) { return sub((Number)param1, (Number)param2); } else if (param2 instanceof Complex) { return sub((Number)param1, (Complex)param2); } } else if (param1 instanceof Complex) { if (param2 instanceof Number) { return sub((Complex)param1, (Number)param2); } else if (param2 instanceof Complex) { return sub((Complex)param1, (Complex)param2); } } throw new ParseException("Invalid parameter type"); } |
else if (param2 instanceof Complex) { return sub((Number)param1, (Complex)param2); } } else if (param1 instanceof Complex) { if (param2 instanceof Number) { return sub((Complex)param1, (Number)param2); } else if (param2 instanceof Complex) { return sub((Complex)param1, (Complex)param2); } } | } | public Object sub(Object param1, Object param2) throws ParseException { if (param1 instanceof Number) { if (param2 instanceof Number) { return sub((Number)param1, (Number)param2); } else if (param2 instanceof Complex) { return sub((Number)param1, (Complex)param2); } } else if (param1 instanceof Complex) { if (param2 instanceof Number) { return sub((Complex)param1, (Number)param2); } else if (param2 instanceof Complex) { return sub((Complex)param1, (Complex)param2); } } throw new ParseException("Invalid parameter type"); } |
if (null == stack) { throw new ParseException("Stack argument null"); | checkStack(stack); if (curNumberOfParameters < 1) throw new ParseException("No arguments for Sum"); Object sum = stack.pop(); Object param; int i = 1; while (i < curNumberOfParameters) { param = stack.pop(); sum = addFun.add(param, sum); i++; | public void run(Stack stack) throws ParseException { // Check if stack is null if (null == stack) { throw new ParseException("Stack argument null"); } Object param = stack.pop(); Number result; if (param instanceof Number) result = (Number) param; else throw new ParseException("Invalid parameter type"); // repeat summation for each one of the current parameters for(int i=1;i < curNumberOfParameters;++i) { // get the parameter from the stack param = stack.pop(); if (param instanceof Number) { // calculate the result result = addFun.add((Number) param,result); } else { throw new ParseException("Invalid parameter type"); } i++; } // push the result on the inStack stack.push(result); } |
Object param = stack.pop(); Number result; if (param instanceof Number) result = (Number) param; else throw new ParseException("Invalid parameter type"); for(int i=1;i < curNumberOfParameters;++i) { param = stack.pop(); if (param instanceof Number) { result = addFun.add((Number) param,result); } else { throw new ParseException("Invalid parameter type"); } i++; } stack.push(result); | stack.push(sum); | public void run(Stack stack) throws ParseException { // Check if stack is null if (null == stack) { throw new ParseException("Stack argument null"); } Object param = stack.pop(); Number result; if (param instanceof Number) result = (Number) param; else throw new ParseException("Invalid parameter type"); // repeat summation for each one of the current parameters for(int i=1;i < curNumberOfParameters;++i) { // get the parameter from the stack param = stack.pop(); if (param instanceof Number) { // calculate the result result = addFun.add((Number) param,result); } else { throw new ParseException("Invalid parameter type"); } i++; } // push the result on the inStack stack.push(result); } |
ampRegistrar.getAmpRange(aSeis, timeRegistrar.getTimeRange()); | public UnitRangeImpl getAmpRange(DataSetSeismogram aSeis){ LocalSeismogramImpl seis = aSeis.getSeismogram(); MicroSecondTimeRange pastTime = (MicroSecondTimeRange)seismoTimes.get(aSeis); if(timeRegistrar == null){ return getAmpRange(aSeis, (MicroSecondTimeRange)seismoTimes.get(aSeis)); }else{ if (!timeRegistrar.contains(aSeis)) { timeRegistrar.addSeismogram(aSeis); } return getAmpRange(aSeis, timeRegistrar.getTimeRange(aSeis)); } } |
|
expandTestString("(5*x+3*y)^2","30*x*y+25*x^2+9*y^2"); | public void testPolySimp() throws ParseException,Exception { Node n1 = j.parse("(1.0+2.0*x+x^2.0)*(1.0+2.0*x+x^2.0)"); pc.createPoly(n1); expandTestString("(a+b)*(c+d)","a*c+a*d+b*c+b*d"); expandTestString("a*c+a*d+b*c+b*d","a*c+a*d+b*c+b*d"); expandTestString("(a+b)*(a+b)","2*a*b+a^2+b^2"); expandTestString("(a-b)*(a-b)","-2*a*b+a^2+b^2"); expandTestString("(x+7.6)*(x+5.8832)*(x-55.12)","-2464.5430784-698.4816639999999*x-41.636799999999994*x^2+x^3"); simplifyTestString("(a+b)^0","1"); simplifyTestString("(a-b)^0","1"); simplifyTestString("(a+b)^1","a+b"); simplifyTestString("(a-b)^1","a-b"); expandTestString("(a+b)^2","2*a*b+a^2+b^2"); expandTestString("(a-b)^2","-2*a*b+a^2+b^2"); expandTestString("(a+b)^3","3*a*b^2+3*a^2*b+a^3+b^3"); expandTestString("(a-b)^3","3*a*b^2-3*a^2*b+a^3-b^3"); expandTestString("1+x+x^2+x*y+y^2","1+x+x*y+x^2+y^2"); j.getPrintVisitor().setMaxLen(80); Node Q8node = j.parse("(xx^2+yy^2+zz^2+ww^2)^4"); Node Q8expand = pc.expand(Q8node); j.println(Q8expand); expandTestString("(xx^2+yy^2+zz^2+ww^2)^4", "24*ww^2*xx^2*yy^2*zz^2+12*ww^2*xx^2*yy^4+12*ww^2*xx^2*"+ "zz^4+12*ww^2*xx^4*yy^2+12*ww^2*xx^4*zz^2+4*ww^2*xx^6+"+ "12*ww^2*yy^2*zz^4+12*ww^2*yy^4*zz^2+4*ww^2*yy^6+4*"+ "ww^2*zz^6+12*ww^4*xx^2*yy^2+12*ww^4*xx^2*zz^2+6*ww^4*"+ "xx^4+12*ww^4*yy^2*zz^2+6*ww^4*yy^4+6*ww^4*zz^4+4*"+ "ww^6*xx^2+4*ww^6*yy^2+4*ww^6*zz^2+ww^8+12*xx^2*yy^2*"+ "zz^4+12*xx^2*yy^4*zz^2+4*xx^2*yy^6+4*xx^2*zz^6+12*"+ "xx^4*yy^2*zz^2+6*xx^4*yy^4+6*xx^4*zz^4+4*xx^6*yy^2+4*"+ "xx^6*zz^2+xx^8+4*yy^2*zz^6+6*yy^4*zz^4+4*yy^6*zz^2+"+ "yy^8+zz^8"); Node n = j.parse("ln(x+1)"); Node diff = j.differentiate(n,"x"); Node simp = pc.simplify(diff); myAssertEquals("diff(ln(x+1))",j.toString(simp),"1.0/(1.0+x)"); diff = j.differentiate(simp,"x"); j.println(diff); simp = pc.simplify(diff); myAssertEquals("d^2(ln(x+1))",j.toString(simp),"-1.0/(1.0+x)^2.0"); diff = j.differentiate(simp,"x"); j.println(diff); simp = pc.simplify(diff); myAssertEquals("d^3(ln(x+1))",j.toString(simp),"2.0/(1.0+x)^3.0"); diff = j.differentiate(simp,"x"); j.println(diff); simp = pc.simplify(diff); System.out.println("D^4\t"+j.toString(simp)); j.getPrintVisitor().setMaxLen(80); diff = j.differentiate(simp,"x");// j.println(diff); simp = pc.simplify(diff); System.out.print("D^5\t"); j.println(simp); diff = j.differentiate(simp,"x");// j.println(diff); simp = pc.simplify(diff); System.out.print("D^6\t"); j.println(simp); diff = j.differentiate(simp,"x");// j.println(diff); simp = pc.simplify(diff); System.out.print("D^7\t"); j.println(simp); diff = j.differentiate(simp,"x");// j.println(diff); simp = pc.simplify(diff); System.out.print("D^8\t"); j.println(simp); } |
|
simplifyTest("(2*x+x)^3","27*x^3"); | public void testSimp() throws ParseException { simplifyTest("2+3","5"); simplifyTest("2*3","6"); simplifyTest("2^3","8"); simplifyTest("3/2","1.5"); simplifyTest("2*3+4","10"); simplifyTest("2*(3+4)","14"); simplifyTest("0+x","x"); simplifyTest("x+0","x"); simplifyTest("0-x","0-x"); simplifyTest("x-0","x"); simplifyTest("0*x","0"); simplifyTest("x*0","0"); simplifyTest("1*x","x"); simplifyTest("x*1","x"); simplifyTest("-1*x","-x"); simplifyTest("x*-1","-x"); simplifyTest("-(-x)","x"); simplifyTest("-(-(-x))","-x"); simplifyTest("(-1)*(-1)*x","x"); simplifyTest("(-1)*(-1)*(-1)*x","-x"); simplifyTest("0/x","0"); simplifyTest("x/0","1/0"); simplifyTest("x^0","1"); simplifyTest("x^1","x"); simplifyTest("0^x","0"); simplifyTest("1^x","1"); // (a+b)+c simplifyTest("(2+3)+x","5+x"); simplifyTest("(2+x)+3","5+x"); simplifyTest("(x+2)+3","5+x"); // a+(b+c) simplifyTest("x+(2+3)","5+x"); simplifyTest("2+(x+3)","5+x"); simplifyTest("2+(3+x)","5+x"); // (a+b)-c simplifyTest("(2+3)-x","5-x"); simplifyTest("(2+x)-3","x-1"); simplifyTest("(x+2)-3","x-1"); // (a-b)+c simplifyTest("(2-3)+x","-1+x"); simplifyTest("(2-x)+3","5-x"); simplifyTest("(x-2)+3","1+x"); // a-(b+c) simplifyTest("x-(2+3)","x-5"); simplifyTest("2-(x+3)","-1-x"); simplifyTest("2-(3+x)","-1-x"); // a+(b-c) simplifyTest("x+(2-3)","x-1"); simplifyTest("2+(x-3)","-1+x"); simplifyTest("2+(3-x)","5-x"); // a-(b-c) simplifyTest("x-(2-3)","1+x"); simplifyTest("2-(x-3)","5-x"); simplifyTest("2-(3-x)","-1+x"); // (a-b)-c simplifyTest("(2-3)-x","-1-x"); simplifyTest("(2-x)-3","-1-x"); simplifyTest("(x-2)-3","x-5"); // (a*b)*c simplifyTest("(2*3)*x","6*x"); simplifyTest("(2*x)*3","6*x"); simplifyTest("(x*2)*3","6*x"); // a+(b+c) simplifyTest("x*(2*3)","6*x"); simplifyTest("2*(x*3)","6*x"); simplifyTest("2*(3*x)","6*x"); // (a+b)-c simplifyTest("(2*3)/x","6/x"); simplifyTest("(3*x)/2","1.5*x"); simplifyTest("(x*3)/2","1.5*x"); // (a-b)+c simplifyTest("(3/2)*x","1.5*x"); simplifyTest("(3/x)*2","6/x"); simplifyTest("(x/2)*3","1.5*x"); // a-(b+c) simplifyTest("x/(2*3)","x/6"); simplifyTest("3/(x*2)","1.5/x"); simplifyTest("3/(2*x)","1.5/x"); // a+(b-c) simplifyTest("x*(3/2)","1.5*x"); simplifyTest("3*(x/2)","1.5*x"); simplifyTest("3*(2/x)","6/x"); // a-(b-c) simplifyTest("x/(3/2)","x/1.5"); simplifyTest("2/(x/3)","6/x"); simplifyTest("3/(2/x)","1.5*x"); // (a-b)-c simplifyTest("(3/2)/x","1.5/x"); simplifyTest("(3/x)/2","1.5/x"); simplifyTest("(x/3)/2","x/6"); simplifyTest("x*(3+2)","5*x");// simplifyTest("3*(x+2)","6+3*x");// simplifyTest("3*(2+x)","6+3*x");// simplifyTest("(3+2)*x","5*x");// simplifyTest("(3+x)*2","6+2*x");// simplifyTest("(x+3)*2","6+x*2"); simplifyTest("x*(3-2)","x");// simplifyTest("3*(x-2)","-6+3*x");// simplifyTest("3*(2-x)","6-3*x"); simplifyTest("(3-2)*x","x");// simplifyTest("(3-x)*2","6-2*x");// simplifyTest("(x-3)*2","-6+2*x");// simplifyTest("3+(x/4)","3+x/4");// simplifyTest("2*(x/4)","0.5*x");// simplifyTest("(2*(3+(x/4)))","6+0.5*x");// simplifyTest("1+(2*(3+(x/4)))","7+0.5*x");// simplifyTest("((3+(x/4))*2)+1","7+0.5*x"); simplifyTest("x*x","x^2"); simplifyTest("x*x*x","x^3"); simplifyTest("(x^3)*(x^4)","x^7"); simplifyTest("(x^4)/(x^3)","x"); simplifyTest("(x^3)/(x^4)","1/x"); simplifyTest("(x^2)/(x^4)","1/x^2"); simplifyTestString("1/x","1/x"); simplifyTestString("-1/x","-1/x"); simplifyTestString("2/x","2/x"); simplifyTestString("-2/x","-2/x"); simplifyTestString("(1+x)*(1+x)","(1+x)^2"); simplifyTestString("(1+x)/(1+x)","1"); simplifyTest("2*x+x","3*x"); simplifyTest("2*x+3*x","5*x"); simplifyTest("5*x-3*x","2*x"); simplifyTest("3*x-5*x","-2*x"); simplifyTest("3*x-x","2*x"); } |
|
QueryResponseRecord rec; | public void processResponse( QueryResponseMsg msg ) { //we like to receive results even if the query was stopped already. // check if it is a response for this query? if (!msg.getHeader().getMsgID().equals( queryMsg.getHeader().getMsgID())) { return; } // remoteHost.log("Got response to my query. " + msg); long speed = msg.getRemoteHostSpeed(); GUID rcID = msg.getRemoteClientID(); DestAddress address = msg.getDestAddress(); QueryHitHost qhHost = new QueryHitHost( rcID, address, speed ); qhHost.setQHDFlags( msg.getPushNeededFlag(), msg.getServerBusyFlag(), msg.getHasUploadedFlag(), msg.getUploadSpeedFlag() ); qhHost.setQueryResponseFields( msg ); QueryResponseRecord rec; RemoteFile rfile; int recordCount = msg.getRecordCount(); ArrayList newHitList = new ArrayList( recordCount ); for (int i = 0; i < recordCount; i++) { rec = msg.getMsgRecord(i); synchronized( this ) { long fileSize = rec.getFileSize(); String filename = rec.getFilename(); URN urn = rec.getURN(); int fileIndex = rec.getFileIndex(); String metaData = rec.getMetaData(); // find duplicate from same host... RemoteFile availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { String pathInfo = rec.getPathInfo(); rfile = new RemoteFile( qhHost, fileIndex, filename, pathInfo, fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } // handle possible AlternateLocations DestAddress[] alternateLocations = rec.getAlternateLocations(); if ( urn != null && alternateLocations != null) { for ( int j = 0; j < alternateLocations.length; j++ ) { // find duplicate from same host... QueryHitHost qhh = new QueryHitHost( null, alternateLocations[j], -1 ); availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { rfile = new RemoteFile( qhh, -1, filename, "", fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } } } } } // if something was added... if ( newHitList.size() > 0 ) { if ( queryEngine != null ) { queryEngine.incrementResultCount( msg.getUniqueResultCount() ); } RemoteFile[] newHits = new RemoteFile[ newHitList.size() ]; newHitList.toArray( newHits ); fireSearchHitsAdded( newHits ); } } |
|
int recordCount = msg.getRecordCount(); ArrayList newHitList = new ArrayList( recordCount ); for (int i = 0; i < recordCount; i++) | QueryResponseRecord[] records = msg.getMsgRecords(); ArrayList<RemoteFile> newHitList = new ArrayList<RemoteFile>( records.length ); for (int i = 0; i < records.length; i++) | public void processResponse( QueryResponseMsg msg ) { //we like to receive results even if the query was stopped already. // check if it is a response for this query? if (!msg.getHeader().getMsgID().equals( queryMsg.getHeader().getMsgID())) { return; } // remoteHost.log("Got response to my query. " + msg); long speed = msg.getRemoteHostSpeed(); GUID rcID = msg.getRemoteClientID(); DestAddress address = msg.getDestAddress(); QueryHitHost qhHost = new QueryHitHost( rcID, address, speed ); qhHost.setQHDFlags( msg.getPushNeededFlag(), msg.getServerBusyFlag(), msg.getHasUploadedFlag(), msg.getUploadSpeedFlag() ); qhHost.setQueryResponseFields( msg ); QueryResponseRecord rec; RemoteFile rfile; int recordCount = msg.getRecordCount(); ArrayList newHitList = new ArrayList( recordCount ); for (int i = 0; i < recordCount; i++) { rec = msg.getMsgRecord(i); synchronized( this ) { long fileSize = rec.getFileSize(); String filename = rec.getFilename(); URN urn = rec.getURN(); int fileIndex = rec.getFileIndex(); String metaData = rec.getMetaData(); // find duplicate from same host... RemoteFile availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { String pathInfo = rec.getPathInfo(); rfile = new RemoteFile( qhHost, fileIndex, filename, pathInfo, fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } // handle possible AlternateLocations DestAddress[] alternateLocations = rec.getAlternateLocations(); if ( urn != null && alternateLocations != null) { for ( int j = 0; j < alternateLocations.length; j++ ) { // find duplicate from same host... QueryHitHost qhh = new QueryHitHost( null, alternateLocations[j], -1 ); availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { rfile = new RemoteFile( qhh, -1, filename, "", fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } } } } } // if something was added... if ( newHitList.size() > 0 ) { if ( queryEngine != null ) { queryEngine.incrementResultCount( msg.getUniqueResultCount() ); } RemoteFile[] newHits = new RemoteFile[ newHitList.size() ]; newHitList.toArray( newHits ); fireSearchHitsAdded( newHits ); } } |
rec = msg.getMsgRecord(i); | public void processResponse( QueryResponseMsg msg ) { //we like to receive results even if the query was stopped already. // check if it is a response for this query? if (!msg.getHeader().getMsgID().equals( queryMsg.getHeader().getMsgID())) { return; } // remoteHost.log("Got response to my query. " + msg); long speed = msg.getRemoteHostSpeed(); GUID rcID = msg.getRemoteClientID(); DestAddress address = msg.getDestAddress(); QueryHitHost qhHost = new QueryHitHost( rcID, address, speed ); qhHost.setQHDFlags( msg.getPushNeededFlag(), msg.getServerBusyFlag(), msg.getHasUploadedFlag(), msg.getUploadSpeedFlag() ); qhHost.setQueryResponseFields( msg ); QueryResponseRecord rec; RemoteFile rfile; int recordCount = msg.getRecordCount(); ArrayList newHitList = new ArrayList( recordCount ); for (int i = 0; i < recordCount; i++) { rec = msg.getMsgRecord(i); synchronized( this ) { long fileSize = rec.getFileSize(); String filename = rec.getFilename(); URN urn = rec.getURN(); int fileIndex = rec.getFileIndex(); String metaData = rec.getMetaData(); // find duplicate from same host... RemoteFile availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { String pathInfo = rec.getPathInfo(); rfile = new RemoteFile( qhHost, fileIndex, filename, pathInfo, fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } // handle possible AlternateLocations DestAddress[] alternateLocations = rec.getAlternateLocations(); if ( urn != null && alternateLocations != null) { for ( int j = 0; j < alternateLocations.length; j++ ) { // find duplicate from same host... QueryHitHost qhh = new QueryHitHost( null, alternateLocations[j], -1 ); availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { rfile = new RemoteFile( qhh, -1, filename, "", fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } } } } } // if something was added... if ( newHitList.size() > 0 ) { if ( queryEngine != null ) { queryEngine.incrementResultCount( msg.getUniqueResultCount() ); } RemoteFile[] newHits = new RemoteFile[ newHitList.size() ]; newHitList.toArray( newHits ); fireSearchHitsAdded( newHits ); } } |
|
long fileSize = rec.getFileSize(); String filename = rec.getFilename(); URN urn = rec.getURN(); int fileIndex = rec.getFileIndex(); String metaData = rec.getMetaData(); | long fileSize = records[i].getFileSize(); String filename = records[i].getFilename(); URN urn = records[i].getURN(); int fileIndex = records[i].getFileIndex(); String metaData = records[i].getMetaData(); | public void processResponse( QueryResponseMsg msg ) { //we like to receive results even if the query was stopped already. // check if it is a response for this query? if (!msg.getHeader().getMsgID().equals( queryMsg.getHeader().getMsgID())) { return; } // remoteHost.log("Got response to my query. " + msg); long speed = msg.getRemoteHostSpeed(); GUID rcID = msg.getRemoteClientID(); DestAddress address = msg.getDestAddress(); QueryHitHost qhHost = new QueryHitHost( rcID, address, speed ); qhHost.setQHDFlags( msg.getPushNeededFlag(), msg.getServerBusyFlag(), msg.getHasUploadedFlag(), msg.getUploadSpeedFlag() ); qhHost.setQueryResponseFields( msg ); QueryResponseRecord rec; RemoteFile rfile; int recordCount = msg.getRecordCount(); ArrayList newHitList = new ArrayList( recordCount ); for (int i = 0; i < recordCount; i++) { rec = msg.getMsgRecord(i); synchronized( this ) { long fileSize = rec.getFileSize(); String filename = rec.getFilename(); URN urn = rec.getURN(); int fileIndex = rec.getFileIndex(); String metaData = rec.getMetaData(); // find duplicate from same host... RemoteFile availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { String pathInfo = rec.getPathInfo(); rfile = new RemoteFile( qhHost, fileIndex, filename, pathInfo, fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } // handle possible AlternateLocations DestAddress[] alternateLocations = rec.getAlternateLocations(); if ( urn != null && alternateLocations != null) { for ( int j = 0; j < alternateLocations.length; j++ ) { // find duplicate from same host... QueryHitHost qhh = new QueryHitHost( null, alternateLocations[j], -1 ); availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { rfile = new RemoteFile( qhh, -1, filename, "", fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } } } } } // if something was added... if ( newHitList.size() > 0 ) { if ( queryEngine != null ) { queryEngine.incrementResultCount( msg.getUniqueResultCount() ); } RemoteFile[] newHits = new RemoteFile[ newHitList.size() ]; newHitList.toArray( newHits ); fireSearchHitsAdded( newHits ); } } |
String pathInfo = rec.getPathInfo(); | String pathInfo = records[i].getPathInfo(); | public void processResponse( QueryResponseMsg msg ) { //we like to receive results even if the query was stopped already. // check if it is a response for this query? if (!msg.getHeader().getMsgID().equals( queryMsg.getHeader().getMsgID())) { return; } // remoteHost.log("Got response to my query. " + msg); long speed = msg.getRemoteHostSpeed(); GUID rcID = msg.getRemoteClientID(); DestAddress address = msg.getDestAddress(); QueryHitHost qhHost = new QueryHitHost( rcID, address, speed ); qhHost.setQHDFlags( msg.getPushNeededFlag(), msg.getServerBusyFlag(), msg.getHasUploadedFlag(), msg.getUploadSpeedFlag() ); qhHost.setQueryResponseFields( msg ); QueryResponseRecord rec; RemoteFile rfile; int recordCount = msg.getRecordCount(); ArrayList newHitList = new ArrayList( recordCount ); for (int i = 0; i < recordCount; i++) { rec = msg.getMsgRecord(i); synchronized( this ) { long fileSize = rec.getFileSize(); String filename = rec.getFilename(); URN urn = rec.getURN(); int fileIndex = rec.getFileIndex(); String metaData = rec.getMetaData(); // find duplicate from same host... RemoteFile availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { String pathInfo = rec.getPathInfo(); rfile = new RemoteFile( qhHost, fileIndex, filename, pathInfo, fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } // handle possible AlternateLocations DestAddress[] alternateLocations = rec.getAlternateLocations(); if ( urn != null && alternateLocations != null) { for ( int j = 0; j < alternateLocations.length; j++ ) { // find duplicate from same host... QueryHitHost qhh = new QueryHitHost( null, alternateLocations[j], -1 ); availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { rfile = new RemoteFile( qhh, -1, filename, "", fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } } } } } // if something was added... if ( newHitList.size() > 0 ) { if ( queryEngine != null ) { queryEngine.incrementResultCount( msg.getUniqueResultCount() ); } RemoteFile[] newHits = new RemoteFile[ newHitList.size() ]; newHitList.toArray( newHits ); fireSearchHitsAdded( newHits ); } } |
DestAddress[] alternateLocations = rec.getAlternateLocations(); | DestAddress[] alternateLocations = records[i].getAlternateLocations(); | public void processResponse( QueryResponseMsg msg ) { //we like to receive results even if the query was stopped already. // check if it is a response for this query? if (!msg.getHeader().getMsgID().equals( queryMsg.getHeader().getMsgID())) { return; } // remoteHost.log("Got response to my query. " + msg); long speed = msg.getRemoteHostSpeed(); GUID rcID = msg.getRemoteClientID(); DestAddress address = msg.getDestAddress(); QueryHitHost qhHost = new QueryHitHost( rcID, address, speed ); qhHost.setQHDFlags( msg.getPushNeededFlag(), msg.getServerBusyFlag(), msg.getHasUploadedFlag(), msg.getUploadSpeedFlag() ); qhHost.setQueryResponseFields( msg ); QueryResponseRecord rec; RemoteFile rfile; int recordCount = msg.getRecordCount(); ArrayList newHitList = new ArrayList( recordCount ); for (int i = 0; i < recordCount; i++) { rec = msg.getMsgRecord(i); synchronized( this ) { long fileSize = rec.getFileSize(); String filename = rec.getFilename(); URN urn = rec.getURN(); int fileIndex = rec.getFileIndex(); String metaData = rec.getMetaData(); // find duplicate from same host... RemoteFile availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { String pathInfo = rec.getPathInfo(); rfile = new RemoteFile( qhHost, fileIndex, filename, pathInfo, fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } // handle possible AlternateLocations DestAddress[] alternateLocations = rec.getAlternateLocations(); if ( urn != null && alternateLocations != null) { for ( int j = 0; j < alternateLocations.length; j++ ) { // find duplicate from same host... QueryHitHost qhh = new QueryHitHost( null, alternateLocations[j], -1 ); availableHit = searchResultHolder.findQueryHit( qhHost, urn, filename, fileSize, fileIndex ); if ( availableHit != null ) { // update availableHit availableHit.updateQueryHitHost( qhHost ); availableHit.setMetaData( metaData ); } else { rfile = new RemoteFile( qhh, -1, filename, "", fileSize, urn, metaData, (short)100 ); searchResultHolder.addQueryHit( rfile ); newHitList.add( rfile ); } } } } } // if something was added... if ( newHitList.size() > 0 ) { if ( queryEngine != null ) { queryEngine.incrementResultCount( msg.getUniqueResultCount() ); } RemoteFile[] newHits = new RemoteFile[ newHitList.size() ]; newHitList.toArray( newHits ); fireSearchHitsAdded( newHits ); } } |
MagnetData magnetData = MagnetData.parseFromURI( uri ); URN urn = MagnetData.lookupSHA1URN( magnetData ); SwarmingManager swarmingMgr = SwarmingManager.getInstance(); if ( !swarmingMgr.isURNDownloaded( urn ) ) | String protocol = uri.getScheme(); if ( "magnet".equals( protocol ) ) | public void createDownload( String uriStr ) throws URIException { if ( uriStr.length() == 0 ) { return; } URI uri = new URI( uriStr, true ); // dont add already downloading urns. MagnetData magnetData = MagnetData.parseFromURI( uri ); URN urn = MagnetData.lookupSHA1URN( magnetData ); SwarmingManager swarmingMgr = SwarmingManager.getInstance(); if ( !swarmingMgr.isURNDownloaded( urn ) ) { swarmingMgr.addFileToDownload( uri ); } } |
swarmingMgr.addFileToDownload( uri ); | MagnetData magnetData = MagnetData.parseFromURI( uri ); URN urn = MagnetData.lookupSHA1URN(magnetData); if ( swarmingMgr.isURNDownloaded( urn ) ) { return; } if ( shareService.isURNShared( urn ) ) { return; } | public void createDownload( String uriStr ) throws URIException { if ( uriStr.length() == 0 ) { return; } URI uri = new URI( uriStr, true ); // dont add already downloading urns. MagnetData magnetData = MagnetData.parseFromURI( uri ); URN urn = MagnetData.lookupSHA1URN( magnetData ); SwarmingManager swarmingMgr = SwarmingManager.getInstance(); if ( !swarmingMgr.isURNDownloaded( urn ) ) { swarmingMgr.addFileToDownload( uri ); } } |
SwarmingManager.getInstance().addFileToDownload( uri ); | public void createDownload( String uriStr ) throws URIException { if ( uriStr.length() == 0 ) { return; } URI uri = new URI( uriStr, true ); // dont add already downloading urns. MagnetData magnetData = MagnetData.parseFromURI( uri ); URN urn = MagnetData.lookupSHA1URN( magnetData ); SwarmingManager swarmingMgr = SwarmingManager.getInstance(); if ( !swarmingMgr.isURNDownloaded( urn ) ) { swarmingMgr.addFileToDownload( uri ); } } |
|
return new Double(SBStringUtils.format(data.getHopAmountAs(row, data.getHopUnits(row)), 1)); | return SBStringUtils.format(data.getHopAmountAs(row, data.getHopUnits(row)), 1); | public Object getValueAt(int row, int col) { // Hop h = (Hop) data.get(row); try { switch (col) { case 0 : return data.getHopName(row); case 1 : return data.getHopType(row); case 2 : return new Double(data.getHopAlpha(row)); case 3 : return new Double(SBStringUtils.format(data.getHopAmountAs(row, data.getHopUnits(row)), 1)); case 4 : return data.getHopUnits(row); case 5 : return data.getHopAdd(row); case 6 : return new Double(data.getHopMinutes(row)); case 7 : return new Double(SBStringUtils.format(data.getHopIBU(row), 1)); case 8 : return new Double(data.getHopCostPerU(row)); } } catch (Exception e) { }; return ""; } |
return new Double(SBStringUtils.format(data.getHopIBU(row), 1)); | return SBStringUtils.format(data.getHopIBU(row), 1); | public Object getValueAt(int row, int col) { // Hop h = (Hop) data.get(row); try { switch (col) { case 0 : return data.getHopName(row); case 1 : return data.getHopType(row); case 2 : return new Double(data.getHopAlpha(row)); case 3 : return new Double(SBStringUtils.format(data.getHopAmountAs(row, data.getHopUnits(row)), 1)); case 4 : return data.getHopUnits(row); case 5 : return data.getHopAdd(row); case 6 : return new Double(data.getHopMinutes(row)); case 7 : return new Double(SBStringUtils.format(data.getHopIBU(row), 1)); case 8 : return new Double(data.getHopCostPerU(row)); } } catch (Exception e) { }; return ""; } |
return new Double(data.getHopCostPerU(row)); | return SBStringUtils.format(data.getHopCostPerU(row), 2); | public Object getValueAt(int row, int col) { // Hop h = (Hop) data.get(row); try { switch (col) { case 0 : return data.getHopName(row); case 1 : return data.getHopType(row); case 2 : return new Double(data.getHopAlpha(row)); case 3 : return new Double(SBStringUtils.format(data.getHopAmountAs(row, data.getHopUnits(row)), 1)); case 4 : return data.getHopUnits(row); case 5 : return data.getHopAdd(row); case 6 : return new Double(data.getHopMinutes(row)); case 7 : return new Double(SBStringUtils.format(data.getHopIBU(row), 1)); case 8 : return new Double(data.getHopCostPerU(row)); } } catch (Exception e) { }; return ""; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.