rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
logger.debug("The name of the data set is "+getName()); logger.debug("The name of the seismogram is "+name);
public LocalSeismogramImpl getSeismogram(String name) { if (seismogramCache.containsKey(name)) { return (LocalSeismogramImpl)seismogramCache.get(name); } // end of if (seismogramCache.containsKey(name)) String urlString = "NONE"; NodeList nList = evalNodeList(config, "localSeismogram/seismogramAttr/property[name="+dquote+"Name"+dquote+ "]"+"[value="+dquote+name+dquote+"]"+"/../../data"); if(nList == null || (nList != null && nList.getLength() == 0)) { nList = getNoNameSeismogram(name); } if (nList != null && nList.getLength() != 0) { try { Node n = nList.item(0); if (n instanceof Element) { Element e = (Element)n; //System.out.println("**********************The name of the element is "+e.getTagName()); urlString = e.getAttribute("xlink:href"); if (urlString == null || urlString == "") { throw new MalformedURLException(name+" does not have an xlink:href attribute"); } // end of if (urlString == null || urlString == "") URL sacURL = new URL(base, urlString); DataInputStream dis = new DataInputStream(new BufferedInputStream(sacURL.openStream())); SacTimeSeries sac = new SacTimeSeries(); sac.read(dis); LocalSeismogramImpl seis = SacToFissures.getSeismogram(sac); //get the Seismogram Attributes from the xml .. only the data must // must be obtained fromt the SAC. NodeList seisAttrNode = XMLUtil.evalNodeList(e, "../seismogramAttr"); if(seisAttrNode != null && seisAttrNode.getLength() != 0) { SeismogramAttr seisAttr = XMLSeismogramAttr.getSeismogramAttr((Element)seisAttrNode.item(0)); logger.debug("The &&&&&&&&&&&&&&&&&&& chan_cdoe from dsml file is "+ ((SeismogramAttrImpl)seisAttr).getChannelID().channel_code); seis.setAttributes(seisAttr); logger.debug("The &&&&&&&&&&&&&&&&&&& chan_code after setting is "+ seis.getChannelID().channel_code); } NodeList propList = evalNodeList(e, "property"); int numDSProps = 0; if (propList != null && propList.getLength() != 0) { numDSProps = nList.getLength(); } else { // no properties in dataset numDSProps = 0; } // end of else Property[] props = seis.getProperties(); Property[] newProps = new Property[1+props.length+numDSProps]; System.arraycopy(props, 0, newProps, 0, props.length); for (int i=0; i<propList.getLength(); i++) { Element propElement = (Element)propList.item(i); newProps[props.length+i] = new Property(xpath.eval(propElement, "name/text()").str(), xpath.eval(propElement, "value/text()").str()); } // end of for newProps[newProps.length-1] = new Property(seisNameKey, name); seis.setProperties(newProps); if (seis != null) { seismogramCache.put(name, seis); } // end of if (seis != null) return seis; } } catch (MalformedURLException e) { logger.error("Couldn't get seismogram "+name, e); logger.error(urlString); } catch (Exception e) { logger.error("Couldn't get seismogram "+name, e); logger.error(urlString); } // end of try-catch } return null; }
public String getUniqueName(String name) { String[] nameList = getSeismogramNames();
public String getUniqueName(String[] nameList, String name) {
public String getUniqueName(String name) { String[] nameList = getSeismogramNames(); int counter = 0; for(int i = 0; i < nameList.length; i++) { if(nameList[i].equals(name)) counter++; } if(counter == 0) return name; return name+"_"+counter; }
if(nameList[i].equals(name)) counter++;
if(nameList[i].indexOf(name) != -1) counter++;
public String getUniqueName(String name) { String[] nameList = getSeismogramNames(); int counter = 0; for(int i = 0; i < nameList.length; i++) { if(nameList[i].equals(name)) counter++; } if(counter == 0) return name; return name+"_"+counter; }
return name+"_"+counter;
return name+"_"+(counter+1);
public String getUniqueName(String name) { String[] nameList = getSeismogramNames(); int counter = 0; for(int i = 0; i < nameList.length; i++) { if(nameList[i].equals(name)) counter++; } if(counter == 0) return name; return name+"_"+counter; }
jLabel8 = new JLabel(); jPanel2.add(jLabel8, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel8.setText("BU:GU:"); ogbuLbl = new JLabel(); jPanel2.add(ogbuLbl, new GridBagConstraints(2, 5, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); ogbuLbl.setText("1:1");
private void initGUI() { try { GridBagLayout pnlStyleLayout = new GridBagLayout(); pnlStyleLayout.rowWeights = new double[] {0.1,0.1}; pnlStyleLayout.rowHeights = new int[] {7,7}; pnlStyleLayout.columnWeights = new double[] {0.1,0.1}; pnlStyleLayout.columnWidths = new int[] {7,7}; this.setLayout(pnlStyleLayout); setPreferredSize(new Dimension(400, 300));// this.addComponentListener(new ComponentAdapter() {// public void componentShown(ComponentEvent evt) {// setStyleData();// }// }); { jPanel1 = new JPanel(); this.add(jPanel1, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); { lblStyle2 = new JLabel(); jPanel1.add(lblStyle2); lblStyle2.setText("Style:"); } { cmbStyle2Model = new ComboModel(); cmbStyle2 = new JComboBox(); jPanel1.add(cmbStyle2); cmbStyle2.setModel(cmbStyle2Model); cmbStyle2.setMaximumSize(new java.awt.Dimension(100, 32767)); cmbStyle2.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { Style s = (Style) cmbStyle2Model.getSelectedItem(); if (myRecipe != null && s != myRecipe.getStyleObj()) { myRecipe.setStyle(s); if (!sbn.equals(null)) sbn.setStyle(s); } setStyleData(); } }); } } { jPanel2 = new JPanel(); GridBagLayout jPanel2Layout1 = new GridBagLayout(); jPanel2Layout1.columnWeights = new double[]{0.1, 0.1, 0.1, 0.1}; jPanel2Layout1.columnWidths = new int[]{7, 7, 7, 7}; jPanel2Layout1.rowWeights = new double[]{0.1, 0.1, 0.1, 0.1, 0.1, 0.1}; jPanel2Layout1.rowHeights = new int[]{7, 7, 7, 7, 7, 7}; jPanel2.setPreferredSize(new java.awt.Dimension(179, 120)); jPanel2.setLayout(jPanel2Layout1); this.add(jPanel2, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jPanel2.setBorder(BorderFactory.createTitledBorder(null, "Recipe Conformance:", TitledBorder.LEADING, TitledBorder.TOP)); { jLabel5 = new JLabel(); jPanel2.add(jLabel5, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel5.setText("OG:"); jLabel5.setBounds(74, 3, 60, 30); } { jLabel1 = new JLabel(); jPanel2.add(jLabel1, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); GridLayout jLabel1Layout = new GridLayout(1, 1); jLabel1.setLayout(jLabel1Layout); jLabel1.setText("Low:"); } { jLabel2 = new JLabel(); jPanel2.add(jLabel2, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel2.setText("Recipe:"); } { jLabel3 = new JLabel(); jPanel2.add(jLabel3, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel3.setText("High:"); } { jLabel4 = new JLabel(); jPanel2.add(jLabel4, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel4.setText("IBU:"); } { jLabel6 = new JLabel(); jPanel2.add(jLabel6, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel6.setText("Colour:"); } { jLabel7 = new JLabel(); jPanel2.add(jLabel7, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); jLabel7.setText("ABV:"); } { stlLowOG = new JLabel(); jPanel2.add(stlLowOG, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); stlLowOG.setText("0"); } { stlRcpOG = new JLabel(); jPanel2.add(stlRcpOG, new GridBagConstraints(2, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); stlRcpOG.setText("0"); } { stlHighOG = new JLabel(); jPanel2.add(stlHighOG, new GridBagConstraints(3, 4, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); stlHighOG.setText("0"); } { stlLowABV = new JLabel(); jPanel2.add(stlLowABV, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); stlLowABV.setText("0"); } { stlRcpABV = new JLabel(); jPanel2.add(stlRcpABV, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); stlRcpABV.setText("0"); } { stlHighABV = new JLabel(); jPanel2.add(stlHighABV, new GridBagConstraints(3, 3, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); stlHighABV.setText("0"); } { stlLowColour = new JLabel(); jPanel2.add(stlLowColour, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); stlLowColour.setText("0"); } { stlRcpColour = new JLabel(); jPanel2.add(stlRcpColour, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); stlRcpColour.setText("0"); } { stlHighColour = new JLabel(); jPanel2.add(stlHighColour, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); stlHighColour.setText("0"); } { stlLowIBU = new JLabel(); jPanel2.add(stlLowIBU, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); stlLowIBU.setText("0"); } { stlRcpIBU = new JLabel(); jPanel2.add(stlRcpIBU, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); stlRcpIBU.setText("0"); } { stlHighIBU = new JLabel(); jPanel2.add(stlHighIBU, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); stlHighIBU.setText("0"); } } { jPanel3 = new JPanel(); BorderLayout jPanel3Layout = new BorderLayout(); jPanel3.setLayout(jPanel3Layout); this.add(jPanel3, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0)); jPanel3.setBorder(BorderFactory.createTitledBorder("Matched Styles:")); { jScrollPane3 = new JScrollPane(); jPanel3.add(jScrollPane3, BorderLayout.CENTER); { txaStyles = new JTextArea(); jScrollPane3.setViewportView(txaStyles); txaStyles.setText("Matched Styles"); } } } } catch (Exception e) { e.printStackTrace(); } }
double bugu = myRecipe.getIbu() / (myRecipe.getEstOg() - 1) * 1000; ogbuLbl.setText("" + SBStringUtils.format(bugu, 1));
public void setStyleData(){ Style s = (Style) cmbStyle2Model.getSelectedItem(); // descriptionTextArea.setText(s.getDescription()); // cmbStyle2.setToolTipText(multiLineToolTip(50,s.getDescription())); stlLowOG.setText(SBStringUtils.format(s.ogLow, 3)); stlRcpOG.setText(SBStringUtils.format(myRecipe.getEstOg(), 3)); stlHighOG.setText(SBStringUtils.format(s.ogHigh, 3)); stlLowABV.setText(SBStringUtils.format(s.alcLow, 1)); stlRcpABV.setText(SBStringUtils.format(myRecipe.getAlcohol(), 1)); stlHighABV.setText(SBStringUtils.format(s.alcHigh, 1)); stlLowColour.setText(SBStringUtils.format(s.lovLow, 1)); stlRcpColour.setText(SBStringUtils.format(myRecipe.getSrm(), 1)); stlHighColour.setText(SBStringUtils.format(s.lovHigh, 1)); stlLowIBU.setText(SBStringUtils.format(s.ibuLow, 1)); stlRcpIBU.setText(SBStringUtils.format(myRecipe.getIbu(), 1)); stlHighIBU.setText(SBStringUtils.format(s.ibuHigh, 1)); checkStyleConformance(); txaStyles.setText(getStyleMatches()); }
while(r!=null && r.getResult()!=null && r.getResult().isWorseThan(Result.SUCCESS))
while(r!=null && (r.getResult()==null || r.getResult().isWorseThan(Result.SUCCESS)))
public synchronized RunT getLastStableBuild() { RunT r = getLastBuild(); while(r!=null && r.getResult()!=null && r.getResult().isWorseThan(Result.SUCCESS)) r=r.getPreviousBuild(); return r; }
while(r!=null && r.getResult()!=null && r.getResult().isWorseThan(Result.UNSTABLE))
while(r!=null && (r.getResult()==null || r.getResult().isWorseThan(Result.UNSTABLE)))
public synchronized RunT getLastSuccessfulBuild() { RunT r = getLastBuild(); while(r!=null && r.getResult()!=null && r.getResult().isWorseThan(Result.UNSTABLE)) r=r.getPreviousBuild(); return r; }
results.setBrowseHostStatus( BrowseHostResults.FETCHING );
public void sendBrowseHostRequest() throws IOException, BrowseHostException { NLogger.debug(BrowseHostConnection.class, "Connection for Browse Host to " + address ); SocketFacade socket; try { socket = OIOSocketFactory.connect( address, ServiceManager.sCfg.mNetConnectionTimeout ); } catch ( IOException exp ) {// standard connection failed try push request, if we have a hostGUID if ( hostGUID == null ) { throw exp; } socket = PushHandler.requestSocketViaPush( hostGUID, // HEX for Phex 50484558 ); if ( socket == null ) { throw new IOException( "Push request failed" ); } } Connection connection = new Connection( socket, BandwidthManager.getInstance().getNetworkBandwidthController() ); HTTPRequest request = new HTTPRequest( "GET", "/", true ); request.addHeader( new HTTPHeader( HTTPHeaderNames.HOST, address.getFullHostName() ) ); request.addHeader( new HTTPHeader( HTTPHeaderNames.ACCEPT, // "text/html, application/x-gnutella-packets" ) ); "application/x-gnutella-packets" ) ); request.addHeader( new HTTPHeader( HTTPHeaderNames.CONTENT_LENGTH, "0" ) ); request.addHeader( new HTTPHeader( HTTPHeaderNames.CONNECTION, "close" ) ); String httpRequestStr = request.buildHTTPRequestString(); NLogger.debug(BrowseHostConnection.class, "Sending Browse Host request: " + httpRequestStr ); connection.write( httpRequestStr.toString().getBytes() ); HTTPResponse response; try { response = HTTPProcessor.parseHTTPResponse( connection ); } catch ( HTTPMessageException exp ) { throw new BrowseHostException( "Invalid HTTP Response: " + exp.getMessage() ); } NLogger.debug(BrowseHostConnection.class, "Received Browse Host response: " + response.buildHTTPResponseString() ); if ( response.getStatusCode() < 200 || response.getStatusCode() > 299 ) { throw new BrowseHostException( "Browse host request not successfull. StatusCode: " + response.getStatusCode() + " " + response.getStatusReason() ); } HTTPHeader typeHeader = response.getHeader( HTTPHeaderNames.CONTENT_TYPE ); if ( typeHeader == null ) { throw new BrowseHostException( "Unknwon content-type." ); } if ( typeHeader.getValue().equals( "application/x-gnutella-packets" ) ) { MsgManager msgMgr = MsgManager.getInstance(); byte[] headerBuffer = new byte[ MsgHeader.DATA_LENGTH ]; while( true ) { MsgHeader header = MessageProcessor.parseMessageHeader( connection, headerBuffer ); if ( header == null ) { break; } if ( header.getPayload() != MsgHeader.QUERY_HIT_PAYLOAD ) { throw new BrowseHostException( "Wrong header payload. Expecting query hit." ); } QueryResponseMsg message = null; try { message = ( QueryResponseMsg )MessageProcessor.parseMessage( header, connection ); } catch ( InvalidMessageException exp ) { NLogger.debug(BrowseHostConnection.class, exp, exp); throw new IOException( "Invalid message returned: " + exp.getMessage() ); } msgMgr.getQueryResultMonitor().processResponse( message ); results.processResponse( message ); } } else { throw new BrowseHostException( "Not supported content-type. " + typeHeader.getValue() ); } }
public static Message parseMessage( MsgHeader header, Connection connection )
public static Message parseMessage( Connection connection )
public static Message parseMessage( MsgHeader header, Connection connection ) throws IOException, InvalidMessageException { byte[] body = readMessageBody( connection, header.getDataLength() ); Message message = createMessageFromBody( header, body ); return message; }
byte[] body = readMessageBody( connection, header.getDataLength() ); Message message = createMessageFromBody( header, body ); return message;
MsgHeader header = parseMessageHeader( connection, new byte[ MsgHeader.DATA_LENGTH ] ); if ( header == null ) { throw new IOException("Connection closed by remote host"); } return parseMessage( header, connection );
public static Message parseMessage( MsgHeader header, Connection connection ) throws IOException, InvalidMessageException { byte[] body = readMessageBody( connection, header.getDataLength() ); Message message = createMessageFromBody( header, body ); return message; }
if(!file.exists()) return createEmptyChangeLog(changelogFile,listener);
public boolean calcChangeLog(Build build, File changelogFile, BuildListener listener) throws IOException { if(build.getPreviousBuild()==null) { // nothing to compare against return createEmptyChangeLog(changelogFile, listener); } PrintStream logger = listener.getLogger(); Map<String,String> previousRevisions = new HashMap<String,String>(); // module -> revision {// read the revision file of the last build File file = getRevisionFile(build.getPreviousBuild()); BufferedReader br = new BufferedReader(new FileReader(file)); String line; while((line=br.readLine())!=null) { int index = line.indexOf('/'); if(index<0) { logger.println("Unable to parse the line: "+line); continue; // invalid line? } previousRevisions.put(line.substring(0,index), line.substring(index+1)); } } Map env = createEnvVarMap(); for( String module : getModuleDirNames() ) { String prevRev = previousRevisions.get(module); if(prevRev==null) { logger.println("no revision recorded for "+module+" in the previous build"); continue; } String cmd = DESCRIPTOR.getSvnExe()+" log --xml --non-interactive -r "+prevRev+":BASE "+module; logger.println("$ "+cmd); ByteArrayOutputStream baos = new ByteArrayOutputStream(); int r = new Proc(cmd,env,baos,build.getProject().getWorkspace()).join(); if(r!=0) { listener.fatalError("revision check failed"); return false; } // TODO: changelog format conversion } return true; }
rsp.sendRedirect(req.getContextPath()+'/'+getBuildStatusUrl());
rsp.sendRedirect(req.getContextPath()+"/nocacheImages/48x48/"+getBuildStatusUrl());
public void doBuildStatus( StaplerRequest req, StaplerResponse rsp ) throws IOException { rsp.sendRedirect(req.getContextPath()+'/'+getBuildStatusUrl()); }
public Node substitute(Node orig,String name,Node replacement,XJep xjep) throws ParseException
public Node substitute(Node orig,String name,Node replacement,XJep xj) throws ParseException
public Node substitute(Node orig,String name,Node replacement,XJep xjep) throws ParseException { this.names = new String[]{name}; this.replacements = new Node[]{replacement}; this.xjep=xjep; Node res = (Node) orig.jjtAccept(this,null); return res; }
this.xjep=xjep;
this.xjep=xj;
public Node substitute(Node orig,String name,Node replacement,XJep xjep) throws ParseException { this.names = new String[]{name}; this.replacements = new Node[]{replacement}; this.xjep=xjep; Node res = (Node) orig.jjtAccept(this,null); return res; }
j.pv.setFullBrackets(true);
j.getPrintVisitor().setFullBrackets(true);
public static void main(String[] args) { XJep j = new XJep(); j.addStandardConstants(); j.addStandardFunctions(); j.addComplex(); j.setAllowUndeclared(true); j.setImplicitMul(true); j.setAllowAssignment(true); try { // parse expression Node node = j.parse("a*b+c*(d+sin(x))"); // print it j.println(node); // convert to string String str = j.toString(node); System.out.println("String is '"+str+"'"); j.pv.setFullBrackets(true); j.println(node); j.pv.setFullBrackets(false); Node node2=j.parse("1*x^1+0"); j.println(node2); Node simp=j.simplify(node2); j.println(simp); } catch(ParseException e) { System.out.println("Parse error"); } }
j.pv.setFullBrackets(false);
j.getPrintVisitor().setFullBrackets(false);
public static void main(String[] args) { XJep j = new XJep(); j.addStandardConstants(); j.addStandardFunctions(); j.addComplex(); j.setAllowUndeclared(true); j.setImplicitMul(true); j.setAllowAssignment(true); try { // parse expression Node node = j.parse("a*b+c*(d+sin(x))"); // print it j.println(node); // convert to string String str = j.toString(node); System.out.println("String is '"+str+"'"); j.pv.setFullBrackets(true); j.println(node); j.pv.setFullBrackets(false); Node node2=j.parse("1*x^1+0"); j.println(node2); Node simp=j.simplify(node2); j.println(simp); } catch(ParseException e) { System.out.println("Parse error"); } }
if(signaled) throw new IllegalStateException();
if(signaled) return;
public synchronized void signal() { if(signaled) throw new IllegalStateException(); // already signaled this.signaled = true; notify(); }
public void setStatus( HostStatus status, String msg, long statusTime)
public void setStatus( HostStatus status)
public void setStatus( HostStatus status, String msg, long statusTime) { if ( this.status == status && lastStatusMsg != null && lastStatusMsg.equals(msg) ) { return; } this.status = status; lastStatusMsg = msg; this.statusTime = statusTime; hostsContainer.fireNetworkHostChanged(this); }
if ( this.status == status && lastStatusMsg != null && lastStatusMsg.equals(msg) ) { return; } this.status = status; lastStatusMsg = msg; this.statusTime = statusTime; hostsContainer.fireNetworkHostChanged(this);
setStatus(status, null, System.currentTimeMillis());
public void setStatus( HostStatus status, String msg, long statusTime) { if ( this.status == status && lastStatusMsg != null && lastStatusMsg.equals(msg) ) { return; } this.status = status; lastStatusMsg = msg; this.statusTime = statusTime; hostsContainer.fireNetworkHostChanged(this); }
case 2 : return data.df1.format( new Double(data.getStepStartTemp(row)) );
case 2 : return new Double(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 data.df1.format( new Double(data.getStepStartTemp(row)) ); case 3 : return data.df1.format( new Double(data.getStepEndTemp(row)) ); case 4 : return new Double(data.getStepRampMin(row)); case 5 : return new Double(data.getStepMin(row)); } } catch (Exception e) { }; return ""; }
return data.df1.format( new Double(data.getStepEndTemp(row)) );
return new Double(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 data.df1.format( new Double(data.getStepStartTemp(row)) ); case 3 : return data.df1.format( new Double(data.getStepEndTemp(row)) ); case 4 : return new Double(data.getStepRampMin(row)); case 5 : return new Double(data.getStepMin(row)); } } catch (Exception e) { }; return ""; }
return new Double(data.getStepRampMin(row));
return new Integer(data.getStepRampMin(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 data.df1.format( new Double(data.getStepStartTemp(row)) ); case 3 : return data.df1.format( new Double(data.getStepEndTemp(row)) ); case 4 : return new Double(data.getStepRampMin(row)); case 5 : return new Double(data.getStepMin(row)); } } catch (Exception e) { }; return ""; }
return new Double(data.getStepMin(row));
return new Integer(data.getStepMin(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 data.df1.format( new Double(data.getStepStartTemp(row)) ); case 3 : return data.df1.format( new Double(data.getStepEndTemp(row)) ); case 4 : return new Double(data.getStepRampMin(row)); case 5 : return new Double(data.getStepMin(row)); } } catch (Exception e) { }; return ""; }
Debug.print(e.toString());
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 data.df1.format( new Double(data.getStepStartTemp(row)) ); case 3 : return data.df1.format( new Double(data.getStepEndTemp(row)) ); case 4 : return new Double(data.getStepRampMin(row)); case 5 : return new Double(data.getStepMin(row)); } } catch (Exception e) { }; return ""; }
data.setStepStartTemp(row, Integer.parseInt(value.toString()));
data.setStepStartTemp(row, Double.parseDouble(value.toString()));
public void setValueAt(Object value, int row, int col) { try { switch (col) { case 0 : data.setStepType(row, value.toString()); break; case 1 : data.setStepMethod(row, value.toString()); break; case 2 : data.setStepStartTemp(row, Integer.parseInt(value.toString())); break; case 3 : data.setStepEndTemp(row, Integer.parseInt(value.toString())); break; case 4 : data.setStepRampMin(row, Integer.parseInt(value.toString())); break; case 5 : data.setStepMin(row, Integer.parseInt(value.toString())); break; } } catch (Exception e) { }; data.calcMashSchedule(); fireTableCellUpdated(row, col); fireTableDataChanged(); mashManager.displayMash(); }
data.setStepEndTemp(row, Integer.parseInt(value.toString()));
data.setStepEndTemp(row, Double.parseDouble(value.toString()));
public void setValueAt(Object value, int row, int col) { try { switch (col) { case 0 : data.setStepType(row, value.toString()); break; case 1 : data.setStepMethod(row, value.toString()); break; case 2 : data.setStepStartTemp(row, Integer.parseInt(value.toString())); break; case 3 : data.setStepEndTemp(row, Integer.parseInt(value.toString())); break; case 4 : data.setStepRampMin(row, Integer.parseInt(value.toString())); break; case 5 : data.setStepMin(row, Integer.parseInt(value.toString())); break; } } catch (Exception e) { }; data.calcMashSchedule(); fireTableCellUpdated(row, col); fireTableDataChanged(); mashManager.displayMash(); }
for( int i=0; i<env.length; i+=2 ) { if(env[i+1]==null) m.remove(env[i]);
for (String e : env) { int index = e.indexOf('='); String key = e.substring(0,index); String value = e.substring(index+1); if(value.length()==0) m.remove(key);
private Map<String,String> inherit(String[] env) { Map<String,String> m = new HashMap<String,String>(EnvVars.masterEnvVars); for( int i=0; i<env.length; i+=2 ) { if(env[i+1]==null) m.remove(env[i]); else m.put(env[i],env[i+1]); } return m; }
m.put(env[i],env[i+1]);
m.put(key,value);
private Map<String,String> inherit(String[] env) { Map<String,String> m = new HashMap<String,String>(EnvVars.masterEnvVars); for( int i=0; i<env.length; i+=2 ) { if(env[i+1]==null) m.remove(env[i]); else m.put(env[i],env[i+1]); } return m; }
public void testBad() throws ParseException
public void testBad() throws Exception
public void testBad() throws ParseException { if(SHOW_BAD) { simplifyTest("1&&(1||x)","1"); simplifyTest("diff(sgn(x),x)","0"); // sgn not implemented simplifyTest("diff(re(x+i y),x)","1"); // not smart enought to work out re(i) = 1 simplifyTest("diff(re(x+i y),y)","0"); simplifyTest("diff(im(x+i y),x)","0"); simplifyTest("diff(im(x+i y),y)","1"); simplifyTest("(x/2)*3","x*1.5"); } }
valueTest("recurse = recurse+1",null);
public void testBad() throws ParseException { if(SHOW_BAD) { simplifyTest("1&&(1||x)","1"); simplifyTest("diff(sgn(x),x)","0"); // sgn not implemented simplifyTest("diff(re(x+i y),x)","1"); // not smart enought to work out re(i) = 1 simplifyTest("diff(re(x+i y),y)","0"); simplifyTest("diff(im(x+i y),x)","0"); simplifyTest("diff(im(x+i y),y)","1"); simplifyTest("(x/2)*3","x*1.5"); } }
} else if (value instanceof Complex) { return (Complex)value;
public Complex getComplexValue() { Object value = getValueAsObject(); if (value == null) { return null; } else if (value instanceof Number) { return new Complex(((Number)value).doubleValue(), 0); } else if (value instanceof Complex) { return (Complex)value; } else { return null; } }
m_status = GET_REVISION;
m_status = GET_SYMBOLIC_NAMES;
private void processFile(final String line) { if (line.startsWith("Working file:")) { m_file = line.substring(14, line.length()); m_status = GET_REVISION; } }
branches.clear();
private void reset() { m_file = null; m_date = null; m_author = null; m_comment = null; m_revision = null; m_previousRevision = null; m_dead = false; }
entry = (CVSEntry) m_entries.get(entryKey);
entry = m_entries.get(entryKey);
private void saveEntry() { final String entryKey = m_date + m_author + m_comment; CVSEntry entry; if (!m_entries.containsKey(entryKey)) { entry = new CVSEntry(parseDate(m_date), m_author, m_comment); m_entries.put(entryKey, entry); } else { entry = (CVSEntry) m_entries.get(entryKey); } entry.addFile(m_file, m_revision, m_previousRevision, m_dead); }
entry.addFile(m_file, m_revision, m_previousRevision, m_dead);
entry.addFile(m_file, m_revision, m_previousRevision, findBranch(m_revision), m_dead);
private void saveEntry() { final String entryKey = m_date + m_author + m_comment; CVSEntry entry; if (!m_entries.containsKey(entryKey)) { entry = new CVSEntry(parseDate(m_date), m_author, m_comment); m_entries.put(entryKey, entry); } else { entry = (CVSEntry) m_entries.get(entryKey); } entry.addFile(m_file, m_revision, m_previousRevision, m_dead); }
case GET_SYMBOLIC_NAMES: processSymbolicName(line); break;
public void stdout(final String line) { if(dead) return; try { switch(m_status) { case GET_FILE: // make sure attributes are reset when // working on a 'new' file. reset(); processFile(line); break; case GET_REVISION: processRevision(line); break; case GET_DATE: processDate(line); break; case GET_COMMENT: processComment(line); break; case GET_PREVIOUS_REV: processGetPreviousRevision(line); break; } } catch (Exception e) { // we don't know how to handle the input any more. don't accept any more input dead = true; } }
downloadCandidate.addToCandidateLog( "Max downloads for candidate IP already reached." );
public synchronized SWDownloadSet allocateDownloadSet( SWDownloadWorker worker ) { synchronized( downloadList ) { SWDownloadCandidate downloadCandidate = null; for ( SWDownloadFile downloadFile : downloadList ) { if ( !downloadFile.isAbleToBeAllocated() ) { //Logger.logMessage( Logger.FINEST, Logger.DOWNLOAD, // "Download file not able to be allocated: " // + downloadFile ); continue; } // Pre check if there is any segment allocateable... boolean segmentAvailable = downloadFile.isScopeAllocateable( null ); if ( !segmentAvailable ) { continue; } downloadCandidate = downloadFile.allocateDownloadCandidate( worker ); if ( downloadCandidate == null ) { //Logger.logMessage( Logger.FINEST, Logger.DOWNLOAD, // "Allocating DownloadSet - No download candidate. " // + worker.toString() ); continue; } // make sure we dont download more than X times from // the same host ipDownloadCounter.setMaxCount( ServiceManager.sCfg.maxDownloadsPerIP ); boolean succ = ipDownloadCounter.validateAndCountIP( downloadCandidate.getHostAddress() ); if ( !succ ) { downloadFile.releaseDownloadCandidate( downloadCandidate ); continue; } // Only check if there would be a segment allocateable for this candidate... boolean segmentAllocateable = downloadFile.isScopeAllocateable( downloadCandidate.getAvailableScopeList() ); if ( !segmentAllocateable ) { //Logger.logMessage( Logger.FINER, Logger.DOWNLOAD, // "Allocating DownloadSet - No download segment. " // + worker.toString() ); downloadFile.releaseDownloadCandidate( downloadCandidate ); continue; } downloadFile.incrementWorkerCount(); // build download set SWDownloadSet set = new SWDownloadSet( downloadFile, downloadCandidate ); if ( worker == temporaryWorker ) { unsetTemporaryWorker(); } return set; } } return null; }
if ( !managedFile.getFile().exists() )
if ( !managedFile.exists() )
public static XJBPhex loadXJBPhexFromFile( ManagedFile managedFile ) throws JAXBException { if ( !managedFile.getFile().exists() ) { return null; } //NLogger.debug(NLoggerNames.GLOBAL, "Loading XJBPhex from: " + managedFile ); XJBPhex phex; InputStream inStream = null; try { inStream = new ManagedFileInputStream( managedFile, 0 ); // create a JAXBContext JAXBContext jc = JAXBContext.newInstance( "phex.xml" ); // create an Unmarshaller Unmarshaller unmarshaller = jc.createUnmarshaller(); unmarshaller.setEventHandler( new TolerantValidationEventHandler() ); phex = (XJBPhex)unmarshaller.unmarshal( inStream ); return phex; } finally { IOUtil.closeQuietly( inStream ); IOUtil.closeQuietly( managedFile ); } }
for( Executor e : executors ) e.interrupt();
if(executors!=null) { for( Executor e : executors ) e.interrupt(); } ExternalJob.reloadThread.interrupt();
public void cleanUp() { shuttingDown = true; for( Executor e : executors ) e.interrupt(); }
Reader r = new InputStreamReader(new FileInputStream(getConfigFile()),"UTF-8"); createConfiguredStream().unmarshal(new XppReader(r),this); r.close();
Reader r = new BufferedReader(new InputStreamReader(new FileInputStream(getConfigFile()),"UTF-8")); try { createConfiguredStream().unmarshal(new XppReader(r),this); } catch(StreamException e) { throw new IOException(e.getMessage()); } finally { r.close(); }
private void load() throws IOException { if(getConfigFile().exists()) { Reader r = new InputStreamReader(new FileInputStream(getConfigFile()),"UTF-8"); createConfiguredStream().unmarshal(new XppReader(r),this); r.close(); } File projectsDir = new File(root,"jobs"); projectsDir.mkdirs(); File[] subdirs = projectsDir.listFiles(new FileFilter() { public boolean accept(File child) { return child.isDirectory(); } }); jobs.clear(); for (final File subdir : subdirs) { try { Job p = Job.load(this,subdir); jobs.put(p.getName(), p); } catch (IOException e) { e.printStackTrace(); // TODO: logging } } }
for (final File subdir : subdirs) {
for (File subdir : subdirs) {
private void load() throws IOException { if(getConfigFile().exists()) { Reader r = new InputStreamReader(new FileInputStream(getConfigFile()),"UTF-8"); createConfiguredStream().unmarshal(new XppReader(r),this); r.close(); } File projectsDir = new File(root,"jobs"); projectsDir.mkdirs(); File[] subdirs = projectsDir.listFiles(new FileFilter() { public boolean accept(File child) { return child.isDirectory(); } }); jobs.clear(); for (final File subdir : subdirs) { try { Job p = Job.load(this,subdir); jobs.put(p.getName(), p); } catch (IOException e) { e.printStackTrace(); // TODO: logging } } }
super("Executor #"+owner.getExecutors().size()+" for "+owner.getDisplayName());
public Executor(Computer owner) { this.owner = owner; this.queue = Hudson.getInstance().getQueue(); start(); }
Writer w = new OutputStreamWriter(new FileOutputStream(getConfigFile()),"UTF-8");
Writer w = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(getConfigFile()),"UTF-8"));
public synchronized void save() throws IOException { Writer w = new OutputStreamWriter(new FileOutputStream(getConfigFile()),"UTF-8"); w.write("<?xml version='1.0' encoding='UTF-8'?>\n"); createConfiguredStream().toXML(this,w); w.close(); }
Reader r = new InputStreamReader(new FileInputStream(new File(dir,"config.xml")),"UTF-8"); Job job = (Job)createConfiguredStream().unmarshal(new XppReader(r)); r.close();
Reader r = new BufferedReader(new InputStreamReader(new FileInputStream(new File(dir,"config.xml")),"UTF-8")); try { Job job = (Job)createConfiguredStream().unmarshal(new XppReader(r)); } catch(StreamException e) { throw new IOException(e.getMessage()); } finally { r.close(); }
static Job load(Hudson root, File dir) throws IOException { Reader r = new InputStreamReader(new FileInputStream(new File(dir,"config.xml")),"UTF-8"); Job job = (Job)createConfiguredStream().unmarshal(new XppReader(r)); r.close(); job.onLoad(root,dir.getName()); return job; }
Writer w = new OutputStreamWriter(new FileOutputStream(f),"UTF-8");
Writer w = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(f),"UTF-8"));
public void toXML( Object o, File f ) throws IOException { Writer w = new OutputStreamWriter(new FileOutputStream(f),"UTF-8"); w.write("<?xml version='1.0' encoding='UTF-8'?>\n"); toXML(o,w); w.close(); }
new Proc(new String[]{"rm","../latest"},new String[0],listener.getLogger(),getProject().getBuildDir()).join();
new Proc(new String[]{"rm","../lastSuccessful"},new String[0],listener.getLogger(),getProject().getBuildDir()).join();
public void run() { run(new Runner() { public Result run(BuildListener listener) throws IOException { if(!project.checkout(Build.this,listener)) return Result.FAILURE; if(!project.getScm().calcChangeLog(Build.this,new File(getRootDir(),"changelog.xml"),listener)) return Result.FAILURE; if(!preBuild(listener,project.getBuilders())) return Result.FAILURE; if(!preBuild(listener,project.getPublishers())) return Result.FAILURE; if(!build(listener,project.getBuilders())) return Result.FAILURE; if(!isWindows()) { try { // ignore a failure. new Proc(new String[]{"rm","../latest"},new String[0],listener.getLogger(),getProject().getBuildDir()).join(); int r = new Proc(new String[]{ "ln","-s","builds/"+getId()/*ugly*/,"../lastSuccessful"}, new String[0],listener.getLogger(),getProject().getBuildDir()).join(); if(r!=0) listener.getLogger().println("ln failed: "+r); } catch (IOException e) { PrintStream log = listener.getLogger(); log.println("ln failed"); e.printStackTrace( log ); } } return Result.SUCCESS; } public void post(BuildListener listener) { build(listener,project.getPublishers()); } }); }
new Proc(new String[]{"rm","../latest"},new String[0],listener.getLogger(),getProject().getBuildDir()).join();
new Proc(new String[]{"rm","../lastSuccessful"},new String[0],listener.getLogger(),getProject().getBuildDir()).join();
public Result run(BuildListener listener) throws IOException { if(!project.checkout(Build.this,listener)) return Result.FAILURE; if(!project.getScm().calcChangeLog(Build.this,new File(getRootDir(),"changelog.xml"),listener)) return Result.FAILURE; if(!preBuild(listener,project.getBuilders())) return Result.FAILURE; if(!preBuild(listener,project.getPublishers())) return Result.FAILURE; if(!build(listener,project.getBuilders())) return Result.FAILURE; if(!isWindows()) { try { // ignore a failure. new Proc(new String[]{"rm","../latest"},new String[0],listener.getLogger(),getProject().getBuildDir()).join(); int r = new Proc(new String[]{ "ln","-s","builds/"+getId()/*ugly*/,"../lastSuccessful"}, new String[0],listener.getLogger(),getProject().getBuildDir()).join(); if(r!=0) listener.getLogger().println("ln failed: "+r); } catch (IOException e) { PrintStream log = listener.getLogger(); log.println("ln failed"); e.printStackTrace( log ); } } return Result.SUCCESS; }
SQETestAction(Build owner, DirectoryScanner results, BuildListener listener) {
SQETestAction(Build owner, DirectoryScanner results, BuildListener listener, boolean considerTestAsTestObject) {
SQETestAction(Build owner, DirectoryScanner results, BuildListener listener) { super(owner); listener.getLogger().println("Collecting JWSDP SQE reports"); int counter=0; File dataDir = getDataDir(); dataDir.mkdirs(); long buildTime = owner.getTimestamp().getTimeInMillis(); // archive report files for (String file : results.getIncludedFiles()) { File src = new File(results.getBasedir(), file); if(src.lastModified()<buildTime) { listener.getLogger().println("Skipping "+src+" because it's not up to date"); continue; // not up to date. } Copy cp = new Copy(); cp.setProject(new Project()); cp.setFile(src); cp.setTofile(new File(dataDir,"report"+(counter++)+".xml")); cp.execute(); } Report r = load(listener); totalCount = r.getTotalCount(); failCount = r.getFailCount(); result = new WeakReference<Report>(r); }
this.considerTestAsTestObject = considerTestAsTestObject;
SQETestAction(Build owner, DirectoryScanner results, BuildListener listener) { super(owner); listener.getLogger().println("Collecting JWSDP SQE reports"); int counter=0; File dataDir = getDataDir(); dataDir.mkdirs(); long buildTime = owner.getTimestamp().getTimeInMillis(); // archive report files for (String file : results.getIncludedFiles()) { File src = new File(results.getBasedir(), file); if(src.lastModified()<buildTime) { listener.getLogger().println("Skipping "+src+" because it's not up to date"); continue; // not up to date. } Copy cp = new Copy(); cp.setProject(new Project()); cp.setFile(src); cp.setTofile(new File(dataDir,"report"+(counter++)+".xml")); cp.execute(); } Report r = load(listener); totalCount = r.getTotalCount(); failCount = r.getFailCount(); result = new WeakReference<Report>(r); }
public ChangeLogSet getChangeSet() {
public ChangeLogSet<?> getChangeSet() {
public ChangeLogSet getChangeSet() { if(scm==null) scm = new CVSChangeLogParser(); if(changeSet==null) // cached value changeSet = calcChangeSet(); return changeSet; }
rsp.sendRedirect(req.getContextPath()+"/nocacheImages/48x48/"+getBuildStatusUrl());
rsp.sendRedirect2(req.getContextPath()+"/nocacheImages/48x48/"+getBuildStatusUrl());
public void doBuildStatus( StaplerRequest req, StaplerResponse rsp ) throws IOException { rsp.sendRedirect(req.getContextPath()+"/nocacheImages/48x48/"+getBuildStatusUrl()); }
rsp.sendRedirect(req.getContextPath()+"/");
rsp.sendRedirect2(req.getContextPath()+"/");
public synchronized void doDoDelete( StaplerRequest req, StaplerResponse rsp ) throws IOException { if(!Hudson.adminCheck(req,rsp)) return; Util.deleteRecursive(root); getParent().deleteJob(this); rsp.sendRedirect(req.getContextPath()+"/"); }
return "job/"+WHITESPACE_REPLACER.matcher(name).replaceAll("%20")+'/';
return "job/"+name+'/';
public String getUrl() { return "job/"+WHITESPACE_REPLACER.matcher(name).replaceAll("%20")+'/'; }
name = edu.iris.Fissures.network.ChannelIdUtil.toStringNoDates(seis.channel_id);
name = seis.channel_id.network_id.network_code+"."+ seis.channel_id.station_code+"."+ seis.channel_id.channel_code;
public void addSeismogram(LocalSeismogramImpl seis, AuditInfo[] audit) { seismogramNameCache = null; // Note this does not set the xlink, as the seis has not been saved anywhere yet. Document doc = config.getOwnerDocument(); Element localSeismogram = doc.createElement("localSeismogram");//doc.createElement("SacSeismogram"); String name =seis.getProperty(seisNameKey); if (name == null || name.length() == 0) { name = edu.iris.Fissures.network.ChannelIdUtil.toStringNoDates(seis.channel_id); } name = getUniqueName(name); seis.setName(name); Element seismogramAttr = doc.createElement("seismogramAttr"); XMLSeismogramAttr.insert(seismogramAttr, (LocalSeismogram)seis); //localSeismogram.appendChild(seismogramAttr); Element propertyElement = doc.createElement("property"); propertyElement.appendChild(XMLUtil.createTextElement(doc, "name", "Name")); propertyElement.appendChild(XMLUtil.createTextElement(doc, "value", name)); ///seismogramAttr.appendChild(propertyElement); localSeismogram.appendChild(seismogramAttr); Property[] props = seis.getProperties(); //System.out.println("the length of the Properties of the seismogram are "+props.length); Element propE, propNameE, propValueE; for (int i=0; i<props.length; i++) { if (props[i].name != seisNameKey) { propE = doc.createElement("property"); propNameE = doc.createElement("name"); propNameE.setNodeValue(props[i].name); propValueE = doc.createElement("value"); propValueE.setNodeValue(props[i].value); propE.appendChild(propNameE); propE.appendChild(propValueE); localSeismogram.appendChild(propE); } } config.appendChild(localSeismogram); seismogramCache.put(name, seis); logger.debug("added seis now "+getSeismogramNames().length+" seisnogram names."); //xpath = new CachedXPathAPI(xpath); logger.debug("2 added seis now "+getSeismogramNames().length+" seisnogram names."); }
seismogramNameCache = null;
public void addSeismogram(LocalSeismogramImpl seis, AuditInfo[] audit) { seismogramNameCache = null; // Note this does not set the xlink, as the seis has not been saved anywhere yet. Document doc = config.getOwnerDocument(); Element localSeismogram = doc.createElement("localSeismogram");//doc.createElement("SacSeismogram"); String name =seis.getProperty(seisNameKey); if (name == null || name.length() == 0) { name = edu.iris.Fissures.network.ChannelIdUtil.toStringNoDates(seis.channel_id); } name = getUniqueName(name); seis.setName(name); Element seismogramAttr = doc.createElement("seismogramAttr"); XMLSeismogramAttr.insert(seismogramAttr, (LocalSeismogram)seis); //localSeismogram.appendChild(seismogramAttr); Element propertyElement = doc.createElement("property"); propertyElement.appendChild(XMLUtil.createTextElement(doc, "name", "Name")); propertyElement.appendChild(XMLUtil.createTextElement(doc, "value", name)); ///seismogramAttr.appendChild(propertyElement); localSeismogram.appendChild(seismogramAttr); Property[] props = seis.getProperties(); //System.out.println("the length of the Properties of the seismogram are "+props.length); Element propE, propNameE, propValueE; for (int i=0; i<props.length; i++) { if (props[i].name != seisNameKey) { propE = doc.createElement("property"); propNameE = doc.createElement("name"); propNameE.setNodeValue(props[i].name); propValueE = doc.createElement("value"); propValueE.setNodeValue(props[i].value); propE.appendChild(propNameE); propE.appendChild(propValueE); localSeismogram.appendChild(propE); } } config.appendChild(localSeismogram); seismogramCache.put(name, seis); logger.debug("added seis now "+getSeismogramNames().length+" seisnogram names."); //xpath = new CachedXPathAPI(xpath); logger.debug("2 added seis now "+getSeismogramNames().length+" seisnogram names."); }
final File file = lastDownloadFile.getIncompleteFile();
File file = null; try { file = lastDownloadFile.getIncompleteDownloadFile().getFile(); } catch ( ManagedFileException exp ) { NLogger.error( DownloadOverviewPanel.class, exp ); } catch ( FileHandlingException exp ) { NLogger.error( DownloadOverviewPanel.class, exp ); }
public void actionPerformed( ActionEvent e ) { if ( lastDownloadFile == null ) { return; } final File file = lastDownloadFile.getIncompleteFile(); if ( file == null ) { return; } File dir = file.getParentFile(); try { SystemShellExecute.exploreFolder( dir ); } catch (IOException exp) {// ignore and do nothing.. } }
String path = lastDownloadFile.getIncompleteFile().getAbsolutePath(); if ( !incompleteFileTxt.getText().equals( path ) )
try
private void updateInterface() { if ( lastDownloadFile == null ) { progressBar.setDownloadFile( null ); progressLabel.setText(""); downloadedLabel.setText(""); downloadedLabel.setToolTipText(""); remainingLabel.setText(""); remainingLabel.setToolTipText(""); totalSizeLabel.setText(""); totalSizeLabel.setToolTipText(""); createdLabel.setText(""); lastDownloadedLabel.setText(""); downloadRateLabel.setText(""); downloadRateLabel.setToolTipText(""); maxRateLabel.setText(""); etaLabel.setText(""); downloadingCandidatesLabel.setText( "" ); queuedCandidatesLabel.setText( "" ); connectingCandidatesLabel.setText( "" ); goodCandidatesLabel.setText( "" ); badCandidatesLabel.setText( "" ); totalCandidatesLabel.setText( "" ); fileNameTxt.setText(""); incompleteFileTxt.setText(""); return; } progressBar.setDownloadFile( lastDownloadFile ); progressLabel.setText( lastDownloadFile.getProgress().toString() + " %" ); downloadedLabel.setText( NumberFormatUtils.formatSignificantByteSize( lastDownloadFile.getTransferredDataSize() ) ); downloadedLabel.setToolTipText( NumberFormatUtils.formatFullByteSize( lastDownloadFile.getTransferredDataSize() ) ); long remaining = lastDownloadFile.getTotalDataSize() - lastDownloadFile.getTransferredDataSize(); remainingLabel.setText( NumberFormatUtils.formatSignificantByteSize( remaining ) ); remainingLabel.setToolTipText( NumberFormatUtils.formatFullByteSize( remaining ) ); totalSizeLabel.setText( NumberFormatUtils.formatSignificantByteSize( lastDownloadFile.getTotalDataSize() ) ); totalSizeLabel.setToolTipText( NumberFormatUtils.formatFullByteSize( lastDownloadFile.getTotalDataSize() ) ); createdLabel.setText( dateFormat.format( lastDownloadFile.getCreatedDate() ) ); lastDownloadedLabel.setText( dateFormat.format( lastDownloadFile.getDownloadedDate() ) ); downloadRateLabel.setText( NumberFormatUtils.formatSignificantByteSize( lastDownloadFile.getTransferSpeed() ) + Localizer.getString( "PerSec" ) ); downloadRateLabel.setToolTipText( NumberFormatUtils.formatFullByteSize( lastDownloadFile.getTransferSpeed() ) + Localizer.getString( "PerSec" ) ); long maxRate = lastDownloadFile.getDownloadThrottlingRate(); String maxRateStr; if ( maxRate >= Integer.MAX_VALUE ) { maxRateStr = Localizer.getDecimalFormatSymbols().getInfinity(); } else { maxRateStr = NumberFormatUtils.formatSignificantByteSize( maxRate) + Localizer.getString( "PerSec" ); } maxRateLabel.setText( maxRateStr ); // TODO1 //etaLabel.setText() downloadingCandidatesLabel.setText( String.valueOf( lastDownloadFile.getDownloadingCandidatesCount() ) ); queuedCandidatesLabel.setText( String.valueOf( lastDownloadFile.getQueuedCandidatesCount() ) ); connectingCandidatesLabel.setText( String.valueOf( lastDownloadFile.getConnectingCandidatesCount() ) ); goodCandidatesLabel.setText( String.valueOf( lastDownloadFile.getGoodCandidateCount() ) ); badCandidatesLabel.setText( String.valueOf( lastDownloadFile.getBadCandidateCount() ) ); totalCandidatesLabel.setText( String.valueOf( lastDownloadFile.getCandidatesCount() ) ); String destFile = lastDownloadFile.getDestinationFileName(); if ( !fileNameTxt.getText().equals( destFile ) ) { fileNameTxt.setText( destFile ); fileNameTxt.setCaretPosition(0); } String path = lastDownloadFile.getIncompleteFile().getAbsolutePath(); if ( !incompleteFileTxt.getText().equals( path ) ) { incompleteFileTxt.setText( path ); incompleteFileTxt.setCaretPosition(0); } long curFinBugScopeLength = lastDownloadFile.getMemoryFile().getFinishedBufferedLength(); if ( lastFinBufScopeLength != curFinBugScopeLength ) { lastFinBufScopeLength = curFinBugScopeLength; progressIconLabel.setIcon( twinkleProgressIcon ); resetProgressTwinkleTimer.restart(); } }
incompleteFileTxt.setText( path ); incompleteFileTxt.setCaretPosition(0);
String path = lastDownloadFile.getIncompleteDownloadFile().getAbsolutePath(); if ( !incompleteFileTxt.getText().equals( path ) ) { incompleteFileTxt.setText( path ); incompleteFileTxt.setCaretPosition(0); } } catch ( ManagedFileException exp ) { NLogger.error( DownloadOverviewPanel.class, exp ); } catch ( FileHandlingException exp ) { NLogger.error( DownloadOverviewPanel.class, exp );
private void updateInterface() { if ( lastDownloadFile == null ) { progressBar.setDownloadFile( null ); progressLabel.setText(""); downloadedLabel.setText(""); downloadedLabel.setToolTipText(""); remainingLabel.setText(""); remainingLabel.setToolTipText(""); totalSizeLabel.setText(""); totalSizeLabel.setToolTipText(""); createdLabel.setText(""); lastDownloadedLabel.setText(""); downloadRateLabel.setText(""); downloadRateLabel.setToolTipText(""); maxRateLabel.setText(""); etaLabel.setText(""); downloadingCandidatesLabel.setText( "" ); queuedCandidatesLabel.setText( "" ); connectingCandidatesLabel.setText( "" ); goodCandidatesLabel.setText( "" ); badCandidatesLabel.setText( "" ); totalCandidatesLabel.setText( "" ); fileNameTxt.setText(""); incompleteFileTxt.setText(""); return; } progressBar.setDownloadFile( lastDownloadFile ); progressLabel.setText( lastDownloadFile.getProgress().toString() + " %" ); downloadedLabel.setText( NumberFormatUtils.formatSignificantByteSize( lastDownloadFile.getTransferredDataSize() ) ); downloadedLabel.setToolTipText( NumberFormatUtils.formatFullByteSize( lastDownloadFile.getTransferredDataSize() ) ); long remaining = lastDownloadFile.getTotalDataSize() - lastDownloadFile.getTransferredDataSize(); remainingLabel.setText( NumberFormatUtils.formatSignificantByteSize( remaining ) ); remainingLabel.setToolTipText( NumberFormatUtils.formatFullByteSize( remaining ) ); totalSizeLabel.setText( NumberFormatUtils.formatSignificantByteSize( lastDownloadFile.getTotalDataSize() ) ); totalSizeLabel.setToolTipText( NumberFormatUtils.formatFullByteSize( lastDownloadFile.getTotalDataSize() ) ); createdLabel.setText( dateFormat.format( lastDownloadFile.getCreatedDate() ) ); lastDownloadedLabel.setText( dateFormat.format( lastDownloadFile.getDownloadedDate() ) ); downloadRateLabel.setText( NumberFormatUtils.formatSignificantByteSize( lastDownloadFile.getTransferSpeed() ) + Localizer.getString( "PerSec" ) ); downloadRateLabel.setToolTipText( NumberFormatUtils.formatFullByteSize( lastDownloadFile.getTransferSpeed() ) + Localizer.getString( "PerSec" ) ); long maxRate = lastDownloadFile.getDownloadThrottlingRate(); String maxRateStr; if ( maxRate >= Integer.MAX_VALUE ) { maxRateStr = Localizer.getDecimalFormatSymbols().getInfinity(); } else { maxRateStr = NumberFormatUtils.formatSignificantByteSize( maxRate) + Localizer.getString( "PerSec" ); } maxRateLabel.setText( maxRateStr ); // TODO1 //etaLabel.setText() downloadingCandidatesLabel.setText( String.valueOf( lastDownloadFile.getDownloadingCandidatesCount() ) ); queuedCandidatesLabel.setText( String.valueOf( lastDownloadFile.getQueuedCandidatesCount() ) ); connectingCandidatesLabel.setText( String.valueOf( lastDownloadFile.getConnectingCandidatesCount() ) ); goodCandidatesLabel.setText( String.valueOf( lastDownloadFile.getGoodCandidateCount() ) ); badCandidatesLabel.setText( String.valueOf( lastDownloadFile.getBadCandidateCount() ) ); totalCandidatesLabel.setText( String.valueOf( lastDownloadFile.getCandidatesCount() ) ); String destFile = lastDownloadFile.getDestinationFileName(); if ( !fileNameTxt.getText().equals( destFile ) ) { fileNameTxt.setText( destFile ); fileNameTxt.setCaretPosition(0); } String path = lastDownloadFile.getIncompleteFile().getAbsolutePath(); if ( !incompleteFileTxt.getText().equals( path ) ) { incompleteFileTxt.setText( path ); incompleteFileTxt.setCaretPosition(0); } long curFinBugScopeLength = lastDownloadFile.getMemoryFile().getFinishedBufferedLength(); if ( lastFinBufScopeLength != curFinBugScopeLength ) { lastFinBufScopeLength = curFinBugScopeLength; progressIconLabel.setIcon( twinkleProgressIcon ); resetProgressTwinkleTimer.restart(); } }
public ASTFunNode buildUnfinishedOperatorNode(Operator op) throws ParseException
public ASTFunNode buildUnfinishedOperatorNode(Operator op)
public ASTFunNode buildUnfinishedOperatorNode(Operator op) throws ParseException { ASTFunNode res = new ASTFunNode(ParserTreeConstants.JJTFUNNODE); res.setOperator(op); return res; }
if(!var.isConstant()) var.setValidValue(false);
var.setValidValue(false);
public void clearValues() { for(Enumeration e = this.elements(); e.hasMoreElements(); ) { Variable var = (Variable) e.nextElement(); if(!var.isConstant()) var.setValidValue(false); } }
this.parser.setInitialTokenManagerState(Parser.NO_DOT_IN_IDENTIFIERS);
this.parser.setInitialTokenManagerState(ParserConstants.NO_DOT_IN_IDENTIFIERS);
public VectorJep() { super(); opSet = new VOperatorSet(); this.ev = new VectorEvaluator(); this.parser.setInitialTokenManagerState(Parser.NO_DOT_IN_IDENTIFIERS); }
else return res;
return res;
public Object evaluate(Node node) throws Exception { Object res = ev.getValue(node,new Vector(),this.getSymbolTable()); if(res instanceof Scaler) return ((Scaler) res).getEle(0); else return res; }
ResultSet rs = prep.executeQuery();
rs = prep.executeQuery();
@Test public void utf() throws SQLException { PreparedStatement prep = conn.prepareStatement( "select ?,?,?,?,?,?,?,?;"); prep.setString(1, utf01); prep.setString(2, utf02); prep.setString(3, utf03); prep.setString(4, utf04); prep.setString(5, utf05); prep.setString(6, utf06); prep.setString(7, utf07); prep.setString(8, utf08); ResultSet rs = prep.executeQuery(); assertTrue(rs.next()); assertEquals(rs.getString(1), utf01); assertEquals(rs.getString(2), utf02); assertEquals(rs.getString(3), utf03); assertEquals(rs.getString(4), utf04); assertEquals(rs.getString(5), utf05); assertEquals(rs.getString(6), utf06); assertEquals(rs.getString(7), utf07); assertEquals(rs.getString(8), utf08); rs.close(); }
nameElement.setNodeValue(name);
Text text = config.getOwnerDocument().createTextNode(name); nameElement.appendChild(text); config.appendChild(nameElement);
public void setName(String name) { Element nameElement = evalElement(config, "name"); nameElement.setNodeValue(name); }
for(int i=r.size()-1; i>=0; i--) { CVSChangeLog log = (CVSChangeLog)r.get(i); boolean merged = false; for(int j=0;j<i;j++) { CVSChangeLog c = (CVSChangeLog) r.get(j); if(c.canBeMergedWith(log)) { c.merge(log); merged = true; break; } } if(merged) r.remove(log); }
public static CVSChangeLog[] parse( java.io.File f ) throws IOException, SAXException { if(!f.exists()) return new CVSChangeLog[0]; Digester digester = new Digester(); ArrayList r = new ArrayList(); digester.push(r); digester.addObjectCreate("*/entry",CVSChangeLog.class); digester.addBeanPropertySetter("*/entry/date"); digester.addBeanPropertySetter("*/entry/time"); digester.addBeanPropertySetter("*/entry/author"); digester.addBeanPropertySetter("*/entry/msg"); digester.addSetNext("*/entry","add"); digester.addObjectCreate("*/entry/file",File.class); digester.addBeanPropertySetter("*/entry/file/name"); digester.addBeanPropertySetter("*/entry/file/revision"); digester.addBeanPropertySetter("*/entry/file/prevrevision"); digester.addSetNext("*/entry/file","addFile"); digester.parse(f); CVSChangeLog[] ar = (CVSChangeLog[]) r.toArray(new CVSChangeLog[r.size()]); for( int i=0; i<ar.length; i++ ) ar[i].index = i; return ar; }
public EORelationship addBlankRelationship(String _name, EORelationshipPath _flattenRelationship) throws DuplicateNameException { String newRelationshipNameBase = _name; String newRelationshipName = newRelationshipNameBase; int newRelationshipNum = 0; while (getRelationshipNamed(newRelationshipName) != null) { newRelationshipNum++; newRelationshipName = newRelationshipNameBase + newRelationshipNum; } EORelationship relationship; if (_flattenRelationship != null) { relationship = new EORelationship(newRelationshipName, _flattenRelationship.toKeyPath()); } else { relationship = new EORelationship(newRelationshipName); } relationship.setClassProperty(Boolean.TRUE); addRelationship(relationship); return relationship;
public EORelationship addBlankRelationship(String _name) throws DuplicateNameException { return addBlankRelationship(_name, null);
public EORelationship addBlankRelationship(String _name, EORelationshipPath _flattenRelationship) throws DuplicateNameException { String newRelationshipNameBase = _name; String newRelationshipName = newRelationshipNameBase; int newRelationshipNum = 0; while (getRelationshipNamed(newRelationshipName) != null) { newRelationshipNum++; newRelationshipName = newRelationshipNameBase + newRelationshipNum; } EORelationship relationship; if (_flattenRelationship != null) { relationship = new EORelationship(newRelationshipName, _flattenRelationship.toKeyPath()); } else { relationship = new EORelationship(newRelationshipName); } relationship.setClassProperty(Boolean.TRUE); addRelationship(relationship); return relationship; }
value.nextBuild = prev.nextBuild; value.previousBuild = prev; if(value.nextBuild!=null) value.nextBuild.previousBuild = value; prev.nextBuild=value;
value.previousBuild = prev.previousBuild; value.nextBuild = prev; if(value.previousBuild!=null) value.previousBuild.nextBuild = value; prev.previousBuild=value;
private R update(TreeMap<Integer, R> m, Integer key, R value) { R first = m.isEmpty() ? null : 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 { value.nextBuild = first; value.previousBuild = null; if(first!=null) first.previousBuild = value; } return r; }
value.nextBuild = first; value.previousBuild = null;
value.previousBuild = first; value.nextBuild = null;
private R update(TreeMap<Integer, R> m, Integer key, R value) { R first = m.isEmpty() ? null : 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 { value.nextBuild = first; value.previousBuild = null; if(first!=null) first.previousBuild = value; } return r; }
first.previousBuild = value;
first.nextBuild = value;
private R update(TreeMap<Integer, R> m, Integer key, R value) { R first = m.isEmpty() ? null : 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 { value.nextBuild = first; value.previousBuild = null; if(first!=null) first.previousBuild = value; } return r; }
if (param instanceof Number) {
if (param instanceof Complex) return ((Complex)param).neg(); if (param instanceof Number)
public Object umin(Object param) throws ParseException { if (param instanceof Number) { return new Double(-((Number)param).doubleValue()); } else if (param instanceof Complex) { return ((Complex)param).neg(); } throw new ParseException("Invalid parameter type"); }
} else if (param instanceof Complex) { return ((Complex)param).neg(); }
public Object umin(Object param) throws ParseException { if (param instanceof Number) { return new Double(-((Number)param).doubleValue()); } else if (param instanceof Complex) { return ((Complex)param).neg(); } throw new ParseException("Invalid parameter type"); }
g2.translate(-1* rowWidth * row, yLoc + titleHeight);
g2.translate(-1* rowWidth * row + LABEL_X_SHIFT, yLoc + titleHeight);
void drawPlottableNew(Graphics g) { int mean = getMean(); // get new graphics to avoid messing up original Graphics2D g2 = (Graphics2D)g.create(); g2.setClip(LABEL_X_SHIFT, 0, rowWidth, Integer.MAX_VALUE); AffineTransform originalTransform = AffineTransform.getTranslateInstance(LABEL_X_SHIFT, titleHeight); for (int row = 0; row < rows && currentImageGraphics == g; row++) { //use title and label transform to draw red center lines g2.setTransform(originalTransform); g2.setPaint(Color.red); int yLoc = rowOffset*row; g2.drawLine(0, yLoc, rowWidth, yLoc); //Create new transform to draw plottable scaled correctly g2.setTransform(new AffineTransform()); //shift the shape left to get to the correct point for this row //and down to get to the correct draw height g2.translate(-1* rowWidth * row, yLoc + titleHeight); //flip the y axis to make going lower positive g2.scale(1,-1); //scale for the amplitude slider g2.scale(1, ampScale); g2.scale(1, ampScalePercent); //center the mean g2.translate(0, -1*mean); if (row % 2 == 0) { g2.setPaint(Color.black); } else { g2.setPaint(Color.blue); } if (plottableShape != null) { g2.draw(plottableShape); } // end of if (plottableShape != null) } repaint(); }
public PVariable(PolynomialCreator pc,XVariable var) throws ParseException {
public PVariable(PolynomialCreator pc,XVariable var) {
public PVariable(PolynomialCreator pc,XVariable var) throws ParseException { super(pc); this.variable = var; }
if(eqn instanceof ASTVarNode) { return isConstantVar((XVariable)((ASTVarNode) eqn).getVar()); }
public boolean isConstantVar(XVariable var) { if(!var.hasEquation()) return true; Node eqn = var.getEquation(); if(eqn instanceof ASTConstant) return true; if(eqn instanceof ASTVarNode) { return isConstantVar((XVariable)((ASTVarNode) eqn).getVar()); } return false; }
public Object visit(ASTFunNode node, Object data) throws ParseException
public Object visit(ASTConstant node, Object data) throws ParseException
public Object visit(ASTFunNode node, Object data) throws ParseException { Node children[]=acceptChildrenAsArray(node,data); return xjep.getNodeFactory().buildFunctionNode(node,children); }
Node children[]=acceptChildrenAsArray(node,data); return xjep.getNodeFactory().buildFunctionNode(node,children);
return xjep.getNodeFactory().buildConstantNode(node);
public Object visit(ASTFunNode node, Object data) throws ParseException { Node children[]=acceptChildrenAsArray(node,data); return xjep.getNodeFactory().buildFunctionNode(node,children); }
public PartialDerivative findDerivative(String derivname,DJep jep)
public PartialDerivative findDerivative(String derivnames[],DJep jep)
public PartialDerivative findDerivative(String derivname,DJep jep) throws ParseException { String newnames[] = new String[1]; newnames[0]=derivname; return findDerivativeSorted(newnames,jep); }
String newnames[] = new String[1]; newnames[0]=derivname;
String newnames[] = sortedNames(derivnames);
public PartialDerivative findDerivative(String derivname,DJep jep) throws ParseException { String newnames[] = new String[1]; newnames[0]=derivname; return findDerivativeSorted(newnames,jep); }
return Integer.parseInt(id);
int value = Integer.parseInt(id); return value;
protected Serializable resolveId(String id) { return Integer.parseInt(id); }
Object value = getHibernateTemplate().load(clazz, resolveId(id));
Serializable key = resolveId(id); Object value = getHibernateTemplate().load(clazz, key);
protected void setAsText(String id, Class clazz) { if (logger.isDebugEnabled()) { logger.debug("Loaded "+clazz.getName()+" property editor"); } try { Object value = getHibernateTemplate().load(clazz, resolveId(id)); super.setValue(value); if (logger.isDebugEnabled()) { logger.debug("Loaded property: "+value); } } catch (Exception e) { super.setValue(null); } }
LocalSeismogramImpl[] alreadyContained = container.getSeismograms(); int maxTries = 100; while(maxTries > 0 && alreadyContained.length < 3){ maxTries--; try { Thread.sleep(5); } catch (InterruptedException e) {} alreadyContained = container.getSeismograms(); } assertEquals("problem getting initial seismograms", 3, alreadyContained.length);
public void setUp(){ seismograms = DisplayUtilsTest.createThreeSeisArray(); dss = new MemoryDataSetSeismogram(seismograms, null); container = new SeismogramContainer(dss); }
while(contained.length < 3){ try { Thread.sleep(5); } catch (InterruptedException e) {} contained = container.getSeismograms(); }
public void testGetSeismograms(){ LocalSeismogramImpl[] contained = container.getSeismograms(); while(contained.length < 3){ try { Thread.sleep(5); } catch (InterruptedException e) {} contained = container.getSeismograms(); } ArrayAssert.assertEquivalenceArrays(seismograms, contained); }
while(alreadyContained.length < 3){ try { Thread.sleep(5); } catch (InterruptedException e) {} alreadyContained = container.getSeismograms(); }
public void testPushAlreadyAddedData(){ LocalSeismogramImpl[] alreadyContained = container.getSeismograms(); while(alreadyContained.length < 3){ try { Thread.sleep(5); } catch (InterruptedException e) {} alreadyContained = container.getSeismograms(); } container.pushData(new SeisDataChangeEvent(DisplayUtilsTest.createThreeSeisArray(), null, container)); LocalSeismogramImpl[] nowContains = container.getSeismograms(); ArrayAssert.assertEquivalenceArrays(alreadyContained, nowContains); }
assertEquals("must be exactly 6 seismograms", 6, nowContains.length);
public void testPushNewData(){ LocalSeismogramImpl[] alreadyContained = container.getSeismograms(); LocalSeismogramImpl[] otherSeis = DisplayUtilsTest.createOtherSeisArray(); container.pushData(new SeisDataChangeEvent(otherSeis, null, container)); LocalSeismogramImpl[] nowContains = container.getSeismograms(); //assertEquals("must be exactly 6 seismograms", 6, nowContains.length); for (int i = 0; i < nowContains.length; i++){ System.out.println("nowContains "+i+" "+nowContains[i].get_id()); boolean found = false; for (int j = 0; j < alreadyContained.length; j++) { if(nowContains[i] == alreadyContained[j]){ found = true; break; } } for (int j = 0; j < otherSeis.length; j++) { if(nowContains[i] == otherSeis[j]){ found = true; break; } } assertTrue("Found an extra seismogram", found); } }
System.out.println("nowContains "+i+" "+nowContains[i].get_id());
public void testPushNewData(){ LocalSeismogramImpl[] alreadyContained = container.getSeismograms(); LocalSeismogramImpl[] otherSeis = DisplayUtilsTest.createOtherSeisArray(); container.pushData(new SeisDataChangeEvent(otherSeis, null, container)); LocalSeismogramImpl[] nowContains = container.getSeismograms(); //assertEquals("must be exactly 6 seismograms", 6, nowContains.length); for (int i = 0; i < nowContains.length; i++){ System.out.println("nowContains "+i+" "+nowContains[i].get_id()); boolean found = false; for (int j = 0; j < alreadyContained.length; j++) { if(nowContains[i] == alreadyContained[j]){ found = true; break; } } for (int j = 0; j < otherSeis.length; j++) { if(nowContains[i] == otherSeis[j]){ found = true; break; } } assertTrue("Found an extra seismogram", found); } }
boolean calledRetrieved = false;
boolean callRetrieve = false;
public synchronized LocalSeismogramImpl[] getSeismograms(){ if(softSeis.size() == 0){ return EMPTY_ARRAY; } List existant = new ArrayList(); Iterator it = softSeis.iterator(); boolean calledRetrieved = false; while(it.hasNext()){ SoftReference current = (SoftReference)it.next(); if(current.get() != null){ existant.add(current.get()); }else{ it.remove(); if(!calledRetrieved){ seismogram.retrieveData(this); calledRetrieved = true; } } } return (LocalSeismogramImpl[])existant.toArray(new LocalSeismogramImpl[existant.size()]); }
if(current.get() != null){ existant.add(current.get());
Object o = current.get(); if(o != null){ existant.add(o);
public synchronized LocalSeismogramImpl[] getSeismograms(){ if(softSeis.size() == 0){ return EMPTY_ARRAY; } List existant = new ArrayList(); Iterator it = softSeis.iterator(); boolean calledRetrieved = false; while(it.hasNext()){ SoftReference current = (SoftReference)it.next(); if(current.get() != null){ existant.add(current.get()); }else{ it.remove(); if(!calledRetrieved){ seismogram.retrieveData(this); calledRetrieved = true; } } } return (LocalSeismogramImpl[])existant.toArray(new LocalSeismogramImpl[existant.size()]); }
if(!calledRetrieved){ seismogram.retrieveData(this); calledRetrieved = true; }
public synchronized LocalSeismogramImpl[] getSeismograms(){ if(softSeis.size() == 0){ return EMPTY_ARRAY; } List existant = new ArrayList(); Iterator it = softSeis.iterator(); boolean calledRetrieved = false; while(it.hasNext()){ SoftReference current = (SoftReference)it.next(); if(current.get() != null){ existant.add(current.get()); }else{ it.remove(); if(!calledRetrieved){ seismogram.retrieveData(this); calledRetrieved = true; } } } return (LocalSeismogramImpl[])existant.toArray(new LocalSeismogramImpl[existant.size()]); }
} if(callRetrieve){ seismogram.retrieveData(this);
public synchronized LocalSeismogramImpl[] getSeismograms(){ if(softSeis.size() == 0){ return EMPTY_ARRAY; } List existant = new ArrayList(); Iterator it = softSeis.iterator(); boolean calledRetrieved = false; while(it.hasNext()){ SoftReference current = (SoftReference)it.next(); if(current.get() != null){ existant.add(current.get()); }else{ it.remove(); if(!calledRetrieved){ seismogram.retrieveData(this); calledRetrieved = true; } } } return (LocalSeismogramImpl[])existant.toArray(new LocalSeismogramImpl[existant.size()]); }
protected FreeMarkerView prepareView(String templateName) {
protected FreeMarkerView prepareView(String templateName) throws Exception {
protected FreeMarkerView prepareView(String templateName) { FreeMarkerView fv = new FreeMarkerView(); fv.setUrl(templateName); fv.setApplicationContext(wac); fv.setExposeSpringMacroHelpers(true); return fv; }
fv.setBeanName(templateName); fv.afterPropertiesSet();
protected FreeMarkerView prepareView(String templateName) { FreeMarkerView fv = new FreeMarkerView(); fv.setUrl(templateName); fv.setApplicationContext(wac); fv.setExposeSpringMacroHelpers(true); return fv; }
System.out.println(request.getAttribute("errors"));
protected MockHttpServletResponse processView(String templateName, Map<String, Object> model, boolean visualTest) throws Exception { MockHttpServletResponse expectedResponse = new MockHttpServletResponse(); FreeMarkerView fv = prepareView(templateName); fv.render(model, request, expectedResponse); if (visualTest) { String output = expectedResponse.getContentAsString(); System.out.println(output); fail(); } return expectedResponse; }
search.addSearchChangeListener(this);
public SearchButton( Search search ) { super( ); this.search = search; updateButtonDisplay(); setUI( new SearchButtonUI() ); setBorder( GUIUtils.ROLLOVER_BUTTON_BORDER ); setRolloverEnabled( true ); setHorizontalAlignment( SwingConstants.LEFT ); setMargin( GUIUtils.EMPTY_INSETS ); }
private void updateButtonDisplay()
public void updateButtonDisplay()
private void updateButtonDisplay() { StringBuffer textBuf = new StringBuffer(); if ( search instanceof KeywordSearch ) { textBuf.append( ((KeywordSearch)search).getSearchString() ); setIcon( GUIRegistry.getInstance().getIconFactory().getIcon("Search") ); } else if ( search instanceof BrowseHostResults ) { DestAddress destAddress = ((BrowseHostResults)search).getDestAddress(); textBuf.append( destAddress.getFullHostName() ); setIcon( GUIRegistry.getInstance().getIconFactory().getIcon("BrowseHost") ); } else if ( search instanceof WhatsNewSearch ) { textBuf.append( Localizer.getString("SearchTab_WhatsNewSearch") ); setIcon( IconFactory.EMPTY_IMAGE_16 ); } else { textBuf.append( search.toString() ); setIcon( IconFactory.EMPTY_IMAGE_16 ); } SearchResultsDataModel dataModel = SearchResultsDataModel.lookupResultDataModel(search); int totalElem = 0; int filteredElem = 0; if ( dataModel != null ) { totalElem = dataModel.getSearchElementCount(); filteredElem = dataModel.getFilteredElementCount(); } textBuf.append( " (" ); if ( filteredElem < totalElem ) { textBuf.append( filteredElem ) .append( "/" ); } textBuf.append( totalElem ) .append( ")" ); setText( textBuf.toString() ); }
textBuf.append( filteredElem )
textBuf.append( totalElem )
private void updateButtonDisplay() { StringBuffer textBuf = new StringBuffer(); if ( search instanceof KeywordSearch ) { textBuf.append( ((KeywordSearch)search).getSearchString() ); setIcon( GUIRegistry.getInstance().getIconFactory().getIcon("Search") ); } else if ( search instanceof BrowseHostResults ) { DestAddress destAddress = ((BrowseHostResults)search).getDestAddress(); textBuf.append( destAddress.getFullHostName() ); setIcon( GUIRegistry.getInstance().getIconFactory().getIcon("BrowseHost") ); } else if ( search instanceof WhatsNewSearch ) { textBuf.append( Localizer.getString("SearchTab_WhatsNewSearch") ); setIcon( IconFactory.EMPTY_IMAGE_16 ); } else { textBuf.append( search.toString() ); setIcon( IconFactory.EMPTY_IMAGE_16 ); } SearchResultsDataModel dataModel = SearchResultsDataModel.lookupResultDataModel(search); int totalElem = 0; int filteredElem = 0; if ( dataModel != null ) { totalElem = dataModel.getSearchElementCount(); filteredElem = dataModel.getFilteredElementCount(); } textBuf.append( " (" ); if ( filteredElem < totalElem ) { textBuf.append( filteredElem ) .append( "/" ); } textBuf.append( totalElem ) .append( ")" ); setText( textBuf.toString() ); }
textBuf.append( totalElem )
textBuf.append( filteredElem )
private void updateButtonDisplay() { StringBuffer textBuf = new StringBuffer(); if ( search instanceof KeywordSearch ) { textBuf.append( ((KeywordSearch)search).getSearchString() ); setIcon( GUIRegistry.getInstance().getIconFactory().getIcon("Search") ); } else if ( search instanceof BrowseHostResults ) { DestAddress destAddress = ((BrowseHostResults)search).getDestAddress(); textBuf.append( destAddress.getFullHostName() ); setIcon( GUIRegistry.getInstance().getIconFactory().getIcon("BrowseHost") ); } else if ( search instanceof WhatsNewSearch ) { textBuf.append( Localizer.getString("SearchTab_WhatsNewSearch") ); setIcon( IconFactory.EMPTY_IMAGE_16 ); } else { textBuf.append( search.toString() ); setIcon( IconFactory.EMPTY_IMAGE_16 ); } SearchResultsDataModel dataModel = SearchResultsDataModel.lookupResultDataModel(search); int totalElem = 0; int filteredElem = 0; if ( dataModel != null ) { totalElem = dataModel.getSearchElementCount(); filteredElem = dataModel.getFilteredElementCount(); } textBuf.append( " (" ); if ( filteredElem < totalElem ) { textBuf.append( filteredElem ) .append( "/" ); } textBuf.append( totalElem ) .append( ")" ); setText( textBuf.toString() ); }
return (SearchResultsDataModel) searchToDataModelMap.get( search );
return searchToDataModelMap.get( search );
public static SearchResultsDataModel lookupResultDataModel( Search search ) { return (SearchResultsDataModel) searchToDataModelMap.get( search ); }
super(aView);
super(aView, aRecipe);
public RecipeDetailsController(RecipeDetailsView aView, Recipe aRecipe) { super(aView); myContents = aView; myRecipe = aRecipe; }
myRecipe = aRecipe;
public RecipeDetailsController(RecipeDetailsView aView, Recipe aRecipe) { super(aView); myContents = aView; myRecipe = aRecipe; }