rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
timeInterval = timeInterval.add(offset); | public void actionPerformed(ActionEvent e) { if (beginTime != null && speed != 0) { MicroSecondDate now = new MicroSecondDate(); TimeInterval timeInterval = new TimeInterval(lastDate, now); timeInterval = timeInterval.add(offset); width = (TimeInterval)timeInterval.multiplyBy(speed); lastDate = now; setAllBeginTime(beginTime.add(width)); updateTimeSyncListeners(); System.out.println("Timer: updateTimeSyncListeners() speed="+speed); } // end of if (beginTime != null) } |
|
newTimeConfig.addSeismogram(current, (MicroSecondDate)seismos.get(current)); seismos.put(current, newTimeConfig.getTimeRange(current)); } | newTimeConfig.addSeismogram(current, ((MicroSecondTimeRange)seismos.get(current)).getBeginTime()); } seismos = newTimeConfig.getData(); | public void setTimeConfig(TimeRangeConfig newTimeConfig){ timeConfig.removeTimeSyncListener(this); Iterator e = seismos.keySet().iterator(); timeFinder = newTimeConfig.getTimeFinder(); newTimeConfig.addTimeSyncListener(this); while(e.hasNext()){ DataSetSeismogram current = (DataSetSeismogram)e.next(); timeConfig.removeSeismogram(current); this.addSeismogram(current); newTimeConfig.addSeismogram(current, (MicroSecondDate)seismos.get(current)); seismos.put(current, newTimeConfig.getTimeRange(current)); } timeConfig = newTimeConfig; } |
updateTimeSyncListeners(); | public void setTimeConfig(TimeRangeConfig newTimeConfig){ timeConfig.removeTimeSyncListener(this); Iterator e = seismos.keySet().iterator(); timeFinder = newTimeConfig.getTimeFinder(); newTimeConfig.addTimeSyncListener(this); while(e.hasNext()){ DataSetSeismogram current = (DataSetSeismogram)e.next(); timeConfig.removeSeismogram(current); this.addSeismogram(current); newTimeConfig.addSeismogram(current, (MicroSecondDate)seismos.get(current)); seismos.put(current, newTimeConfig.getTimeRange(current)); } timeConfig = newTimeConfig; } |
|
RCSFile(final String name, final String rev) { this(name, rev, null, false); | RCSFile(final String name, final String revision, final String previousRevision, final String branch, final boolean dead) { m_name = name; m_revision = revision; if (!revision.equals(previousRevision)) { m_previousRevision = previousRevision; } m_branch = branch; m_dead = dead; | RCSFile(final String name, final String rev) { this(name, rev, null, false); } |
public void bind(Object instance, Bundle bundle) { if (bundle == null) { return; } String filterString = "(&(" + org.osgi.framework.Constants.OBJECTCLASS + "=" + interfaceName + ")" + "(" + Constants.BUNDLE_ID + "=" + bundle.getBundleId() + "))"; try { Filter filter = this.context.createFilter(filterString); ServiceReference[] refs = this.context.getServiceReferences(null, filter.toString()); bound = refs[0]; invokeEventMethod(instance, bindMethodName, bound); } catch (InvalidSyntaxException e) { Activator.log.error("Couldn't create filter for reference " + filterString + "\" used by component \"" + config.getName() + "\". Got exception.", e); | public void bind(Object instance, Object bindObject) { if (bindObject != null) { invokeEventMethod(instance, bindMethodName, bindObject); | public void bind(Object instance, Bundle bundle) { if (bundle == null) { return; } String filterString = "(&(" + org.osgi.framework.Constants.OBJECTCLASS + "=" + interfaceName + ")" + "(" + Constants.BUNDLE_ID + "=" + bundle.getBundleId() + "))"; try { Filter filter = this.context.createFilter(filterString); ServiceReference[] refs = this.context.getServiceReferences(null, filter.toString()); bound = refs[0]; invokeEventMethod(instance, bindMethodName, bound); } catch (InvalidSyntaxException e) { Activator.log.error("Couldn't create filter for reference " + filterString + "\" used by component \"" + config.getName() + "\". Got exception.", e); } } |
ServiceReference ref) { | Object duplexObject) { | private void invokeEventMethod(Object instance, String methodName, ServiceReference ref) { if (methodName == null) { return; } Class instanceClass = instance.getClass(); Bundle bundle = ref.getBundle(); Class serviceClass = null; try { serviceClass = bundle.loadClass(getInterfaceName()); } catch (ClassNotFoundException e) { Activator.log.error("Declarative Services could not load class", e); return; } while (instanceClass != null) { Method[] ms = instanceClass.getDeclaredMethods(); // searches this class for a suitable method. for (int i = 0; i < ms.length; i++) { if (methodName.equals(ms[i].getName()) && (Modifier.isProtected(ms[i].getModifiers()) || Modifier .isPublic(ms[i].getModifiers()))) { Class[] parms = ms[i].getParameterTypes(); if (parms.length == 1) { try { // if (ServiceReference.class.equals(parms[0])) { // ms[i].setAccessible(true); // ms[i].invoke(instance, new Object[] { ref }); // return; // } else if (parms[0].isAssignableFrom(serviceClass)) { Object service = this.context.getService(ref); ms[i].setAccessible(true); ms[i] .invoke(instance, new Object[] { service }); return; } } catch (IllegalAccessException e) { Activator.log.error( "Declarative Services could not access the method \"" + methodName + "\" used by component \"" + config.getName() + "\". Got exception.", e); } catch (InvocationTargetException e) { Activator.log.error( "Declarative Services got exception while invoking\"" + methodName + "\" used by component \"" + config.getName() + "\". Got exception.", e); } } } } instanceClass = instanceClass.getSuperclass(); } // did not find any such method. Activator.log .error("Declarative Services could not find bind/unbind method \"" + methodName + "\" in class \"" + config.getImplementation() + "\" used by component " + config.getName() + "\"."); } |
Bundle bundle = ref.getBundle(); Class serviceClass = null; try { serviceClass = bundle.loadClass(getInterfaceName()); } catch (ClassNotFoundException e) { Activator.log.error("Declarative Services could not load class", e); return; } | private void invokeEventMethod(Object instance, String methodName, ServiceReference ref) { if (methodName == null) { return; } Class instanceClass = instance.getClass(); Bundle bundle = ref.getBundle(); Class serviceClass = null; try { serviceClass = bundle.loadClass(getInterfaceName()); } catch (ClassNotFoundException e) { Activator.log.error("Declarative Services could not load class", e); return; } while (instanceClass != null) { Method[] ms = instanceClass.getDeclaredMethods(); // searches this class for a suitable method. for (int i = 0; i < ms.length; i++) { if (methodName.equals(ms[i].getName()) && (Modifier.isProtected(ms[i].getModifiers()) || Modifier .isPublic(ms[i].getModifiers()))) { Class[] parms = ms[i].getParameterTypes(); if (parms.length == 1) { try { // if (ServiceReference.class.equals(parms[0])) { // ms[i].setAccessible(true); // ms[i].invoke(instance, new Object[] { ref }); // return; // } else if (parms[0].isAssignableFrom(serviceClass)) { Object service = this.context.getService(ref); ms[i].setAccessible(true); ms[i] .invoke(instance, new Object[] { service }); return; } } catch (IllegalAccessException e) { Activator.log.error( "Declarative Services could not access the method \"" + methodName + "\" used by component \"" + config.getName() + "\". Got exception.", e); } catch (InvocationTargetException e) { Activator.log.error( "Declarative Services got exception while invoking\"" + methodName + "\" used by component \"" + config.getName() + "\". Got exception.", e); } } } } instanceClass = instanceClass.getSuperclass(); } // did not find any such method. Activator.log .error("Declarative Services could not find bind/unbind method \"" + methodName + "\" in class \"" + config.getImplementation() + "\" used by component " + config.getName() + "\"."); } |
|
if (parms[0].isAssignableFrom(serviceClass)) { Object service = this.context.getService(ref); | if (parms[0].isAssignableFrom(duplexObject .getClass())) { | private void invokeEventMethod(Object instance, String methodName, ServiceReference ref) { if (methodName == null) { return; } Class instanceClass = instance.getClass(); Bundle bundle = ref.getBundle(); Class serviceClass = null; try { serviceClass = bundle.loadClass(getInterfaceName()); } catch (ClassNotFoundException e) { Activator.log.error("Declarative Services could not load class", e); return; } while (instanceClass != null) { Method[] ms = instanceClass.getDeclaredMethods(); // searches this class for a suitable method. for (int i = 0; i < ms.length; i++) { if (methodName.equals(ms[i].getName()) && (Modifier.isProtected(ms[i].getModifiers()) || Modifier .isPublic(ms[i].getModifiers()))) { Class[] parms = ms[i].getParameterTypes(); if (parms.length == 1) { try { // if (ServiceReference.class.equals(parms[0])) { // ms[i].setAccessible(true); // ms[i].invoke(instance, new Object[] { ref }); // return; // } else if (parms[0].isAssignableFrom(serviceClass)) { Object service = this.context.getService(ref); ms[i].setAccessible(true); ms[i] .invoke(instance, new Object[] { service }); return; } } catch (IllegalAccessException e) { Activator.log.error( "Declarative Services could not access the method \"" + methodName + "\" used by component \"" + config.getName() + "\". Got exception.", e); } catch (InvocationTargetException e) { Activator.log.error( "Declarative Services got exception while invoking\"" + methodName + "\" used by component \"" + config.getName() + "\". Got exception.", e); } } } } instanceClass = instanceClass.getSuperclass(); } // did not find any such method. Activator.log .error("Declarative Services could not find bind/unbind method \"" + methodName + "\" in class \"" + config.getImplementation() + "\" used by component " + config.getName() + "\"."); } |
ms[i] .invoke(instance, new Object[] { service }); | ms[i].invoke(instance, new Object[] { duplexObject }); | private void invokeEventMethod(Object instance, String methodName, ServiceReference ref) { if (methodName == null) { return; } Class instanceClass = instance.getClass(); Bundle bundle = ref.getBundle(); Class serviceClass = null; try { serviceClass = bundle.loadClass(getInterfaceName()); } catch (ClassNotFoundException e) { Activator.log.error("Declarative Services could not load class", e); return; } while (instanceClass != null) { Method[] ms = instanceClass.getDeclaredMethods(); // searches this class for a suitable method. for (int i = 0; i < ms.length; i++) { if (methodName.equals(ms[i].getName()) && (Modifier.isProtected(ms[i].getModifiers()) || Modifier .isPublic(ms[i].getModifiers()))) { Class[] parms = ms[i].getParameterTypes(); if (parms.length == 1) { try { // if (ServiceReference.class.equals(parms[0])) { // ms[i].setAccessible(true); // ms[i].invoke(instance, new Object[] { ref }); // return; // } else if (parms[0].isAssignableFrom(serviceClass)) { Object service = this.context.getService(ref); ms[i].setAccessible(true); ms[i] .invoke(instance, new Object[] { service }); return; } } catch (IllegalAccessException e) { Activator.log.error( "Declarative Services could not access the method \"" + methodName + "\" used by component \"" + config.getName() + "\". Got exception.", e); } catch (InvocationTargetException e) { Activator.log.error( "Declarative Services got exception while invoking\"" + methodName + "\" used by component \"" + config.getName() + "\". Got exception.", e); } } } } instanceClass = instanceClass.getSuperclass(); } // did not find any such method. Activator.log .error("Declarative Services could not find bind/unbind method \"" + methodName + "\" in class \"" + config.getImplementation() + "\" used by component " + config.getName() + "\"."); } |
public void unbind(Object instance) { if (this.bound == null) { return; | public void unbind(Object instance, Object unbindObject) { if (unbindObject != null) { invokeEventMethod(instance, unbindMethodName, unbindObject); | public void unbind(Object instance) { if (this.bound == null) { return; } invokeEventMethod(instance, unbindMethodName, bound); this.context.ungetService(bound); } |
invokeEventMethod(instance, unbindMethodName, bound); this.context.ungetService(bound); | public void unbind(Object instance) { if (this.bound == null) { return; } invokeEventMethod(instance, unbindMethodName, bound); this.context.ungetService(bound); } |
|
if (!cvsEntry.containsBranch(branch)) continue; | private CVSEntry[] filterEntrySet(final CVSEntry[] entrySet) { final Vector results = new Vector(); for (int i = 0; i < entrySet.length; i++) { final CVSEntry cvsEntry = entrySet[i]; final Date date = cvsEntry.getDate(); if(date==null) // skip dates that didn't parse. continue; if (null != m_start && m_start.after(date)) { //Skip dates that are too early continue; } if (null != m_stop && m_stop.before(date)) { //Skip dates that are too late continue; } results.addElement(cvsEntry); } final CVSEntry[] resultArray = new CVSEntry[results.size()]; results.copyInto(resultArray); return resultArray; } |
|
sb.append(xmlElement("name", name, indent)); sb.append(xmlElement("aroma", aroma, indent)); sb.append(xmlElement("appearance", appearance, indent)); sb.append(xmlElement("flavor", flavour, indent)); sb.append(xmlElement("mouthfeel", mouthfeel, indent)); sb.append(xmlElement("impression", impression, indent)); sb.append(xmlElement("comments", comments, indent)); sb.append(xmlElement("ingredients", ingredients, indent)); | sb.append(SBStringUtils.xmlElement("name", name, indent)); sb.append(SBStringUtils.xmlElement("aroma", aroma, indent)); sb.append(SBStringUtils.xmlElement("appearance", appearance, indent)); sb.append(SBStringUtils.xmlElement("flavor", flavour, indent)); sb.append(SBStringUtils.xmlElement("mouthfeel", mouthfeel, indent)); sb.append(SBStringUtils.xmlElement("impression", impression, indent)); sb.append(SBStringUtils.xmlElement("comments", comments, indent)); sb.append(SBStringUtils.xmlElement("ingredients", ingredients, indent)); | public String toXML(){ StringBuffer sb = new StringBuffer(); int indent = 0; sb.append(" <style>\n"); // this is the BJCP style dtd: sb.append(" <subcategory id=\"" + catNum + "\">"); indent = 4; sb.append(xmlElement("name", name, indent)); sb.append(xmlElement("aroma", aroma, indent)); sb.append(xmlElement("appearance", appearance, indent)); sb.append(xmlElement("flavor", flavour, indent)); sb.append(xmlElement("mouthfeel", mouthfeel, indent)); sb.append(xmlElement("impression", impression, indent)); sb.append(xmlElement("comments", comments, indent)); sb.append(xmlElement("ingredients", ingredients, indent)); sb.append(" <stats>\n"); sb.append(" <og flexible=\"" + ogFlexible + "\">\n"); indent = 6; sb.append(xmlElement("low", ""+ogLow, indent)); sb.append(xmlElement("high", ""+ogHigh, indent)); sb.append(" </og>\n"); sb.append(" <fg flexible=\"" + fgFlexible + "\">\n"); sb.append(xmlElement("low", ""+fgLow, indent)); sb.append(xmlElement("high", ""+fgHigh, indent)); sb.append(" </fg>\n"); sb.append(" <ibu flexible=\"" + ibuFlexible + "\">\n"); sb.append(xmlElement("low", ""+ibuLow, indent)); sb.append(xmlElement("high", ""+ibuHigh, indent)); sb.append(" </ibu>\n"); sb.append(" <srm flexible=\"" + srmFlexible + "\">\n"); sb.append(xmlElement("low", ""+srmLow, indent)); sb.append(xmlElement("high", ""+srmHigh, indent)); sb.append(" </srm>\n"); sb.append(" <abv flexible=\"" + alcFlexible + "\">\n"); sb.append(xmlElement("low", ""+alcLow, indent)); sb.append(xmlElement("high", ""+alcHigh, indent)); sb.append(" </abv>\n"); sb.append("</stats>\n"); indent = 4; sb.append(xmlElement("examples", examples, indent)); sb.append(" </subcategory>\n"); sb.append(" </style>\n"); return sb.toString(); } |
sb.append(xmlElement("low", ""+ogLow, indent)); sb.append(xmlElement("high", ""+ogHigh, indent)); | sb.append(SBStringUtils.xmlElement("low", ""+ogLow, indent)); sb.append(SBStringUtils.xmlElement("high", ""+ogHigh, indent)); | public String toXML(){ StringBuffer sb = new StringBuffer(); int indent = 0; sb.append(" <style>\n"); // this is the BJCP style dtd: sb.append(" <subcategory id=\"" + catNum + "\">"); indent = 4; sb.append(xmlElement("name", name, indent)); sb.append(xmlElement("aroma", aroma, indent)); sb.append(xmlElement("appearance", appearance, indent)); sb.append(xmlElement("flavor", flavour, indent)); sb.append(xmlElement("mouthfeel", mouthfeel, indent)); sb.append(xmlElement("impression", impression, indent)); sb.append(xmlElement("comments", comments, indent)); sb.append(xmlElement("ingredients", ingredients, indent)); sb.append(" <stats>\n"); sb.append(" <og flexible=\"" + ogFlexible + "\">\n"); indent = 6; sb.append(xmlElement("low", ""+ogLow, indent)); sb.append(xmlElement("high", ""+ogHigh, indent)); sb.append(" </og>\n"); sb.append(" <fg flexible=\"" + fgFlexible + "\">\n"); sb.append(xmlElement("low", ""+fgLow, indent)); sb.append(xmlElement("high", ""+fgHigh, indent)); sb.append(" </fg>\n"); sb.append(" <ibu flexible=\"" + ibuFlexible + "\">\n"); sb.append(xmlElement("low", ""+ibuLow, indent)); sb.append(xmlElement("high", ""+ibuHigh, indent)); sb.append(" </ibu>\n"); sb.append(" <srm flexible=\"" + srmFlexible + "\">\n"); sb.append(xmlElement("low", ""+srmLow, indent)); sb.append(xmlElement("high", ""+srmHigh, indent)); sb.append(" </srm>\n"); sb.append(" <abv flexible=\"" + alcFlexible + "\">\n"); sb.append(xmlElement("low", ""+alcLow, indent)); sb.append(xmlElement("high", ""+alcHigh, indent)); sb.append(" </abv>\n"); sb.append("</stats>\n"); indent = 4; sb.append(xmlElement("examples", examples, indent)); sb.append(" </subcategory>\n"); sb.append(" </style>\n"); return sb.toString(); } |
sb.append(xmlElement("low", ""+fgLow, indent)); sb.append(xmlElement("high", ""+fgHigh, indent)); | sb.append(SBStringUtils.xmlElement("low", ""+fgLow, indent)); sb.append(SBStringUtils.xmlElement("high", ""+fgHigh, indent)); | public String toXML(){ StringBuffer sb = new StringBuffer(); int indent = 0; sb.append(" <style>\n"); // this is the BJCP style dtd: sb.append(" <subcategory id=\"" + catNum + "\">"); indent = 4; sb.append(xmlElement("name", name, indent)); sb.append(xmlElement("aroma", aroma, indent)); sb.append(xmlElement("appearance", appearance, indent)); sb.append(xmlElement("flavor", flavour, indent)); sb.append(xmlElement("mouthfeel", mouthfeel, indent)); sb.append(xmlElement("impression", impression, indent)); sb.append(xmlElement("comments", comments, indent)); sb.append(xmlElement("ingredients", ingredients, indent)); sb.append(" <stats>\n"); sb.append(" <og flexible=\"" + ogFlexible + "\">\n"); indent = 6; sb.append(xmlElement("low", ""+ogLow, indent)); sb.append(xmlElement("high", ""+ogHigh, indent)); sb.append(" </og>\n"); sb.append(" <fg flexible=\"" + fgFlexible + "\">\n"); sb.append(xmlElement("low", ""+fgLow, indent)); sb.append(xmlElement("high", ""+fgHigh, indent)); sb.append(" </fg>\n"); sb.append(" <ibu flexible=\"" + ibuFlexible + "\">\n"); sb.append(xmlElement("low", ""+ibuLow, indent)); sb.append(xmlElement("high", ""+ibuHigh, indent)); sb.append(" </ibu>\n"); sb.append(" <srm flexible=\"" + srmFlexible + "\">\n"); sb.append(xmlElement("low", ""+srmLow, indent)); sb.append(xmlElement("high", ""+srmHigh, indent)); sb.append(" </srm>\n"); sb.append(" <abv flexible=\"" + alcFlexible + "\">\n"); sb.append(xmlElement("low", ""+alcLow, indent)); sb.append(xmlElement("high", ""+alcHigh, indent)); sb.append(" </abv>\n"); sb.append("</stats>\n"); indent = 4; sb.append(xmlElement("examples", examples, indent)); sb.append(" </subcategory>\n"); sb.append(" </style>\n"); return sb.toString(); } |
sb.append(xmlElement("low", ""+ibuLow, indent)); sb.append(xmlElement("high", ""+ibuHigh, indent)); | sb.append(SBStringUtils.xmlElement("low", ""+ibuLow, indent)); sb.append(SBStringUtils.xmlElement("high", ""+ibuHigh, indent)); | public String toXML(){ StringBuffer sb = new StringBuffer(); int indent = 0; sb.append(" <style>\n"); // this is the BJCP style dtd: sb.append(" <subcategory id=\"" + catNum + "\">"); indent = 4; sb.append(xmlElement("name", name, indent)); sb.append(xmlElement("aroma", aroma, indent)); sb.append(xmlElement("appearance", appearance, indent)); sb.append(xmlElement("flavor", flavour, indent)); sb.append(xmlElement("mouthfeel", mouthfeel, indent)); sb.append(xmlElement("impression", impression, indent)); sb.append(xmlElement("comments", comments, indent)); sb.append(xmlElement("ingredients", ingredients, indent)); sb.append(" <stats>\n"); sb.append(" <og flexible=\"" + ogFlexible + "\">\n"); indent = 6; sb.append(xmlElement("low", ""+ogLow, indent)); sb.append(xmlElement("high", ""+ogHigh, indent)); sb.append(" </og>\n"); sb.append(" <fg flexible=\"" + fgFlexible + "\">\n"); sb.append(xmlElement("low", ""+fgLow, indent)); sb.append(xmlElement("high", ""+fgHigh, indent)); sb.append(" </fg>\n"); sb.append(" <ibu flexible=\"" + ibuFlexible + "\">\n"); sb.append(xmlElement("low", ""+ibuLow, indent)); sb.append(xmlElement("high", ""+ibuHigh, indent)); sb.append(" </ibu>\n"); sb.append(" <srm flexible=\"" + srmFlexible + "\">\n"); sb.append(xmlElement("low", ""+srmLow, indent)); sb.append(xmlElement("high", ""+srmHigh, indent)); sb.append(" </srm>\n"); sb.append(" <abv flexible=\"" + alcFlexible + "\">\n"); sb.append(xmlElement("low", ""+alcLow, indent)); sb.append(xmlElement("high", ""+alcHigh, indent)); sb.append(" </abv>\n"); sb.append("</stats>\n"); indent = 4; sb.append(xmlElement("examples", examples, indent)); sb.append(" </subcategory>\n"); sb.append(" </style>\n"); return sb.toString(); } |
sb.append(xmlElement("low", ""+srmLow, indent)); sb.append(xmlElement("high", ""+srmHigh, indent)); | sb.append(SBStringUtils.xmlElement("low", ""+srmLow, indent)); sb.append(SBStringUtils.xmlElement("high", ""+srmHigh, indent)); | public String toXML(){ StringBuffer sb = new StringBuffer(); int indent = 0; sb.append(" <style>\n"); // this is the BJCP style dtd: sb.append(" <subcategory id=\"" + catNum + "\">"); indent = 4; sb.append(xmlElement("name", name, indent)); sb.append(xmlElement("aroma", aroma, indent)); sb.append(xmlElement("appearance", appearance, indent)); sb.append(xmlElement("flavor", flavour, indent)); sb.append(xmlElement("mouthfeel", mouthfeel, indent)); sb.append(xmlElement("impression", impression, indent)); sb.append(xmlElement("comments", comments, indent)); sb.append(xmlElement("ingredients", ingredients, indent)); sb.append(" <stats>\n"); sb.append(" <og flexible=\"" + ogFlexible + "\">\n"); indent = 6; sb.append(xmlElement("low", ""+ogLow, indent)); sb.append(xmlElement("high", ""+ogHigh, indent)); sb.append(" </og>\n"); sb.append(" <fg flexible=\"" + fgFlexible + "\">\n"); sb.append(xmlElement("low", ""+fgLow, indent)); sb.append(xmlElement("high", ""+fgHigh, indent)); sb.append(" </fg>\n"); sb.append(" <ibu flexible=\"" + ibuFlexible + "\">\n"); sb.append(xmlElement("low", ""+ibuLow, indent)); sb.append(xmlElement("high", ""+ibuHigh, indent)); sb.append(" </ibu>\n"); sb.append(" <srm flexible=\"" + srmFlexible + "\">\n"); sb.append(xmlElement("low", ""+srmLow, indent)); sb.append(xmlElement("high", ""+srmHigh, indent)); sb.append(" </srm>\n"); sb.append(" <abv flexible=\"" + alcFlexible + "\">\n"); sb.append(xmlElement("low", ""+alcLow, indent)); sb.append(xmlElement("high", ""+alcHigh, indent)); sb.append(" </abv>\n"); sb.append("</stats>\n"); indent = 4; sb.append(xmlElement("examples", examples, indent)); sb.append(" </subcategory>\n"); sb.append(" </style>\n"); return sb.toString(); } |
sb.append(xmlElement("low", ""+alcLow, indent)); sb.append(xmlElement("high", ""+alcHigh, indent)); | sb.append(SBStringUtils.xmlElement("low", ""+alcLow, indent)); sb.append(SBStringUtils.xmlElement("high", ""+alcHigh, indent)); | public String toXML(){ StringBuffer sb = new StringBuffer(); int indent = 0; sb.append(" <style>\n"); // this is the BJCP style dtd: sb.append(" <subcategory id=\"" + catNum + "\">"); indent = 4; sb.append(xmlElement("name", name, indent)); sb.append(xmlElement("aroma", aroma, indent)); sb.append(xmlElement("appearance", appearance, indent)); sb.append(xmlElement("flavor", flavour, indent)); sb.append(xmlElement("mouthfeel", mouthfeel, indent)); sb.append(xmlElement("impression", impression, indent)); sb.append(xmlElement("comments", comments, indent)); sb.append(xmlElement("ingredients", ingredients, indent)); sb.append(" <stats>\n"); sb.append(" <og flexible=\"" + ogFlexible + "\">\n"); indent = 6; sb.append(xmlElement("low", ""+ogLow, indent)); sb.append(xmlElement("high", ""+ogHigh, indent)); sb.append(" </og>\n"); sb.append(" <fg flexible=\"" + fgFlexible + "\">\n"); sb.append(xmlElement("low", ""+fgLow, indent)); sb.append(xmlElement("high", ""+fgHigh, indent)); sb.append(" </fg>\n"); sb.append(" <ibu flexible=\"" + ibuFlexible + "\">\n"); sb.append(xmlElement("low", ""+ibuLow, indent)); sb.append(xmlElement("high", ""+ibuHigh, indent)); sb.append(" </ibu>\n"); sb.append(" <srm flexible=\"" + srmFlexible + "\">\n"); sb.append(xmlElement("low", ""+srmLow, indent)); sb.append(xmlElement("high", ""+srmHigh, indent)); sb.append(" </srm>\n"); sb.append(" <abv flexible=\"" + alcFlexible + "\">\n"); sb.append(xmlElement("low", ""+alcLow, indent)); sb.append(xmlElement("high", ""+alcHigh, indent)); sb.append(" </abv>\n"); sb.append("</stats>\n"); indent = 4; sb.append(xmlElement("examples", examples, indent)); sb.append(" </subcategory>\n"); sb.append(" </style>\n"); return sb.toString(); } |
sb.append(xmlElement("examples", examples, indent)); | sb.append(SBStringUtils.xmlElement("examples", examples, indent)); | public String toXML(){ StringBuffer sb = new StringBuffer(); int indent = 0; sb.append(" <style>\n"); // this is the BJCP style dtd: sb.append(" <subcategory id=\"" + catNum + "\">"); indent = 4; sb.append(xmlElement("name", name, indent)); sb.append(xmlElement("aroma", aroma, indent)); sb.append(xmlElement("appearance", appearance, indent)); sb.append(xmlElement("flavor", flavour, indent)); sb.append(xmlElement("mouthfeel", mouthfeel, indent)); sb.append(xmlElement("impression", impression, indent)); sb.append(xmlElement("comments", comments, indent)); sb.append(xmlElement("ingredients", ingredients, indent)); sb.append(" <stats>\n"); sb.append(" <og flexible=\"" + ogFlexible + "\">\n"); indent = 6; sb.append(xmlElement("low", ""+ogLow, indent)); sb.append(xmlElement("high", ""+ogHigh, indent)); sb.append(" </og>\n"); sb.append(" <fg flexible=\"" + fgFlexible + "\">\n"); sb.append(xmlElement("low", ""+fgLow, indent)); sb.append(xmlElement("high", ""+fgHigh, indent)); sb.append(" </fg>\n"); sb.append(" <ibu flexible=\"" + ibuFlexible + "\">\n"); sb.append(xmlElement("low", ""+ibuLow, indent)); sb.append(xmlElement("high", ""+ibuHigh, indent)); sb.append(" </ibu>\n"); sb.append(" <srm flexible=\"" + srmFlexible + "\">\n"); sb.append(xmlElement("low", ""+srmLow, indent)); sb.append(xmlElement("high", ""+srmHigh, indent)); sb.append(" </srm>\n"); sb.append(" <abv flexible=\"" + alcFlexible + "\">\n"); sb.append(xmlElement("low", ""+alcLow, indent)); sb.append(xmlElement("high", ""+alcHigh, indent)); sb.append(" </abv>\n"); sb.append("</stats>\n"); indent = 4; sb.append(xmlElement("examples", examples, indent)); sb.append(" </subcategory>\n"); sb.append(" </style>\n"); return sb.toString(); } |
if(url.endsWith("/")) url = url.substring(0,url.length()-1); | public Checker(String url) { this.url = url; } |
|
return new Double(data.getStepStartTemp(row)) ; | return SBStringUtils.df1.format(data.getStepStartTemp(row)); | public Object getValueAt(int row, int col) { try { switch (col) { case 0 : return data.getStepType(row); case 1 : return data.getStepMethod(row); case 2 : return new Double(data.getStepStartTemp(row)) ; case 3 : return new Double(data.getStepEndTemp(row)) ; case 4 : return new Integer(data.getStepRampMin(row)); case 5 : return new Integer(data.getStepMin(row)); } } catch (Exception e) { Debug.print(e.toString()); }; return ""; } |
return new Double(data.getStepEndTemp(row)) ; | return SBStringUtils.df1.format(data.getStepEndTemp(row)) ; | public Object getValueAt(int row, int col) { try { switch (col) { case 0 : return data.getStepType(row); case 1 : return data.getStepMethod(row); case 2 : return new Double(data.getStepStartTemp(row)) ; case 3 : return new Double(data.getStepEndTemp(row)) ; case 4 : return new Integer(data.getStepRampMin(row)); case 5 : return new Integer(data.getStepMin(row)); } } catch (Exception e) { Debug.print(e.toString()); }; return ""; } |
BundleContext bc = Backdoor.getBundleContext(declaringBundle); DuplexReference ref = new DuplexReference(interfaceName, optional, bind, unbind, bc); | DuplexReference ref = new DuplexReference(interfaceName, optional, bind, unbind, Backdoor.getBundleContext(declaringBundle)); | private static void setDuplexReference(Config compConf, XmlPullParser parser, Bundle declaringBundle) throws IllegalXMLException, XmlPullParserException, IOException { String interfaceName = null; // String target = null; String bind = null; String unbind = null; boolean optional = false; for (int i = 0; i < parser.getAttributeCount(); i++) { // if (parser.getAttributeName(i).equals("name")) { // if (checkNMToken(parser.getAttributeValue(i))) { // name = parser.getAttributeValue(i); // // } else { // throw new IllegalXMLException("Attribute \"" // + parser.getAttributeName(i) // + "\" in duplex-reference-tag is invalid."); // } // } else if (parser.getAttributeName(i).equals("interface")) { if (checkToken(parser.getAttributeValue(i))) { interfaceName = parser.getAttributeValue(i); } else { throw new IllegalXMLException("Attribute \"" + parser.getAttributeName(i) + "\" in duplex-reference-tag is invalid"); } } else if (parser.getAttributeName(i).equals("optional")) { optional = parseBoolean(parser, i); // } else if (parser.getAttributeName(i).equals("target")) { // target = parser.getAttributeValue(i); } else if (parser.getAttributeName(i).equals("bind")) { bind = parser.getAttributeValue(i); } else if (parser.getAttributeName(i).equals("unbind")) { unbind = parser.getAttributeValue(i); } else { unrecognizedAttr(parser, i); } } skip(parser);// if (name == null)// missingAttr(parser, "name"); if (interfaceName == null) missingAttr(parser, "interface"); BundleContext bc = Backdoor.getBundleContext(declaringBundle); // try { // Filter filter; // if (target != null) { // filter = bc.createFilter("(&(" + Constants.OBJECTCLASS + "=" // + interfaceName + ")" + target + ")"); // } else { // filter = bc.createFilter("(" + Constants.OBJECTCLASS + "=" // + interfaceName + ")"); // } DuplexReference ref = new DuplexReference(interfaceName, optional, bind, unbind, bc); compConf.addDuplexReference(ref); // } catch (InvalidSyntaxException e) { // throw new IllegalXMLException( // "Couldn't create filter for reference \"" + name + "\"", e); // } } |
Filter filter; | StringBuffer sb = new StringBuffer(); sb.append("(|("); sb.append(Constants.OBJECTCLASS); sb.append("="); sb.append(interfaceName); sb.append(")(&("); sb.append(Constants.OBJECTCLASS); sb.append("="); sb.append(DuplexFactoryComponent.class.getName()); sb.append(")("); sb.append(org.bamja.core.impl.Constants.OBJECT_CLASS); sb.append("="); sb.append(interfaceName); sb.append(")))"); | private static void setReference(Config compConf, XmlPullParser parser, Bundle declaringBundle) throws IllegalXMLException, XmlPullParserException, IOException { String name = null; String interfaceName = null; String target = null; String bind = null; String unbind = null; boolean optional = false; // default value boolean multiple = false; // default value boolean dynamic = false; // default value for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("name")) { if (checkNMToken(parser.getAttributeValue(i))) { name = parser.getAttributeValue(i); } else { throw new IllegalXMLException("Attribute \"" + parser.getAttributeName(i) + "\" in reference-tag is invalid."); } } else if (parser.getAttributeName(i).equals("interface")) { if (checkToken(parser.getAttributeValue(i))) { interfaceName = parser.getAttributeValue(i); } else { throw new IllegalXMLException("Attribute \"" + parser.getAttributeName(i) + "\" in reference-tag is invalid"); } } else if (parser.getAttributeName(i).equals("cardinality")) { String val = parser.getAttributeValue(i); if ("1..1".equals(val)) { multiple = optional = false; } else if ("0..1".equals(val)) { optional = true; multiple = false; } else if ("1..n".equals(val)) { optional = false; multiple = true; } else if ("0..n".equals(val)) { multiple = optional = true; } else { invalidValue(parser, new String[] { "1..1", "0..1", "1..n", "0..n" }, i); } } else if (parser.getAttributeName(i).equals("policy")) { String val = parser.getAttributeValue(i); if ("static".equals(val)) { dynamic = false; } else if ("dynamic".equals(val)) { dynamic = true; } else { invalidValue(parser, new String[] { "static", "dynamic" }, i); } } else if (parser.getAttributeName(i).equals("target")) { target = parser.getAttributeValue(i); } else if (parser.getAttributeName(i).equals("bind")) { bind = parser.getAttributeValue(i); } else if (parser.getAttributeName(i).equals("unbind")) { unbind = parser.getAttributeValue(i); } else { unrecognizedAttr(parser, i); } } skip(parser); if (name == null) missingAttr(parser, "name"); if (interfaceName == null) missingAttr(parser, "interface"); BundleContext bc = Backdoor.getBundleContext(declaringBundle); try { Filter filter; if (target != null) { filter = bc.createFilter("(&(" + Constants.OBJECTCLASS + "=" + interfaceName + ")" + target + ")"); } else { filter = bc.createFilter("(" + Constants.OBJECTCLASS + "=" + interfaceName + ")"); } Reference ref = new Reference(name, filter, interfaceName, optional, multiple, dynamic, bind, unbind, bc); compConf.addReference(ref); } catch (InvalidSyntaxException e) { throw new IllegalXMLException( "Couldn't create filter for reference \"" + name + "\"", e); } } |
filter = bc.createFilter("(&(" + Constants.OBJECTCLASS + "=" + interfaceName + ")" + target + ")"); } else { filter = bc.createFilter("(" + Constants.OBJECTCLASS + "=" + interfaceName + ")"); | sb.insert(0, "(&"); sb.append(target); sb.append(")"); | private static void setReference(Config compConf, XmlPullParser parser, Bundle declaringBundle) throws IllegalXMLException, XmlPullParserException, IOException { String name = null; String interfaceName = null; String target = null; String bind = null; String unbind = null; boolean optional = false; // default value boolean multiple = false; // default value boolean dynamic = false; // default value for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("name")) { if (checkNMToken(parser.getAttributeValue(i))) { name = parser.getAttributeValue(i); } else { throw new IllegalXMLException("Attribute \"" + parser.getAttributeName(i) + "\" in reference-tag is invalid."); } } else if (parser.getAttributeName(i).equals("interface")) { if (checkToken(parser.getAttributeValue(i))) { interfaceName = parser.getAttributeValue(i); } else { throw new IllegalXMLException("Attribute \"" + parser.getAttributeName(i) + "\" in reference-tag is invalid"); } } else if (parser.getAttributeName(i).equals("cardinality")) { String val = parser.getAttributeValue(i); if ("1..1".equals(val)) { multiple = optional = false; } else if ("0..1".equals(val)) { optional = true; multiple = false; } else if ("1..n".equals(val)) { optional = false; multiple = true; } else if ("0..n".equals(val)) { multiple = optional = true; } else { invalidValue(parser, new String[] { "1..1", "0..1", "1..n", "0..n" }, i); } } else if (parser.getAttributeName(i).equals("policy")) { String val = parser.getAttributeValue(i); if ("static".equals(val)) { dynamic = false; } else if ("dynamic".equals(val)) { dynamic = true; } else { invalidValue(parser, new String[] { "static", "dynamic" }, i); } } else if (parser.getAttributeName(i).equals("target")) { target = parser.getAttributeValue(i); } else if (parser.getAttributeName(i).equals("bind")) { bind = parser.getAttributeValue(i); } else if (parser.getAttributeName(i).equals("unbind")) { unbind = parser.getAttributeValue(i); } else { unrecognizedAttr(parser, i); } } skip(parser); if (name == null) missingAttr(parser, "name"); if (interfaceName == null) missingAttr(parser, "interface"); BundleContext bc = Backdoor.getBundleContext(declaringBundle); try { Filter filter; if (target != null) { filter = bc.createFilter("(&(" + Constants.OBJECTCLASS + "=" + interfaceName + ")" + target + ")"); } else { filter = bc.createFilter("(" + Constants.OBJECTCLASS + "=" + interfaceName + ")"); } Reference ref = new Reference(name, filter, interfaceName, optional, multiple, dynamic, bind, unbind, bc); compConf.addReference(ref); } catch (InvalidSyntaxException e) { throw new IllegalXMLException( "Couldn't create filter for reference \"" + name + "\"", e); } } |
Filter filter = bc.createFilter(sb.toString()); | private static void setReference(Config compConf, XmlPullParser parser, Bundle declaringBundle) throws IllegalXMLException, XmlPullParserException, IOException { String name = null; String interfaceName = null; String target = null; String bind = null; String unbind = null; boolean optional = false; // default value boolean multiple = false; // default value boolean dynamic = false; // default value for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("name")) { if (checkNMToken(parser.getAttributeValue(i))) { name = parser.getAttributeValue(i); } else { throw new IllegalXMLException("Attribute \"" + parser.getAttributeName(i) + "\" in reference-tag is invalid."); } } else if (parser.getAttributeName(i).equals("interface")) { if (checkToken(parser.getAttributeValue(i))) { interfaceName = parser.getAttributeValue(i); } else { throw new IllegalXMLException("Attribute \"" + parser.getAttributeName(i) + "\" in reference-tag is invalid"); } } else if (parser.getAttributeName(i).equals("cardinality")) { String val = parser.getAttributeValue(i); if ("1..1".equals(val)) { multiple = optional = false; } else if ("0..1".equals(val)) { optional = true; multiple = false; } else if ("1..n".equals(val)) { optional = false; multiple = true; } else if ("0..n".equals(val)) { multiple = optional = true; } else { invalidValue(parser, new String[] { "1..1", "0..1", "1..n", "0..n" }, i); } } else if (parser.getAttributeName(i).equals("policy")) { String val = parser.getAttributeValue(i); if ("static".equals(val)) { dynamic = false; } else if ("dynamic".equals(val)) { dynamic = true; } else { invalidValue(parser, new String[] { "static", "dynamic" }, i); } } else if (parser.getAttributeName(i).equals("target")) { target = parser.getAttributeValue(i); } else if (parser.getAttributeName(i).equals("bind")) { bind = parser.getAttributeValue(i); } else if (parser.getAttributeName(i).equals("unbind")) { unbind = parser.getAttributeValue(i); } else { unrecognizedAttr(parser, i); } } skip(parser); if (name == null) missingAttr(parser, "name"); if (interfaceName == null) missingAttr(parser, "interface"); BundleContext bc = Backdoor.getBundleContext(declaringBundle); try { Filter filter; if (target != null) { filter = bc.createFilter("(&(" + Constants.OBJECTCLASS + "=" + interfaceName + ")" + target + ")"); } else { filter = bc.createFilter("(" + Constants.OBJECTCLASS + "=" + interfaceName + ")"); } Reference ref = new Reference(name, filter, interfaceName, optional, multiple, dynamic, bind, unbind, bc); compConf.addReference(ref); } catch (InvalidSyntaxException e) { throw new IllegalXMLException( "Couldn't create filter for reference \"" + name + "\"", e); } } |
|
handleDuplexReference(compConf, parser, declaringBundle); | if (compConf.isServiceFactory() || compConf.isImmediate() || compConf.getFactory() != null) { throw new IllegalXMLException( "Element duplex-reference cannot be set when component " + "is an immediate, a servicefactory or " + "a factory component."); } setDuplexReference(compConf, parser, declaringBundle); | private static void setService(Config compConf, XmlPullParser parser, Bundle declaringBundle) throws IllegalXMLException, XmlPullParserException, IOException { boolean interfaceFound = false; /* If there is an attribute in the service tag */ for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("servicefactory")) { // && boolean isServiceFactory = parseBoolean(parser, i); if (isServiceFactory && (compConf.isImmediate() || compConf.getFactory() != null)) { throw new IllegalXMLException( "Attribute servicefactory in service-tag " + "cannot be set to \"true\" when component " + "is either an immediate component or " + "a factory component."); } compConf.setServiceFactory(isServiceFactory); } else { throw new IllegalXMLException("Unrecognized attribute \"" + parser.getAttributeName(i) + "\" in service-tag"); } } int event = parser.next(); while (event != XmlPullParser.END_TAG) { if (event != XmlPullParser.START_TAG) { event = parser.next(); continue; } if (isInSCRNamespace(parser, "provide", 3)) { String interfaceName = null; for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("interface")) { interfaceName = parser.getAttributeValue(i); interfaceFound = true; } else { throw new IllegalXMLException( "Unrecognized attribute \"" + parser.getAttributeName(i) + "\" in provide-tag"); } } if (interfaceName == null) missingAttr(parser, "interface"); compConf.addService(interfaceName); skip(parser); } else if (isInSCRNamespace(parser, "duplex-reference", 3)) { handleDuplexReference(compConf, parser, declaringBundle); } else if (isInSCRNamespace(parser, "virtual_provide", 3)) { String virtualInterfaceName = null; for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("name")) { virtualInterfaceName = parser.getAttributeValue(i); } else { throw new IllegalXMLException( "Unrecognized attribute \"" + parser.getAttributeName(i) + "\" in virtual_provide-tag"); } } if (virtualInterfaceName == null) missingAttr(parser, "name"); compConf.addVirtuallService(virtualInterfaceName); skip(parser); } else { skip(parser); } event = parser.getEventType(); } /* check if required attributes has been set */ if (!interfaceFound) { throw new IllegalXMLException( "Service-tag did not contain a proper \"provides\"-tag."); } } |
compConf.addVirtuallService(virtualInterfaceName); | compConf.addVirtualService(virtualInterfaceName); | private static void setService(Config compConf, XmlPullParser parser, Bundle declaringBundle) throws IllegalXMLException, XmlPullParserException, IOException { boolean interfaceFound = false; /* If there is an attribute in the service tag */ for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("servicefactory")) { // && boolean isServiceFactory = parseBoolean(parser, i); if (isServiceFactory && (compConf.isImmediate() || compConf.getFactory() != null)) { throw new IllegalXMLException( "Attribute servicefactory in service-tag " + "cannot be set to \"true\" when component " + "is either an immediate component or " + "a factory component."); } compConf.setServiceFactory(isServiceFactory); } else { throw new IllegalXMLException("Unrecognized attribute \"" + parser.getAttributeName(i) + "\" in service-tag"); } } int event = parser.next(); while (event != XmlPullParser.END_TAG) { if (event != XmlPullParser.START_TAG) { event = parser.next(); continue; } if (isInSCRNamespace(parser, "provide", 3)) { String interfaceName = null; for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("interface")) { interfaceName = parser.getAttributeValue(i); interfaceFound = true; } else { throw new IllegalXMLException( "Unrecognized attribute \"" + parser.getAttributeName(i) + "\" in provide-tag"); } } if (interfaceName == null) missingAttr(parser, "interface"); compConf.addService(interfaceName); skip(parser); } else if (isInSCRNamespace(parser, "duplex-reference", 3)) { handleDuplexReference(compConf, parser, declaringBundle); } else if (isInSCRNamespace(parser, "virtual_provide", 3)) { String virtualInterfaceName = null; for (int i = 0; i < parser.getAttributeCount(); i++) { if (parser.getAttributeName(i).equals("name")) { virtualInterfaceName = parser.getAttributeValue(i); } else { throw new IllegalXMLException( "Unrecognized attribute \"" + parser.getAttributeName(i) + "\" in virtual_provide-tag"); } } if (virtualInterfaceName == null) missingAttr(parser, "name"); compConf.addVirtuallService(virtualInterfaceName); skip(parser); } else { skip(parser); } event = parser.getEventType(); } /* check if required attributes has been set */ if (!interfaceFound) { throw new IllegalXMLException( "Service-tag did not contain a proper \"provides\"-tag."); } } |
this.duplexFactory = true; | public void addDuplexReference(DuplexReference ref) { ref.setConfig(this); this.duplexReferences.add(ref); } |
|
private void displayDilution(){ | public void displayDilution(){ | private void displayDilution(){ postBoilText.setValue(new Double(myRecipe.getPostBoilVol(myRecipe.getVolUnits()))); diluteWithText.setValue(new Double(myRecipe.dilution.getAddVol())); totalVolumeSpinner.setValue(new Double(myRecipe.dilution.getDilVol())); ibuDilutedSpin.setValue(new Double(myRecipe.dilution.getDilIbu())); colourDilutedLabel.setText(SBStringUtils.format(myRecipe.dilution.getDilSrm(), 0)); abvDilutedLabel.setText(SBStringUtils.format(myRecipe.dilution.getDilAlc(), 1)); ogDilutedSpin.setValue(new Double(myRecipe.dilution.getDilOG())); // recipe values: ibuRecipeLabel.setText(SBStringUtils.format(myRecipe.getIbu(), 1)); colourRecipeLabel.setText(SBStringUtils.format(myRecipe.getSrm(), 1)); abvRecipeLabel.setText(SBStringUtils.format(myRecipe.getAlcohol(), 1)); ogRecipeLabel.setText(SBStringUtils.format(myRecipe.getEstOg(), 3)); // style values Style s = myRecipe.getStyleObj(); ogLowLabel.setText(SBStringUtils.format(s.getOgLow(), 3)); ogHighLabel.setText(SBStringUtils.format(s.getOgHigh(), 3)); abvLowLabel.setText(SBStringUtils.format(s.getAlcLow(), 1)); abvHighLabel.setText(SBStringUtils.format(s.getAlcHigh(), 1)); colourLowLabel.setText(SBStringUtils.format(s.getSrmLow(), 1)); colourHighLabel.setText(SBStringUtils.format(s.getSrmHigh(), 1)); ibuLowLabel.setText(SBStringUtils.format(s.getIbuLow(), 1)); ibuHighLabel.setText(SBStringUtils.format(s.getIbuHigh(), 1)); } |
public Object log(Object param) throws ParseException { if (param instanceof Number) { | public Object log(Object param) throws ParseException { if (param instanceof Complex) { return ((Complex)param).log().div(CLOG10); } else if (param instanceof Number) { | public Object log(Object param) throws ParseException { if (param instanceof Number) { double num = ((Number) param).doubleValue(); if( num > 0) return new Double(Math.log(num)/LOG10); else { Complex temp = new Complex(num); return temp.log().div(CLOG10); } } else if (param instanceof Complex) { return ((Complex)param).log().div(CLOG10); } throw new ParseException("Invalid parameter type"); } |
} else if (param instanceof Complex) { return ((Complex)param).log().div(CLOG10); | public Object log(Object param) throws ParseException { if (param instanceof Number) { double num = ((Number) param).doubleValue(); if( num > 0) return new Double(Math.log(num)/LOG10); else { Complex temp = new Complex(num); return temp.log().div(CLOG10); } } else if (param instanceof Complex) { return ((Complex)param).log().div(CLOG10); } throw new ParseException("Invalid parameter type"); } |
|
public void addFile(String file, String revision) { m_files.addElement(new RCSFile(file, revision)); | public void addFile(String file, String revision, String previousRevision, String branch, boolean dead) { m_files.addElement(new RCSFile(file, revision, previousRevision, branch, dead)); | public void addFile(String file, String revision) { m_files.addElement(new RCSFile(file, revision)); } |
sender = createMock(ConfigurableMailSender.class); | public void setUp() { operatorDao = createMock(OperatorDao.class); serviceManagementTemplate = createMock(ServiceManagementTemplate.class); systemConfigurationTemplate = createMock(SystemConfigurationTemplate.class); configurableMailSenderFactory = createMock(ConfigurableMailSenderFactory.class); mailMessageComposer = createMock(MailMessageComposer.class); serverMgr = new ServerMgrImpl(); serverMgr.setOperatorDao(operatorDao); serverMgr.setServiceManagementTemplate(serviceManagementTemplate); serverMgr.setSystemConfigurationTemplate(systemConfigurationTemplate); serverMgr.setConfigurableMailSenderFactory(configurableMailSenderFactory); serverMgr.setMailMessageComposer(mailMessageComposer); } |
|
reset(sender); | public void tearDown() { reset(operatorDao); reset(serviceManagementTemplate); reset(systemConfigurationTemplate); reset(configurableMailSenderFactory); reset(mailMessageComposer); } |
|
ConfigurableMailSender sender = new ConfigurableMailSenderImpl(); | public void testsendPasswordConfirmation() throws MessagingException { PasswordConfirmationMailForm mailForm = new PasswordConfirmationMailForm(); Operator operator = new Operator(); mailForm.setOperator(operator); List<Server> serverList = new ArrayList<Server>(); // Server transportServer = OperatorTestSupport.createServer();// Server accessServer = OperatorTestSupport.createServer(operator); ConfigurableMailSender sender = new ConfigurableMailSenderImpl(); expect(operatorDao.findServerActive(mailForm.getOperator())).andReturn(serverList); replay(operatorDao); expect(configurableMailSenderFactory.create(serverList)).andReturn(sender); replay(operatorDao); serverMgr.sendPasswordConfirmation(mailForm); } |
|
replay(operatorDao); | replay(configurableMailSenderFactory); expect(mailMessageComposer.composeMessage("PASSWORD", mailForm)).andReturn(decoratedPreparator); replay(mailMessageComposer); sender.send(decoratedPreparator); replay(sender); | public void testsendPasswordConfirmation() throws MessagingException { PasswordConfirmationMailForm mailForm = new PasswordConfirmationMailForm(); Operator operator = new Operator(); mailForm.setOperator(operator); List<Server> serverList = new ArrayList<Server>(); // Server transportServer = OperatorTestSupport.createServer();// Server accessServer = OperatorTestSupport.createServer(operator); ConfigurableMailSender sender = new ConfigurableMailSenderImpl(); expect(operatorDao.findServerActive(mailForm.getOperator())).andReturn(serverList); replay(operatorDao); expect(configurableMailSenderFactory.create(serverList)).andReturn(sender); replay(operatorDao); serverMgr.sendPasswordConfirmation(mailForm); } |
Entity entity = OperatorCreator.entityFactory(operator, "DEFAULT"); Identity identity = AuthenticationCreator.identityFactory("manager", "Manager account"); User user = AuthorizationCreator.userFactory(entity, identity); | public Operator createLocalDefaultOperator() { Operator operator = OperatorCreator.operatorFactory("DEFAULT", OperationMode.LOCAL, Locale.getDefault()); Entity entity = OperatorCreator.entityFactory(operator, "DEFAULT"); Identity identity = AuthenticationCreator.identityFactory("manager", "Manager account"); User user = AuthorizationCreator.userFactory(entity, identity); return operator; } |
|
myRecipe.mash.setBoilTempF(Double.parseDouble(s)); | myRecipe.mash.setBoilTemp(Double.parseDouble(s)); | public void actionPerformed(ActionEvent e) { Object o = e.getSource(); if (o == ratioText) { double d = Double.parseDouble(ratioText.getText()); myRecipe.mash.setMashRatio(d); } else if (o == volUnitsCombo) { String s = (String) volUnitsComboModel.getSelectedItem(); myRecipe.mash.setMashVolUnits(s); } else if (o == ratioUnitsCombo) { String s = (String) ratioUnitsCombo.getSelectedItem(); myRecipe.mash.setMashRatioU(s); } else if (o == tempFrb) { myRecipe.mash.setMashTempUnits("F"); myRecipe.mash.calcMashSchedule(); } else if (o == tempCrb) { myRecipe.mash.setMashTempUnits("C"); myRecipe.mash.calcMashSchedule(); } else if (o == grainTempText) { String s = grainTempText.getText(); myRecipe.mash.setGrainTemp(Double.parseDouble(s)); } else if (o == boilTempTxt) { String s = boilTempTxt.getText(); myRecipe.mash.setBoilTempF(Double.parseDouble(s)); } else if (o == tunLossTxt) { String s = tunLossTxt.getText(); myRecipe.mash.setTunLossF(Double.parseDouble(s)); } tblMash.updateUI(); displayMash(); } |
myRecipe.mash.setTunLossF(Double.parseDouble(s)); | myRecipe.mash.setTunLoss(Double.parseDouble(s)); | public void actionPerformed(ActionEvent e) { Object o = e.getSource(); if (o == ratioText) { double d = Double.parseDouble(ratioText.getText()); myRecipe.mash.setMashRatio(d); } else if (o == volUnitsCombo) { String s = (String) volUnitsComboModel.getSelectedItem(); myRecipe.mash.setMashVolUnits(s); } else if (o == ratioUnitsCombo) { String s = (String) ratioUnitsCombo.getSelectedItem(); myRecipe.mash.setMashRatioU(s); } else if (o == tempFrb) { myRecipe.mash.setMashTempUnits("F"); myRecipe.mash.calcMashSchedule(); } else if (o == tempCrb) { myRecipe.mash.setMashTempUnits("C"); myRecipe.mash.calcMashSchedule(); } else if (o == grainTempText) { String s = grainTempText.getText(); myRecipe.mash.setGrainTemp(Double.parseDouble(s)); } else if (o == boilTempTxt) { String s = boilTempTxt.getText(); myRecipe.mash.setBoilTempF(Double.parseDouble(s)); } else if (o == tunLossTxt) { String s = tunLossTxt.getText(); myRecipe.mash.setTunLossF(Double.parseDouble(s)); } tblMash.updateUI(); displayMash(); } |
boilTempTxt.setText(new Double(myRecipe.mash.getBoilTempF()).toString()); tunLossTxt.setText(new Double(myRecipe.mash.getTunLossF()).toString()); | boilTempTxt.setText(new Double(myRecipe.mash.getBoilTemp()).toString()); tunLossTxt.setText(new Double(myRecipe.mash.getTunLoss()).toString()); | public void displayMash() { if (myRecipe != null) { recipeNameLabel.setText(myRecipe.getName()); volUnitsComboModel.addOrInsert(myRecipe.mash.getMashVolUnits()); // temp units: if (myRecipe.mash.getMashTempUnits().equals("F")) tempFrb.setSelected(true); else tempCrb.setSelected(true); grainTempULabel.setText(myRecipe.mash.getMashTempUnits()); tempLostULabel.setText(myRecipe.mash.getMashTempUnits()); // set totals: String mashWeightTotal = SBStringUtils.format(myRecipe.getTotalMash(), 1) + " " + myRecipe.getMaltUnits(); totalMashLabel.setText(mashWeightTotal); totalTimeLabel.setText(new Integer(myRecipe.mash.getMashTotalTime()).toString()); volLabel.setText(myRecipe.mash.getMashTotalVol()); grainTempText.setText(new Double(myRecipe.mash.getGrainTemp()).toString()); boilTempTxt.setText(new Double(myRecipe.mash.getBoilTempF()).toString()); tunLossTxt.setText(new Double(myRecipe.mash.getTunLossF()).toString()); tempFrb.setSelected(myRecipe.mash.getMashTempUnits().equalsIgnoreCase("F")); } } |
jLabel12 = new JLabel(); settingsPanel.add(jLabel12, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, | boilTempULbl = new JLabel(); settingsPanel.add(boilTempULbl, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, | private void initGUI() { try { GridBagLayout thisLayout = new GridBagLayout(); thisLayout.columnWeights = new double[]{0.3, 0.3}; thisLayout.columnWidths = new int[]{7, 7}; thisLayout.rowWeights = new double[]{0.1, 0.8, 0.1}; thisLayout.rowHeights = new int[]{7, 7, 7}; this.setLayout(thisLayout); { titlePanel = new JPanel(); FlowLayout titlePanelLayout = new FlowLayout(); titlePanelLayout.setAlignment(FlowLayout.LEFT); titlePanel.setLayout(titlePanelLayout); this.add(titlePanel, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); { titleLabel = new JLabel(); titlePanel.add(titleLabel); titleLabel.setText("Mash schedule for:"); titleLabel.setFont(new java.awt.Font("Dialog", 0, 12)); } { recipeNameLabel = new JLabel(); titlePanel.add(recipeNameLabel); recipeNameLabel.setText("Recipe Name"); } } { tablePanel = new JPanel(); BorderLayout pnlTableLayout = new BorderLayout(); tablePanel.setLayout(pnlTableLayout); this.add(tablePanel, new GridBagConstraints(0, 1, 2, 3, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); tablePanel.setName(""); tablePanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); { jScrollPane1 = new JScrollPane(); tablePanel.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(344, 145)); { mashModel = new MashTableModel(); tblMash = new JTable() { public String getToolTipText(MouseEvent e) { java.awt.Point p = e.getPoint(); int rowIndex = rowAtPoint(p); return SBStringUtils.multiLineToolTip(40, mashModel .getDirectionsAt(rowIndex)); } }; jScrollPane1.setViewportView(tblMash); tblMash.setModel(mashModel); tblMash.setAutoCreateColumnsFromModel(false); tblMash.getTableHeader().setReorderingAllowed(false); // set up type combo String[] types = {"acid", "gluten", "protein", "beta", "alpha", "mashout"}; JComboBox typesComboBox = new JComboBox(types); TableColumn mashColumn = tblMash.getColumnModel().getColumn(0); mashColumn.setCellEditor(new DefaultCellEditor(typesComboBox)); // set up method combo String[] methods = {"infusion", "decoction", "decoction thick", "decoction thin", "direct"}; JComboBox methodComboBox = new JComboBox(methods); mashColumn = tblMash.getColumnModel().getColumn(1); mashColumn.setCellEditor(new DefaultCellEditor(methodComboBox)); } } } jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); this.add(jPanel1, new GridBagConstraints(3, 1, 1, 2, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); jPanel1.setPreferredSize(new java.awt.Dimension(158, 230)); { settingsPanel = new JPanel(); jPanel1.add(settingsPanel, BorderLayout.CENTER); GridBagLayout settingsPanelLayout = new GridBagLayout(); settingsPanelLayout.rowWeights = new double[]{0.1, 0.1, 0.1, 0.1}; settingsPanelLayout.rowHeights = new int[]{7, 7, 7, 7}; settingsPanelLayout.columnWeights = new double[]{0.3, 0.1, 0.1}; settingsPanelLayout.columnWidths = new int[]{7, 7, 7}; settingsPanel.setLayout(settingsPanelLayout); settingsPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); settingsPanel.setPreferredSize(new java.awt.Dimension(172, 175)); jLabel15 = new JLabel(); settingsPanel.add(jLabel15, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel15.setText("Mash Ratio: 1:"); { ratioText = new JTextField(); settingsPanel.add(ratioText, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); ratioText.setText("1.25"); ratioText.addFocusListener(this); ratioText.addActionListener(this); } { ComboBoxModel ratioUnitsComboModel = new DefaultComboBoxModel(new String[]{ "qt/lb", "l/kg"}); this.setPreferredSize(new java.awt.Dimension(502, 276)); ratioUnitsCombo = new JComboBox(); settingsPanel.add(ratioUnitsCombo, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); ratioUnitsCombo.setModel(ratioUnitsComboModel); ratioUnitsCombo.addActionListener(this); } { grainTempText = new JTextField(); settingsPanel.add(grainTempText, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); grainTempText.setText("10"); grainTempText.addFocusListener(this); grainTempText.addActionListener(this); } { grainTempULabel = new JLabel(); settingsPanel.add(grainTempULabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grainTempULabel.setText("F"); } jLabel19 = new JLabel(); settingsPanel.add(jLabel19, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel19.setText("Grain Temp:"); boilTempTxt = new JTextField(); settingsPanel.add(boilTempTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); boilTempTxt.setText("212"); jLabel20 = new JLabel(); settingsPanel.add(jLabel20, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel20.setText("Boil Temp:"); jLabel12 = new JLabel(); settingsPanel.add(jLabel12, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel12.setText("F"); { tunLossTxt = new JTextField(); settingsPanel.add(tunLossTxt, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); tunLossTxt.addFocusListener(this); tunLossTxt.addActionListener(this); } { tempLostULabel = new JLabel(); settingsPanel.add(tempLostULabel, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); tempLostULabel.setText("F"); } jLabel1 = new JLabel(); settingsPanel.add(jLabel1, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("Temp Lost in Tun:"); { buttonsPanel = new JPanel(); tablePanel.add(buttonsPanel, BorderLayout.SOUTH); FlowLayout buttonsPanelLayout = new FlowLayout(); buttonsPanelLayout.setAlignment(FlowLayout.LEFT); buttonsPanel.setLayout(buttonsPanelLayout); buttonsPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); jToolBar1 = new JToolBar(); buttonsPanel.add(jToolBar1); jToolBar1.setFloatable(false); jToolBar1.setPreferredSize(new java.awt.Dimension(65, 18)); jLabel13 = new JLabel(); buttonsPanel.add(jLabel13); jLabel13.setText("Temp Units:"); { tempFrb = new JRadioButton(); buttonsPanel.add(tempFrb); tempFrb.setText("F"); tempFrb.addActionListener(this); } { tempCrb = new JRadioButton(); buttonsPanel.add(tempCrb); tempCrb.setText("C"); tempCrb.addActionListener(this); } tempBg = new ButtonGroup(); tempBg.add(tempFrb); tempBg.add(tempCrb); jLabel14 = new JLabel(); settingsPanel.add(jLabel14, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel14.setText("Vol Units:"); { delStepButton = new JButton(); jToolBar1.add(delStepButton); delStepButton.setText("-"); delStepButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { delStepButtonActionPerformed(evt); } }); } { addStepButton = new JButton(); jToolBar1.add(addStepButton); addStepButton.setText("+"); addStepButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { addStepButtonActionPerformed(evt); } }); } } { volUnitsComboModel = new ComboModel(); volUnitsComboModel.setList(new Quantity().getListofUnits("vol")); volUnitsCombo = new JComboBox(); settingsPanel.add(volUnitsCombo, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); volUnitsCombo.setModel(volUnitsComboModel); volUnitsCombo.addActionListener(this); } boilTempTxt.addFocusListener(this); boilTempTxt.addActionListener(this); } totalsPanel = new JPanel(); GridBagLayout totalsPanelLayout = new GridBagLayout(); totalsPanel.setLayout(totalsPanelLayout); jPanel1.add(totalsPanel, BorderLayout.SOUTH); jLabel16 = new JLabel(); totalMashLabel = new JLabel(); jLabel17 = new JLabel(); jLabel18 = new JLabel(); { totalTimeLabel = new JLabel(); totalTimeLabel.setText("Time"); } jLabel18.setText("Total Time:"); jLabel17.setText("Total Vol:"); totalsPanel .add(jLabel16, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalsPanel .add(totalMashLabel, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 0, 0), 0, 0)); totalsPanel .add(jLabel17, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalsPanel .add(jLabel18, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalsPanel .add(totalTimeLabel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 0, 0), 0, 0)); { volLabel = new JLabel(); totalsPanel.add(volLabel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 0, 0), 0, 0)); volLabel.setText("10"); } jLabel16.setText("Total Weight:"); totalsPanelLayout.rowWeights = new double[]{0.1, 0.1, 0.1}; totalsPanelLayout.rowHeights = new int[]{7, 7, 7}; totalsPanelLayout.columnWeights = new double[]{0.1, 0.1}; totalsPanelLayout.columnWidths = new int[]{7, 7}; totalsPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); totalMashLabel.setText("10"); } catch (Exception e) { e.printStackTrace(); } } |
jLabel12.setText("F"); | boilTempULbl.setText("F"); | private void initGUI() { try { GridBagLayout thisLayout = new GridBagLayout(); thisLayout.columnWeights = new double[]{0.3, 0.3}; thisLayout.columnWidths = new int[]{7, 7}; thisLayout.rowWeights = new double[]{0.1, 0.8, 0.1}; thisLayout.rowHeights = new int[]{7, 7, 7}; this.setLayout(thisLayout); { titlePanel = new JPanel(); FlowLayout titlePanelLayout = new FlowLayout(); titlePanelLayout.setAlignment(FlowLayout.LEFT); titlePanel.setLayout(titlePanelLayout); this.add(titlePanel, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); { titleLabel = new JLabel(); titlePanel.add(titleLabel); titleLabel.setText("Mash schedule for:"); titleLabel.setFont(new java.awt.Font("Dialog", 0, 12)); } { recipeNameLabel = new JLabel(); titlePanel.add(recipeNameLabel); recipeNameLabel.setText("Recipe Name"); } } { tablePanel = new JPanel(); BorderLayout pnlTableLayout = new BorderLayout(); tablePanel.setLayout(pnlTableLayout); this.add(tablePanel, new GridBagConstraints(0, 1, 2, 3, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); tablePanel.setName(""); tablePanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); { jScrollPane1 = new JScrollPane(); tablePanel.add(jScrollPane1, BorderLayout.CENTER); jScrollPane1.setPreferredSize(new java.awt.Dimension(344, 145)); { mashModel = new MashTableModel(); tblMash = new JTable() { public String getToolTipText(MouseEvent e) { java.awt.Point p = e.getPoint(); int rowIndex = rowAtPoint(p); return SBStringUtils.multiLineToolTip(40, mashModel .getDirectionsAt(rowIndex)); } }; jScrollPane1.setViewportView(tblMash); tblMash.setModel(mashModel); tblMash.setAutoCreateColumnsFromModel(false); tblMash.getTableHeader().setReorderingAllowed(false); // set up type combo String[] types = {"acid", "gluten", "protein", "beta", "alpha", "mashout"}; JComboBox typesComboBox = new JComboBox(types); TableColumn mashColumn = tblMash.getColumnModel().getColumn(0); mashColumn.setCellEditor(new DefaultCellEditor(typesComboBox)); // set up method combo String[] methods = {"infusion", "decoction", "decoction thick", "decoction thin", "direct"}; JComboBox methodComboBox = new JComboBox(methods); mashColumn = tblMash.getColumnModel().getColumn(1); mashColumn.setCellEditor(new DefaultCellEditor(methodComboBox)); } } } jPanel1 = new JPanel(); BorderLayout jPanel1Layout = new BorderLayout(); jPanel1.setLayout(jPanel1Layout); this.add(jPanel1, new GridBagConstraints(3, 1, 1, 2, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); jPanel1.setPreferredSize(new java.awt.Dimension(158, 230)); { settingsPanel = new JPanel(); jPanel1.add(settingsPanel, BorderLayout.CENTER); GridBagLayout settingsPanelLayout = new GridBagLayout(); settingsPanelLayout.rowWeights = new double[]{0.1, 0.1, 0.1, 0.1}; settingsPanelLayout.rowHeights = new int[]{7, 7, 7, 7}; settingsPanelLayout.columnWeights = new double[]{0.3, 0.1, 0.1}; settingsPanelLayout.columnWidths = new int[]{7, 7, 7}; settingsPanel.setLayout(settingsPanelLayout); settingsPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); settingsPanel.setPreferredSize(new java.awt.Dimension(172, 175)); jLabel15 = new JLabel(); settingsPanel.add(jLabel15, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel15.setText("Mash Ratio: 1:"); { ratioText = new JTextField(); settingsPanel.add(ratioText, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); ratioText.setText("1.25"); ratioText.addFocusListener(this); ratioText.addActionListener(this); } { ComboBoxModel ratioUnitsComboModel = new DefaultComboBoxModel(new String[]{ "qt/lb", "l/kg"}); this.setPreferredSize(new java.awt.Dimension(502, 276)); ratioUnitsCombo = new JComboBox(); settingsPanel.add(ratioUnitsCombo, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); ratioUnitsCombo.setModel(ratioUnitsComboModel); ratioUnitsCombo.addActionListener(this); } { grainTempText = new JTextField(); settingsPanel.add(grainTempText, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); grainTempText.setText("10"); grainTempText.addFocusListener(this); grainTempText.addActionListener(this); } { grainTempULabel = new JLabel(); settingsPanel.add(grainTempULabel, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); grainTempULabel.setText("F"); } jLabel19 = new JLabel(); settingsPanel.add(jLabel19, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel19.setText("Grain Temp:"); boilTempTxt = new JTextField(); settingsPanel.add(boilTempTxt, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); boilTempTxt.setText("212"); jLabel20 = new JLabel(); settingsPanel.add(jLabel20, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel20.setText("Boil Temp:"); jLabel12 = new JLabel(); settingsPanel.add(jLabel12, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel12.setText("F"); { tunLossTxt = new JTextField(); settingsPanel.add(tunLossTxt, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); tunLossTxt.addFocusListener(this); tunLossTxt.addActionListener(this); } { tempLostULabel = new JLabel(); settingsPanel.add(tempLostULabel, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); tempLostULabel.setText("F"); } jLabel1 = new JLabel(); settingsPanel.add(jLabel1, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel1.setText("Temp Lost in Tun:"); { buttonsPanel = new JPanel(); tablePanel.add(buttonsPanel, BorderLayout.SOUTH); FlowLayout buttonsPanelLayout = new FlowLayout(); buttonsPanelLayout.setAlignment(FlowLayout.LEFT); buttonsPanel.setLayout(buttonsPanelLayout); buttonsPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); jToolBar1 = new JToolBar(); buttonsPanel.add(jToolBar1); jToolBar1.setFloatable(false); jToolBar1.setPreferredSize(new java.awt.Dimension(65, 18)); jLabel13 = new JLabel(); buttonsPanel.add(jLabel13); jLabel13.setText("Temp Units:"); { tempFrb = new JRadioButton(); buttonsPanel.add(tempFrb); tempFrb.setText("F"); tempFrb.addActionListener(this); } { tempCrb = new JRadioButton(); buttonsPanel.add(tempCrb); tempCrb.setText("C"); tempCrb.addActionListener(this); } tempBg = new ButtonGroup(); tempBg.add(tempFrb); tempBg.add(tempCrb); jLabel14 = new JLabel(); settingsPanel.add(jLabel14, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel14.setText("Vol Units:"); { delStepButton = new JButton(); jToolBar1.add(delStepButton); delStepButton.setText("-"); delStepButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { delStepButtonActionPerformed(evt); } }); } { addStepButton = new JButton(); jToolBar1.add(addStepButton); addStepButton.setText("+"); addStepButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { addStepButtonActionPerformed(evt); } }); } } { volUnitsComboModel = new ComboModel(); volUnitsComboModel.setList(new Quantity().getListofUnits("vol")); volUnitsCombo = new JComboBox(); settingsPanel.add(volUnitsCombo, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); volUnitsCombo.setModel(volUnitsComboModel); volUnitsCombo.addActionListener(this); } boilTempTxt.addFocusListener(this); boilTempTxt.addActionListener(this); } totalsPanel = new JPanel(); GridBagLayout totalsPanelLayout = new GridBagLayout(); totalsPanel.setLayout(totalsPanelLayout); jPanel1.add(totalsPanel, BorderLayout.SOUTH); jLabel16 = new JLabel(); totalMashLabel = new JLabel(); jLabel17 = new JLabel(); jLabel18 = new JLabel(); { totalTimeLabel = new JLabel(); totalTimeLabel.setText("Time"); } jLabel18.setText("Total Time:"); jLabel17.setText("Total Vol:"); totalsPanel .add(jLabel16, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalsPanel .add(totalMashLabel, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 0, 0), 0, 0)); totalsPanel .add(jLabel17, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalsPanel .add(jLabel18, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); totalsPanel .add(totalTimeLabel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 0, 0), 0, 0)); { volLabel = new JLabel(); totalsPanel.add(volLabel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 0, 0), 0, 0)); volLabel.setText("10"); } jLabel16.setText("Total Weight:"); totalsPanelLayout.rowWeights = new double[]{0.1, 0.1, 0.1}; totalsPanelLayout.rowHeights = new int[]{7, 7, 7}; totalsPanelLayout.columnWeights = new double[]{0.1, 0.1}; totalsPanelLayout.columnWidths = new int[]{7, 7}; totalsPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); totalMashLabel.setText("10"); } catch (Exception e) { e.printStackTrace(); } } |
Object param = null; double result = 0; int i = 0; | Object param = stack.pop(); Number result; if (param instanceof Number) result = (Number) param; else throw new ParseException("Invalid parameter type"); | public void run(Stack stack) throws ParseException { // Check if stack is null if (null == stack) { throw new ParseException("Stack argument null"); } Object param = null; double result = 0; int i = 0; // repeat summation for each one of the current parameters while (i < curNumberOfParameters) { // get the parameter from the stack param = stack.pop(); if (param instanceof Number) { // calculate the result result += ((Number) param).doubleValue(); } else { throw new ParseException("Invalid parameter type"); } i++; } // push the result on the inStack stack.push(new Double(result)); } |
while (i < curNumberOfParameters) { | for(int i=1;i < curNumberOfParameters;++i) { | public void run(Stack stack) throws ParseException { // Check if stack is null if (null == stack) { throw new ParseException("Stack argument null"); } Object param = null; double result = 0; int i = 0; // repeat summation for each one of the current parameters while (i < curNumberOfParameters) { // get the parameter from the stack param = stack.pop(); if (param instanceof Number) { // calculate the result result += ((Number) param).doubleValue(); } else { throw new ParseException("Invalid parameter type"); } i++; } // push the result on the inStack stack.push(new Double(result)); } |
result += ((Number) param).doubleValue(); | result = addFun.add((Number) param,result); | public void run(Stack stack) throws ParseException { // Check if stack is null if (null == stack) { throw new ParseException("Stack argument null"); } Object param = null; double result = 0; int i = 0; // repeat summation for each one of the current parameters while (i < curNumberOfParameters) { // get the parameter from the stack param = stack.pop(); if (param instanceof Number) { // calculate the result result += ((Number) param).doubleValue(); } else { throw new ParseException("Invalid parameter type"); } i++; } // push the result on the inStack stack.push(new Double(result)); } |
stack.push(new Double(result)); | stack.push(result); | public void run(Stack stack) throws ParseException { // Check if stack is null if (null == stack) { throw new ParseException("Stack argument null"); } Object param = null; double result = 0; int i = 0; // repeat summation for each one of the current parameters while (i < curNumberOfParameters) { // get the parameter from the stack param = stack.pop(); if (param instanceof Number) { // calculate the result result += ((Number) param).doubleValue(); } else { throw new ParseException("Invalid parameter type"); } i++; } // push the result on the inStack stack.push(new Double(result)); } |
public UnitRangeImpl getAmpRange(){ return ampConfig.getAmpRange(); } | public UnitRangeImpl getAmpRange(LocalSeismogram seis){ return ampConfig.getAmpRange(seis); } | public UnitRangeImpl getAmpRange(){ return ampConfig.getAmpRange(); } |
setSize(400, 400); | setSize(500, 500); | private void layoutUi() { JPanel buttons = new JPanel(); okButton = new JButton("OK"); okButton.addActionListener(this); JButton cancelButton = new JButton("Cancel"); cancelButton.addActionListener(this); buttons.setLayout(new FlowLayout(FlowLayout.RIGHT)); buttons.add(cancelButton); buttons.add(okButton); getContentPane().setLayout(new BorderLayout()); this.setFocusTraversalKeysEnabled(false); { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); { pnlCalculations = new JPanel(); jTabbedPane1.addTab("Calculations", null, pnlCalculations, null); { try { { GridBagLayout thisLayout = new GridBagLayout(); thisLayout.rowWeights = new double[]{0.1, 0.1, 0.1, 0.1}; thisLayout.rowHeights = new int[]{7, 7, 7, 7}; thisLayout.columnWeights = new double[]{0.1, 0.2}; thisLayout.columnWidths = new int[]{7, 7}; pnlCalculations.setLayout(thisLayout); pnlCalculations.setPreferredSize(new java.awt.Dimension(524, 372)); { { bgHopsCalc = new ButtonGroup(); { pnlHops = new JPanel(); GridLayout pnlHopsLayout = new GridLayout(2, 2); pnlHopsLayout.setColumns(2); pnlHopsLayout.setHgap(5); pnlHopsLayout.setVgap(5); pnlHopsLayout.setRows(2); pnlHops.setLayout(pnlHopsLayout); pnlCalculations.add(pnlHops, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); pnlHops .setBorder(BorderFactory .createTitledBorder("Hops:")); { jLabelc1 = new JLabel(); pnlHops.add(jLabelc1); jLabelc1.setText("Pellet Hops +%"); } { txtPellet = new JTextField(); pnlHops.add(txtPellet); txtPellet.setPreferredSize(new java.awt.Dimension(20, 20)); } { jLabelc2 = new JLabel(); pnlHops.add(jLabelc2); jLabelc2.setText("Tinseth Utilization Factor"); } { txtTinsethUtil = new JTextField(); pnlHops.add(txtTinsethUtil); txtTinsethUtil.setText("4.15"); } } { pnlAlc = new JPanel(); BoxLayout pnlAlcLayout = new BoxLayout(pnlAlc, javax.swing.BoxLayout.Y_AXIS); pnlAlc.setLayout(pnlAlcLayout); pnlCalculations.add(pnlAlc, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); pnlAlc.setBorder(BorderFactory .createTitledBorder("Alcohol By:")); { rbABV = new JRadioButton(); pnlAlc.add(rbABV); bgAlc.add(rbABV); rbABV.setText("Volume"); } { rbABW = new JRadioButton(); pnlAlc.add(rbABW); bgAlc.add(rbABW); rbABW.setText("Weight"); } } { pnlHopTimes = new JPanel(); GridLayout pnlHopTimesLayout = new GridLayout(3, 2); pnlHopTimesLayout.setColumns(2); pnlHopTimesLayout.setHgap(5); pnlHopTimesLayout.setVgap(5); pnlHopTimesLayout.setRows(3); pnlHopTimes.setLayout(pnlHopTimesLayout); pnlCalculations.add(pnlHopTimes, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); pnlHopTimes.setBorder(BorderFactory .createTitledBorder("Hop Times:")); { jLabelc3 = new JLabel(); pnlHopTimes.add(jLabelc3); jLabelc3.setText("Dry (min):"); } { txtDryHopTime = new JTextField(); pnlHopTimes.add(txtDryHopTime); txtDryHopTime.setText("0.0"); } { jLabelc4 = new JLabel(); pnlHopTimes.add(jLabelc4); jLabelc4.setText("FWH, boil minus (min):"); } { txtFWHTime = new JTextField(); pnlHopTimes.add(txtFWHTime); txtFWHTime.setText("20.0"); } { jLabelc5 = new JLabel(); pnlHopTimes.add(jLabelc5); jLabelc5.setText("Mash Hop (min):"); } { txtMashHopTime = new JTextField(); pnlHopTimes.add(txtMashHopTime); txtMashHopTime.setText("2.0"); } } } pnlHopsCalc = new JPanel(); BoxLayout pnlHopsCalcLayout = new BoxLayout(pnlHopsCalc, javax.swing.BoxLayout.Y_AXIS); pnlHopsCalc.setLayout(pnlHopsCalcLayout); pnlCalculations.add(pnlHopsCalc, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); pnlCalculations.add(getPnlWaterUsage(), new GridBagConstraints(1, 2, 1, 2, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); pnlCalculations.add(getPnlColourOptions(), new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); pnlCalculations.add(getPnlEvaporation(), new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); pnlHopsCalc.setPreferredSize(new java.awt.Dimension(117, 107)); pnlHopsCalc.setBorder(BorderFactory .createTitledBorder("IBU Calc Method:")); { rbTinseth = new JRadioButton(); pnlHopsCalc.add(rbTinseth); rbTinseth.setText("Tinseth"); bgHopsCalc.add(rbTinseth); } { rbRager = new JRadioButton(); pnlHopsCalc.add(rbRager); rbRager.setText("Rager"); bgHopsCalc.add(rbRager); } { rbGaretz = new JRadioButton(); pnlHopsCalc.add(rbGaretz); rbGaretz.setText("Garetz"); bgHopsCalc.add(rbGaretz); } } } } catch (Exception e) { e.printStackTrace(); } } } { costCarbPanel = new JPanel(); BorderLayout costCarbPanelLayout = new BorderLayout(); costCarbPanel.setLayout(costCarbPanelLayout); jTabbedPane1.addTab("Cost & Carb", null, costCarbPanel, null); { carbPanel = new JPanel(); costCarbPanel.add(carbPanel, BorderLayout.CENTER); carbPanel.setBorder(BorderFactory.createTitledBorder(null, "Carbonation", TitledBorder.LEADING, TitledBorder.TOP)); { jLabel3 = new JLabel(); carbPanel.add(jLabel3); jLabel3.setText("Not implemented"); } } { jPanel2 = new JPanel(); costCarbPanel.add(jPanel2, BorderLayout.NORTH); GridBagLayout jPanel2Layout = new GridBagLayout(); jPanel2Layout.rowWeights = new double[]{0.1, 0.1, 0.4}; jPanel2Layout.rowHeights = new int[]{7, 7, 7}; jPanel2Layout.columnWeights = new double[]{0.1, 0.1, 0.1}; jPanel2Layout.columnWidths = new int[]{7, 7, 7}; jPanel2.setPreferredSize(new java.awt.Dimension(232, 176)); jPanel2.setBorder(BorderFactory.createTitledBorder("Cost")); jPanel2.setLayout(jPanel2Layout); { jLabel1 = new JLabel(); jPanel2.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets( 0, 0, 0, 0), 0, 0)); jLabel1.setText("Other Cost:"); } { txtOtherCost = new JTextField(); jPanel2.add(txtOtherCost, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets( 0, 0, 0, 0), 0, 0)); txtOtherCost.setText("$0.00"); } { jLabel2 = new JLabel(); jPanel2.add(jLabel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets( 0, 0, 0, 0), 0, 0)); jLabel2.setText("Bottle Size:"); } { cmbBottleSize = new JComboBox(); cmbBottleSizeModel = new ComboModel(); cmbBottleSizeModel.setList(new Quantity().getListofUnits("vol")); cmbBottleSize.setModel(cmbBottleSizeModel); jPanel2.add(cmbBottleSize, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jPanel2.add(getTxtBottleSize(), new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); } } { } } { pnlBrewer = new JPanel(); GridBagLayout pnlBrewerLayout = new GridBagLayout(); pnlBrewerLayout.rowWeights = new double[]{0.1, 0.1, 0.3, 0.3}; pnlBrewerLayout.rowHeights = new int[]{2, 2, 7, 7}; pnlBrewerLayout.columnWeights = new double[]{0.1, 0.1, 0.1, 0.1}; pnlBrewerLayout.columnWidths = new int[]{7, 7, 7, 7}; pnlBrewer.setLayout(pnlBrewerLayout); jTabbedPane1.addTab("Brewer", null, pnlBrewer, null); { jLabel4 = new JLabel(); pnlBrewer.add(jLabel4, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel4.setText("Name:"); } { txtBrewerName = new JTextField(); pnlBrewer.add(txtBrewerName, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); txtBrewerName.setText("Your Name"); } { jLabel5 = new JLabel(); pnlBrewer.add(jLabel5, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel5.setText("Phone:"); } { txtPhone = new JTextField(); pnlBrewer.add(txtPhone, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); txtPhone.setText("Your Phone"); } { jLabel6 = new JLabel(); pnlBrewer.add(jLabel6, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel6.setText("Club Name:"); } { txtClubName = new JTextField(); pnlBrewer.add(txtClubName, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); txtClubName.setText("Club Name"); } { jLabel7 = new JLabel(); pnlBrewer.add(jLabel7, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("Email:"); } { txtEmail = new JTextField(); pnlBrewer.add(txtEmail, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0)); txtEmail.setText("Email"); } } { pnlDatabase = new JPanel(); BorderLayout pnlDatabaseLayout = new BorderLayout(); pnlDatabase.setLayout(pnlDatabaseLayout); pnlDatabase.add(getPnlDefaultDB(), BorderLayout.NORTH); pnlDatabase.add(getPnlSortOrder(), BorderLayout.WEST); jTabbedPane1.addTab("Database", null, pnlDatabase, null); pnlDatabase.setVisible(false); } newRecipePanel = new JPanel(); GridBagLayout newRecipePanelLayout = new GridBagLayout(); newRecipePanelLayout.rowWeights = new double[]{0.1, 0.1, 0.1, 0.1}; newRecipePanelLayout.rowHeights = new int[]{7, 7, 7, 7}; newRecipePanelLayout.columnWeights = new double[]{0.1, 0.1, 0.1, 0.1}; newRecipePanelLayout.columnWidths = new int[]{7, 7, 7, 7}; newRecipePanel.setLayout(newRecipePanelLayout); jTabbedPane1.addTab("New Recipe Defaults", null, newRecipePanel, null); appearancePanel = new JPanel(); BorderLayout appearancePanelLayout = new BorderLayout(); appearancePanel.setLayout(appearancePanelLayout); jTabbedPane1.addTab("Appearance", null, appearancePanel, null); colourPanel = new JPanel(); appearancePanel.add(colourPanel, BorderLayout.CENTER); GridBagLayout colourPanelLayout = new GridBagLayout(); colourPanelLayout.rowWeights = new double[]{0.1, 0.1, 0.1, 0.1}; colourPanelLayout.rowHeights = new int[]{7, 7, 7, 7}; colourPanelLayout.columnWeights = new double[]{0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; colourPanelLayout.columnWidths = new int[]{7, 7, 7, 7, 7, 7}; colourPanel.setLayout(colourPanelLayout); colourPanel.setPreferredSize(new java.awt.Dimension(340, 223)); colourPanel.setBorder(BorderFactory.createTitledBorder("Colour Swatch")); landfPanel = new JPanel(); appearancePanel.add(landfPanel, BorderLayout.NORTH); jLabel19 = new JLabel(); landfPanel.add(jLabel19); jLabel19.setText("Look and Feel:"); landfCombo = new JComboBox(looks.toArray()); landfPanel.add(landfCombo); colMethod1rb = new JRadioButton(); colMethod1rb.addActionListener(this); colourGroup.add(colMethod1rb); colourPanel.add(colMethod1rb, new GridBagConstraints(0, 0, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); colMethod1rb.setText("Colour Method 1"); colMethod2rb = new JRadioButton(); colMethod2rb.addActionListener(this); colourGroup.add(colMethod2rb); colourPanel.add(colMethod2rb, new GridBagConstraints(3, 0, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); colMethod2rb.setText("Colour Method 2"); jLabel13 = new JLabel(); colourPanel.add(jLabel13, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel13.setText("Straw \n(2)"); jLabel14 = new JLabel(); colourPanel.add(jLabel14, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel14.setText("Pale\n(4)"); jLabel15 = new JLabel(); colourPanel.add(jLabel15, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel15.setText("Amber\n(8)"); jLabel16 = new JLabel(); colourPanel.add(jLabel16, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel16.setText("Copper (15)"); jLabel17 = new JLabel(); colourPanel.add(jLabel17, new GridBagConstraints(4, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel17.setText("Brown (20)"); jLabel18 = new JLabel(); colourPanel.add(jLabel18, new GridBagConstraints(5, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel18.setText("Black (30)"); stawPanel = new JPanel(); colourPanel.add(stawPanel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); stawPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); palePanel = new JPanel(); colourPanel.add(palePanel, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); palePanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); amberPanel = new JPanel(); colourPanel.add(amberPanel, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); amberPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); copperPanel = new JPanel(); colourPanel.add(copperPanel, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); copperPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); brownPanel = new JPanel(); colourPanel.add(brownPanel, new GridBagConstraints(4, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); brownPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); blackPanel = new JPanel(); colourPanel.add(blackPanel, new GridBagConstraints(5, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); blackPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); mashPanel = new JPanel(); newRecipePanel.add(mashPanel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); mashPanel.setBorder(BorderFactory.createTitledBorder("Mash")); jLabel12 = new JLabel(); mashPanel.add(jLabel12); jLabel12.setText("Boil Temp (F):"); boilTempTxt = new JTextField(); mashPanel.add(boilTempTxt); boilTempTxt.setText("212"); } getContentPane().add(BorderLayout.CENTER, jTabbedPane1); getContentPane().add(BorderLayout.SOUTH, buttons); setSize(400, 400); } |
else if(splits[0].equals("Qu")) { j = new GroupJep(new Quartonians()); j.addStandardConstants(); } | private String getCommand() throws IOException { String s; System.out.print(prompt); if (br == null) return null; if ( (s = br.readLine()) == null) return null; if (s.equals("q") || s.equals("quit") || s.equals("exit")) return null; if(s.equals("group")) { System.out.println("Current Group: "+j.getGroup().toString()); return getCommand(); } else if(s.startsWith("group")) { try { groupName = s.substring(6); // split into string separated by spaces String splits[] = split(groupName); System.out.println("Changing group to '"+groupName+"'"); if(splits[0].equals("Z")) { j = new GroupJep(new Integers()); } else if(splits[0].equals("Q")) { j = new GroupJep(new Rationals()); } else if(splits[0].equals("R")) { j = new GroupJep(new BigReals( Integer.parseInt(splits[1]), BigDecimal.ROUND_HALF_EVEN )); } else if(splits[0].equals("P")) { j = new GroupJep(new PermutationGroup( Integer.parseInt(splits[1])) ); } else if(splits[0].equals("Zn")) { j = new GroupJep(new Zn(new BigInteger(splits[1]))); } else if(splits[0].equals("extend") && splits.length == 2) { RingI ring = (RingI) j.getGroup(); j = new GroupJep(new FreeGroup(ring, splits[1])); j.addStandardConstants(); } else if(splits[0].equals("extend")) { RingI ring = (RingI) j.getGroup(); int deg = splits.length-3; Number coeffs[] = new Number[deg+1]; for(int i=0;i<=deg;++i) coeffs[i] = ring.valueOf(splits[splits.length-i-1]); Polynomial p1 = new Polynomial(ring,splits[1],coeffs); j = new GroupJep(new AlgebraicExtension(ring, p1)); j.addStandardConstants(); } else System.out.println("Invalid group: "+groupName); System.out.println("Current Group: "+j.getGroup().toString()); return getCommand(); } catch(Exception e) { e.printStackTrace(); return getCommand(); } } return s; } |
|
public BigReals(int scale,int roundMode) { this.roundMode = roundMode; this.scale = scale; } | private BigReals() {} | public BigReals(int scale,int roundMode) { this.roundMode = roundMode; this.scale = scale; } |
else return a.divide(b,roundMode); | return a.divide(b,roundMode); | public Number div(Number num1, Number num2) { BigDecimal a = (BigDecimal) num1; BigDecimal b = (BigDecimal) num2; if(scale>0) return a.divide(b,scale,roundMode); else return a.divide(b,roundMode); } |
if (!allowRecalcs) return; | public void calcHopsTotals() { double ibuTotal = 0; totalHopsCost = 0; totalHopsOz = 0; for (int i = 0; i < hops.size(); i++) { // calculate the average OG of the boil // first, the OG at the time of addition: double adjPreSize, aveOg = 0; Hop h = ((Hop) hops.get(i)); if (h.getAdd().equalsIgnoreCase("boil") || h.getAdd().equalsIgnoreCase("fwh")) { if (h.getMinutes() > 0) adjPreSize = postBoilVol.getValueAs("gal") + (preBoilVol.getValueAs("gal") - postBoilVol.getValueAs("gal")) / (boilMinutes / h.getMinutes()); else adjPreSize = postBoilVol.getValueAs("gal"); aveOg = 1 + (((estOg - 1) + ((estOg - 1) / (adjPreSize / postBoilVol .getValueAs("gal")))) / 2); if (ibuCalcMethod.equals("Tinseth")) h.setIBU(calcTinseth(h.getAmountAs("oz"), postBoilVol.getValueAs("gal"), aveOg, h.getMinutes(), h.getAlpha(), ibuHopUtil)); else if (ibuCalcMethod.equals("Rager")) h.setIBU(CalcRager(h.getAmountAs("oz"), postBoilVol.getValueAs("gal"), aveOg, h .getMinutes(), h.getAlpha())); else h.setIBU(CalcGaretz(h.getAmountAs("oz"), postBoilVol.getValueAs("gal"), aveOg, h.getMinutes(), preBoilVol.getValueAs("gal"), 1, h.getAlpha())); if (h.getType().equalsIgnoreCase("Pellet")) { h.setIBU(h.getIBU() * (1.0 + (pelletHopPct / 100))); } ibuTotal += h.getIBU(); } totalHopsCost += h.getCostPerU() * h.getAmountAs(h.getUnits()); totalHopsOz += h.getAmountAs("oz"); } ibu = ibuTotal; } |
|
if (!allowRecalcs) return; | public void calcMaltTotals() { double maltPoints = 0; double mcu = 0; totalMaltLbs = 0; totalMaltCost = 0; totalMashLbs = 0; // first figure out the total we're dealing with for (int i = 0; i < fermentables.size(); i++) { Fermentable m = ((Fermentable) fermentables.get(i)); totalMaltLbs += (m.getAmountAs("lb")); if (m.getMashed()) { // apply efficiency and add to mash weight maltPoints += (m.getPppg() - 1) * m.getAmountAs("lb") * efficiency / postBoilVol.getValueAs("gal"); totalMashLbs += (m.getAmountAs("lb")); } else maltPoints += (m.getPppg() - 1) * m.getAmountAs("lb") * 100 / postBoilVol.getValueAs("gal"); mcu += m.getLov() * m.getAmountAs("lb") / postBoilVol.getValueAs("gal"); totalMaltCost += m.getCostPerU() * m.getAmountAs(m.getUnits()); } // now set the malt % by weight: for (int i = 0; i < fermentables.size(); i++) { Fermentable m = ((Fermentable) fermentables.get(i)); m.setPercent((m.getAmountAs("lb") / totalMaltLbs * 100)); } // set the fields in the object estOg = (maltPoints / 100) + 1; estFg = 1 + ((estOg - 1) * ((100 - attenuation) / 100)); srm = calcColour(mcu); mash.setMaltWeight(totalMashLbs); calcAlcohol(getAlcMethod()); // do the water calcs w/ the updated mash: chillShrinkQTS = getPostBoilVol("qt") * CHILLPERCENT; spargeQTS = getPreBoilVol("qt") - (mash.getTotalWaterQts() - mash.getAbsorbedQts()); totalWaterQTS = mash.getTotalWaterQts() + spargeQTS; finalWortVolQTS = postBoilVol.getValueAs("qt") - (chillShrinkQTS + Quantity.convertUnit(getVolUnits(), "qt", kettleLoss) + Quantity.convertUnit(getVolUnits(), "qt", trubLoss) + Quantity .convertUnit(getVolUnits(), "qt", miscLoss)); } |
|
sb.append(" <EVAP>" + evap + "</EVAP>\n"); sb.append(" <EVAP_METHOD>" + evapMethod + "</EVAP_METHOD>\n"); | public String toXML() { StringBuffer sb = new StringBuffer(); sb.append("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"); sb.append("<STRANGEBREWRECIPE version = \"" + version + "\">\n"); sb.append("<!-- This is a SBJava export. StrangeBrew 1.8 will not import it. -->\n"); sb.append(" <DETAILS>\n"); sb.append(" <NAME>" + SBStringUtils.subEntities(name) + "</NAME>\n"); sb.append(" <BREWER>" + SBStringUtils.subEntities(brewer) + "</BREWER>\n"); sb.append(" <NOTES>" + SBStringUtils.subEntities(comments) + "</NOTES>\n"); sb.append(" <EFFICIENCY>" + efficiency + "</EFFICIENCY>\n"); sb.append(" <OG>" + SBStringUtils.format(estOg, 3) + "</OG>\n"); sb.append(" <FG>" + SBStringUtils.format(estFg, 3) + "</FG>\n"); sb.append(" <STYLE>" + style.getName() + "</STYLE>\n"); sb.append(" <MASH>" + mashed + "</MASH>\n"); sb.append(" <LOV>" + SBStringUtils.format(srm, 1) + "</LOV>\n"); sb.append(" <IBU>" + SBStringUtils.format(ibu, 1) + "</IBU>\n"); sb.append(" <ALC>" + SBStringUtils.format(alcohol, 1) + "</ALC>\n"); sb.append(" <BOIL_TIME>" + boilMinutes + "</BOIL_TIME>\n"); sb.append(" <PRESIZE>" + preBoilVol.getValue() + "</PRESIZE>\n"); sb.append(" <SIZE>" + postBoilVol.getValue() + "</SIZE>\n"); sb.append(" <SIZE_UNITS>" + postBoilVol.getUnits() + "</SIZE_UNITS>\n"); sb.append(" <MALT_UNITS>" + maltUnits + "</MALT_UNITS>\n"); sb.append(" <HOPS_UNITS>" + hopUnits + "</HOPS_UNITS>\n"); sb.append(" <YEAST>" + yeast.getName() + "</YEAST>\n"); SimpleDateFormat df = new SimpleDateFormat("MM/dd/yyyy"); sb.append(" <RECIPE_DATE>" + df.format(created.getTime()) + "</RECIPE_DATE>\n"); sb.append(" <ATTENUATION>" + attenuation + "</ATTENUATION>\n"); sb.append(" <!-- SBJ1.0 Extensions: -->\n"); sb.append(" <ALC_METHOD>" + alcMethod + "</ALC_METHOD>\n"); sb.append(" <IBU_METHOD>" + ibuCalcMethod + "</IBU_METHOD>\n"); sb.append(" <COLOUR_METHOD>" + colourMethod + "</COLOUR_METHOD>\n"); sb.append(" <EVAP>" + evap + "</EVAP>\n"); sb.append(" <EVAP_METHOD>" + evapMethod + "</EVAP_METHOD>\n"); sb.append(" <KETTLE_LOSS>" + kettleLoss + "</KETTLE_LOSS>\n"); sb.append(" <TRUB_LOSS>" + trubLoss + "</TRUB_LOSS>\n"); sb.append(" <MISC_LOSS>" + miscLoss + "</MISC_LOSS>\n"); sb.append(" <PELLET_HOP_PCT>" + pelletHopPct + "</PELLET_HOP_PCT>\n"); sb.append(" <YEAST_COST>" + yeast.getCostPerU() + "</YEAST_COST>\n"); sb.append(" <OTHER_COST>" + otherCost + "</OTHER_COST>\n"); sb.append(" <!-- END SBJ1.0 Extensions -->\n"); sb.append(" </DETAILS>\n"); // fermentables list: sb.append(" <FERMENTABLES>\n"); for (int i = 0; i < fermentables.size(); i++) { Fermentable m = (Fermentable) fermentables.get(i); sb.append(m.toXML()); } sb.append(" </FERMENTABLES>\n"); // hops list: sb.append(" <HOPS>\n"); for (int i = 0; i < hops.size(); i++) { Hop h = (Hop) hops.get(i); sb.append(h.toXML()); } sb.append(" </HOPS>\n"); // misc ingredients list: sb.append(" <MISC>\n"); for (int i = 0; i < misc.size(); i++) { Misc mi = (Misc) misc.get(i); sb.append(mi.toXML()); } sb.append(" </MISC>\n"); sb.append(mash.toXml()); // notes list: sb.append(" <NOTES>\n"); for (int i = 0; i < notes.size(); i++) { sb.append(((Note) notes.get(i)).toXML()); } sb.append(" </NOTES>\n"); sb.append("</STRANGEBREWRECIPE>"); return sb.toString(); } |
|
sb.append( " <DESCRIPTION>"+getDescription()+"</DESCRIPTION>\n" ); | sb.append( " <DESCRIPTION>"+SBStringUtils.subEntities(getDescription())+"</DESCRIPTION>\n" ); | public String toXML(){ StringBuffer sb = new StringBuffer(); sb.append( " <ITEM>\n" ); sb.append( " <HOP>"+getName()+"</HOP>\n" ); sb.append( " <AMOUNT>"+getAmountAs(getUnits())+"</AMOUNT>\n" ); sb.append( " <TIME>"+getMinutes()+"</TIME>\n" ); sb.append( " <UNITS>"+getUnitsAbrv()+"</UNITS>\n" ); sb.append( " <FORM>"+getType()+"</FORM>\n" ); sb.append( " <ALPHA>"+alpha+"</ALPHA>\n" ); sb.append( " <COSTOZ>"+getCostPerU()+"</COSTOZ>\n" ); sb.append( " <ADD>"+add+"</ADD>\n" ); sb.append( " <DESCRIPTION>"+getDescription()+"</DESCRIPTION>\n" ); sb.append( " <DATE>"+getDate()+"</DATE>\n" ); sb.append( " </ITEM>\n" ); return sb.toString(); } |
sb.append( " <COMMENTS>"+comments+"</COMMENTS>\n" ); | sb.append( " <COMMENTS>"+SBStringUtils.subEntities(comments)+"</COMMENTS>\n" ); | public String toXML(){ StringBuffer sb = new StringBuffer(); sb.append( " <ITEM>\n" ); sb.append( " <NAME>"+getName()+"</NAME>\n" ); sb.append( " <AMOUNT>"+getAmountAs(getUnits())+"</AMOUNT>\n" ); sb.append( " <UNITS>"+getUnits()+"</UNITS>\n" ); sb.append( " <STAGE>"+stage+"</STAGE>\n" ); sb.append( " <TIME>"+time+"</TIME>\n" ); sb.append( " <COMMENTS>"+comments+"</COMMENTS>\n" ); sb.append( " </ITEM>\n" ); return sb.toString(); } |
R first = m.get(m.firstKey()); | R first = m.isEmpty() ? null : m.get(m.firstKey()); | private R update(TreeMap<Integer, R> m, Integer key, R value) { R first = m.get(m.firstKey()); R r = m.put(key, value); SortedMap<Integer,R> head = m.headMap(key); if(!head.isEmpty()) { R prev = m.get(head.lastKey()); value.nextBuild = prev.nextBuild; value.previousBuild = prev; if(value.nextBuild!=null) value.nextBuild.previousBuild = value; prev.nextBuild=value; } else { if(!m.isEmpty()) { value.nextBuild = first; value.previousBuild = null; first.previousBuild = value; } } return r; } |
if(!m.isEmpty()) { value.nextBuild = first; value.previousBuild = null; | value.nextBuild = first; value.previousBuild = null; if(first!=null) | private R update(TreeMap<Integer, R> m, Integer key, R value) { R first = m.get(m.firstKey()); R r = m.put(key, value); SortedMap<Integer,R> head = m.headMap(key); if(!head.isEmpty()) { R prev = m.get(head.lastKey()); value.nextBuild = prev.nextBuild; value.previousBuild = prev; if(value.nextBuild!=null) value.nextBuild.previousBuild = value; prev.nextBuild=value; } else { if(!m.isEmpty()) { value.nextBuild = first; value.previousBuild = null; first.previousBuild = value; } } return r; } |
} | private R update(TreeMap<Integer, R> m, Integer key, R value) { R first = m.get(m.firstKey()); R r = m.put(key, value); SortedMap<Integer,R> head = m.headMap(key); if(!head.isEmpty()) { R prev = m.get(head.lastKey()); value.nextBuild = prev.nextBuild; value.previousBuild = prev; if(value.nextBuild!=null) value.nextBuild.previousBuild = value; prev.nextBuild=value; } else { if(!m.isEmpty()) { value.nextBuild = first; value.previousBuild = null; first.previousBuild = value; } } return r; } |
|
return new LocalSeismogramImpl(seisId, time, evRec.getFixedHeader().getSampleCount(), new SamplingImpl(1, new TimeInterval(1.0/evRec.getFixedHeader().getSampleRate(), UnitImpl.SECOND) ), UnitImpl.COUNT, channelId, data); | LocalSeismogramImpl lsi = new LocalSeismogramImpl(seisId, time, evRec.getFixedHeader().getSampleCount(), new SamplingImpl(1, new TimeInterval(1.0/evRec.getFixedHeader().getSampleRate(), UnitImpl.SECOND) ), UnitImpl.COUNT, channelId, data); return lsi; | public static LocalSeismogramImpl getSeismogram(PSNEventRecord evRec) throws FissuresException{ MicroSecondDate beginTime = microSecondDateFromPSN(evRec.getFixedHeader().getDateTime()); Time time = beginTime.getFissuresTime(); TimeSeriesDataSel data = new TimeSeriesDataSel(); if (evRec.isSampleDataShort()){ data.sht_values(evRec.getSampleDataShort()); } else if(evRec.isSampleDataInt()){ data.int_values(evRec.getSampleDataInt()); } else if(evRec.isSampleDataFloat()){ data.flt_values(evRec.getSampleDataFloat()); } else if(evRec.isSampleDataDouble()){ data.dbl_values(evRec.getSampleDataDouble()); } else throw new FissuresException(); ChannelId channelId = getChannelId(evRec); String eventName = " "; if (evRec.getVariableHeader().hasComment()){ eventName = evRec.getVariableHeader().getComment(); } String seisId = channelId.network_id.network_code + ":" + channelId.station_code + ":" + channelId.site_code + ":" + channelId.channel_code + ":" + time.date_time; return new LocalSeismogramImpl(seisId, time, evRec.getFixedHeader().getSampleCount(), new SamplingImpl(1, new TimeInterval(1.0/evRec.getFixedHeader().getSampleRate(), UnitImpl.SECOND) ), UnitImpl.COUNT, channelId, data); } |
dataset.addParameterRef(new URL(base, | URL dirURL = new URL(base, directory.getName()); dataset.addParameterRef(new URL(dirURL, | void process() throws ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = factory.newDocumentBuilder(); String userName = System.getProperty("user.name"); dataset = new XMLDataSet(docBuilder, base, "genid"+Math.round(Math.random()*Integer.MAX_VALUE), dsName, userName); Iterator it = paramRefs.keySet().iterator(); while (it.hasNext()) { String key = (String)it.next(); AuditInfo[] audit = new AuditInfo[1]; audit[0] = new AuditInfo(userName, "Added parameter "+key); try { dataset.addParameterRef(new URL(base, (String)paramRefs.get(key)), key, audit); } catch (MalformedURLException e) { //can't happen? e.printStackTrace(); System.err.println("Caught exception on parameterRef " +key+", continuing..."); } // end of try-catch } // end of while (it.hasNext()) File[] sacFiles = directory.listFiles(); //SacTimeSeries sac = new SacTimeSeries(); for (int i=0; i<sacFiles.length; i++) { if (excludes.contains(sacFiles[i].getName())) { continue; } // end of if (excludes.contains(sacFiles[i].getName())) if (paramRefs.containsValue(sacFiles[i].getName())) { continue; } // end of if (excludes.contains(sacFiles[i].getName())) try { //sac.read(sacFiles[i].getCanonicalPath()); AuditInfo[] audit = new AuditInfo[1]; audit[0] = new AuditInfo(userName+" via SacDirToDataSet", "seismogram loaded from sacFiles[i].getCanonicalPath()"); URL seisURL = new URL(base, sacFiles[i].getName()); dataset.addSeismogramRef(seisURL, sacFiles[i].getName(), new Property[0], new ParameterRef[0], audit); } catch (Exception e) { e.printStackTrace(); System.err.println("Caught exception on " +sacFiles[i].getName()+", continuing..."); } // end of try-catch } // end of for (int i=0; i<sacFiles.length; i++) } |
if(notLoaded) { | if(notLoaded || runs==null) { | protected SortedMap<Integer,RunT> _getRuns() { if(notLoaded) { // if none is loaded yet, do so immediately. synchronized(this) { if(notLoaded) { notLoaded = false; _reload(); } } } if(nextUpdate<System.currentTimeMillis()) { if(!reloadingInProgress) { // schedule a new reloading operation. // we don't want to block the current thread, // so reloading is done asynchronously. reloadingInProgress = true; synchronized(reloadQueue) { reloadQueue.add(this); reloadQueue.notify(); } } } return runs; } |
if(runs==null) runs = new RunMap<RunT>(); | protected SortedMap<Integer,RunT> _getRuns() { if(notLoaded) { // if none is loaded yet, do so immediately. synchronized(this) { if(notLoaded) { notLoaded = false; _reload(); } } } if(nextUpdate<System.currentTimeMillis()) { if(!reloadingInProgress) { // schedule a new reloading operation. // we don't want to block the current thread, // so reloading is done asynchronously. reloadingInProgress = true; synchronized(reloadQueue) { reloadQueue.add(this); reloadQueue.notify(); } } } return runs; } |
|
debug = false; | public JEP() { debug = false; topNode = null; traverse = false; allowUndeclared = false; implicitMul = false; initSymTab(); initFunTab(); errorList = new Vector(); ev = new EvaluatorVisitor(); parser = new Parser(new StringReader("")); //Ensure errors are reported for the initial expression //e.g. No expression entered parseExpression(""); } |
|
private SymbolTable() {} | public SymbolTable(VariableFactory varFac) { vf = varFac; } | private SymbolTable() {} |
Node res = Start(); if(res == null) throw new ParseException("No expression entered"); return res.jjtGetChild(0); | Node node = Start(); if (node == null) throw new ParseException("No expression entered"); return node.jjtGetChild(0); | public Node parseStream(java.io.Reader stream, JEP jep_in) throws ParseException { restart(stream,jep_in); // Parse the expression, and return the enable_tracing(); Node res = Start(); if(res == null) throw new ParseException("No expression entered"); return res.jjtGetChild(0); } |
Complex temp = new Complex(((Number)param).doubleValue(),0.0); return temp.acosh(); | double val = ((Number)param).doubleValue(); if(val >= 1.0) { double res = Math.log(val+Math.sqrt(val*val-1)); return new Double(res); } else { Complex temp = new Complex(((Number)param).doubleValue(),0.0); return temp.acosh(); } | public Object acosh(Object param) throws ParseException { if (param instanceof Complex) { return ((Complex)param).acosh(); } else if (param instanceof Number) { Complex temp = new Complex(((Number)param).doubleValue(),0.0); return temp.acosh(); } throw new ParseException("Invalid parameter type"); } |
super.execute(); final String errors = handler.getErrors(); | try { super.execute(); } finally { final String errors = handler.getErrors(); | public void execute() throws BuildException { File savedDir = m_dir; // may be altered in validate try { validate(); final Properties userList = new Properties(); loadUserlist(userList); for (Enumeration e = m_cvsUsers.elements(); e.hasMoreElements();) { final CvsUser user = (CvsUser) e.nextElement(); user.validate(); userList.put(user.getUserID(), user.getDisplayname()); } setCommand("log"); if (getTag() != null) { CvsVersion myCvsVersion = new CvsVersion(); myCvsVersion.setProject(getProject()); myCvsVersion.setTaskName("cvsversion"); myCvsVersion.setCvsRoot(getCvsRoot()); myCvsVersion.setCvsRsh(getCvsRsh()); myCvsVersion.setPassfile(getPassFile()); myCvsVersion.setDest(m_dir); myCvsVersion.execute(); if (myCvsVersion.supportsCvsLogWithSOption()) { addCommandArgument("-S"); } } if (null != m_start) { final SimpleDateFormat outputDate = new SimpleDateFormat("yyyy-MM-dd"); // We want something of the form: -d ">=YYYY-MM-dd" final String dateRange = ">=" + outputDate.format(m_start); // Supply '-d' as a separate argument - Bug# 14397 addCommandArgument("-d"); addCommandArgument(dateRange); } // Check if list of files to check has been specified if (!m_filesets.isEmpty()) { for (String file : m_filesets) { addCommandArgument(file); } } final ChangeLogParser parser = new hudson.org.apache.tools.ant.taskdefs.cvslib.ChangeLogParser(); final RedirectingStreamHandler handler = new RedirectingStreamHandler(parser); log(getCommand(), Project.MSG_VERBOSE); setDest(m_dir); setExecuteStreamHandler(handler); super.execute(); final String errors = handler.getErrors(); if (null != errors) { log(errors, Project.MSG_ERR); } final CVSEntry[] entrySet = parser.getEntrySetAsArray(); final CVSEntry[] filteredEntrySet = filterEntrySet(entrySet); replaceAuthorIdWithName(userList, filteredEntrySet); writeChangeLog(filteredEntrySet); } finally { m_dir = savedDir; } } |
if (null != errors) { log(errors, Project.MSG_ERR); | if (null != errors) { log(errors, Project.MSG_ERR); } | public void execute() throws BuildException { File savedDir = m_dir; // may be altered in validate try { validate(); final Properties userList = new Properties(); loadUserlist(userList); for (Enumeration e = m_cvsUsers.elements(); e.hasMoreElements();) { final CvsUser user = (CvsUser) e.nextElement(); user.validate(); userList.put(user.getUserID(), user.getDisplayname()); } setCommand("log"); if (getTag() != null) { CvsVersion myCvsVersion = new CvsVersion(); myCvsVersion.setProject(getProject()); myCvsVersion.setTaskName("cvsversion"); myCvsVersion.setCvsRoot(getCvsRoot()); myCvsVersion.setCvsRsh(getCvsRsh()); myCvsVersion.setPassfile(getPassFile()); myCvsVersion.setDest(m_dir); myCvsVersion.execute(); if (myCvsVersion.supportsCvsLogWithSOption()) { addCommandArgument("-S"); } } if (null != m_start) { final SimpleDateFormat outputDate = new SimpleDateFormat("yyyy-MM-dd"); // We want something of the form: -d ">=YYYY-MM-dd" final String dateRange = ">=" + outputDate.format(m_start); // Supply '-d' as a separate argument - Bug# 14397 addCommandArgument("-d"); addCommandArgument(dateRange); } // Check if list of files to check has been specified if (!m_filesets.isEmpty()) { for (String file : m_filesets) { addCommandArgument(file); } } final ChangeLogParser parser = new hudson.org.apache.tools.ant.taskdefs.cvslib.ChangeLogParser(); final RedirectingStreamHandler handler = new RedirectingStreamHandler(parser); log(getCommand(), Project.MSG_VERBOSE); setDest(m_dir); setExecuteStreamHandler(handler); super.execute(); final String errors = handler.getErrors(); if (null != errors) { log(errors, Project.MSG_ERR); } final CVSEntry[] entrySet = parser.getEntrySetAsArray(); final CVSEntry[] filteredEntrySet = filterEntrySet(entrySet); replaceAuthorIdWithName(userList, filteredEntrySet); writeChangeLog(filteredEntrySet); } finally { m_dir = savedDir; } } |
sb.append( " <PERCENT>"+SBStringUtils.format(percent, 1)+"</PERCENT>\n" ); | public String toXML(){ StringBuffer sb = new StringBuffer(); sb.append( " <ITEM>\n" ); sb.append( " <MALT>"+getName()+"</MALT>\n" ); sb.append( " <AMOUNT>"+getAmountAs(getUnits())+"</AMOUNT>\n" ); sb.append( " <UNITS>"+getUnitsAbrv()+"</UNITS>\n" ); sb.append( " <POINTS>"+pppg+"</POINTS>\n" ); sb.append( " <LOV>"+lov+"</LOV>\n" ); sb.append( " <MASHED>"+mashed+"</MASHED>\n" ); sb.append( " <STEEPED>"+steeped+"</STEEPED>\n" ); sb.append( " <COSTLB>"+getCostPerU()+"</COSTLB>\n" ); sb.append( " <DESCRIPTION>"+SBStringUtils.subEntities(getDescription())+"</DESCRIPTION>\n" ); sb.append( " </ITEM>\n" ); return sb.toString(); } |
|
if (param instanceof Number) | if (param instanceof Complex) { return ((Complex)param).sinh(); } else if (param instanceof Number) | public Object sinh(Object param) throws ParseException { if (param instanceof Number) { double value = ((Number)param).doubleValue(); return new Double((Math.exp(value)-Math.exp(-value))/2); } else if (param instanceof Complex) { return ((Complex)param).sinh(); } throw new ParseException("Invalid parameter type"); } |
else if (param instanceof Complex) { return ((Complex)param).sinh(); } | public Object sinh(Object param) throws ParseException { if (param instanceof Number) { double value = ((Number)param).doubleValue(); return new Double((Math.exp(value)-Math.exp(-value))/2); } else if (param instanceof Complex) { return ((Complex)param).sinh(); } throw new ParseException("Invalid parameter type"); } |
|
newChildProjects.add(this); | if(!newChildProjects.contains(this)) newChildProjects.add(this); | public void doConfigSubmit( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException { Set<Project> upstream = Collections.EMPTY_SET; synchronized(this) { try { if(!Hudson.adminCheck(req,rsp)) return; req.setCharacterEncoding("UTF-8"); int scmidx = Integer.parseInt(req.getParameter("scm")); scm = SCMS.SCMS[scmidx].newInstance(req); disabled = req.getParameter("disable")!=null; jdk = req.getParameter("jdk"); if(req.getParameter("hasCustomQuietPeriod")!=null) { quietPeriod = Integer.parseInt(req.getParameter("quiet_period")); } else { quietPeriod = null; } if(req.getParameter("hasSlaveAffinity")!=null) { canRoam = false; assignedNode = req.getParameter("slave"); if(assignedNode !=null) { if(Hudson.getInstance().getSlave(assignedNode)==null) { assignedNode = null; // no such slave } } } else { canRoam = true; assignedNode = null; } buildDescribable(req, BuildStep.BUILDERS, builders, "builder"); buildDescribable(req, BuildStep.PUBLISHERS, publishers, "publisher"); for (Trigger t : triggers) t.stop(); buildDescribable(req, Triggers.TRIGGERS, triggers, "trigger"); for (Trigger t : triggers) t.start(this); updateTransientActions(); super.doConfigSubmit(req,rsp); } catch (FormException e) { sendError(e,req,rsp); } } if(req.getParameter("pseudoUpstreamTrigger")!=null) { upstream = new HashSet<Project>(Project.fromNameList(req.getParameter("upstreamProjects"))); } // this needs to be done after we release the lock on this, // or otherwise we could dead-lock for (Project p : Hudson.getInstance().getProjects()) { boolean isUpstream = upstream.contains(p); synchronized(p) { List<Project> newChildProjects = p.getDownstreamProjects(); if(isUpstream) { newChildProjects.add(this); } else { newChildProjects.remove(this); } if(newChildProjects.isEmpty()) { p.removePublisher(BuildTrigger.DESCRIPTOR); } else { p.addPublisher(new BuildTrigger(newChildProjects)); } } } } |
redo = false; | public void createOversizedImage(){ overTimeRange = timeConfig.getTimeRange().getOversizedTimeRange(2); redo = false; Dimension d = getSize(); int sizeScale = 5; int w = d.width * sizeScale, h = d.height; overSize = new Dimension(w, h); overSizedImage = createImage(w, h); displayInterval = timeConfig.getTimeRange().getInterval(); Graphics2D overSizedGraphic = (Graphics2D)overSizedImage.getGraphics(); Iterator e = plotters.keySet().iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); overSizedGraphic.setColor((Color)plotters.get(current)); overSizedGraphic.draw(current.draw(overSize)); } } |
|
overSizedImage = createImage(w, h); | overSizedImage = new SoftReference(createImage(w, h)); | public void createOversizedImage(){ overTimeRange = timeConfig.getTimeRange().getOversizedTimeRange(2); redo = false; Dimension d = getSize(); int sizeScale = 5; int w = d.width * sizeScale, h = d.height; overSize = new Dimension(w, h); overSizedImage = createImage(w, h); displayInterval = timeConfig.getTimeRange().getInterval(); Graphics2D overSizedGraphic = (Graphics2D)overSizedImage.getGraphics(); Iterator e = plotters.keySet().iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); overSizedGraphic.setColor((Color)plotters.get(current)); overSizedGraphic.draw(current.draw(overSize)); } } |
Graphics2D overSizedGraphic = (Graphics2D)overSizedImage.getGraphics(); | Graphics2D overSizedGraphic = (Graphics2D)((Image)overSizedImage.get()).getGraphics(); | public void createOversizedImage(){ overTimeRange = timeConfig.getTimeRange().getOversizedTimeRange(2); redo = false; Dimension d = getSize(); int sizeScale = 5; int w = d.width * sizeScale, h = d.height; overSize = new Dimension(w, h); overSizedImage = createImage(w, h); displayInterval = timeConfig.getTimeRange().getInterval(); Graphics2D overSizedGraphic = (Graphics2D)overSizedImage.getGraphics(); Iterator e = plotters.keySet().iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); overSizedGraphic.setColor((Color)plotters.get(current)); overSizedGraphic.draw(current.draw(overSize)); } } |
if(redo) | if(overSizedImage == null){ logger.debug("the image is null and is being recreated"); | public void paint(Graphics g){ if(redo) this.createOversizedImage(); long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); long overEndTime = overTimeRange.getEndTime().getMicroSecondTime(); long overBeginTime = overTimeRange.getBeginTime().getMicroSecondTime(); if(endTime >= overEndTime || beginTime <= overBeginTime) this.createOversizedImage(); //displayInterval.getValue() != timeConfig.getTimeRange().getInterval().getValue() Graphics2D g2 = (Graphics2D)g; double offset = (beginTime - overBeginTime)/ (double)(overEndTime - overBeginTime) * overSize.getWidth(); AffineTransform tx; if(displayInterval.getValue() == timeConfig.getTimeRange().getInterval().getValue()){ tx = AffineTransform.getTranslateInstance(-offset, 0.0); g2.drawImage(overSizedImage, tx, null); } else{ double scale = displayInterval.getValue()/timeConfig.getTimeRange().getInterval().getValue(); tx = AffineTransform.getTranslateInstance(-offset * scale, 0.0); tx.scale(scale, 1); g2.drawImage(overSizedImage, tx, null); redo = true; repaint(); } } |
g2.drawImage(overSizedImage, tx, null); | if(overSizedImage.get() == null) this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); | public void paint(Graphics g){ if(redo) this.createOversizedImage(); long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); long overEndTime = overTimeRange.getEndTime().getMicroSecondTime(); long overBeginTime = overTimeRange.getBeginTime().getMicroSecondTime(); if(endTime >= overEndTime || beginTime <= overBeginTime) this.createOversizedImage(); //displayInterval.getValue() != timeConfig.getTimeRange().getInterval().getValue() Graphics2D g2 = (Graphics2D)g; double offset = (beginTime - overBeginTime)/ (double)(overEndTime - overBeginTime) * overSize.getWidth(); AffineTransform tx; if(displayInterval.getValue() == timeConfig.getTimeRange().getInterval().getValue()){ tx = AffineTransform.getTranslateInstance(-offset, 0.0); g2.drawImage(overSizedImage, tx, null); } else{ double scale = displayInterval.getValue()/timeConfig.getTimeRange().getInterval().getValue(); tx = AffineTransform.getTranslateInstance(-offset * scale, 0.0); tx.scale(scale, 1); g2.drawImage(overSizedImage, tx, null); redo = true; repaint(); } } |
g2.drawImage(overSizedImage, tx, null); redo = true; | this.createOversizedImage(); g2.drawImage(((Image)overSizedImage.get()), tx, null); overSizedImage = null; | public void paint(Graphics g){ if(redo) this.createOversizedImage(); long endTime = timeConfig.getTimeRange().getEndTime().getMicroSecondTime(); long beginTime = timeConfig.getTimeRange().getBeginTime().getMicroSecondTime(); long overEndTime = overTimeRange.getEndTime().getMicroSecondTime(); long overBeginTime = overTimeRange.getBeginTime().getMicroSecondTime(); if(endTime >= overEndTime || beginTime <= overBeginTime) this.createOversizedImage(); //displayInterval.getValue() != timeConfig.getTimeRange().getInterval().getValue() Graphics2D g2 = (Graphics2D)g; double offset = (beginTime - overBeginTime)/ (double)(overEndTime - overBeginTime) * overSize.getWidth(); AffineTransform tx; if(displayInterval.getValue() == timeConfig.getTimeRange().getInterval().getValue()){ tx = AffineTransform.getTranslateInstance(-offset, 0.0); g2.drawImage(overSizedImage, tx, null); } else{ double scale = displayInterval.getValue()/timeConfig.getTimeRange().getInterval().getValue(); tx = AffineTransform.getTranslateInstance(-offset * scale, 0.0); tx.scale(scale, 1); g2.drawImage(overSizedImage, tx, null); redo = true; repaint(); } } |
redo = true; | overSizedImage = null; | public void addSeismogram(LocalSeismogram newSeismogram){ SeismogramPlotter newPlotter = new SeismogramPlotter(newSeismogram, timeConfig, ampConfig); plotters.put(newPlotter, colors[plotters.size()%colors.length]); timeConfig.addSeismogram(newSeismogram); ampConfig.addSeismogram(newSeismogram); redo = true; } |
redo = true; | overSizedImage = null; | public void redraw(){ redo = true; repaint(); } |
redo = true; | overSizedImage = null; | protected void resize() { Dimension dim = getSize(); Insets insets = getInsets(); timeScaleMap.setTotalPixels(dim.width-insets.left-insets.right); ampScaleMap.setTotalPixels(dim.height-insets.top-insets.bottom); redo = true; repaint(); } |
redo = true; | overSizedImage = null; | public void updateAmpRange(){ redo = true; this.ampScaleMap.setUnitRange(ampConfig.getAmpRange()); repaint(); } |
AsynchronousDispatcher.invokeLater( new Runnable() { public void run() | ThreadPool.getInstance().addJob( new Runnable() | private void fireSecurityRuleAdded( final SecurityRule rule, final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } } }); } |
Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; for ( int i = listeners.length - 1; i >= 0; i-- ) | public void run() | private void fireSecurityRuleAdded( final SecurityRule rule, final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } } }); } |
listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); | Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } | private void fireSecurityRuleAdded( final SecurityRule rule, final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } } }); } |
} }); | }, "SecurityRuleAddedEvent"); | private void fireSecurityRuleAdded( final SecurityRule rule, final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } } }); } |
{ Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; for ( int i = listeners.length - 1; i >= 0; i-- ) | public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } } |
|
listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); | Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } | public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } } |
} | public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleAdded( rule, position ); } } |
|
AsynchronousDispatcher.invokeLater( new Runnable() { public void run() | ThreadPool.getInstance().addJob( new Runnable() | private void fireSecurityRuleChanged( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } } }); } |
Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; for ( int i = listeners.length - 1; i >= 0; i-- ) | public void run() | private void fireSecurityRuleChanged( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } } }); } |
listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); | Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } | private void fireSecurityRuleChanged( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } } }); } |
} }); | }, "SecurityRuleChangeEvent" ); | private void fireSecurityRuleChanged( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } } }); } |
{ Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; for ( int i = listeners.length - 1; i >= 0; i-- ) | public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } } |
|
listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); | Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } | public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } } |
} | public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleChanged( position ); } } |
|
AsynchronousDispatcher.invokeLater( new Runnable() { public void run() | ThreadPool.getInstance().addJob( new Runnable() | private void fireSecurityRuleRemoved( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleRemoved( position ); } } }); } |
Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; for ( int i = listeners.length - 1; i >= 0; i-- ) | public void run() | private void fireSecurityRuleRemoved( final int position ) { // invoke update in event dispatcher AsynchronousDispatcher.invokeLater( new Runnable() { public void run() { Object[] listeners = listenerList.toArray(); SecurityRulesChangeListener listener; // Process the listeners last to first, notifying // those that are interested in this event for ( int i = listeners.length - 1; i >= 0; i-- ) { listener = (SecurityRulesChangeListener)listeners[ i ]; listener.securityRuleRemoved( position ); } } }); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.