rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
Shape(String url, Point point) {
Shape(String url, Point point, Dimension size) {
Shape(String url, Point point) { this.url = url; this.point = point; }
this.size = size;
Shape(String url, Point point) { this.url = url; this.point = point; }
if (!filter.getPrincipalSearch().isEmpty()) {
if (!filter.getPrincipalSearch().equals("")) {
public String createCriteriaAsString(IdentityFilter filter) { StringBuilder criteria = new StringBuilder(); if (!filter.getPrincipalSearch().isEmpty()) { criteria.append("lower(identity.principal) like '%") .append(filter.getPrincipalSearch().toLowerCase()) .append("%' "); } if (!filter.getNameOrAliasSearch().isEmpty()) { String nameOrAliasSearch = filter.getNameOrAliasSearch().toLowerCase(); if (!criteria.toString().isEmpty()) { criteria.append("or "); } criteria.append("lower(identity.optionalAlias) like '%") .append(nameOrAliasSearch) .append("%' ") .append("or ") .append("lower(identity.firstName) like '%") .append(nameOrAliasSearch) .append("%' ") .append("or ") .append("lower(identity.lastName) like '%") .append(nameOrAliasSearch) .append("%' "); } if (criteria.toString().isEmpty()) { return ""; } return criteria.insert(0, "where ").toString(); }
if (!filter.getNameOrAliasSearch().isEmpty()) {
if (!filter.getNameOrAliasSearch().equals("")) {
public String createCriteriaAsString(IdentityFilter filter) { StringBuilder criteria = new StringBuilder(); if (!filter.getPrincipalSearch().isEmpty()) { criteria.append("lower(identity.principal) like '%") .append(filter.getPrincipalSearch().toLowerCase()) .append("%' "); } if (!filter.getNameOrAliasSearch().isEmpty()) { String nameOrAliasSearch = filter.getNameOrAliasSearch().toLowerCase(); if (!criteria.toString().isEmpty()) { criteria.append("or "); } criteria.append("lower(identity.optionalAlias) like '%") .append(nameOrAliasSearch) .append("%' ") .append("or ") .append("lower(identity.firstName) like '%") .append(nameOrAliasSearch) .append("%' ") .append("or ") .append("lower(identity.lastName) like '%") .append(nameOrAliasSearch) .append("%' "); } if (criteria.toString().isEmpty()) { return ""; } return criteria.insert(0, "where ").toString(); }
if (!criteria.toString().isEmpty()) {
if (!criteria.toString().equals("")) {
public String createCriteriaAsString(IdentityFilter filter) { StringBuilder criteria = new StringBuilder(); if (!filter.getPrincipalSearch().isEmpty()) { criteria.append("lower(identity.principal) like '%") .append(filter.getPrincipalSearch().toLowerCase()) .append("%' "); } if (!filter.getNameOrAliasSearch().isEmpty()) { String nameOrAliasSearch = filter.getNameOrAliasSearch().toLowerCase(); if (!criteria.toString().isEmpty()) { criteria.append("or "); } criteria.append("lower(identity.optionalAlias) like '%") .append(nameOrAliasSearch) .append("%' ") .append("or ") .append("lower(identity.firstName) like '%") .append(nameOrAliasSearch) .append("%' ") .append("or ") .append("lower(identity.lastName) like '%") .append(nameOrAliasSearch) .append("%' "); } if (criteria.toString().isEmpty()) { return ""; } return criteria.insert(0, "where ").toString(); }
if (criteria.toString().isEmpty()) {
if (criteria.toString().equals("")) {
public String createCriteriaAsString(IdentityFilter filter) { StringBuilder criteria = new StringBuilder(); if (!filter.getPrincipalSearch().isEmpty()) { criteria.append("lower(identity.principal) like '%") .append(filter.getPrincipalSearch().toLowerCase()) .append("%' "); } if (!filter.getNameOrAliasSearch().isEmpty()) { String nameOrAliasSearch = filter.getNameOrAliasSearch().toLowerCase(); if (!criteria.toString().isEmpty()) { criteria.append("or "); } criteria.append("lower(identity.optionalAlias) like '%") .append(nameOrAliasSearch) .append("%' ") .append("or ") .append("lower(identity.firstName) like '%") .append(nameOrAliasSearch) .append("%' ") .append("or ") .append("lower(identity.lastName) like '%") .append(nameOrAliasSearch) .append("%' "); } if (criteria.toString().isEmpty()) { return ""; } return criteria.insert(0, "where ").toString(); }
if(names[i].length()==0) continue;
if(Util.nullify(names[i])==null) continue; if(Util.nullify(homes[i])==null) continue;
public boolean configure(HttpServletRequest req) { boolean r = true; int i; String[] names = req.getParameterValues("maven_name"); String[] homes = req.getParameterValues("maven_home"); int len; if(names!=null && homes!=null) len = Math.min(names.length,homes.length); else len = 0; MavenInstallation[] insts = new MavenInstallation[len]; for( i=0; i<len; i++ ) { if(names[i].length()==0) continue; insts[i] = new MavenInstallation(names[i],homes[i]); } getProperties().put("installations",insts); save(); return r; }
if(dead) return EditType.DELETE;
public EditType getEditType() { // see issue #73. Can't do much better right now if(revision.equals("1.1")) return EditType.ADD; if(dead) return EditType.DELETE; return EditType.EDIT; }
scaleRecipe();
scaleRecipe(); setVisible(false); dispose(); } else if (o == cancelButton) {
public void actionPerformed(ActionEvent e) { Object o = e.getSource(); if (o == okBtn) { scaleRecipe(); setVisible(false); dispose(); } else if (o == cancelButton){ setVisible(false); dispose(); } }
else if (o == cancelButton){ setVisible(false); dispose(); }
public void actionPerformed(ActionEvent e) { Object o = e.getSource(); if (o == okBtn) { scaleRecipe(); setVisible(false); dispose(); } else if (o == cancelButton){ setVisible(false); dispose(); } }
this.setTitle("Resize Recipe");
private void initGUI() { try { this.setTitle("Resize Recipe"); jPanel1 = new JPanel(); GridBagLayout jPanel1Layout = new GridBagLayout(); jPanel1Layout.rowWeights = new double[] {0.1, 0.1}; jPanel1Layout.rowHeights = new int[] {7, 7}; jPanel1Layout.columnWeights = new double[] {0.1, 0.1, 0.1}; jPanel1Layout.columnWidths = new int[] {7, 7, 7}; jPanel1.setLayout(jPanel1Layout); getContentPane().add(jPanel1, BorderLayout.CENTER); jLabel1 = new JLabel(); jPanel1.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("New Size:"); sizeTxt = new JTextField(); jPanel1.add(sizeTxt, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); sizeTxt.setText("" + myRecipe.getPostBoilVol(myRecipe.getVolUnits())); sizeUnitsComboModel = new ComboModel(); sizeUnitsComboModel.setList(new Quantity().getListofUnits("vol")); sizeUnitsComboModel.addOrInsert(myRecipe.getVolUnits()); sizeUnitsCombo = new JComboBox(); jPanel1.add(sizeUnitsCombo, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); sizeUnitsCombo.setModel(sizeUnitsComboModel); jPanel2 = new JPanel(); FlowLayout jPanel2Layout = new FlowLayout(); jPanel2Layout.setAlignment(FlowLayout.RIGHT); jPanel2.setLayout(jPanel2Layout); getContentPane().add(jPanel2, BorderLayout.SOUTH); cancelButton = new JButton(); cancelButton.addActionListener(this); jPanel2.add(cancelButton); cancelButton.setText("Cancel"); okBtn = new JButton(); okBtn.addActionListener(this); jPanel2.add(okBtn); okBtn.setText("OK"); this.setSize(306, 135); } catch (Exception e) { e.printStackTrace(); } }
jPanel1 = new JPanel(); GridBagLayout jPanel1Layout = new GridBagLayout(); jPanel1Layout.rowWeights = new double[] {0.1, 0.1}; jPanel1Layout.rowHeights = new int[] {7, 7}; jPanel1Layout.columnWeights = new double[] {0.1, 0.1, 0.1}; jPanel1Layout.columnWidths = new int[] {7, 7, 7}; jPanel1.setLayout(jPanel1Layout); getContentPane().add(jPanel1, BorderLayout.CENTER);
maltUnitsCombo = new JComboBox(); jPanel4.add(maltUnitsCombo, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); maltUnitsCombo.setModel(maltUnitsComboModel); maltUnitsCombo.setPreferredSize(new java.awt.Dimension(96, 20));
private void initGUI() { try { this.setTitle("Resize Recipe"); jPanel1 = new JPanel(); GridBagLayout jPanel1Layout = new GridBagLayout(); jPanel1Layout.rowWeights = new double[] {0.1, 0.1}; jPanel1Layout.rowHeights = new int[] {7, 7}; jPanel1Layout.columnWeights = new double[] {0.1, 0.1, 0.1}; jPanel1Layout.columnWidths = new int[] {7, 7, 7}; jPanel1.setLayout(jPanel1Layout); getContentPane().add(jPanel1, BorderLayout.CENTER); jLabel1 = new JLabel(); jPanel1.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("New Size:"); sizeTxt = new JTextField(); jPanel1.add(sizeTxt, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); sizeTxt.setText("" + myRecipe.getPostBoilVol(myRecipe.getVolUnits())); sizeUnitsComboModel = new ComboModel(); sizeUnitsComboModel.setList(new Quantity().getListofUnits("vol")); sizeUnitsComboModel.addOrInsert(myRecipe.getVolUnits()); sizeUnitsCombo = new JComboBox(); jPanel1.add(sizeUnitsCombo, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); sizeUnitsCombo.setModel(sizeUnitsComboModel); jPanel2 = new JPanel(); FlowLayout jPanel2Layout = new FlowLayout(); jPanel2Layout.setAlignment(FlowLayout.RIGHT); jPanel2.setLayout(jPanel2Layout); getContentPane().add(jPanel2, BorderLayout.SOUTH); cancelButton = new JButton(); cancelButton.addActionListener(this); jPanel2.add(cancelButton); cancelButton.setText("Cancel"); okBtn = new JButton(); okBtn.addActionListener(this); jPanel2.add(okBtn); okBtn.setText("OK"); this.setSize(306, 135); } catch (Exception e) { e.printStackTrace(); } }
jLabel1 = new JLabel(); jPanel1.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("New Size:");
hopsUnitsComboModel = new ComboModel(); hopsUnitsComboModel.setList(new Quantity().getListofUnits("weight")); hopsUnitsComboModel.addOrInsert(myRecipe.getHopUnits());
private void initGUI() { try { this.setTitle("Resize Recipe"); jPanel1 = new JPanel(); GridBagLayout jPanel1Layout = new GridBagLayout(); jPanel1Layout.rowWeights = new double[] {0.1, 0.1}; jPanel1Layout.rowHeights = new int[] {7, 7}; jPanel1Layout.columnWeights = new double[] {0.1, 0.1, 0.1}; jPanel1Layout.columnWidths = new int[] {7, 7, 7}; jPanel1.setLayout(jPanel1Layout); getContentPane().add(jPanel1, BorderLayout.CENTER); jLabel1 = new JLabel(); jPanel1.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("New Size:"); sizeTxt = new JTextField(); jPanel1.add(sizeTxt, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); sizeTxt.setText("" + myRecipe.getPostBoilVol(myRecipe.getVolUnits())); sizeUnitsComboModel = new ComboModel(); sizeUnitsComboModel.setList(new Quantity().getListofUnits("vol")); sizeUnitsComboModel.addOrInsert(myRecipe.getVolUnits()); sizeUnitsCombo = new JComboBox(); jPanel1.add(sizeUnitsCombo, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); sizeUnitsCombo.setModel(sizeUnitsComboModel); jPanel2 = new JPanel(); FlowLayout jPanel2Layout = new FlowLayout(); jPanel2Layout.setAlignment(FlowLayout.RIGHT); jPanel2.setLayout(jPanel2Layout); getContentPane().add(jPanel2, BorderLayout.SOUTH); cancelButton = new JButton(); cancelButton.addActionListener(this); jPanel2.add(cancelButton); cancelButton.setText("Cancel"); okBtn = new JButton(); okBtn.addActionListener(this); jPanel2.add(okBtn); okBtn.setText("OK"); this.setSize(306, 135); } catch (Exception e) { e.printStackTrace(); } }
sizeTxt = new JTextField(); jPanel1.add(sizeTxt, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); sizeTxt.setText("" + myRecipe.getPostBoilVol(myRecipe.getVolUnits()));
hopsUnitsCombo = new JComboBox(); jPanel4.add(hopsUnitsCombo, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); hopsUnitsCombo.setModel(hopsUnitsComboModel); hopsUnitsCombo.setPreferredSize(new java.awt.Dimension(97, 20));
private void initGUI() { try { this.setTitle("Resize Recipe"); jPanel1 = new JPanel(); GridBagLayout jPanel1Layout = new GridBagLayout(); jPanel1Layout.rowWeights = new double[] {0.1, 0.1}; jPanel1Layout.rowHeights = new int[] {7, 7}; jPanel1Layout.columnWeights = new double[] {0.1, 0.1, 0.1}; jPanel1Layout.columnWidths = new int[] {7, 7, 7}; jPanel1.setLayout(jPanel1Layout); getContentPane().add(jPanel1, BorderLayout.CENTER); jLabel1 = new JLabel(); jPanel1.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("New Size:"); sizeTxt = new JTextField(); jPanel1.add(sizeTxt, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); sizeTxt.setText("" + myRecipe.getPostBoilVol(myRecipe.getVolUnits())); sizeUnitsComboModel = new ComboModel(); sizeUnitsComboModel.setList(new Quantity().getListofUnits("vol")); sizeUnitsComboModel.addOrInsert(myRecipe.getVolUnits()); sizeUnitsCombo = new JComboBox(); jPanel1.add(sizeUnitsCombo, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); sizeUnitsCombo.setModel(sizeUnitsComboModel); jPanel2 = new JPanel(); FlowLayout jPanel2Layout = new FlowLayout(); jPanel2Layout.setAlignment(FlowLayout.RIGHT); jPanel2.setLayout(jPanel2Layout); getContentPane().add(jPanel2, BorderLayout.SOUTH); cancelButton = new JButton(); cancelButton.addActionListener(this); jPanel2.add(cancelButton); cancelButton.setText("Cancel"); okBtn = new JButton(); okBtn.addActionListener(this); jPanel2.add(okBtn); okBtn.setText("OK"); this.setSize(306, 135); } catch (Exception e) { e.printStackTrace(); } }
sizeUnitsComboModel = new ComboModel(); sizeUnitsComboModel.setList(new Quantity().getListofUnits("vol")); sizeUnitsComboModel.addOrInsert(myRecipe.getVolUnits());
cancelButton = new JButton(); cancelButton.addActionListener(this); jPanel2.add(cancelButton); cancelButton.setText("Cancel");
private void initGUI() { try { this.setTitle("Resize Recipe"); jPanel1 = new JPanel(); GridBagLayout jPanel1Layout = new GridBagLayout(); jPanel1Layout.rowWeights = new double[] {0.1, 0.1}; jPanel1Layout.rowHeights = new int[] {7, 7}; jPanel1Layout.columnWeights = new double[] {0.1, 0.1, 0.1}; jPanel1Layout.columnWidths = new int[] {7, 7, 7}; jPanel1.setLayout(jPanel1Layout); getContentPane().add(jPanel1, BorderLayout.CENTER); jLabel1 = new JLabel(); jPanel1.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("New Size:"); sizeTxt = new JTextField(); jPanel1.add(sizeTxt, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); sizeTxt.setText("" + myRecipe.getPostBoilVol(myRecipe.getVolUnits())); sizeUnitsComboModel = new ComboModel(); sizeUnitsComboModel.setList(new Quantity().getListofUnits("vol")); sizeUnitsComboModel.addOrInsert(myRecipe.getVolUnits()); sizeUnitsCombo = new JComboBox(); jPanel1.add(sizeUnitsCombo, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); sizeUnitsCombo.setModel(sizeUnitsComboModel); jPanel2 = new JPanel(); FlowLayout jPanel2Layout = new FlowLayout(); jPanel2Layout.setAlignment(FlowLayout.RIGHT); jPanel2.setLayout(jPanel2Layout); getContentPane().add(jPanel2, BorderLayout.SOUTH); cancelButton = new JButton(); cancelButton.addActionListener(this); jPanel2.add(cancelButton); cancelButton.setText("Cancel"); okBtn = new JButton(); okBtn.addActionListener(this); jPanel2.add(okBtn); okBtn.setText("OK"); this.setSize(306, 135); } catch (Exception e) { e.printStackTrace(); } }
sizeUnitsCombo = new JComboBox(); jPanel1.add(sizeUnitsCombo, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); sizeUnitsCombo.setModel(sizeUnitsComboModel);
okBtn = new JButton(); okBtn.addActionListener(this); jPanel2.add(okBtn); okBtn.setText("OK");
private void initGUI() { try { this.setTitle("Resize Recipe"); jPanel1 = new JPanel(); GridBagLayout jPanel1Layout = new GridBagLayout(); jPanel1Layout.rowWeights = new double[] {0.1, 0.1}; jPanel1Layout.rowHeights = new int[] {7, 7}; jPanel1Layout.columnWeights = new double[] {0.1, 0.1, 0.1}; jPanel1Layout.columnWidths = new int[] {7, 7, 7}; jPanel1.setLayout(jPanel1Layout); getContentPane().add(jPanel1, BorderLayout.CENTER); jLabel1 = new JLabel(); jPanel1.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("New Size:"); sizeTxt = new JTextField(); jPanel1.add(sizeTxt, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); sizeTxt.setText("" + myRecipe.getPostBoilVol(myRecipe.getVolUnits())); sizeUnitsComboModel = new ComboModel(); sizeUnitsComboModel.setList(new Quantity().getListofUnits("vol")); sizeUnitsComboModel.addOrInsert(myRecipe.getVolUnits()); sizeUnitsCombo = new JComboBox(); jPanel1.add(sizeUnitsCombo, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); sizeUnitsCombo.setModel(sizeUnitsComboModel); jPanel2 = new JPanel(); FlowLayout jPanel2Layout = new FlowLayout(); jPanel2Layout.setAlignment(FlowLayout.RIGHT); jPanel2.setLayout(jPanel2Layout); getContentPane().add(jPanel2, BorderLayout.SOUTH); cancelButton = new JButton(); cancelButton.addActionListener(this); jPanel2.add(cancelButton); cancelButton.setText("Cancel"); okBtn = new JButton(); okBtn.addActionListener(this); jPanel2.add(okBtn); okBtn.setText("OK"); this.setSize(306, 135); } catch (Exception e) { e.printStackTrace(); } }
jPanel2 = new JPanel(); FlowLayout jPanel2Layout = new FlowLayout(); jPanel2Layout.setAlignment(FlowLayout.RIGHT); jPanel2.setLayout(jPanel2Layout); getContentPane().add(jPanel2, BorderLayout.SOUTH); cancelButton = new JButton(); cancelButton.addActionListener(this); jPanel2.add(cancelButton); cancelButton.setText("Cancel"); okBtn = new JButton(); okBtn.addActionListener(this); jPanel2.add(okBtn); okBtn.setText("OK"); this.setSize(306, 135);
this.setSize(306, 193);
private void initGUI() { try { this.setTitle("Resize Recipe"); jPanel1 = new JPanel(); GridBagLayout jPanel1Layout = new GridBagLayout(); jPanel1Layout.rowWeights = new double[] {0.1, 0.1}; jPanel1Layout.rowHeights = new int[] {7, 7}; jPanel1Layout.columnWeights = new double[] {0.1, 0.1, 0.1}; jPanel1Layout.columnWidths = new int[] {7, 7, 7}; jPanel1.setLayout(jPanel1Layout); getContentPane().add(jPanel1, BorderLayout.CENTER); jLabel1 = new JLabel(); jPanel1.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("New Size:"); sizeTxt = new JTextField(); jPanel1.add(sizeTxt, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); sizeTxt.setText("" + myRecipe.getPostBoilVol(myRecipe.getVolUnits())); sizeUnitsComboModel = new ComboModel(); sizeUnitsComboModel.setList(new Quantity().getListofUnits("vol")); sizeUnitsComboModel.addOrInsert(myRecipe.getVolUnits()); sizeUnitsCombo = new JComboBox(); jPanel1.add(sizeUnitsCombo, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); sizeUnitsCombo.setModel(sizeUnitsComboModel); jPanel2 = new JPanel(); FlowLayout jPanel2Layout = new FlowLayout(); jPanel2Layout.setAlignment(FlowLayout.RIGHT); jPanel2.setLayout(jPanel2Layout); getContentPane().add(jPanel2, BorderLayout.SOUTH); cancelButton = new JButton(); cancelButton.addActionListener(this); jPanel2.add(cancelButton); cancelButton.setText("Cancel"); okBtn = new JButton(); okBtn.addActionListener(this); jPanel2.add(okBtn); okBtn.setText("OK"); this.setSize(306, 135); } catch (Exception e) { e.printStackTrace(); } }
if (convMaltsChk.isSelected()){ for (int i=0;i<myRecipe.getMaltListSize();i++){ myRecipe.getFermentable(i).convertTo(maltUnitsComboModel.getSelectedItem().toString()); } } if (convHopsChk.isSelected()){ for (int i=0;i<myRecipe.getHopsListSize();i++){ myRecipe.getHop(i).convertTo(hopsUnitsComboModel.getSelectedItem().toString()); } }
private void scaleRecipe() { String newUnits = sizeUnitsComboModel.getSelectedItem().toString(); double newSize = Double.parseDouble(sizeTxt.getText()); myRecipe.scaleRecipe(newSize, newUnits); app.displayRecipe(); app.maltTable.updateUI(); app.hopsTable.updateUI(); }
if ((param1 instanceof Number) && (param2 instanceof Number))
if ((param1 instanceof Complex) && (param2 instanceof Complex)) { int r; switch (id) { case NE: r = ((Complex)param1).equals((Complex)param2,tolerance) ? 0 : 1; break; case EQ: r = ((Complex)param1).equals((Complex)param2,tolerance) ? 1 : 0; break; default: throw new ParseException("Relational operator type error"); } inStack.push(new Double(r)); } else if ((param1 instanceof Number) && (param2 instanceof Number))
public void run(Stack inStack) throws ParseException { checkStack(inStack);// check the stack Object param2 = inStack.pop(); Object param1 = inStack.pop(); if ((param1 instanceof Number) && (param2 instanceof Number)) { double x = ((Number)param1).doubleValue(); double y = ((Number)param2).doubleValue(); int r; switch (id) { case LT: r = (x<y) ? 1 : 0; break; case GT: r = (x>y) ? 1 : 0; break; case LE: r = (x<=y) ? 1 : 0; break; case GE: r = (x>=y) ? 1 : 0; break; case NE: r = (x!=y) ? 1 : 0; break; case EQ: r = (x==y) ? 1 : 0; break; default: throw new ParseException("Unknown relational operator"); } inStack.push(new Double(r));//push the result on the inStack } else if ((param1 instanceof Complex) && (param2 instanceof Complex)) { int r; switch (id) { case NE: r = ((Complex)param1).equals((Complex)param2,tolerance) ? 0 : 1; break; case EQ: r = ((Complex)param1).equals((Complex)param2,tolerance) ? 1 : 0; break; default: throw new ParseException("Relational operator type error"); } inStack.push(new Double(r));//push the result on the inStack } else if ((param1 instanceof String) && (param2 instanceof String)) { int r; switch (id) { case NE: r = ((String)param1).equals((String)param2) ? 0 : 1; break; case EQ: r = ((String)param1).equals((String)param2) ? 1 : 0; break; default: throw new ParseException("Relational operator type error"); } inStack.push(new Double(r));//push the result on the inStack } else { throw new ParseException("Invalid parameter type"); } return; }
} else if ((param1 instanceof Complex) && (param2 instanceof Complex)) { int r; switch (id) { case NE: r = ((Complex)param1).equals((Complex)param2,tolerance) ? 0 : 1; break; case EQ: r = ((Complex)param1).equals((Complex)param2,tolerance) ? 1 : 0; break; default: throw new ParseException("Relational operator type error"); } inStack.push(new Double(r)); } else if ((param1 instanceof String) && (param2 instanceof String))
} else if ((param1 instanceof String) && (param2 instanceof String))
public void run(Stack inStack) throws ParseException { checkStack(inStack);// check the stack Object param2 = inStack.pop(); Object param1 = inStack.pop(); if ((param1 instanceof Number) && (param2 instanceof Number)) { double x = ((Number)param1).doubleValue(); double y = ((Number)param2).doubleValue(); int r; switch (id) { case LT: r = (x<y) ? 1 : 0; break; case GT: r = (x>y) ? 1 : 0; break; case LE: r = (x<=y) ? 1 : 0; break; case GE: r = (x>=y) ? 1 : 0; break; case NE: r = (x!=y) ? 1 : 0; break; case EQ: r = (x==y) ? 1 : 0; break; default: throw new ParseException("Unknown relational operator"); } inStack.push(new Double(r));//push the result on the inStack } else if ((param1 instanceof Complex) && (param2 instanceof Complex)) { int r; switch (id) { case NE: r = ((Complex)param1).equals((Complex)param2,tolerance) ? 0 : 1; break; case EQ: r = ((Complex)param1).equals((Complex)param2,tolerance) ? 1 : 0; break; default: throw new ParseException("Relational operator type error"); } inStack.push(new Double(r));//push the result on the inStack } else if ((param1 instanceof String) && (param2 instanceof String)) { int r; switch (id) { case NE: r = ((String)param1).equals((String)param2) ? 0 : 1; break; case EQ: r = ((String)param1).equals((String)param2) ? 1 : 0; break; default: throw new ParseException("Relational operator type error"); } inStack.push(new Double(r));//push the result on the inStack } else { throw new ParseException("Invalid parameter type"); } return; }
else return null;
return null;
public Dimensions calcDim(Dimensions ldim,Dimensions rdim) { if(ldim.equals(rdim)) return ldim; else return null; }
public SubversionChangeLogSet parse(File changelogFile) throws IOException, SAXException {
public SubversionChangeLogSet parse(Build build, File changelogFile) throws IOException, SAXException {
public SubversionChangeLogSet parse(File changelogFile) throws IOException, SAXException { // http://svn.collab.net/repos/svn/trunk/subversion/svn/schema/ Digester digester = new Digester(); ArrayList<LogEntry> r = new ArrayList<LogEntry>(); digester.push(r); digester.addObjectCreate("*/logentry", LogEntry.class); digester.addSetProperties("*/logentry"); digester.addBeanPropertySetter("*/logentry/author"); digester.addBeanPropertySetter("*/logentry/date"); digester.addBeanPropertySetter("*/logentry/msg"); digester.addSetNext("*/logentry","add"); digester.addObjectCreate("*/logentry/paths/path", Path.class); digester.addSetProperties("*/logentry/paths/path"); digester.addBeanPropertySetter("*/logentry/paths/path","value"); digester.addSetNext("*/logentry/paths/path","addPath"); digester.parse(changelogFile); return new SubversionChangeLogSet(r); }
return new SubversionChangeLogSet(r);
return new SubversionChangeLogSet(build,r);
public SubversionChangeLogSet parse(File changelogFile) throws IOException, SAXException { // http://svn.collab.net/repos/svn/trunk/subversion/svn/schema/ Digester digester = new Digester(); ArrayList<LogEntry> r = new ArrayList<LogEntry>(); digester.push(r); digester.addObjectCreate("*/logentry", LogEntry.class); digester.addSetProperties("*/logentry"); digester.addBeanPropertySetter("*/logentry/author"); digester.addBeanPropertySetter("*/logentry/date"); digester.addBeanPropertySetter("*/logentry/msg"); digester.addSetNext("*/logentry","add"); digester.addObjectCreate("*/logentry/paths/path", Path.class); digester.addSetProperties("*/logentry/paths/path"); digester.addBeanPropertySetter("*/logentry/paths/path","value"); digester.addSetNext("*/logentry/paths/path","addPath"); digester.parse(changelogFile); return new SubversionChangeLogSet(r); }
User user = userRoleList.get((int) Math.random()*userRoleList.size()).getUser();
User user = (User) userRoleList.get((int) Math.random()*userRoleList.size()).getUserGroup();
public void testGrantedAuthorities() { int i = 4, e = 3, d = 4, s = 3; List<UserRole> userRoleList = AuthorizationTestSupport.createUserRoleList(i, e, d, s); User user = userRoleList.get((int) Math.random()*userRoleList.size()).getUser(); Credential credential = AuthenticationDaoImplTests.createAndPersistCredential(null); user.setIdentity(credential.getIdentity()); UserDetailsAdapter userDetails = new UserDetailsAdapter(user, credential); GrantedAuthority[] authorities = userDetails.getAuthorities(); assertEquals(i*s, authorities.length); List<GrantedAuthority> list = Arrays.asList(authorities); for (UserRole ur: user.getRoles()) { String roleName = userDetails.convertUserRoleToString(ur); assertTrue(list.contains(new GrantedAuthorityImpl(roleName))); } }
miscCommentsTextArea.setPreferredSize(new java.awt.Dimension(136, 272));
private void initGUI() { try { BoxLayout thisLayout = new BoxLayout(this, javax.swing.BoxLayout.X_AXIS); this.setLayout(thisLayout); setPreferredSize(new Dimension(400, 300)); { tablePanel = new JPanel(); this.add(tablePanel); BoxLayout tablePanelLayout = new BoxLayout(tablePanel, javax.swing.BoxLayout.Y_AXIS); tablePanel.setLayout(tablePanelLayout); tablePanel.setPreferredSize(new java.awt.Dimension(261, 175)); { miscTableScrollPane = new JScrollPane(); tablePanel.add(miscTableScrollPane); { miscTableModel = new MiscTableModel(myRecipe); miscTable = new JTable() { public String getToolTipText(MouseEvent e) { java.awt.Point p = e.getPoint(); int rowIndex = rowAtPoint(p); return SBStringUtils.multiLineToolTip(40, miscTableModel .getDescriptionAt(rowIndex)); } }; miscTableScrollPane.setViewportView(miscTable); miscTable.setModel(miscTableModel); // set up name combo JComboBox miscComboBox = new JComboBox(); miscComboModel = new ComboModel(); miscComboBox.setModel(miscComboModel); TableColumn miscColumn = miscTable.getColumnModel().getColumn(0); miscColumn.setCellEditor(new DefaultCellEditor(miscComboBox)); miscComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Misc m = (Misc) miscComboModel.getSelectedItem(); int i = miscTable.getSelectedRow(); if (myRecipe != null && i != -1) { Misc m2 = myRecipe.getMisc(i); m2.setStage(m.getStage()); m2.setDescription(m.getDescription()); m2.setCost(m.getCostPerU()); } } }); // set up stage combo String [] stage = {"Mash", "Boil", "Primary", "Secondary", "Bottle", "Keg" }; JComboBox stageComboBox = new JComboBox(stage); miscColumn = miscTable.getColumnModel().getColumn(4); miscColumn.setCellEditor(new DefaultCellEditor(stageComboBox)); } } { buttonPanel = new JPanel(); FlowLayout buttonPanelLayout = new FlowLayout(); buttonPanelLayout.setAlignment(FlowLayout.LEFT); buttonPanel.setLayout(buttonPanelLayout); tablePanel.add(buttonPanel); { addButton = new JButton(); buttonPanel.add(addButton); addButton.setText("+"); addButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { Misc m = new Misc(); myRecipe.addMisc(m); miscTable.updateUI(); } } }); } { delButton = new JButton(); buttonPanel.add(delButton); delButton.setText("-"); delButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { if (myRecipe != null) { int i = miscTable.getSelectedRow(); myRecipe.delMisc(i); miscTable.updateUI(); } } }); } } } { commentsPanel = new JPanel(); BoxLayout commentsPanelLayout = new BoxLayout(commentsPanel, javax.swing.BoxLayout.Y_AXIS); commentsPanel.setLayout(commentsPanelLayout); this.add(commentsPanel); commentsPanel.setBorder(BorderFactory.createTitledBorder(new LineBorder(new java.awt.Color(0,0,0), 1, false), "Comments", TitledBorder.LEADING, TitledBorder.TOP)); { jScrollPane1 = new JScrollPane(); commentsPanel.add(jScrollPane1); { miscCommentsTextArea = new JTextArea(); jScrollPane1.setViewportView(miscCommentsTextArea); miscCommentsTextArea.setLineWrap(true); miscCommentsTextArea.setWrapStyleWord(true); miscCommentsTextArea.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { if ( selectedRow > -1 && !miscCommentsTextArea.getText().equals(myRecipe.getMiscComments(selectedRow))) { myRecipe.setMiscComments(selectedRow, miscCommentsTextArea.getText()); } } }); miscCommentsTextArea.addFocusListener(new FocusAdapter() { public void focusGained(FocusEvent evt) { selectedRow = miscTable.getSelectedRow(); } }); } } } } catch (Exception e) { e.printStackTrace(); } }
return ((Double) value).compareTo(pc.zero) > 0;
return ((Double) value).compareTo((Double) pc.zero) > 0;
public boolean isPositive() { try { return ((Double) value).compareTo(pc.zero) > 0; } catch(Exception e) { return false; } }
public void testDoublePut() throws NotFound, SQLException {
public void testDoublePut() throws SQLException {
public void testDoublePut() throws NotFound, SQLException { assertEquals(table.put(TimeUtils.future.getFissuresTime()), table.put(TimeUtils.future.getFissuresTime())); }
assertSame(user, userRole.getUser());
assertSame(user, userRole.getUserGroup());
public void testUserRoleFactory() { Service service = new Service(); User user = new User(); UserRole userRole = AuthorizationCreator.userRoleFactory(user, service, "EXT"); assertSame(service, userRole.getService()); assertSame(user, userRole.getUser()); assertEquals("EXT", userRole.getServiceExtension()); assertTrue(user.getRoles().contains(userRole)); }
public MashStep(String t, double st, double et, String tu, String m, int min,
public MashStep(String t, double st, double et, String m, int min,
public MashStep(String t, double st, double et, String tu, String m, int min, int rmin) { type = t; startTemp = st; endTemp = et; tempU = tu; method = m; minutes = min; rampMin = rmin; }
endTemp = et; tempU = tu;
endTemp = et;
public MashStep(String t, double st, double et, String tu, String m, int min, int rmin) { type = t; startTemp = st; endTemp = et; tempU = tu; method = m; minutes = min; rampMin = rmin; }
grainTemp = opts.getDProperty("optGrainTemp");
grainTempF = opts.getDProperty("optGrainTemp");
public Mash(){ Options opts = new Options("mash"); mashRatio = opts.getDProperty("optMashRatio"); mashRatioU = opts.getProperty("optMashRatioU");; tempUnits = opts.getProperty("optMashTempU"); volUnits = opts.getProperty("optMashVolU"); grainTemp = opts.getDProperty("optGrainTemp"); boilTempF = opts.getDProperty("optBoilTempF"); }
public void addStep(String type, double st, double et, String tu, String m, int min,
public void addStep(String type, double st, double et, String m, int min,
public void addStep(String type, double st, double et, String tu, String m, int min, int rmin) { MashStep step = new MashStep(type, st, et, tu, m, min, rmin); steps.add(step); calcMashSchedule(); }
MashStep step = new MashStep(type, st, et, tu, m, min, rmin);
MashStep step = new MashStep(type, st, et, m, min, rmin);
public void addStep(String type, double st, double et, String tu, String m, int min, int rmin) { MashStep step = new MashStep(type, st, et, tu, m, min, rmin); steps.add(step); calcMashSchedule(); }
private double cToF(double tempC) {
public static double cToF(double tempC) {
private double cToF(double tempC) { // routine to convert Celcius to Farenheit return ((tempC * 9) / 5) + 32; }
double currentTemp = grainTemp;
double currentTemp = grainTempF;
public void calcMashSchedule() { // Method to run through the mash table and calculate values double strikeTemp = 0; double targetTemp = 0; double endTemp = 0; double waterAddedQTS = 0; double waterEquiv = 0; double mr = mashRatio; double currentTemp = grainTemp; double displTemp = 0; double tunLoss = tunLossF; // figure out a better way to do this, eg: themal mass double decoct = 0; int totalMashTime = 0; double totalSpargeTime = 0; double mashWaterQTS = 0; double mashVolQTS = 0; String stepType; int numSparge = 0; // convert mash ratio to qts/lb if in l/kg if (mashRatioU.equalsIgnoreCase("l/kg")) { mr *= 0.479325; } // convert CurrentTemp to F if (mashTempU == "C") { currentTemp = cToF(currentTemp); tunLoss = cToF(tunLossF); } // perform calcs on first record if (steps.isEmpty()) return; // sort the list Collections.sort(steps, new stepComparator()); MashStep stp = ((MashStep) steps.get(0)); targetTemp = stp.startTemp; endTemp = stp.endTemp; strikeTemp = calcStrikeTemp(targetTemp, currentTemp, mr, tunLoss); waterAddedQTS = mr * maltWeightLbs; waterEquiv = maltWeightLbs * (0.192 + mr); mashVolQTS = calcMashVol(maltWeightLbs, mr); totalMashTime += stp.minutes; mashWaterQTS += waterAddedQTS; stp.infuseVol.setUnits("qt"); stp.infuseVol.setAmount(waterAddedQTS); stp.method = "infusion"; // subtract the water added from the Water Equiv so that they are correct when added in the next part of the loop waterEquiv -= waterAddedQTS; // Updated the water added if (tempUnits == "C") strikeTemp = fToC(strikeTemp); stp.directions = "Mash in with " + df1.format(stp.infuseVol.getValueAs(volUnits)) + " " + volUnits + " of water at " + df1.format(strikeTemp) + " " + tempUnits; // set TargetTemp to the end temp targetTemp = stp.endTemp; for (int i = 1; i < steps.size(); i++) { stp = ((MashStep) steps.get(i)); currentTemp = targetTemp; // switch targetTemp = stp.startTemp; // do calcs if (stp.method.equals("infusion")) { // calculate an infusion step decoct = 0; waterEquiv += waterAddedQTS; // add previous addition to get WE strikeTemp = boilTempF; // boiling water // Updated the water added waterAddedQTS = calcWaterAddition(targetTemp, currentTemp, waterEquiv, boilTempF); stp.infuseVol.setUnits("qt"); stp.infuseVol.setAmount(waterAddedQTS); if (tempUnits == "C") strikeTemp = 100; stp.directions = "Add " + df1.format(stp.infuseVol.getValueAs(volUnits)) + " " + volUnits + " of water at " + df1.format(strikeTemp) + " " + tempUnits; mashWaterQTS += waterAddedQTS; mashVolQTS += waterAddedQTS; } else if (stp.method.indexOf("decoction") > 0) { // calculate a decoction step waterEquiv += waterAddedQTS; // add previous addition to get WE waterAddedQTS = 0; strikeTemp = boilTempF; // boiling water double ratio=0.75; if (stp.method.indexOf("thick") > 0) ratio = 0.6; else if (stp.method.indexOf("thin") > 0) ratio = 0.9; // Calculate volume (qts) of mash to remove decoct = calcDecoction2(targetTemp, currentTemp, mashWaterQTS, ratio); stp.decoctVol.setUnits("qt"); stp.decoctVol.setAmount(decoct); // Updated the decoction, convert to right units & make directions stp.directions = "Remove " + df1.format(stp.decoctVol.getValueAs(volUnits)) + " " + volUnits + " of mash, boil, and return to mash."; } else if (stp.method.equals("direct")) { // calculate a direct heat step decoct = 0; waterEquiv += waterAddedQTS; // add previous addition to get WE waterAddedQTS = 0; stp.directions = "Add direct heat until mash reaches " + displTemp + " " + tempUnits + "."; } if (stp.method.equals("sparge")) { // Count it numSparge++; } else totalMashTime += stp.minutes; stp.infuseVol.setUnits("qt"); stp.infuseVol.setAmount(waterAddedQTS); stp.decoctVol.setUnits("qt"); stp.decoctVol.setAmount(decoct); // set target temp to end temp for next step targetTemp = stp.endTemp; } // while not eof waterEquiv += waterAddedQTS; // add previous addition to get WE totalTime = totalMashTime; volQts = mashVolQTS; // water use stats: absorbedQTS = maltWeightLbs * 0.55; // figure from HBD // spargeTotalQTS = (myRecipe.getPreBoilVol("qt")) - (mashWaterQTS - absorbedQTS); totalWaterQTS = mashWaterQTS; // TODO: sparge stuff should get figured here: }
private double fToC(double tempF) {
public static double fToC(double tempF) {
private double fToC(double tempF) { // routine to convert basic F temps to C return (5 * (tempF - 32)) / 9; }
public double getGrainTemp() { return grainTemp; }
public double getGrainTemp() { if (tempUnits.equals("F")) return grainTempF; else return fToC(grainTempF); }
public double getGrainTemp() { return grainTemp; }
grainTemp = t;
if (tempUnits.equals("F")) grainTempF = t; else grainTempF = cToF(t);
public void setGrainTemp(double t){ grainTemp = t; calcMashSchedule(); }
totalWeight = Quantity.convertUnit(weightUCombo.getSelectedItem().toString(), "lb", totalWeight);
private void calcWeights() { // we've set the % in the fermentables list, now // let's figure out the correct amounts: // by weight? if (weightBtn.isSelected()) { double totalWeight = Double.parseDouble(weightSpn.getValue().toString()); for (int i = 0; i < myRecipe.getMaltListSize(); i++) { double newAmount = totalWeight * myRecipe.getMaltPercent(i) / 100; myRecipe.setMaltAmountAs(i, newAmount, "lb"); } } // no, by OG else { double targOG = Double.parseDouble(OGSpn.getValue().toString()); // "seed" value -- assume conservative 30 ppppg double totalPoints = (targOG - 1) * 1000 * myRecipe.getPostBoilVol("gal"); double totalWeightLbs = (totalPoints / 30) * (myRecipe.getEfficiency() / 100); // brute force - just keep incrementing the total grain bill // by .1 lb until it's close to what we want (95%) while (calcOG(totalWeightLbs) < ((targOG -1))*0.95) { totalWeightLbs += 0.1; } while (calcOG(totalWeightLbs) < (targOG -1)) { totalWeightLbs += 0.01; } for (int k = 0; k < myRecipe.getMaltListSize(); k++) { double newAmount = totalWeightLbs * (myRecipe.getMaltPercent(k)/ 100); myRecipe.setMaltAmountAs(k, newAmount, "lb"); } } myRecipe.calcMaltTotals(); }
weightSpn.setValue(new Double(myRecipe.getTotalMaltLbs()));
weightSpn.setValue(new Double(myRecipe.getTotalMalt()));
private void initGUI() { try { this.setTitle("Malt Percent"); TableModel maltTableModel = new MaltPercentTableModel(); jPanel5 = new JPanel(); BoxLayout jPanel5Layout = new BoxLayout(jPanel5, javax.swing.BoxLayout.Y_AXIS); jPanel5.setLayout(jPanel5Layout); getContentPane().add(jPanel5, BorderLayout.CENTER); jPanel3 = new JPanel(); jPanel5.add(jPanel3); BoxLayout jPanel3Layout = new BoxLayout(jPanel3, javax.swing.BoxLayout.Y_AXIS); jPanel3.setLayout(jPanel3Layout); jPanel1 = new JScrollPane(); jPanel3.add(jPanel1); jPanel1.setPreferredSize(new java.awt.Dimension(392, 252)); jPanel1.setBorder(BorderFactory.createTitledBorder("Fermentables")); jPanel4 = new JPanel(); GridBagLayout jPanel4Layout = new GridBagLayout(); jPanel4Layout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1}; jPanel4Layout.rowHeights = new int[] {7, 7, 7, 7}; jPanel4Layout.columnWeights = new double[] {0.1, 0.2, 0.1, 0.1}; jPanel4Layout.columnWidths = new int[] {5, 9, 7, 7}; jPanel4.setLayout(jPanel4Layout); jPanel3.add(jPanel4); weightBtn = new JRadioButton("Target weight:"); jPanel4.add(weightBtn, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); bg.add(weightBtn); weightBtn.setSelected(true); weightSpn = new JSpinner(); jPanel4.add(weightSpn, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); // SpinnerListModel weightSpnModel = new SpinnerListModel(new String[] { "Sun", "Mon", "Tue", // "Wed", "Thu", "Fri", "Sat" }); // weightSpn.setModel(weightSpnModel); weightSpn.setValue(new Double(myRecipe.getTotalMaltLbs())); OGBtn = new JRadioButton("Target OG:"); jPanel4.add(OGBtn, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); bg.add(OGBtn); OGSpn = new JSpinner(); SpinnerNumberModel OGSpnModel = new SpinnerNumberModel(1.000, 0.900, 2.000, 0.001); jPanel4.add(OGSpn, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); OGSpn.setModel(OGSpnModel); jLabel1 = new JLabel(); jPanel4.add(jLabel1, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("lbs"); OGSpn.setValue(new Double(myRecipe.getEstOg())); maltTable = new JTable(); jPanel1.setViewportView(maltTable); maltTable.setModel(maltTableModel); maltTable.setPreferredSize(new java.awt.Dimension(203, 84)); jPanel2 = new JPanel(); jPanel5.add(jPanel2); FlowLayout jPanel2Layout = new FlowLayout(); jPanel2Layout.setAlignment(FlowLayout.RIGHT); jPanel2.setLayout(jPanel2Layout); cancelBtn = new JButton(); jPanel2.add(cancelBtn); cancelBtn.setText("Cancel"); okBtn = new JButton(); jPanel2.add(okBtn); okBtn.setText("OK"); okBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { calcWeights(); setVisible(false); app.displayRecipe(); app.maltTable.updateUI(); dispose(); } }); cancelBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { setVisible(false); dispose(); } }); // jPanel1.add(maltTable, BorderLayout.CENTER); setSize(400, 300); } catch (Exception e) { e.printStackTrace(); } }
jLabel1 = new JLabel(); jPanel4.add(jLabel1, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("lbs");
ComboModel weightUComboModel = new ComboModel(); weightUComboModel.setList(new Quantity().getListofUnits("weight")); weightUComboModel.addOrInsert(myRecipe.getMaltUnits()); weightUCombo = new JComboBox(); jPanel4.add(weightUCombo, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); weightUCombo.setModel(weightUComboModel);
private void initGUI() { try { this.setTitle("Malt Percent"); TableModel maltTableModel = new MaltPercentTableModel(); jPanel5 = new JPanel(); BoxLayout jPanel5Layout = new BoxLayout(jPanel5, javax.swing.BoxLayout.Y_AXIS); jPanel5.setLayout(jPanel5Layout); getContentPane().add(jPanel5, BorderLayout.CENTER); jPanel3 = new JPanel(); jPanel5.add(jPanel3); BoxLayout jPanel3Layout = new BoxLayout(jPanel3, javax.swing.BoxLayout.Y_AXIS); jPanel3.setLayout(jPanel3Layout); jPanel1 = new JScrollPane(); jPanel3.add(jPanel1); jPanel1.setPreferredSize(new java.awt.Dimension(392, 252)); jPanel1.setBorder(BorderFactory.createTitledBorder("Fermentables")); jPanel4 = new JPanel(); GridBagLayout jPanel4Layout = new GridBagLayout(); jPanel4Layout.rowWeights = new double[] {0.1, 0.1, 0.1, 0.1}; jPanel4Layout.rowHeights = new int[] {7, 7, 7, 7}; jPanel4Layout.columnWeights = new double[] {0.1, 0.2, 0.1, 0.1}; jPanel4Layout.columnWidths = new int[] {5, 9, 7, 7}; jPanel4.setLayout(jPanel4Layout); jPanel3.add(jPanel4); weightBtn = new JRadioButton("Target weight:"); jPanel4.add(weightBtn, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); bg.add(weightBtn); weightBtn.setSelected(true); weightSpn = new JSpinner(); jPanel4.add(weightSpn, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); // SpinnerListModel weightSpnModel = new SpinnerListModel(new String[] { "Sun", "Mon", "Tue", // "Wed", "Thu", "Fri", "Sat" }); // weightSpn.setModel(weightSpnModel); weightSpn.setValue(new Double(myRecipe.getTotalMaltLbs())); OGBtn = new JRadioButton("Target OG:"); jPanel4.add(OGBtn, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); bg.add(OGBtn); OGSpn = new JSpinner(); SpinnerNumberModel OGSpnModel = new SpinnerNumberModel(1.000, 0.900, 2.000, 0.001); jPanel4.add(OGSpn, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); OGSpn.setModel(OGSpnModel); jLabel1 = new JLabel(); jPanel4.add(jLabel1, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("lbs"); OGSpn.setValue(new Double(myRecipe.getEstOg())); maltTable = new JTable(); jPanel1.setViewportView(maltTable); maltTable.setModel(maltTableModel); maltTable.setPreferredSize(new java.awt.Dimension(203, 84)); jPanel2 = new JPanel(); jPanel5.add(jPanel2); FlowLayout jPanel2Layout = new FlowLayout(); jPanel2Layout.setAlignment(FlowLayout.RIGHT); jPanel2.setLayout(jPanel2Layout); cancelBtn = new JButton(); jPanel2.add(cancelBtn); cancelBtn.setText("Cancel"); okBtn = new JButton(); jPanel2.add(okBtn); okBtn.setText("OK"); okBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { calcWeights(); setVisible(false); app.displayRecipe(); app.maltTable.updateUI(); dispose(); } }); cancelBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { setVisible(false); dispose(); } }); // jPanel1.add(maltTable, BorderLayout.CENTER); setSize(400, 300); } catch (Exception e) { e.printStackTrace(); } }
cmd.add(module);
cmd.addTokenized(module);
public boolean checkout(Build build, Launcher launcher, FilePath dir, BuildListener listener, File changelogFile) throws IOException { List<String> changedFiles = null; // files that were affected by update. null this is a check out if(canUseUpdate && isUpdatable(dir.getLocal())) { changedFiles = update(false,launcher,dir,listener); if(changedFiles==null) return false; // failed } else { dir.deleteContents(); ArgumentListBuilder cmd = new ArgumentListBuilder(); cmd.add("cvs","-Q","-z9","-d",cvsroot,"co"); if(branch!=null) cmd.add("-r",branch); if(flatten) cmd.add("-d",dir.getName()); cmd.add(module); if(!run(launcher,cmd,listener, flatten ? dir.getParent() : dir)) return false; } // archive the workspace to support later tagging // TODO: doing this partially remotely would be faster File archiveFile = getArchiveFile(build); ZipOutputStream zos = new ZipOutputStream(archiveFile); if(flatten) { archive(build.getProject().getWorkspace().getLocal(), module, zos); } else { StringTokenizer tokens = new StringTokenizer(module); while(tokens.hasMoreTokens()) { String m = tokens.nextToken(); archive(new File(build.getProject().getWorkspace().getLocal(),m),m,zos); } } zos.close(); // contribute the tag action build.getActions().add(new TagAction(build)); return calcChangeLog(build, changedFiles, changelogFile, listener); }
else {
public Node differentiate(ASTFunNode node,String var,Node [] children,Node [] dchildren,DJep djep) throws ParseException { OperatorSet opset = djep.getOperatorSet(); NodeFactory nf = djep.getNodeFactory(); Operator op = opset.getMultiply(); if(mulOp!=null) op = mulOp; int nchild = node.jjtGetNumChildren(); if(nchild==2) return nf.buildOperatorNode(opset.getAdd(), nf.buildOperatorNode(op, dchildren[0], djep.deepCopy(children[1])), nf.buildOperatorNode(op, djep.deepCopy(children[0]), dchildren[1])); else { Node sums[] = new Node[nchild]; for(int i=0;i<nchild;++i) { Node terms[] = new Node[nchild]; for(int j=0;j<nchild;++j) terms[j] = children[j]; terms[i] = dchildren[i]; sums[i] = nf.buildOperatorNode(op,terms); } Node res = nf.buildOperatorNode(opset.getAdd(),sums); return res; } //throw new ParseException("Too many children "+nchild+" for "+node+"\n"); }
}
public Node differentiate(ASTFunNode node,String var,Node [] children,Node [] dchildren,DJep djep) throws ParseException { OperatorSet opset = djep.getOperatorSet(); NodeFactory nf = djep.getNodeFactory(); Operator op = opset.getMultiply(); if(mulOp!=null) op = mulOp; int nchild = node.jjtGetNumChildren(); if(nchild==2) return nf.buildOperatorNode(opset.getAdd(), nf.buildOperatorNode(op, dchildren[0], djep.deepCopy(children[1])), nf.buildOperatorNode(op, djep.deepCopy(children[0]), dchildren[1])); else { Node sums[] = new Node[nchild]; for(int i=0;i<nchild;++i) { Node terms[] = new Node[nchild]; for(int j=0;j<nchild;++j) terms[j] = children[j]; terms[i] = dchildren[i]; sums[i] = nf.buildOperatorNode(op,terms); } Node res = nf.buildOperatorNode(opset.getAdd(),sums); return res; } //throw new ParseException("Too many children "+nchild+" for "+node+"\n"); }
j.dv.addStandardDiffRules();
j.addStandardDiffRules();
protected void setUp() { j = new MatrixJep(); j.addStandardConstants(); j.addStandardFunctions(); j.addComplex(); //j.setTraverse(true); j.setAllowAssignment(true); j.setAllowUndeclared(true); j.setImplicitMul(true); j.dv.addStandardDiffRules(); }
String res = j.pv.toString(simp);
String res = j.toString(simp);
public void simplifyTest(String expr,String expected) throws ParseException { Node node = j.parse(expr); MatrixNodeI matEqn = j.dec.preprocess(node,j); Node simp = j.simplify(matEqn); String res = j.pv.toString(simp); Node node2 = j.parse(expected); MatrixNodeI matEqn2 = j.dec.preprocess(node2,j); Node simp2 = j.simplify(matEqn2); String res2 = j.pv.toString(simp2); if(!res2.equals(res)) System.out.println("Error: Value of \""+expr+"\" is \""+res+"\" should be \""+res2+"\""); assertEquals("<"+expr+">",res2,res); System.out.println("Sucess: Value of \""+expr+"\" is \""+res+"\""); // System.out.print("Full Brackets:\t");// j.pv.setFullBrackets(true);// j.pv.println(simp);// j.pv.setFullBrackets(false); }
String res2 = j.pv.toString(simp2);
String res2 = j.toString(simp2);
public void simplifyTest(String expr,String expected) throws ParseException { Node node = j.parse(expr); MatrixNodeI matEqn = j.dec.preprocess(node,j); Node simp = j.simplify(matEqn); String res = j.pv.toString(simp); Node node2 = j.parse(expected); MatrixNodeI matEqn2 = j.dec.preprocess(node2,j); Node simp2 = j.simplify(matEqn2); String res2 = j.pv.toString(simp2); if(!res2.equals(res)) System.out.println("Error: Value of \""+expr+"\" is \""+res+"\" should be \""+res2+"\""); assertEquals("<"+expr+">",res2,res); System.out.println("Sucess: Value of \""+expr+"\" is \""+res+"\""); // System.out.print("Full Brackets:\t");// j.pv.setFullBrackets(true);// j.pv.println(simp);// j.pv.setFullBrackets(false); }
String res = j.pv.toString(matEqn);
String res = j.toString(matEqn);
public void simplifyTestString(String expr,String expected) throws ParseException { Node node = j.parse(expr); MatrixNodeI matEqn = j.dec.preprocess(node,j); String res = j.pv.toString(matEqn); if(!expected.equals(res)) System.out.println("Error: Value of \""+expr+"\" is \""+res+"\" should be \""+expected+"\""); assertEquals("<"+expr+">",expected,res); System.out.println("Sucess: Value of \""+expr+"\" is \""+res+"\""); // System.out.print("Full Brackets:\t");// j.pv.setFullBrackets(true);// j.pv.println(simp);// j.pv.setFullBrackets(false); }
stat.executeUpdate("create temp table testobj ("
stat.executeUpdate("create table testobj ("
@Test public void getObject() throws SQLException { stat.executeUpdate("create temp table testobj (" + "c1 integer, c2 float, c3, c4 varchar, c5 bit, c6, c7);"); PreparedStatement prep = conn.prepareStatement( "insert into testobj values (?,?,?,?,?,?,?);"); prep.setInt (1, Integer.MAX_VALUE); prep.setFloat (2, Float.MAX_VALUE); prep.setDouble (3, Double.MAX_VALUE); prep.setLong (4, Long.MAX_VALUE); prep.setBoolean(5, false); prep.setByte (6, (byte)7); prep.setBytes (7, b1); prep.executeUpdate(); ResultSet rs = stat.executeQuery( "select c1,c2,c3,c4,c5,c6,c7 from testobj;"); assertTrue(rs.next()); assertEquals(rs.getInt(1), Integer.MAX_VALUE); assertEquals(rs.getFloat(2), Float.MAX_VALUE); assertEquals(rs.getDouble(3), Double.MAX_VALUE); assertEquals(rs.getLong(4), Long.MAX_VALUE); assertFalse(rs.getBoolean(5)); assertEquals(rs.getByte(6), (byte)7); assertArrayEq(rs.getBytes(7), b1); assertNotNull(rs.getObject(1)); assertNotNull(rs.getObject(2)); assertNotNull(rs.getObject(3)); assertNotNull(rs.getObject(4)); assertNotNull(rs.getObject(5)); assertNotNull(rs.getObject(6)); assertNotNull(rs.getObject(7)); assertTrue(rs.getObject(1) instanceof Integer); assertTrue(rs.getObject(2) instanceof Double); assertTrue(rs.getObject(3) instanceof Double); assertTrue(rs.getObject(4) instanceof String); assertTrue(rs.getObject(5) instanceof Integer); assertTrue(rs.getObject(6) instanceof Integer); assertTrue(rs.getObject(7) instanceof byte[]); rs.close(); }
stat.executeUpdate("create temp table in1000 (a);");
stat.executeUpdate("create table in1000 (a);");
@Test public void insert1000() throws SQLException { stat.executeUpdate("create temp table in1000 (a);"); PreparedStatement prep = conn.prepareStatement( "insert into in1000 values (?);"); conn.setAutoCommit(false); for (int i=0; i < 1000; i++) { prep.setInt(1, i); prep.executeUpdate(); } conn.commit(); ResultSet rs = stat.executeQuery("select count(a) from in1000;"); assertTrue(rs.next()); assertEquals(rs.getInt(1), 1000); rs.close(); }
double bugu = myRecipe.getIbu() / (myRecipe.getEstOg() - 1) * 1000; ogbuLbl.setText("" + SBStringUtils.format(bugu, 1));
ogbuLbl.setText("" + SBStringUtils.format(myRecipe.getBUGU(), 1));
public void setStyleData(){ Style s = (Style) cmbStyle2Model.getSelectedItem(); // descriptionTextArea.setText(s.getDescription()); // cmbStyle2.setToolTipText(multiLineToolTip(50,s.getDescription())); stlLowOG.setText(SBStringUtils.format(s.ogLow, 3)); stlRcpOG.setText(SBStringUtils.format(myRecipe.getEstOg(), 3)); stlHighOG.setText(SBStringUtils.format(s.ogHigh, 3)); stlLowABV.setText(SBStringUtils.format(s.alcLow, 1)); stlRcpABV.setText(SBStringUtils.format(myRecipe.getAlcohol(), 1)); stlHighABV.setText(SBStringUtils.format(s.alcHigh, 1)); stlLowColour.setText(SBStringUtils.format(s.srmLow, 1)); stlRcpColour.setText(SBStringUtils.format(myRecipe.getSrm(), 1)); stlHighColour.setText(SBStringUtils.format(s.srmHigh, 1)); stlLowIBU.setText(SBStringUtils.format(s.ibuLow, 1)); stlRcpIBU.setText(SBStringUtils.format(myRecipe.getIbu(), 1)); stlHighIBU.setText(SBStringUtils.format(s.ibuHigh, 1)); double bugu = myRecipe.getIbu() / (myRecipe.getEstOg() - 1) * 1000; ogbuLbl.setText("" + SBStringUtils.format(bugu, 1)); checkStyleConformance(); txaStyles.setText(getStyleMatches()); }
TestResultAction action = new TestResultAction(build, fs.getDirectoryScanner(p), listener);
if(ds.getIncludedFiles().length==0) { listener.getLogger().println("No test report files wer efound. Configuration error?"); build.setResult(Result.FAILURE); } TestResultAction action = new TestResultAction(build, ds, listener);
public boolean perform(Build build, Launcher launcher, BuildListener listener) { FileSet fs = new FileSet(); Project p = new Project(); fs.setProject(p); fs.setDir(build.getProject().getWorkspace().getLocal()); fs.setIncludes(testResults); TestResultAction action = new TestResultAction(build, fs.getDirectoryScanner(p), listener); build.getActions().add(action); TestResult r = action.getResult(); if(r.getPassCount()==0 && r.getFailCount()==0) { listener.getLogger().println("No test report is found. Configuration error?"); // no test result. Most likely a configuration error or fatal problem build.setResult(Result.FAILURE); } if(r.getFailCount()>0) build.setResult(Result.UNSTABLE); return true; }
listener.getLogger().println("No test report is found. Configuration error?");
listener.getLogger().println("Test reports were found but none of them are new. Did tests run?");
public boolean perform(Build build, Launcher launcher, BuildListener listener) { FileSet fs = new FileSet(); Project p = new Project(); fs.setProject(p); fs.setDir(build.getProject().getWorkspace().getLocal()); fs.setIncludes(testResults); TestResultAction action = new TestResultAction(build, fs.getDirectoryScanner(p), listener); build.getActions().add(action); TestResult r = action.getResult(); if(r.getPassCount()==0 && r.getFailCount()==0) { listener.getLogger().println("No test report is found. Configuration error?"); // no test result. Most likely a configuration error or fatal problem build.setResult(Result.FAILURE); } if(r.getFailCount()>0) build.setResult(Result.UNSTABLE); return true; }
return isFolder?"folder.png":"text.png";
return isFolder?"folder.gif":"text.gif";
public String getIconName() { return isFolder?"folder.png":"text.png"; }
if(state!=State.COMPLETED) return null;
public final Result getResult() { if(state!=State.COMPLETED) return null; return result; }
&& ( ((ASTConstant) node).getValue() instanceof Number );
&& ( ((ASTConstant) node).getValue() instanceof Double );
public boolean isReal(Node node) { return (node instanceof ASTConstant) && ( ((ASTConstant) node).getValue() instanceof Number ); }
Trigger.init();
public void contextInitialized(ServletContextEvent event) { File home = getHomeDir(event); home.mkdirs(); System.out.println("hudson home directory: "+home); try { event.getServletContext().setAttribute("app",new Hudson(home)); } catch( IOException e ) { throw new Error(e); } new PluginManager(event.getServletContext()); // set the version Properties props = new Properties(); try { InputStream is = getClass().getResourceAsStream("hudson-version.properties"); if(is!=null) props.load(is); } catch (IOException e) { e.printStackTrace(); // if the version properties is missing, that's OK. } Object ver = props.get("version"); if(ver==null) ver="?"; event.getServletContext().setAttribute("version",ver); }
public void fireDownloadFileChanged( SWDownloadFile file )
private void fireDownloadFileChanged( final int position )
public void fireDownloadFileChanged( SWDownloadFile file ) { int position = downloadList.indexOf( file ); if ( position >= 0 ) { fireDownloadFileChanged( position ); } }
int position = downloadList.indexOf( file ); if ( position >= 0 )
AsynchronousDispatcher.invokeLater( new Runnable()
public void fireDownloadFileChanged( SWDownloadFile file ) { int position = downloadList.indexOf( file ); if ( position >= 0 ) { fireDownloadFileChanged( position ); } }
fireDownloadFileChanged( position ); }
public void run() { Object[] listeners = listenerList.toArray(); DownloadFilesChangeListener listener; for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (DownloadFilesChangeListener)listeners[ i ]; listener.downloadFileChanged( position ); } } });
public void fireDownloadFileChanged( SWDownloadFile file ) { int position = downloadList.indexOf( file ); if ( position >= 0 ) { fireDownloadFileChanged( position ); } }
public void run(Stack inStack) throws ParseException { if (null == inStack) {
public void run(Stack stack) throws ParseException { if (null == stack) {
public void run(Stack inStack) throws ParseException { /* Check if stack is null */ if (null == inStack) { throw new ParseException("Stack argument null"); } Object param = null; double r = 0; while(!inStack.isEmpty()) { // get the parameter from the stack param = inStack.pop(); if (param instanceof Double) { // calculate the result r += ((Double) param).doubleValue(); } else throw new ParseException("Invalid parameter type"); } // push the result on the inStack inStack.push(new Double(r)); }
double r = 0; while(!inStack.isEmpty()) {
double result = 0; int i = 0; while (i < curNumberOfParameters) {
public void run(Stack inStack) throws ParseException { /* Check if stack is null */ if (null == inStack) { throw new ParseException("Stack argument null"); } Object param = null; double r = 0; while(!inStack.isEmpty()) { // get the parameter from the stack param = inStack.pop(); if (param instanceof Double) { // calculate the result r += ((Double) param).doubleValue(); } else throw new ParseException("Invalid parameter type"); } // push the result on the inStack inStack.push(new Double(r)); }
param = inStack.pop();
param = stack.pop();
public void run(Stack inStack) throws ParseException { /* Check if stack is null */ if (null == inStack) { throw new ParseException("Stack argument null"); } Object param = null; double r = 0; while(!inStack.isEmpty()) { // get the parameter from the stack param = inStack.pop(); if (param instanceof Double) { // calculate the result r += ((Double) param).doubleValue(); } else throw new ParseException("Invalid parameter type"); } // push the result on the inStack inStack.push(new Double(r)); }
r += ((Double) param).doubleValue();
result += ((Double) param).doubleValue(); } else { throw new ParseException("Invalid parameter type");
public void run(Stack inStack) throws ParseException { /* Check if stack is null */ if (null == inStack) { throw new ParseException("Stack argument null"); } Object param = null; double r = 0; while(!inStack.isEmpty()) { // get the parameter from the stack param = inStack.pop(); if (param instanceof Double) { // calculate the result r += ((Double) param).doubleValue(); } else throw new ParseException("Invalid parameter type"); } // push the result on the inStack inStack.push(new Double(r)); }
else throw new ParseException("Invalid parameter type");
i++;
public void run(Stack inStack) throws ParseException { /* Check if stack is null */ if (null == inStack) { throw new ParseException("Stack argument null"); } Object param = null; double r = 0; while(!inStack.isEmpty()) { // get the parameter from the stack param = inStack.pop(); if (param instanceof Double) { // calculate the result r += ((Double) param).doubleValue(); } else throw new ParseException("Invalid parameter type"); } // push the result on the inStack inStack.push(new Double(r)); }
inStack.push(new Double(r));
stack.push(new Double(result));
public void run(Stack inStack) throws ParseException { /* Check if stack is null */ if (null == inStack) { throw new ParseException("Stack argument null"); } Object param = null; double r = 0; while(!inStack.isEmpty()) { // get the parameter from the stack param = inStack.pop(); if (param instanceof Double) { // calculate the result r += ((Double) param).doubleValue(); } else throw new ParseException("Invalid parameter type"); } // push the result on the inStack inStack.push(new Double(r)); }
if (logger.isDebugEnabled()) { logger.debug("Persisted "+userGroup); } } else { if (logger.isDebugEnabled()) { logger.debug("Retrieved "+userGroup); }
public UserGroup findOrCreateUserGroup(Entity entity, String groupName) { Identity groupIdentity = authenticationDao.findIdentityByPrincipal(groupName); if (groupIdentity==null) { groupIdentity = AuthenticationCreator.identityFactory(groupName, groupName); groupIdentity.setIdentityType(IdentityType.GROUP.getValue()); authenticationDao.persistIdentity(groupIdentity); } UserGroup userGroup = authorizationDao.findUserGroupByNaturalId(entity, groupIdentity); if (userGroup==null) { userGroup = AuthorizationCreator.userGroupFactory(entity, groupIdentity); authorizationDao.persistUserGroup(userGroup); } return userGroup; }
private Dimensions() {};
private Dimensions() {}
private Dimensions() {};
private Complex parseNextLine(BufferedReader reader) { Complex value;
private Object parseNextLine(BufferedReader reader) throws Exception { Object value;
private Complex parseNextLine(BufferedReader reader) { Complex value; String line, errorStr; // cycle till a valid line is found do { try { line = reader.readLine(); lineCount++; } catch (Exception e) { return null; } if (line==null) return null; } while (line.length()==0 || line.trim().charAt(0)=='#'); // parse the expression myParser.parseExpression(line); // did an error occur while parsing? errorStr = myParser.getErrorInfo(); if (errorStr != null) { println("Error while parsing line " + lineCount + ": " + errorStr); return null; } // evaluate the expression value = myParser.getComplexValue(); // did an error occur while evaluating? errorStr = myParser.getErrorInfo(); if ((value == null) || (errorStr != null)) { println("Error while evaluating line " + lineCount + ": " + errorStr); return null; } return value; }
try { line = reader.readLine(); lineCount++; } catch (Exception e) { return null; }
line = reader.readLine(); lineCount++; if (line == null) return null; } while (line.length() == 0 || line.trim().charAt(0) == '#');
private Complex parseNextLine(BufferedReader reader) { Complex value; String line, errorStr; // cycle till a valid line is found do { try { line = reader.readLine(); lineCount++; } catch (Exception e) { return null; } if (line==null) return null; } while (line.length()==0 || line.trim().charAt(0)=='#'); // parse the expression myParser.parseExpression(line); // did an error occur while parsing? errorStr = myParser.getErrorInfo(); if (errorStr != null) { println("Error while parsing line " + lineCount + ": " + errorStr); return null; } // evaluate the expression value = myParser.getComplexValue(); // did an error occur while evaluating? errorStr = myParser.getErrorInfo(); if ((value == null) || (errorStr != null)) { println("Error while evaluating line " + lineCount + ": " + errorStr); return null; } return value; }
if (line==null) return null; } while (line.length()==0 || line.trim().charAt(0)=='#');
private Complex parseNextLine(BufferedReader reader) { Complex value; String line, errorStr; // cycle till a valid line is found do { try { line = reader.readLine(); lineCount++; } catch (Exception e) { return null; } if (line==null) return null; } while (line.length()==0 || line.trim().charAt(0)=='#'); // parse the expression myParser.parseExpression(line); // did an error occur while parsing? errorStr = myParser.getErrorInfo(); if (errorStr != null) { println("Error while parsing line " + lineCount + ": " + errorStr); return null; } // evaluate the expression value = myParser.getComplexValue(); // did an error occur while evaluating? errorStr = myParser.getErrorInfo(); if ((value == null) || (errorStr != null)) { println("Error while evaluating line " + lineCount + ": " + errorStr); return null; } return value; }
errorStr = myParser.getErrorInfo(); if (errorStr != null) { println("Error while parsing line " + lineCount + ": " + errorStr); return null;
if (myParser.hasError()) { errorStr = myParser.getErrorInfo(); throw new Exception("Error while parsing line " + lineCount + ": " + errorStr);
private Complex parseNextLine(BufferedReader reader) { Complex value; String line, errorStr; // cycle till a valid line is found do { try { line = reader.readLine(); lineCount++; } catch (Exception e) { return null; } if (line==null) return null; } while (line.length()==0 || line.trim().charAt(0)=='#'); // parse the expression myParser.parseExpression(line); // did an error occur while parsing? errorStr = myParser.getErrorInfo(); if (errorStr != null) { println("Error while parsing line " + lineCount + ": " + errorStr); return null; } // evaluate the expression value = myParser.getComplexValue(); // did an error occur while evaluating? errorStr = myParser.getErrorInfo(); if ((value == null) || (errorStr != null)) { println("Error while evaluating line " + lineCount + ": " + errorStr); return null; } return value; }
value = myParser.getComplexValue();
value = myParser.getValueAsObject();
private Complex parseNextLine(BufferedReader reader) { Complex value; String line, errorStr; // cycle till a valid line is found do { try { line = reader.readLine(); lineCount++; } catch (Exception e) { return null; } if (line==null) return null; } while (line.length()==0 || line.trim().charAt(0)=='#'); // parse the expression myParser.parseExpression(line); // did an error occur while parsing? errorStr = myParser.getErrorInfo(); if (errorStr != null) { println("Error while parsing line " + lineCount + ": " + errorStr); return null; } // evaluate the expression value = myParser.getComplexValue(); // did an error occur while evaluating? errorStr = myParser.getErrorInfo(); if ((value == null) || (errorStr != null)) { println("Error while evaluating line " + lineCount + ": " + errorStr); return null; } return value; }
errorStr = myParser.getErrorInfo(); if ((value == null) || (errorStr != null)) { println("Error while evaluating line " + lineCount + ": " + errorStr); return null;
if (value == null || myParser.hasError()) { errorStr = myParser.getErrorInfo(); throw new Exception("Error while evaluating line " + lineCount + ": " + errorStr);
private Complex parseNextLine(BufferedReader reader) { Complex value; String line, errorStr; // cycle till a valid line is found do { try { line = reader.readLine(); lineCount++; } catch (Exception e) { return null; } if (line==null) return null; } while (line.length()==0 || line.trim().charAt(0)=='#'); // parse the expression myParser.parseExpression(line); // did an error occur while parsing? errorStr = myParser.getErrorInfo(); if (errorStr != null) { println("Error while parsing line " + lineCount + ": " + errorStr); return null; } // evaluate the expression value = myParser.getComplexValue(); // did an error occur while evaluating? errorStr = myParser.getErrorInfo(); if ((value == null) || (errorStr != null)) { println("Error while evaluating line " + lineCount + ": " + errorStr); return null; } return value; }
Complex c1, c2;
Object v1, v2;
public void run(String fileName) { BufferedReader reader; Complex c1, c2; boolean hasError = false; // Load the input file try { reader = new BufferedReader(new FileReader(fileName)); } catch (Exception e) { println("File \""+fileName+"\" not found"); return; } // reset the line count lineCount = 0; // cycle through the expressions in pairs of two println("Evaluating and comparing expressions..."); while (true) { // get values of a pair of two lines c1 = parseNextLine(reader); c2 = parseNextLine(reader); if (c1==null || c2==null) break; // TODO: add comparison method that handles all types (Strings...) if (!c1.equals(c2,1e-15)) { hasError = true; print("Line: " + lineCount + ": "); if (c1.im() == 0) print("" + c1.re() + " != "); else print("" + c1 + " != "); if (c2.im() == 0) println("" + c2.re()); else println("" + c2); } } if (!hasError) { print("\n" + lineCount + " lines processed. No errors were found.\n\n"); } }
c1 = parseNextLine(reader); c2 = parseNextLine(reader);
try { v1 = parseNextLine(reader); v2 = parseNextLine(reader); } catch (Exception e) { println(e.getMessage()); hasError = true; break; }
public void run(String fileName) { BufferedReader reader; Complex c1, c2; boolean hasError = false; // Load the input file try { reader = new BufferedReader(new FileReader(fileName)); } catch (Exception e) { println("File \""+fileName+"\" not found"); return; } // reset the line count lineCount = 0; // cycle through the expressions in pairs of two println("Evaluating and comparing expressions..."); while (true) { // get values of a pair of two lines c1 = parseNextLine(reader); c2 = parseNextLine(reader); if (c1==null || c2==null) break; // TODO: add comparison method that handles all types (Strings...) if (!c1.equals(c2,1e-15)) { hasError = true; print("Line: " + lineCount + ": "); if (c1.im() == 0) print("" + c1.re() + " != "); else print("" + c1 + " != "); if (c2.im() == 0) println("" + c2.re()); else println("" + c2); } } if (!hasError) { print("\n" + lineCount + " lines processed. No errors were found.\n\n"); } }
if (c1==null || c2==null) break; if (!c1.equals(c2,1e-15)) {
if (v1 == null || v2 == null) { println("Reached end of file."); break; } try { if (!equal(v1, v2)) { hasError = true; print("Line: " + lineCount + ": "); println(v1.toString() + " != " + v2.toString()); } } catch (Exception e) {
public void run(String fileName) { BufferedReader reader; Complex c1, c2; boolean hasError = false; // Load the input file try { reader = new BufferedReader(new FileReader(fileName)); } catch (Exception e) { println("File \""+fileName+"\" not found"); return; } // reset the line count lineCount = 0; // cycle through the expressions in pairs of two println("Evaluating and comparing expressions..."); while (true) { // get values of a pair of two lines c1 = parseNextLine(reader); c2 = parseNextLine(reader); if (c1==null || c2==null) break; // TODO: add comparison method that handles all types (Strings...) if (!c1.equals(c2,1e-15)) { hasError = true; print("Line: " + lineCount + ": "); if (c1.im() == 0) print("" + c1.re() + " != "); else print("" + c1 + " != "); if (c2.im() == 0) println("" + c2.re()); else println("" + c2); } } if (!hasError) { print("\n" + lineCount + " lines processed. No errors were found.\n\n"); } }
print("Line: " + lineCount + ": "); if (c1.im() == 0) print("" + c1.re() + " != "); else print("" + c1 + " != "); if (c2.im() == 0) println("" + c2.re()); else println("" + c2);
println(e.getMessage());
public void run(String fileName) { BufferedReader reader; Complex c1, c2; boolean hasError = false; // Load the input file try { reader = new BufferedReader(new FileReader(fileName)); } catch (Exception e) { println("File \""+fileName+"\" not found"); return; } // reset the line count lineCount = 0; // cycle through the expressions in pairs of two println("Evaluating and comparing expressions..."); while (true) { // get values of a pair of two lines c1 = parseNextLine(reader); c2 = parseNextLine(reader); if (c1==null || c2==null) break; // TODO: add comparison method that handles all types (Strings...) if (!c1.equals(c2,1e-15)) { hasError = true; print("Line: " + lineCount + ": "); if (c1.im() == 0) print("" + c1.re() + " != "); else print("" + c1 + " != "); if (c2.im() == 0) println("" + c2.re()); else println("" + c2); } } if (!hasError) { print("\n" + lineCount + " lines processed. No errors were found.\n\n"); } }
if (!hasError) { print("\n" + lineCount + " lines processed. No errors were found.\n\n");
print("\n" + lineCount + " lines processed. "); if (hasError) { print("Errors were found.\n\n"); } else { print("No errors were found.\n\n");
public void run(String fileName) { BufferedReader reader; Complex c1, c2; boolean hasError = false; // Load the input file try { reader = new BufferedReader(new FileReader(fileName)); } catch (Exception e) { println("File \""+fileName+"\" not found"); return; } // reset the line count lineCount = 0; // cycle through the expressions in pairs of two println("Evaluating and comparing expressions..."); while (true) { // get values of a pair of two lines c1 = parseNextLine(reader); c2 = parseNextLine(reader); if (c1==null || c2==null) break; // TODO: add comparison method that handles all types (Strings...) if (!c1.equals(c2,1e-15)) { hasError = true; print("Line: " + lineCount + ": "); if (c1.im() == 0) print("" + c1.re() + " != "); else print("" + c1 + " != "); if (c2.im() == 0) println("" + c2.re()); else println("" + c2); } } if (!hasError) { print("\n" + lineCount + " lines processed. No errors were found.\n\n"); } }
sitMap.clear(); chanMap.clear();
public void setChannels(String netCode, String stationCode) { NetworkAccess netAccess = (edu.iris.Fissures.IfNetwork.NetworkAccess) netMap.get(netCode); Station station = (edu.iris.Fissures.IfNetwork.Station) staMap.get(stationCode); Channel[] allChannels = netAccess.retrieve_for_station(station.get_id()); for (int i=0; i<allChannels.length; i++) { edu.iris.Fissures.IfNetwork.Site thesite = allChannels[i].my_site; edu.iris.Fissures.IfNetwork.SiteId thesiteid = thesite.get_id(); String siteCode = thesiteid .site_code; sitMap.put(siteCode, thesite); edu.iris.Fissures.IfNetwork.ChannelId thechannelid = allChannels[i].get_id(); String channelCode = thechannelid.channel_code; chanMap.put(channelCode, allChannels[i]); } TreeSet sitTree = new TreeSet(sitMap.keySet()); sites = (String[])sitTree.toArray(new String[0]); TreeSet chaTree = new TreeSet(chanMap.keySet()); channels = (String[])chaTree.toArray(new String[0]); }
staMap.clear();
public void setStations(String netcode) { edu.iris.Fissures.IfNetwork.NetworkAccess netAccess = (edu.iris.Fissures.IfNetwork.NetworkAccess) netMap.get(netcode); edu.iris.Fissures.IfNetwork.Station[] allstations = netAccess.retrieve_stations(); Set staSet = new HashSet(); for (int i=0; i < allstations.length; i++) { StationId id = allstations[i].get_id(); String stationCode = id.station_code; NetworkAttr attr = netAccess.get_attributes(); staMap.put(stationCode, allstations[i]); staSet.add(stationCode);// maybe needs station_id } TreeSet staTree = new TreeSet(staSet); stations = (String[])staTree.toArray(new String[0]); // add to station JList }
return node.getNodeName();
return getNode().getNodeName();
public String getDisplayName() { return node.getNodeName(); }
if(p.getAssignedNode()==node)
if(p.getAssignedNode()==getNode())
public List<Project> getTiedJobs() { List<Project> r = new ArrayList<Project>(); for( Job j : Hudson.getInstance().getJobs() ) { if (j instanceof Project) { Project p = (Project) j; if(p.getAssignedNode()==node) r.add(p); } } return r; }
req.setCharacterEncoding("UTF-8");
public synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { if(!Hudson.adminCheck(req,rsp)) return; description = req.getParameter("description"); if(req.getParameter("logrotate")!=null) logRotator = LogRotator.DESCRIPTOR.newInstance(req); else logRotator = null; save(); rsp.sendRedirect("."); }
private Date parseDate(final String date) { try { return c_inputDate.parse(date); } catch (ParseException e) { StringWriter w = new StringWriter(); w.write("Failed to parse "); w.write(date); w.write('\n'); e.printStackTrace(new PrintWriter(w)); owner.log(w.toString(), Project.MSG_ERR); return null;
private Date parseDate(String date) { for (SimpleDateFormat df : c_inputDate) { try { return df.parse(date); } catch (ParseException e) { }
private Date parseDate(final String date) { try { return c_inputDate.parse(date); } catch (ParseException e) { StringWriter w = new StringWriter(); w.write("Failed to parse "); w.write(date); w.write('\n'); e.printStackTrace(new PrintWriter(w)); owner.log(w.toString(), Project.MSG_ERR); //final String message = REZ.getString( "changelog.bat-date.error", date ); //getContext().error( message ); return null; } }
owner.log("Failed to parse "+date+"\n", Project.MSG_ERR); return null;
private Date parseDate(final String date) { try { return c_inputDate.parse(date); } catch (ParseException e) { StringWriter w = new StringWriter(); w.write("Failed to parse "); w.write(date); w.write('\n'); e.printStackTrace(new PrintWriter(w)); owner.log(w.toString(), Project.MSG_ERR); //final String message = REZ.getString( "changelog.bat-date.error", date ); //getContext().error( message ); return null; } }
ShapeType(String typeID, String name, boolean isSelected) {
ShapeType(String typeID, String name, String color, boolean isSelected) {
ShapeType(String typeID, String name, boolean isSelected) { this.typeID = typeID; this.name = name; this.isSelected = isSelected; }
this.color = color;
ShapeType(String typeID, String name, boolean isSelected) { this.typeID = typeID; this.name = name; this.isSelected = isSelected; }
swarmingMgr = SwarmingManager.getInstance();
public void run() { while ( !isShutingDown ) { try { writeDownloadData(); synchronized( this ) { wait( 5000 ); } } catch (Throwable th) { NLogger.error( DownloadDataWriter.class, th, th ); } } }
List<SWDownloadFile> downloadList = SwarmingManager.getInstance().getDownloadFileListCopy();
List<SWDownloadFile> downloadList = swarmingMgr.getDownloadFileListCopy();
private void writeDownloadData() { long totalBufferedSize = 0; boolean performCompleteWrite = false; if ( isShutingDown || lastCompleteWrite + DateUtils.MILLIS_PER_MINUTE < System.currentTimeMillis() ) { NLogger.debug(DownloadDataWriter.class, "Time for complete write cycle." ); performCompleteWrite = true; } List<SWDownloadFile> downloadList = SwarmingManager.getInstance().getDownloadFileListCopy(); ListIterator<SWDownloadFile> iterator = downloadList.listIterator(); while( iterator.hasNext() ) { SWDownloadFile downloadFile = iterator.next(); MemoryFile memoryFile = downloadFile.getMemoryFile(); long bufferedSize = memoryFile.getBufferedDataLength(); totalBufferedSize += bufferedSize; if ( performCompleteWrite || bufferedSize > ServiceManager.sCfg.maxWriteBufferPerDownload ) { NLogger.debug(DownloadDataWriter.class, "Trigger buffer write for " + downloadFile + ", amount: " + bufferedSize ); memoryFile.writeBuffersToDisk(); // remove from buffer since not needed anymore in possible // following complete write cycle iterator.remove(); } } NLogger.debug(DownloadDataWriter.class, "Total buffered data was: " + totalBufferedSize ); // if we have not already written everything but have a high total buffer // size we write down the complete download buffers to disk. if ( !performCompleteWrite && totalBufferedSize > ServiceManager.sCfg.maxTotalDownloadWriteBuffer ) { performCompleteWrite = true; iterator = downloadList.listIterator(); while( iterator.hasNext() ) { SWDownloadFile downloadFile = iterator.next(); MemoryFile memoryFile = downloadFile.getMemoryFile(); NLogger.debug(DownloadDataWriter.class, "Trigger buffer write for " + downloadFile + ", amount: " + memoryFile.getBufferedDataLength() ); memoryFile.writeBuffersToDisk(); } } if ( performCompleteWrite ) { lastCompleteWrite = System.currentTimeMillis(); } }
memoryFile.isBufferWritingRequested() ||
private void writeDownloadData() { long totalBufferedSize = 0; boolean performCompleteWrite = false; if ( isShutingDown || lastCompleteWrite + DateUtils.MILLIS_PER_MINUTE < System.currentTimeMillis() ) { NLogger.debug(DownloadDataWriter.class, "Time for complete write cycle." ); performCompleteWrite = true; } List<SWDownloadFile> downloadList = SwarmingManager.getInstance().getDownloadFileListCopy(); ListIterator<SWDownloadFile> iterator = downloadList.listIterator(); while( iterator.hasNext() ) { SWDownloadFile downloadFile = iterator.next(); MemoryFile memoryFile = downloadFile.getMemoryFile(); long bufferedSize = memoryFile.getBufferedDataLength(); totalBufferedSize += bufferedSize; if ( performCompleteWrite || bufferedSize > ServiceManager.sCfg.maxWriteBufferPerDownload ) { NLogger.debug(DownloadDataWriter.class, "Trigger buffer write for " + downloadFile + ", amount: " + bufferedSize ); memoryFile.writeBuffersToDisk(); // remove from buffer since not needed anymore in possible // following complete write cycle iterator.remove(); } } NLogger.debug(DownloadDataWriter.class, "Total buffered data was: " + totalBufferedSize ); // if we have not already written everything but have a high total buffer // size we write down the complete download buffers to disk. if ( !performCompleteWrite && totalBufferedSize > ServiceManager.sCfg.maxTotalDownloadWriteBuffer ) { performCompleteWrite = true; iterator = downloadList.listIterator(); while( iterator.hasNext() ) { SWDownloadFile downloadFile = iterator.next(); MemoryFile memoryFile = downloadFile.getMemoryFile(); NLogger.debug(DownloadDataWriter.class, "Trigger buffer write for " + downloadFile + ", amount: " + memoryFile.getBufferedDataLength() ); memoryFile.writeBuffersToDisk(); } } if ( performCompleteWrite ) { lastCompleteWrite = System.currentTimeMillis(); } }
if (!o.getClass().getName().endsWith("JTextField"))
if (!o.getClass().getName().endsWith("TextField"))
public void actionPerformed(ActionEvent e) { Object o = e.getSource(); String s = ""; // String t = ""; if (!o.getClass().getName().endsWith("JTextField")) return; s = ((JTextField) o).getText(); // t = s.replace(',','.'); // accept also european decimal komma if (o == txtName) myRecipe.setName(s); else if (o == brewerNameText) myRecipe.setBrewer(s); else if (o == txtPreBoil) { myRecipe.setPreBoil(Double.parseDouble(s)); displayRecipe(); } else if (o == postBoilText) { myRecipe.setPostBoil(Double.parseDouble(s)); displayRecipe(); } else if (o == evapText) { myRecipe.setEvap(Double.parseDouble(s)); displayRecipe(); } else if (o == boilMinText) { if( s.indexOf('.') > 0) { // parseInt doesn't like '.' or ',', so trim the string s = s.substring(0,s.indexOf('.')); } myRecipe.setBoilMinutes(Integer.parseInt(s)); displayRecipe(); } }
else if (o == txtPreBoil) {
else if (o == preBoilText) {
public void actionPerformed(ActionEvent e) { Object o = e.getSource(); String s = ""; // String t = ""; if (!o.getClass().getName().endsWith("JTextField")) return; s = ((JTextField) o).getText(); // t = s.replace(',','.'); // accept also european decimal komma if (o == txtName) myRecipe.setName(s); else if (o == brewerNameText) myRecipe.setBrewer(s); else if (o == txtPreBoil) { myRecipe.setPreBoil(Double.parseDouble(s)); displayRecipe(); } else if (o == postBoilText) { myRecipe.setPostBoil(Double.parseDouble(s)); displayRecipe(); } else if (o == evapText) { myRecipe.setEvap(Double.parseDouble(s)); displayRecipe(); } else if (o == boilMinText) { if( s.indexOf('.') > 0) { // parseInt doesn't like '.' or ',', so trim the string s = s.substring(0,s.indexOf('.')); } myRecipe.setBoilMinutes(Integer.parseInt(s)); displayRecipe(); } }
txtPreBoil.addFocusListener(this); txtPreBoil.addActionListener(this);
preBoilText.addFocusListener(this); preBoilText.addActionListener(this); postBoilText.addFocusListener(this); postBoilText.addActionListener(this);
private void addListeners(){ txtName.addActionListener(this); txtName.addFocusListener(this); brewerNameText.addFocusListener(this); brewerNameText.addActionListener(this); txtDate.addFocusListener(this); txtDate.addActionListener(this); txtPreBoil.addFocusListener(this); txtPreBoil.addActionListener(this); boilMinText.addFocusListener(this); boilMinText.addActionListener(this); evapText.addFocusListener(this); evapText.addActionListener(this); cmbStyle.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Style s = (Style) cmbStyleModel.getSelectedItem(); if (myRecipe != null && s != myRecipe.getStyleObj()) { myRecipe.setStyle(s); stylePanel.setStyle(s); } cmbStyle.setToolTipText(SBStringUtils.multiLineToolTip(50, s .getDescription())); } }); postBoilText.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { myRecipe.setPostBoil(Double.parseDouble(postBoilText.getText() .toString())); displayRecipe(); } }); postBoilText.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { myRecipe.setPostBoil(Double.parseDouble(postBoilText.getText() .toString())); displayRecipe(); } }); cmbYeast.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Yeast y = (Yeast) cmbYeastModel.getSelectedItem(); if (myRecipe != null && y != myRecipe.getYeastObj()) { myRecipe.setYeast(y); } String st = SBStringUtils.multiLineToolTip(40, y .getDescription()); cmbYeast.setToolTipText(st); } }); cmbSizeUnits.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String q = (String) cmbSizeUnits.getSelectedItem(); if (myRecipe != null && q != myRecipe.getVolUnits()) { // also sets postboil units: myRecipe.setVolUnits(q); displayRecipe(); } } }); alcMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); ibuMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); colourMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); evapMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); maltComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Fermentable f = (Fermentable) cmbMaltModel .getSelectedItem(); int i = maltTable.getSelectedRow(); if (myRecipe != null && i != -1 ) { Fermentable f2 = myRecipe.getFermentable(i); if (f2 != null){ f2.setLov(f.getLov()); f2.setPppg(f.getPppg()); f2.setDescription(f.getDescription()); f2.setMashed(f.getMashed()); f2.setSteep(f.getSteep()); f2.setCost(f.getCostPerU()); } } } }); maltUnitsComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String u = (String) cmbMaltUnitsModel.getSelectedItem(); int i = maltTable.getSelectedRow(); if (myRecipe != null && i != -1) { Fermentable f2 = myRecipe.getFermentable(i); if (f2 != null){ // this converts the cost and amount: f2.convertTo(u); myRecipe.calcMaltTotals(); displayRecipe(); } } } }); hopComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Hop h = (Hop) cmbHopsModel.getSelectedItem(); int i = hopsTable.getSelectedRow(); if (myRecipe != null && i != -1) { Hop h2 = myRecipe.getHop(i); h2.setAlpha(h.getAlpha()); h2.setDescription(h.getDescription()); h2.setCost(h.getCostPerU()); } } }); hopsUnitsComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String u = (String) cmbHopsUnitsModel.getSelectedItem(); int i = hopsTable.getSelectedRow(); if (myRecipe != null && i != -1) { Hop h = myRecipe.getHop(i); h.convertTo(u); myRecipe.calcHopsTotals(); // tblHops.updateUI(); displayRecipe(); } } }); }
postBoilText.addFocusListener(new FocusAdapter() {
/* postBoilText.addFocusListener(new FocusAdapter() {
private void addListeners(){ txtName.addActionListener(this); txtName.addFocusListener(this); brewerNameText.addFocusListener(this); brewerNameText.addActionListener(this); txtDate.addFocusListener(this); txtDate.addActionListener(this); txtPreBoil.addFocusListener(this); txtPreBoil.addActionListener(this); boilMinText.addFocusListener(this); boilMinText.addActionListener(this); evapText.addFocusListener(this); evapText.addActionListener(this); cmbStyle.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Style s = (Style) cmbStyleModel.getSelectedItem(); if (myRecipe != null && s != myRecipe.getStyleObj()) { myRecipe.setStyle(s); stylePanel.setStyle(s); } cmbStyle.setToolTipText(SBStringUtils.multiLineToolTip(50, s .getDescription())); } }); postBoilText.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { myRecipe.setPostBoil(Double.parseDouble(postBoilText.getText() .toString())); displayRecipe(); } }); postBoilText.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { myRecipe.setPostBoil(Double.parseDouble(postBoilText.getText() .toString())); displayRecipe(); } }); cmbYeast.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Yeast y = (Yeast) cmbYeastModel.getSelectedItem(); if (myRecipe != null && y != myRecipe.getYeastObj()) { myRecipe.setYeast(y); } String st = SBStringUtils.multiLineToolTip(40, y .getDescription()); cmbYeast.setToolTipText(st); } }); cmbSizeUnits.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String q = (String) cmbSizeUnits.getSelectedItem(); if (myRecipe != null && q != myRecipe.getVolUnits()) { // also sets postboil units: myRecipe.setVolUnits(q); displayRecipe(); } } }); alcMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); ibuMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); colourMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); evapMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); maltComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Fermentable f = (Fermentable) cmbMaltModel .getSelectedItem(); int i = maltTable.getSelectedRow(); if (myRecipe != null && i != -1 ) { Fermentable f2 = myRecipe.getFermentable(i); if (f2 != null){ f2.setLov(f.getLov()); f2.setPppg(f.getPppg()); f2.setDescription(f.getDescription()); f2.setMashed(f.getMashed()); f2.setSteep(f.getSteep()); f2.setCost(f.getCostPerU()); } } } }); maltUnitsComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String u = (String) cmbMaltUnitsModel.getSelectedItem(); int i = maltTable.getSelectedRow(); if (myRecipe != null && i != -1) { Fermentable f2 = myRecipe.getFermentable(i); if (f2 != null){ // this converts the cost and amount: f2.convertTo(u); myRecipe.calcMaltTotals(); displayRecipe(); } } } }); hopComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Hop h = (Hop) cmbHopsModel.getSelectedItem(); int i = hopsTable.getSelectedRow(); if (myRecipe != null && i != -1) { Hop h2 = myRecipe.getHop(i); h2.setAlpha(h.getAlpha()); h2.setDescription(h.getDescription()); h2.setCost(h.getCostPerU()); } } }); hopsUnitsComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String u = (String) cmbHopsUnitsModel.getSelectedItem(); int i = hopsTable.getSelectedRow(); if (myRecipe != null && i != -1) { Hop h = myRecipe.getHop(i); h.convertTo(u); myRecipe.calcHopsTotals(); // tblHops.updateUI(); displayRecipe(); } } }); }
}); postBoilText.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { myRecipe.setPostBoil(Double.parseDouble(postBoilText.getText() .toString()));
});*/
private void addListeners(){ txtName.addActionListener(this); txtName.addFocusListener(this); brewerNameText.addFocusListener(this); brewerNameText.addActionListener(this); txtDate.addFocusListener(this); txtDate.addActionListener(this); txtPreBoil.addFocusListener(this); txtPreBoil.addActionListener(this); boilMinText.addFocusListener(this); boilMinText.addActionListener(this); evapText.addFocusListener(this); evapText.addActionListener(this); cmbStyle.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Style s = (Style) cmbStyleModel.getSelectedItem(); if (myRecipe != null && s != myRecipe.getStyleObj()) { myRecipe.setStyle(s); stylePanel.setStyle(s); } cmbStyle.setToolTipText(SBStringUtils.multiLineToolTip(50, s .getDescription())); } }); postBoilText.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { myRecipe.setPostBoil(Double.parseDouble(postBoilText.getText() .toString())); displayRecipe(); } }); postBoilText.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { myRecipe.setPostBoil(Double.parseDouble(postBoilText.getText() .toString())); displayRecipe(); } }); cmbYeast.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Yeast y = (Yeast) cmbYeastModel.getSelectedItem(); if (myRecipe != null && y != myRecipe.getYeastObj()) { myRecipe.setYeast(y); } String st = SBStringUtils.multiLineToolTip(40, y .getDescription()); cmbYeast.setToolTipText(st); } }); cmbSizeUnits.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String q = (String) cmbSizeUnits.getSelectedItem(); if (myRecipe != null && q != myRecipe.getVolUnits()) { // also sets postboil units: myRecipe.setVolUnits(q); displayRecipe(); } } }); alcMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); ibuMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); colourMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); evapMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); maltComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Fermentable f = (Fermentable) cmbMaltModel .getSelectedItem(); int i = maltTable.getSelectedRow(); if (myRecipe != null && i != -1 ) { Fermentable f2 = myRecipe.getFermentable(i); if (f2 != null){ f2.setLov(f.getLov()); f2.setPppg(f.getPppg()); f2.setDescription(f.getDescription()); f2.setMashed(f.getMashed()); f2.setSteep(f.getSteep()); f2.setCost(f.getCostPerU()); } } } }); maltUnitsComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String u = (String) cmbMaltUnitsModel.getSelectedItem(); int i = maltTable.getSelectedRow(); if (myRecipe != null && i != -1) { Fermentable f2 = myRecipe.getFermentable(i); if (f2 != null){ // this converts the cost and amount: f2.convertTo(u); myRecipe.calcMaltTotals(); displayRecipe(); } } } }); hopComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Hop h = (Hop) cmbHopsModel.getSelectedItem(); int i = hopsTable.getSelectedRow(); if (myRecipe != null && i != -1) { Hop h2 = myRecipe.getHop(i); h2.setAlpha(h.getAlpha()); h2.setDescription(h.getDescription()); h2.setCost(h.getCostPerU()); } } }); hopsUnitsComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String u = (String) cmbHopsUnitsModel.getSelectedItem(); int i = hopsTable.getSelectedRow(); if (myRecipe != null && i != -1) { Hop h = myRecipe.getHop(i); h.convertTo(u); myRecipe.calcHopsTotals(); // tblHops.updateUI(); displayRecipe(); } } }); }
displayRecipe(); } });
private void addListeners(){ txtName.addActionListener(this); txtName.addFocusListener(this); brewerNameText.addFocusListener(this); brewerNameText.addActionListener(this); txtDate.addFocusListener(this); txtDate.addActionListener(this); txtPreBoil.addFocusListener(this); txtPreBoil.addActionListener(this); boilMinText.addFocusListener(this); boilMinText.addActionListener(this); evapText.addFocusListener(this); evapText.addActionListener(this); cmbStyle.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Style s = (Style) cmbStyleModel.getSelectedItem(); if (myRecipe != null && s != myRecipe.getStyleObj()) { myRecipe.setStyle(s); stylePanel.setStyle(s); } cmbStyle.setToolTipText(SBStringUtils.multiLineToolTip(50, s .getDescription())); } }); postBoilText.addFocusListener(new FocusAdapter() { public void focusLost(FocusEvent evt) { myRecipe.setPostBoil(Double.parseDouble(postBoilText.getText() .toString())); displayRecipe(); } }); postBoilText.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { myRecipe.setPostBoil(Double.parseDouble(postBoilText.getText() .toString())); displayRecipe(); } }); cmbYeast.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Yeast y = (Yeast) cmbYeastModel.getSelectedItem(); if (myRecipe != null && y != myRecipe.getYeastObj()) { myRecipe.setYeast(y); } String st = SBStringUtils.multiLineToolTip(40, y .getDescription()); cmbYeast.setToolTipText(st); } }); cmbSizeUnits.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String q = (String) cmbSizeUnits.getSelectedItem(); if (myRecipe != null && q != myRecipe.getVolUnits()) { // also sets postboil units: myRecipe.setVolUnits(q); displayRecipe(); } } }); alcMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); ibuMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); colourMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); evapMethodCombo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); } }); maltComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Fermentable f = (Fermentable) cmbMaltModel .getSelectedItem(); int i = maltTable.getSelectedRow(); if (myRecipe != null && i != -1 ) { Fermentable f2 = myRecipe.getFermentable(i); if (f2 != null){ f2.setLov(f.getLov()); f2.setPppg(f.getPppg()); f2.setDescription(f.getDescription()); f2.setMashed(f.getMashed()); f2.setSteep(f.getSteep()); f2.setCost(f.getCostPerU()); } } } }); maltUnitsComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String u = (String) cmbMaltUnitsModel.getSelectedItem(); int i = maltTable.getSelectedRow(); if (myRecipe != null && i != -1) { Fermentable f2 = myRecipe.getFermentable(i); if (f2 != null){ // this converts the cost and amount: f2.convertTo(u); myRecipe.calcMaltTotals(); displayRecipe(); } } } }); hopComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Hop h = (Hop) cmbHopsModel.getSelectedItem(); int i = hopsTable.getSelectedRow(); if (myRecipe != null && i != -1) { Hop h2 = myRecipe.getHop(i); h2.setAlpha(h.getAlpha()); h2.setDescription(h.getDescription()); h2.setCost(h.getCostPerU()); } } }); hopsUnitsComboBox.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { String u = (String) cmbHopsUnitsModel.getSelectedItem(); int i = hopsTable.getSelectedRow(); if (myRecipe != null && i != -1) { Hop h = myRecipe.getHop(i); h.convertTo(u); myRecipe.calcHopsTotals(); // tblHops.updateUI(); displayRecipe(); } } }); }
recipeSettingsActionPerformed(evt);
Fermentable f = (Fermentable) cmbMaltModel .getSelectedItem(); int i = maltTable.getSelectedRow(); if (myRecipe != null && i != -1 ) { Fermentable f2 = myRecipe.getFermentable(i); if (f2 != null){ f2.setLov(f.getLov()); f2.setPppg(f.getPppg()); f2.setDescription(f.getDescription()); f2.setMashed(f.getMashed()); f2.setSteep(f.getSteep()); f2.setCost(f.getCostPerU()); } }
public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); }
recipeSettingsActionPerformed(evt);
String u = (String) cmbMaltUnitsModel.getSelectedItem(); int i = maltTable.getSelectedRow(); if (myRecipe != null && i != -1) { Fermentable f2 = myRecipe.getFermentable(i); if (f2 != null){ f2.convertTo(u); myRecipe.calcMaltTotals(); displayRecipe(); } }
public void actionPerformed(ActionEvent evt) { recipeSettingsActionPerformed(evt); }
Fermentable f = (Fermentable) cmbMaltModel .getSelectedItem(); int i = maltTable.getSelectedRow(); if (myRecipe != null && i != -1 ) { Fermentable f2 = myRecipe.getFermentable(i); if (f2 != null){ f2.setLov(f.getLov()); f2.setPppg(f.getPppg()); f2.setDescription(f.getDescription()); f2.setMashed(f.getMashed()); f2.setSteep(f.getSteep()); f2.setCost(f.getCostPerU()); }
Hop h = (Hop) cmbHopsModel.getSelectedItem(); int i = hopsTable.getSelectedRow(); if (myRecipe != null && i != -1) { Hop h2 = myRecipe.getHop(i); h2.setAlpha(h.getAlpha()); h2.setDescription(h.getDescription()); h2.setCost(h.getCostPerU());
public void actionPerformed(ActionEvent evt) { Fermentable f = (Fermentable) cmbMaltModel .getSelectedItem(); int i = maltTable.getSelectedRow(); if (myRecipe != null && i != -1 ) { Fermentable f2 = myRecipe.getFermentable(i); if (f2 != null){ f2.setLov(f.getLov()); f2.setPppg(f.getPppg()); f2.setDescription(f.getDescription()); f2.setMashed(f.getMashed()); f2.setSteep(f.getSteep()); f2.setCost(f.getCostPerU()); } } }