bugged
stringlengths 6
599k
| fixed
stringlengths 10
599k
| __index_level_0__
int64 0
1.13M
|
|---|---|---|
public void removeSeismogram(MouseEvent me){ BasicSeismogramDisplay clicked = ((BasicSeismogramDisplay)me.getComponent()); clicked.removeAllSeismograms(); seismograms.remove(clicked); basicDisplays.remove(clicked); ((SeismogramDisplay)basicDisplays.getFirst()).addTopTimeBorder(); ((SeismogramDisplay)basicDisplays.getLast()).addBottomTimeBorder(); }
|
public void removeSeismogram(MouseEvent me){ BasicSeismogramDisplay clicked = ((BasicSeismogramDisplay)me.getComponent()); clicked.remove(me); seismograms.remove(clicked); basicDisplays.remove(clicked); ((SeismogramDisplay)basicDisplays.getFirst()).addTopTimeBorder(); ((SeismogramDisplay)basicDisplays.getLast()).addBottomTimeBorder(); }
| 1,117,991
|
public void setLabels(MicroSecondDate time, double amp){ calendar.setTime(time); this.time.setText(" Time: " + output.format(calendar.getTime())); if(amp < 0) if(Math.abs(amp) < 10) this.amp.setText(" Amplitude: -000" + Math.abs(Math.round(amp))); else if(Math.abs(amp) < 100) this.amp.setText(" Amplitude: -00" + Math.abs(Math.round(amp))); else if(Math.abs(amp) < 1000) this.amp.setText(" Amplitude: -0" + Math.abs(Math.round(amp))); else this.amp.setText(" Amplitude: -" + Math.abs(Math.round(amp))); else if(Math.abs(amp) < 10) this.amp.setText(" Amplitude: 000" + Math.round(amp)); else if(Math.abs(amp) < 100) this.amp.setText(" Amplitude: 00" + Math.round(amp)); else if(Math.abs(amp) < 1000) this.amp.setText(" Amplitude: 0" + Math.round(amp)); else this.amp.setText(" Amplitude: " + Math.round(amp)); }
|
public void setLabels(MicroSecondDate time, double amp){ calendar.setTime(time); if(output.format(calendar.getTime()).length() == 21) this.time.setText(" Time: " + output.format(calendar.getTime()) + "00"); else if(output.format(calendar.getTime()).length() == 22) this.time.setText(" Time: " + output.format(calendar.getTime()) + "0"); else this.time.setText(" Time: " + output.format(calendar.getTime())); if(amp < 0) if(Math.abs(amp) < 10) this.amp.setText(" Amplitude: -000" + Math.abs(Math.round(amp))); else if(Math.abs(amp) < 100) this.amp.setText(" Amplitude: -00" + Math.abs(Math.round(amp))); else if(Math.abs(amp) < 1000) this.amp.setText(" Amplitude: -0" + Math.abs(Math.round(amp))); else this.amp.setText(" Amplitude: -" + Math.abs(Math.round(amp))); else if(Math.abs(amp) < 10) this.amp.setText(" Amplitude: 000" + Math.round(amp)); else if(Math.abs(amp) < 100) this.amp.setText(" Amplitude: 00" + Math.round(amp)); else if(Math.abs(amp) < 1000) this.amp.setText(" Amplitude: 0" + Math.round(amp)); else this.amp.setText(" Amplitude: " + Math.round(amp)); }
| 1,117,992
|
public void addNewCalendars() throws CalFacadeException { HibSession sess = getSess(); /* Add a user collection to the userCalendarRoot and then a default calendar collection. */ sess.namedQuery("getCalendarByPath"); String path = userCalendarRootPath; sess.setString("path", path); BwCalendar userrootcal = (BwCalendar)sess.getUnique(); if (userrootcal == null) { throw new CalFacadeException("No user root at " + path); } path += "/" + user.getAccount(); sess.namedQuery("getCalendarByPath"); sess.setString("path", path); BwCalendar usercal = (BwCalendar)sess.getUnique(); if (usercal != null) { throw new CalFacadeException("User calendar already exists at " + path); } /* Create a folder for the user */ usercal = new BwCalendar(); usercal.setName(user.getAccount()); usercal.setCreator(user); usercal.setOwner(user); usercal.setPublick(false); usercal.setPath(path); usercal.setCalendar(userrootcal); userrootcal.addChild(usercal); sess.save(userrootcal); /* Create a default calendar */ BwCalendar cal = new BwCalendar(); cal.setName(getSyspars().getUserDefaultCalendar()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getUserDefaultCalendar()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); /* Add the trash calendar */ cal = new BwCalendar(); cal.setName(getSyspars().getDefaultTrashCalendar()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getDefaultTrashCalendar()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); /* Add the inbox */ cal = new BwCalendar(); cal.setName(getSyspars().getUserInbox()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getUserInbox()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); /* Add the outbox */ cal = new BwCalendar(); cal.setName(getSyspars().getUserOutbox()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getUserOutbox()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); sess.save(usercal); sess.update(user); }
|
public void addNewCalendars(BwUser user) throws CalFacadeException { HibSession sess = getSess(); /* Add a user collection to the userCalendarRoot and then a default calendar collection. */ sess.namedQuery("getCalendarByPath"); String path = userCalendarRootPath; sess.setString("path", path); BwCalendar userrootcal = (BwCalendar)sess.getUnique(); if (userrootcal == null) { throw new CalFacadeException("No user root at " + path); } path += "/" + user.getAccount(); sess.namedQuery("getCalendarByPath"); sess.setString("path", path); BwCalendar usercal = (BwCalendar)sess.getUnique(); if (usercal != null) { throw new CalFacadeException("User calendar already exists at " + path); } /* Create a folder for the user */ usercal = new BwCalendar(); usercal.setName(user.getAccount()); usercal.setCreator(user); usercal.setOwner(user); usercal.setPublick(false); usercal.setPath(path); usercal.setCalendar(userrootcal); userrootcal.addChild(usercal); sess.save(userrootcal); /* Create a default calendar */ BwCalendar cal = new BwCalendar(); cal.setName(getSyspars().getUserDefaultCalendar()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getUserDefaultCalendar()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); /* Add the trash calendar */ cal = new BwCalendar(); cal.setName(getSyspars().getDefaultTrashCalendar()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getDefaultTrashCalendar()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); /* Add the inbox */ cal = new BwCalendar(); cal.setName(getSyspars().getUserInbox()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getUserInbox()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); /* Add the outbox */ cal = new BwCalendar(); cal.setName(getSyspars().getUserOutbox()); cal.setCreator(user); cal.setOwner(user); cal.setPublick(false); cal.setPath(path + "/" + getSyspars().getUserOutbox()); cal.setCalendar(usercal); cal.setCalendarCollection(true); usercal.addChild(cal); sess.save(usercal); sess.update(user); }
| 1,117,993
|
public BwFreeBusy getFreeBusy(CalSvcI svci, String account) throws WebdavException { try { BwUser user = svci.findUser(account); if (user == null) { throw WebdavIntfException.unauthorized(); } BwFreeBusy fb = svci.getFreeBusy(null, user, timeRange.getStart(), timeRange.getEnd(), null, false); if (debug) { trace("Got " + fb); } return fb; } catch (Throwable t) { throw new WebdavException(t); } }
|
public BwFreeBusy getFreeBusy(CalSvcI svci, BwCalendar cal, String account) throws WebdavException { try { BwUser user = svci.findUser(account); if (user == null) { throw WebdavIntfException.unauthorized(); } BwFreeBusy fb = svci.getFreeBusy(null, user, timeRange.getStart(), timeRange.getEnd(), null, false); if (debug) { trace("Got " + fb); } return fb; } catch (Throwable t) { throw new WebdavException(t); } }
| 1,117,994
|
public BwFreeBusy getFreeBusy(CalSvcI svci, String account) throws WebdavException { try { BwUser user = svci.findUser(account); if (user == null) { throw WebdavIntfException.unauthorized(); } BwFreeBusy fb = svci.getFreeBusy(null, user, timeRange.getStart(), timeRange.getEnd(), null, false); if (debug) { trace("Got " + fb); } return fb; } catch (Throwable t) { throw new WebdavException(t); } }
|
public BwFreeBusy getFreeBusy(CalSvcI svci, String account) throws WebdavException { try { BwUser user = svci.findUser(account); if (user == null) { throw WebdavIntfException.unauthorized(); } BwFreeBusy fb = svci.getFreeBusy(cal, user, timeRange.getStart(), timeRange.getEnd(), null, false); if (debug) { trace("Got " + fb); } return fb; } catch (Throwable t) { throw new WebdavException(t); } }
| 1,117,995
|
public CalSvcI getSvci() throws WebdavIntfException { boolean publicMode = (account == null); if (svci != null) { if (!svci.isOpen()) { try { svci.open(); svci.beginTransaction(); } catch (Throwable t) { throw new WebdavIntfException(t); } } return svci; } try { svci = new CalSvc(); /* account is what we authenticated with. * user, if non-null, is the user calendar we want to access. */ CalSvcIPars pars = new CalSvcIPars(account, UserAuth.noPrivileges, account, envPrefix, publicMode, true, // caldav null, // synchId debug); svci.init(pars); svci.open(); svci.beginTransaction(); trans = new IcalTranslator(svci.getIcalCallback(), debug); } catch (Throwable t) { throw new WebdavIntfException(t); } return svci; }
|
public CalSvcI getSvci() throws WebdavIntfException { boolean publicMode = (account == null); if (svci != null) { if (!svci.isOpen()) { try { svci.open(); svci.beginTransaction(); } catch (Throwable t) { throw new WebdavIntfException(t); } } return svci; } try { svci = new CalSvc(); /* account is what we authenticated with. * user, if non-null, is the user calendar we want to access. */ CalSvcIPars pars = new CalSvcIPars(account, account, envPrefix, publicMode, true, // caldav null, // synchId debug); svci.init(pars); svci.open(); svci.beginTransaction(); trans = new IcalTranslator(svci.getIcalCallback(), debug); } catch (Throwable t) { throw new WebdavIntfException(t); } return svci; }
| 1,117,996
|
void process() throws ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = factory.newDocumentBuilder(); String userName = System.getProperty("user.name"); URL dirURL = base; System.out.println(" dirURL is "+dirURL.toString()); try { dirURL = new URL(dirURL, directory.getName()+"/"); System.out.println("updated dirURL is "+dirURL.toString()); } catch (MalformedURLException e) { e.printStackTrace(); return; } // end of try-catch dataset = new XMLDataSet(docBuilder, dirURL, "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.addParameter(key,new URL(dirURL, (String)paramRefs.get(key)).toString(), 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(); 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 { SacTimeSeries sac = new SacTimeSeries(); 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(dirURL, sacFiles[i].getName()); // System.out.println(" the seisURL is "+seisURL.toString()); // DataInputStream dis = new DataInputStream(new BufferedInputStream(seisURL.openStream())); // SacTimeSeries sac = new SacTimeSeries(); //sac.read(dis); edu.iris.Fissures.seismogramDC.LocalSeismogramImpl seis = SacToFissures.getSeismogram(sac); edu.sc.seis.fissuresUtil.cache.CacheEvent event = SacToFissures.getEvent(sac); if (event != null && dataset.getParameter(EVENT) == null) { // add event AuditInfo[] eventAudit = new AuditInfo[1]; eventAudit[0] = new AuditInfo(System.getProperty("user.name"), "event loaded from sac file."); dataset.addParameter( EVENT, event, eventAudit); } // end of if (event != null) Channel channel = SacToFissures.getChannel(sac); String channelParamName = CHANNEL+ChannelIdUtil.toString(seis.channel_id); if (channel != null && dataset.getParameter(channelParamName) == null) { // add event AuditInfo[] chanAudit = new AuditInfo[1]; chanAudit[0] = new AuditInfo(System.getProperty("user.name"), "channel loaded from sac file."); dataset.addParameter(channelParamName, channel, chanAudit); } String seisName = sacFiles[i].getName(); if (seisName.endsWith(".SAC")) { seisName = seisName.substring(seisName.length()-4); } // end of if (seisName.endsWith(".SAC")) dataset.addSeismogramRef(seis, seisURL, seisName, 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++) }
|
void process() throws ParserConfigurationException { DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = factory.newDocumentBuilder(); String userName = System.getProperty("user.name"); URL dirURL = base; System.out.println(" dirURL is "+dirURL.toString()); try { dirURL = new URL(dirURL, directory.getName()+"/"); System.out.println("updated dirURL is "+dirURL.toString()); } catch (MalformedURLException e) { e.printStackTrace(); return; } // end of try-catch dataset = new XMLDataSet(docBuilder, dirURL, "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.addParameter(key,new URL(dirURL, (String)paramRefs.get(key)).toString(), 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(); 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 { SacTimeSeries sac = new SacTimeSeries(); 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(dirURL, sacFiles[i].getName()); // System.out.println(" the seisURL is "+seisURL.toString()); // DataInputStream dis = new DataInputStream(new BufferedInputStream(seisURL.openStream())); // SacTimeSeries sac = new SacTimeSeries(); //sac.read(dis); edu.iris.Fissures.seismogramDC.LocalSeismogramImpl seis = SacToFissures.getSeismogram(sac); edu.sc.seis.fissuresUtil.cache.CacheEvent event = SacToFissures.getEvent(sac); if (event != null && dataset.getParameter(EVENT) == null) { // add event AuditInfo[] eventAudit = new AuditInfo[1]; eventAudit[0] = new AuditInfo(System.getProperty("user.name"), "event loaded from sac file."); dataset.addParameter( EVENT, event, eventAudit); } // end of if (event != null) Channel channel = SacToFissures.getChannel(sac); String channelParamName = CHANNEL+ChannelIdUtil.toString(seis.channel_id); if (channel != null && dataset.getParameter(channelParamName) == null) { // add event AuditInfo[] chanAudit = new AuditInfo[1]; chanAudit[0] = new AuditInfo(System.getProperty("user.name"), "channel loaded from sac file."); dataset.addParameter(channelParamName, channel, chanAudit); } String seisName = sacFiles[i].getName(); if (seisName.endsWith(".SAC")) { seisName = seisName.substring(0,seisName.length()-4); } // end of if (seisName.endsWith(".SAC")) dataset.addSeismogramRef(seis, seisURL, seisName, 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++) }
| 1,117,997
|
private PacketType finalizeSeismogramCreation(PacketType seismogramData, PacketType stateOfHealthData, boolean gapInData) { if(gapInData) { System.out.println("The data collecting unit stopped recording data on channel " + seismogramData.channel_number); System.out.println("for a period of time longer than allowed."); System.out.println("A new seismogram will be created to hold the rest of the data."); } if(stateOfHealthData == null || stateOfHealthData.begin_time_from_state_of_health_file == null) { System.err.println("The begin time for the channel is not present in the state of health data."); } else { seismogramData.begin_time_from_state_of_health_file = stateOfHealthData.begin_time_from_state_of_health_file; } if(stateOfHealthData == null || stateOfHealthData.latitude_ == 0) { System.err.println("The latitude for the channel is not present in the state of health data."); } else { seismogramData.latitude_ = stateOfHealthData.latitude_; } if(stateOfHealthData == null || stateOfHealthData.longitude_ == 0) { System.err.println("The longitude for the channel is not present in the state of health data."); } else { seismogramData.longitude_ = stateOfHealthData.longitude_; } if(stateOfHealthData == null || stateOfHealthData.channel_name == null) { System.err.println("The channel name for the channel is not present in the state of health data."); } else { seismogramData.channel_name = stateOfHealthData.channel_name; } if(seismogramData.sample_rate == 0){ seismogramData.sample_rate = 40; System.out.println("The Event Header and Event Trailer Packets for channel " + seismogramData.channel_number + " were missing " + "from the beginning and end of the data file."); System.out.println("This rare occurance is handled by using " + "the header information from the first " + "data packet instead."); System.out.println("The only information unable to be recovered " + "is the data sample rate. A sample rate of " + seismogramData.sample_rate + " samples per second will be assumed."); } System.out.println("Sample rate: " + seismogramData.sample_rate); return seismogramData; }
|
private PacketType finalizeSeismogramCreation(PacketType seismogramData, PacketType stateOfHealthData, boolean gapInData) { if(gapInData) { System.out.println("The data collecting unit stopped recording data on channel " + seismogramData.channel_number); System.out.println("for a period of time longer than allowed."); System.out.println("A new seismogram will be created to hold the rest of the data."); } if(stateOfHealthData == null || stateOfHealthData.begin_time_from_state_of_health_file == null) { System.err.println("The begin time for the channel is not present in the state of health data."); } else { seismogramData.begin_time_from_state_of_health_file = stateOfHealthData.begin_time_from_state_of_health_file; } if(stateOfHealthData == null || stateOfHealthData.latitude_ == 0) { System.err.println("The latitude for the channel is not present in the state of health data."); } else { seismogramData.latitude_ = stateOfHealthData.latitude_; } if(stateOfHealthData == null || stateOfHealthData.longitude_ == 0) { System.err.println("The longitude for the channel is not present in the state of health data."); } else { seismogramData.longitude_ = stateOfHealthData.longitude_; } if(stateOfHealthData == null || stateOfHealthData.channel_name == null) { System.err.println("The channel name for the channel is not present in the state of health data."); } else { seismogramData.channel_name = stateOfHealthData.channel_name; } if(seismogramData.sample_rate == 0){ seismogramData.sample_rate = 40; System.out.println("The Event Header and Event Trailer Packets for channel " + seismogramData.channel_number + " were missing " + "from the beginning and end of the data file."); System.out.println("This rare occurance is handled by using " + "the header information from the first " + "data packet instead."); System.out.println("The only information unable to be recovered " + "is the data sample rate. A sample rate of " + seismogramData.sample_rate + " samples per second will be assumed."); } return seismogramData; }
| 1,117,999
|
public boolean contains(String[] names){ for(int i = 0; i < names.length; i++){ if(this.names.contains(names[i])) return true; } return false; }
|
public boolean contains(String[] names){ for(int i = 0; i < names.length; i++){ if(this.names.contains(names[i])) return true; } return false; }
| 1,118,000
|
public int sort(DataSetSeismogram[] seismograms, String[] names){ this.names.add(names); return this.names.size() - 1; }
|
public int sort(DataSetSeismogram[] seismograms, String[] names){ this.names.add(names); return this.names.size() - 1; }
| 1,118,001
|
private void doNode(WebdavNsNode node) throws WebdavException { PropFindMethod pm = (PropFindMethod)getNsIntf().findMethod( WebdavMethods.propFind); int status = node.getStatus(); String content = null; openTag(WebdavTags.response); if (status == HttpServletResponse.SC_OK) { if ((reportType == reportTypeQuery) || (reportType == reportTypeMultiGet)) { try { content = caldata.process(node); } catch (WebdavException wde) { status = wde.getStatusCode();; if (debug && (status != HttpServletResponse.SC_NOT_FOUND)) { error(wde); } } } } if (status != HttpServletResponse.SC_OK) { openTag(WebdavTags.propstat); property(WebdavTags.status, "HTTP/1.1 " + status + " " + WebdavStatusCode.getMessage(status)); closeTag(WebdavTags.propstat); } else if (reportType == reportTypeExpandProperty) { } else { pm.doNodeProperties(node, preq); /* Output the (transformed) node. */ property(CaldavTags.calendarData, content); } closeTag(WebdavTags.response); flush(); }
|
private void doNode(WebdavNsNode node) throws WebdavException { PropFindMethod pm = (PropFindMethod)getNsIntf().findMethod( WebdavMethods.propFind); int status = node.getStatus(); openTag(WebdavTags.response); if (status == HttpServletResponse.SC_OK) { if ((reportType == reportTypeQuery) || (reportType == reportTypeMultiGet)) { try { content = caldata.process(node); } catch (WebdavException wde) { status = wde.getStatusCode();; if (debug && (status != HttpServletResponse.SC_NOT_FOUND)) { error(wde); } } } } if (status != HttpServletResponse.SC_OK) { openTag(WebdavTags.propstat); property(WebdavTags.status, "HTTP/1.1 " + status + " " + WebdavStatusCode.getMessage(status)); closeTag(WebdavTags.propstat); } else if (reportType == reportTypeExpandProperty) { } else { pm.doNodeProperties(node, preq); /* Output the (transformed) node. */ property(CaldavTags.calendarData, content); } closeTag(WebdavTags.response); flush(); }
| 1,118,002
|
private void doNode(WebdavNsNode node) throws WebdavException { PropFindMethod pm = (PropFindMethod)getNsIntf().findMethod( WebdavMethods.propFind); int status = node.getStatus(); String content = null; openTag(WebdavTags.response); if (status == HttpServletResponse.SC_OK) { if ((reportType == reportTypeQuery) || (reportType == reportTypeMultiGet)) { try { content = caldata.process(node); } catch (WebdavException wde) { status = wde.getStatusCode();; if (debug && (status != HttpServletResponse.SC_NOT_FOUND)) { error(wde); } } } } if (status != HttpServletResponse.SC_OK) { openTag(WebdavTags.propstat); property(WebdavTags.status, "HTTP/1.1 " + status + " " + WebdavStatusCode.getMessage(status)); closeTag(WebdavTags.propstat); } else if (reportType == reportTypeExpandProperty) { } else { pm.doNodeProperties(node, preq); /* Output the (transformed) node. */ property(CaldavTags.calendarData, content); } closeTag(WebdavTags.response); flush(); }
|
private void doNode(WebdavNsNode node) throws WebdavException { PropFindMethod pm = (PropFindMethod)getNsIntf().findMethod( WebdavMethods.propFind); int status = node.getStatus(); String content = null; openTag(WebdavTags.response); if (status == HttpServletResponse.SC_OK) { if ((reportType == reportTypeQuery) || (reportType == reportTypeMultiGet)) { try { content = caldata.process(node); } catch (WebdavException wde) { status = wde.getStatusCode();; if (debug && (status != HttpServletResponse.SC_NOT_FOUND)) { error(wde); } } } } if (status != HttpServletResponse.SC_OK) { openTag(WebdavTags.propstat); property(WebdavTags.status, "HTTP/1.1 " + status + " " + WebdavStatusCode.getMessage(status)); closeTag(WebdavTags.propstat); } else if (reportType == reportTypeExpandProperty) { } else { pm.doNodeProperties(node, preq); /* Output the (transformed) node. */ property(CaldavTags.calendarData, content); } closeTag(WebdavTags.response); flush(); }
| 1,118,003
|
private void doNode(WebdavNsNode node) throws WebdavException { PropFindMethod pm = (PropFindMethod)getNsIntf().findMethod( WebdavMethods.propFind); int status = node.getStatus(); String content = null; openTag(WebdavTags.response); if (status == HttpServletResponse.SC_OK) { if ((reportType == reportTypeQuery) || (reportType == reportTypeMultiGet)) { try { content = caldata.process(node); } catch (WebdavException wde) { status = wde.getStatusCode();; if (debug && (status != HttpServletResponse.SC_NOT_FOUND)) { error(wde); } } } } if (status != HttpServletResponse.SC_OK) { openTag(WebdavTags.propstat); property(WebdavTags.status, "HTTP/1.1 " + status + " " + WebdavStatusCode.getMessage(status)); closeTag(WebdavTags.propstat); } else if (reportType == reportTypeExpandProperty) { } else { pm.doNodeProperties(node, preq); /* Output the (transformed) node. */ property(CaldavTags.calendarData, content); } closeTag(WebdavTags.response); flush(); }
|
private void doNode(WebdavNsNode node) throws WebdavException { PropFindMethod pm = (PropFindMethod)getNsIntf().findMethod( WebdavMethods.propFind); int status = node.getStatus(); String content = null; openTag(WebdavTags.response); if (status == HttpServletResponse.SC_OK) { if ((reportType == reportTypeQuery) || (reportType == reportTypeMultiGet)) { try { content = caldata.process(node); } catch (WebdavException wde) { status = wde.getStatusCode();; if (debug && (status != HttpServletResponse.SC_NOT_FOUND)) { error(wde); } } } } if (status != HttpServletResponse.SC_OK) { openTag(WebdavTags.propstat); property(WebdavTags.status, "HTTP/1.1 " + status + " " + WebdavStatusCode.getMessage(status)); closeTag(WebdavTags.propstat); } else if (reportType == reportTypeExpandProperty) { } else { pm.doNodeProperties(node, preq); /* Output the (transformed) node. */ } closeTag(WebdavTags.response); flush(); }
| 1,118,004
|
private int processDoc(Document doc) throws WebdavException { try { WebdavNsIntf intf = getNsIntf(); Element root = doc.getDocumentElement(); /* Get hold of the PROPFIND method instance - we need it to process possible prop requests. */ PropFindMethod pm = (PropFindMethod)intf.findMethod( WebdavMethods.propFind); if (pm == null) { return HttpServletResponse.SC_INTERNAL_SERVER_ERROR; } if (nodeMatches(root, CaldavTags.calendarQuery)) { reportType = reportTypeQuery; } else if (nodeMatches(root, CaldavTags.calendarMultiget)) { reportType = reportTypeMultiGet; } else if (nodeMatches(root, CaldavTags.freeBusyQuery)) { reportType = reportTypeFreeBusy; freeBusy = new FreeBusyQuery(intf, debug); } else if (nodeMatches(root, WebdavTags.expandProperty)) { reportType = reportTypeExpandProperty; } else { throw new WebdavBadRequest(); } Element[] children = getChildren(root); for (int i = 0; i < children.length; i++) { Element curnode = children[i]; /** The names come through looking something like A:allprop etc. */ String nm = curnode.getLocalName(); String ns = curnode.getNamespaceURI(); if (debug) { trace("reqtype: " + nm + " ns: " + ns); } if (reportType == reportTypeFreeBusy) { freeBusy.parse(curnode); } else if (reportType == reportTypeExpandProperty) { } else { /* Two possibilities: <!ELEMENT calendar-multiget (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? DAV:href+> <!ELEMENT calendar-query (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? filter> */ /* First try for a property request */ PropFindMethod.PropRequest pr = pm.tryPropRequest(curnode); if (pr != null) { if (preq != null) { if (debug) { trace("REPORT: preq not null"); } throw new WebdavBadRequest(); } preq = pr; } else if (nodeMatches(curnode, CaldavTags.calendarData)) { if (caldata != null) { if (debug) { trace("REPORT: caldata not null"); } throw new WebdavBadRequest(); } caldata = new CalendarData(debug); caldata.parse(curnode); } else if ((reportType == reportTypeQuery) && nodeMatches(curnode, CaldavTags.filter)) { if (filter != null) { if (debug) { trace("REPORT: filter not null"); } throw new WebdavBadRequest(); } filter = new Filter(intf, debug); int st = filter.parse(curnode); if (st != HttpServletResponse.SC_OK) { return st; } } else if ((reportType == reportTypeMultiGet) && nodeMatches(curnode, WebdavTags.href)) { String href = XmlUtil.getElementContent(curnode); if ((href == null) || (href.length() == 0)) { throw new WebdavBadRequest(); } if (hrefs == null) { hrefs = new ArrayList(); } hrefs.add(href); } else { if (debug) { trace("REPORT: unexpected element"); } throw new WebdavBadRequest(); } } } // Final validation if (reportType == reportTypeMultiGet) { if (hrefs == null) { // need at least 1 throw new WebdavBadRequest(); } } else if (reportType == reportTypeQuery) { if (caldata == null) { // same as empty element? caldata = new CalendarData(debug); } if (filter == null) { // filter required throw new WebdavBadRequest(); } } if (debug) { trace("REPORT: "); if (reportType == reportTypeFreeBusy) { trace("free-busy"); freeBusy.dump(); } else if (reportType == reportTypeQuery) { // Query - optional props + optional calendar data + filter if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } filter.dump(); } else if (reportType == reportTypeMultiGet) { // Multi-get - optional props + optional calendar data + one or more hrefs if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } Iterator it = hrefs.iterator(); while (it.hasNext()) { String href = (String)it.next(); trace(" <DAV:href>" + href + "</DAV:href>"); } } else { } } return HttpServletResponse.SC_OK; } catch (WebdavException wde) { throw wde; } catch (Throwable t) { System.err.println(t.getMessage()); if (debug) { t.printStackTrace(); } throw new WebdavException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } }
|
private int processDoc(Document doc) throws WebdavException { try { WebdavNsIntf intf = getNsIntf(); Element root = doc.getDocumentElement(); /* Get hold of the PROPFIND method instance - we need it to process possible prop requests. */ PropFindMethod pm = (PropFindMethod)intf.findMethod( WebdavMethods.propFind); if (pm == null) { return HttpServletResponse.SC_INTERNAL_SERVER_ERROR; } if (nodeMatches(root, CaldavTags.calendarQuery)) { reportType = reportTypeQuery; } else if (nodeMatches(root, CaldavTags.calendarMultiget)) { reportType = reportTypeMultiGet; } else if (nodeMatches(root, CaldavTags.freeBusyQuery)) { reportType = reportTypeFreeBusy; freeBusy = new FreeBusyQuery(intf, debug); } else if (nodeMatches(root, WebdavTags.expandProperty)) { reportType = reportTypeExpandProperty; } else { throw new WebdavBadRequest(); } Element[] children = getChildren(root); for (int i = 0; i < children.length; i++) { Element curnode = children[i]; /** The names come through looking something like A:allprop etc. */ String nm = curnode.getLocalName(); String ns = curnode.getNamespaceURI(); if (debug) { trace("reqtype: " + nm + " ns: " + ns); } if (reportType == reportTypeFreeBusy) { freeBusy.parse(curnode); } else if (reportType == reportTypeExpandProperty) { } else { /* Two possibilities: <!ELEMENT calendar-multiget (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? DAV:href+> <!ELEMENT calendar-query (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? filter> */ /* First try for a property request */ PropFindMethod.PropRequest pr = pm.tryPropRequest(curnode); if (pr != null) { if (preq != null) { if (debug) { trace("REPORT: preq not null"); } throw new WebdavBadRequest(); } preq = pr; } else if (nodeMatches(curnode, CaldavTags.calendarData)) { if (caldata != null) { if (debug) { trace("REPORT: caldata not null"); } throw new WebdavBadRequest(); } caldata = new CalendarData(debug); caldata.parse(curnode); } else if ((reportType == reportTypeQuery) && nodeMatches(curnode, CaldavTags.filter)) { if (filter != null) { if (debug) { trace("REPORT: filter not null"); } throw new WebdavBadRequest(); } filter = new Filter(intf, debug); int st = filter.parse(curnode); if (st != HttpServletResponse.SC_OK) { return st; } } else if ((reportType == reportTypeMultiGet) && nodeMatches(curnode, WebdavTags.href)) { String href = XmlUtil.getElementContent(curnode); if ((href == null) || (href.length() == 0)) { throw new WebdavBadRequest(); } if (hrefs == null) { hrefs = new ArrayList(); } hrefs.add(href); } else { if (debug) { trace("REPORT: unexpected element"); } throw new WebdavBadRequest(); } } } // Final validation if (reportType == reportTypeMultiGet) { if (hrefs == null) { // need at least 1 throw new WebdavBadRequest(); } } else if (reportType == reportTypeQuery) { if (caldata == null) { // same as empty element? caldata = new CalendarData(debug); } if (filter == null) { // filter required throw new WebdavBadRequest(); } } if (debug) { trace("REPORT: "); if (reportType == reportTypeFreeBusy) { trace("free-busy"); freeBusy.dump(); } else if (reportType == reportTypeQuery) { // Query - optional props + optional calendar data + filter if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } filter.dump(); } else if (reportType == reportTypeMultiGet) { // Multi-get - optional props + optional calendar data + one or more hrefs if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } Iterator it = hrefs.iterator(); while (it.hasNext()) { String href = (String)it.next(); trace(" <DAV:href>" + href + "</DAV:href>"); } } else { } } return HttpServletResponse.SC_OK; } catch (WebdavException wde) { throw wde; } catch (Throwable t) { System.err.println(t.getMessage()); if (debug) { t.printStackTrace(); } throw new WebdavException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } }
| 1,118,005
|
private int processDoc(Document doc) throws WebdavException { try { WebdavNsIntf intf = getNsIntf(); Element root = doc.getDocumentElement(); /* Get hold of the PROPFIND method instance - we need it to process possible prop requests. */ PropFindMethod pm = (PropFindMethod)intf.findMethod( WebdavMethods.propFind); if (pm == null) { return HttpServletResponse.SC_INTERNAL_SERVER_ERROR; } if (nodeMatches(root, CaldavTags.calendarQuery)) { reportType = reportTypeQuery; } else if (nodeMatches(root, CaldavTags.calendarMultiget)) { reportType = reportTypeMultiGet; } else if (nodeMatches(root, CaldavTags.freeBusyQuery)) { reportType = reportTypeFreeBusy; freeBusy = new FreeBusyQuery(intf, debug); } else if (nodeMatches(root, WebdavTags.expandProperty)) { reportType = reportTypeExpandProperty; } else { throw new WebdavBadRequest(); } Element[] children = getChildren(root); for (int i = 0; i < children.length; i++) { Element curnode = children[i]; /** The names come through looking something like A:allprop etc. */ String nm = curnode.getLocalName(); String ns = curnode.getNamespaceURI(); if (debug) { trace("reqtype: " + nm + " ns: " + ns); } if (reportType == reportTypeFreeBusy) { freeBusy.parse(curnode); } else if (reportType == reportTypeExpandProperty) { } else { /* Two possibilities: <!ELEMENT calendar-multiget (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? DAV:href+> <!ELEMENT calendar-query (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? filter> */ /* First try for a property request */ PropFindMethod.PropRequest pr = pm.tryPropRequest(curnode); if (pr != null) { if (preq != null) { if (debug) { trace("REPORT: preq not null"); } throw new WebdavBadRequest(); } preq = pr; } else if (nodeMatches(curnode, CaldavTags.calendarData)) { if (caldata != null) { if (debug) { trace("REPORT: caldata not null"); } throw new WebdavBadRequest(); } caldata = new CalendarData(debug); caldata.parse(curnode); } else if ((reportType == reportTypeQuery) && nodeMatches(curnode, CaldavTags.filter)) { if (filter != null) { if (debug) { trace("REPORT: filter not null"); } throw new WebdavBadRequest(); } filter = new Filter(intf, debug); int st = filter.parse(curnode); if (st != HttpServletResponse.SC_OK) { return st; } } else if ((reportType == reportTypeMultiGet) && nodeMatches(curnode, WebdavTags.href)) { String href = XmlUtil.getElementContent(curnode); if ((href == null) || (href.length() == 0)) { throw new WebdavBadRequest(); } if (hrefs == null) { hrefs = new ArrayList(); } hrefs.add(href); } else { if (debug) { trace("REPORT: unexpected element"); } throw new WebdavBadRequest(); } } } // Final validation if (reportType == reportTypeMultiGet) { if (hrefs == null) { // need at least 1 throw new WebdavBadRequest(); } } else if (reportType == reportTypeQuery) { if (caldata == null) { // same as empty element? caldata = new CalendarData(debug); } if (filter == null) { // filter required throw new WebdavBadRequest(); } } if (debug) { trace("REPORT: "); if (reportType == reportTypeFreeBusy) { trace("free-busy"); freeBusy.dump(); } else if (reportType == reportTypeQuery) { // Query - optional props + optional calendar data + filter if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } filter.dump(); } else if (reportType == reportTypeMultiGet) { // Multi-get - optional props + optional calendar data + one or more hrefs if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } Iterator it = hrefs.iterator(); while (it.hasNext()) { String href = (String)it.next(); trace(" <DAV:href>" + href + "</DAV:href>"); } } else { } } return HttpServletResponse.SC_OK; } catch (WebdavException wde) { throw wde; } catch (Throwable t) { System.err.println(t.getMessage()); if (debug) { t.printStackTrace(); } throw new WebdavException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } }
|
private int processDoc(Document doc) throws WebdavException { try { WebdavNsIntf intf = getNsIntf(); Element root = doc.getDocumentElement(); /* Get hold of the PROPFIND method instance - we need it to process possible prop requests. */ PropFindMethod pm = (PropFindMethod)intf.findMethod( WebdavMethods.propFind); if (pm == null) { return HttpServletResponse.SC_INTERNAL_SERVER_ERROR; } if (nodeMatches(root, CaldavTags.calendarQuery)) { reportType = reportTypeQuery; } else if (nodeMatches(root, CaldavTags.calendarMultiget)) { reportType = reportTypeMultiGet; } else if (nodeMatches(root, CaldavTags.freeBusyQuery)) { reportType = reportTypeFreeBusy; freeBusy = new FreeBusyQuery(intf, debug); } else if (nodeMatches(root, WebdavTags.expandProperty)) { reportType = reportTypeExpandProperty; } else { throw new WebdavBadRequest(); } Element[] children = getChildren(root); for (int i = 0; i < children.length; i++) { Element curnode = children[i]; /** The names come through looking something like A:allprop etc. */ String nm = curnode.getLocalName(); String ns = curnode.getNamespaceURI(); if (debug) { trace("reqtype: " + nm + " ns: " + ns); } if (reportType == reportTypeFreeBusy) { freeBusy.parse(curnode); } else if (reportType == reportTypeExpandProperty) { } else { /* Two possibilities: <!ELEMENT calendar-multiget (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? DAV:href+> <!ELEMENT calendar-query (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? filter> */ /* First try for a property request */ PropFindMethod.PropRequest pr = pm.tryPropRequest(curnode); if (pr != null) { if (preq != null) { if (debug) { trace("REPORT: preq not null"); } throw new WebdavBadRequest(); } preq = pr; } else if (nodeMatches(curnode, CaldavTags.calendarData)) { if (caldata != null) { if (debug) { trace("REPORT: caldata not null"); } throw new WebdavBadRequest(); } caldata = new CalendarData(debug); caldata.parse(curnode); } else if ((reportType == reportTypeQuery) && nodeMatches(curnode, CaldavTags.filter)) { if (filter != null) { if (debug) { trace("REPORT: filter not null"); } throw new WebdavBadRequest(); } filter = new Filter(intf, debug); int st = filter.parse(curnode); if (st != HttpServletResponse.SC_OK) { return st; } } else if ((reportType == reportTypeMultiGet) && nodeMatches(curnode, WebdavTags.href)) { String href = XmlUtil.getElementContent(curnode); if ((href == null) || (href.length() == 0)) { throw new WebdavBadRequest(); } if (hrefs == null) { hrefs = new ArrayList(); } hrefs.add(href); } else { if (debug) { trace("REPORT: unexpected element"); } throw new WebdavBadRequest(); } } } // Final validation if (reportType == reportTypeMultiGet) { if (hrefs == null) { // need at least 1 throw new WebdavBadRequest(); } } else if (reportType == reportTypeQuery) { if (caldata == null) { // same as empty element? caldata = new CalendarData(debug); } if (filter == null) { // filter required throw new WebdavBadRequest(); } } if (debug) { trace("REPORT: "); if (reportType == reportTypeFreeBusy) { trace("free-busy"); freeBusy.dump(); } else if (reportType == reportTypeQuery) { // Query - optional props + optional calendar data + filter if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } filter.dump(); } else if (reportType == reportTypeMultiGet) { // Multi-get - optional props + optional calendar data + one or more hrefs if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } Iterator it = hrefs.iterator(); while (it.hasNext()) { String href = (String)it.next(); trace(" <DAV:href>" + href + "</DAV:href>"); } } else { } } return HttpServletResponse.SC_OK; } catch (WebdavException wde) { throw wde; } catch (Throwable t) { System.err.println(t.getMessage()); if (debug) { t.printStackTrace(); } throw new WebdavException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } }
| 1,118,006
|
private int processDoc(Document doc) throws WebdavException { try { WebdavNsIntf intf = getNsIntf(); Element root = doc.getDocumentElement(); /* Get hold of the PROPFIND method instance - we need it to process possible prop requests. */ PropFindMethod pm = (PropFindMethod)intf.findMethod( WebdavMethods.propFind); if (pm == null) { return HttpServletResponse.SC_INTERNAL_SERVER_ERROR; } if (nodeMatches(root, CaldavTags.calendarQuery)) { reportType = reportTypeQuery; } else if (nodeMatches(root, CaldavTags.calendarMultiget)) { reportType = reportTypeMultiGet; } else if (nodeMatches(root, CaldavTags.freeBusyQuery)) { reportType = reportTypeFreeBusy; freeBusy = new FreeBusyQuery(intf, debug); } else if (nodeMatches(root, WebdavTags.expandProperty)) { reportType = reportTypeExpandProperty; } else { throw new WebdavBadRequest(); } Element[] children = getChildren(root); for (int i = 0; i < children.length; i++) { Element curnode = children[i]; /** The names come through looking something like A:allprop etc. */ String nm = curnode.getLocalName(); String ns = curnode.getNamespaceURI(); if (debug) { trace("reqtype: " + nm + " ns: " + ns); } if (reportType == reportTypeFreeBusy) { freeBusy.parse(curnode); } else if (reportType == reportTypeExpandProperty) { } else { /* Two possibilities: <!ELEMENT calendar-multiget (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? DAV:href+> <!ELEMENT calendar-query (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? filter> */ /* First try for a property request */ PropFindMethod.PropRequest pr = pm.tryPropRequest(curnode); if (pr != null) { if (preq != null) { if (debug) { trace("REPORT: preq not null"); } throw new WebdavBadRequest(); } preq = pr; } else if (nodeMatches(curnode, CaldavTags.calendarData)) { if (caldata != null) { if (debug) { trace("REPORT: caldata not null"); } throw new WebdavBadRequest(); } caldata = new CalendarData(debug); caldata.parse(curnode); } else if ((reportType == reportTypeQuery) && nodeMatches(curnode, CaldavTags.filter)) { if (filter != null) { if (debug) { trace("REPORT: filter not null"); } throw new WebdavBadRequest(); } filter = new Filter(intf, debug); int st = filter.parse(curnode); if (st != HttpServletResponse.SC_OK) { return st; } } else if ((reportType == reportTypeMultiGet) && nodeMatches(curnode, WebdavTags.href)) { String href = XmlUtil.getElementContent(curnode); if ((href == null) || (href.length() == 0)) { throw new WebdavBadRequest(); } if (hrefs == null) { hrefs = new ArrayList(); } hrefs.add(href); } else { if (debug) { trace("REPORT: unexpected element"); } throw new WebdavBadRequest(); } } } // Final validation if (reportType == reportTypeMultiGet) { if (hrefs == null) { // need at least 1 throw new WebdavBadRequest(); } } else if (reportType == reportTypeQuery) { if (caldata == null) { // same as empty element? caldata = new CalendarData(debug); } if (filter == null) { // filter required throw new WebdavBadRequest(); } } if (debug) { trace("REPORT: "); if (reportType == reportTypeFreeBusy) { trace("free-busy"); freeBusy.dump(); } else if (reportType == reportTypeQuery) { // Query - optional props + optional calendar data + filter if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } filter.dump(); } else if (reportType == reportTypeMultiGet) { // Multi-get - optional props + optional calendar data + one or more hrefs if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } Iterator it = hrefs.iterator(); while (it.hasNext()) { String href = (String)it.next(); trace(" <DAV:href>" + href + "</DAV:href>"); } } else { } } return HttpServletResponse.SC_OK; } catch (WebdavException wde) { throw wde; } catch (Throwable t) { System.err.println(t.getMessage()); if (debug) { t.printStackTrace(); } throw new WebdavException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } }
|
private int processDoc(Document doc) throws WebdavException { try { WebdavNsIntf intf = getNsIntf(); Element root = doc.getDocumentElement(); /* Get hold of the PROPFIND method instance - we need it to process possible prop requests. */ PropFindMethod pm = (PropFindMethod)intf.findMethod( WebdavMethods.propFind); if (pm == null) { return HttpServletResponse.SC_INTERNAL_SERVER_ERROR; } if (nodeMatches(root, CaldavTags.calendarQuery)) { reportType = reportTypeQuery; } else if (nodeMatches(root, CaldavTags.calendarMultiget)) { reportType = reportTypeMultiGet; } else if (nodeMatches(root, CaldavTags.freeBusyQuery)) { reportType = reportTypeFreeBusy; freeBusy = new FreeBusyQuery(intf, debug); } else if (nodeMatches(root, WebdavTags.expandProperty)) { reportType = reportTypeExpandProperty; } else { throw new WebdavBadRequest(); } Element[] children = getChildren(root); for (int i = 0; i < children.length; i++) { Element curnode = children[i]; /** The names come through looking something like A:allprop etc. */ String nm = curnode.getLocalName(); String ns = curnode.getNamespaceURI(); if (debug) { trace("reqtype: " + nm + " ns: " + ns); } if (reportType == reportTypeFreeBusy) { freeBusy.parse(curnode); } else if (reportType == reportTypeExpandProperty) { } else { /* Two possibilities: <!ELEMENT calendar-multiget (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? DAV:href+> <!ELEMENT calendar-query (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? filter> */ /* First try for a property request */ PropFindMethod.PropRequest pr = pm.tryPropRequest(curnode); if (pr != null) { if (preq != null) { if (debug) { trace("REPORT: preq not null"); } throw new WebdavBadRequest(); } preq = pr; } else if (nodeMatches(curnode, CaldavTags.calendarData)) { if (caldata != null) { if (debug) { trace("REPORT: caldata not null"); } throw new WebdavBadRequest(); } caldata = new CalendarData(debug); caldata.parse(curnode); } else if ((reportType == reportTypeQuery) && nodeMatches(curnode, CaldavTags.filter)) { if (filter != null) { if (debug) { trace("REPORT: filter not null"); } throw new WebdavBadRequest(); } filter = new Filter(intf, debug); int st = filter.parse(curnode); if (st != HttpServletResponse.SC_OK) { return st; } } else if ((reportType == reportTypeMultiGet) && nodeMatches(curnode, WebdavTags.href)) { String href = XmlUtil.getElementContent(curnode); if ((href == null) || (href.length() == 0)) { throw new WebdavBadRequest(); } if (hrefs == null) { hrefs = new ArrayList(); } hrefs.add(href); } else { if (debug) { trace("REPORT: unexpected element"); } throw new WebdavBadRequest(); } } } // Final validation if (reportType == reportTypeMultiGet) { if (hrefs == null) { // need at least 1 throw new WebdavBadRequest(); } } else if (reportType == reportTypeQuery) { if (caldata == null) { // same as empty element? caldata = new CalendarData(debug); } if (filter == null) { // filter required throw new WebdavBadRequest(); } } if (debug) { trace("REPORT: "); if (reportType == reportTypeFreeBusy) { trace("free-busy"); freeBusy.dump(); } else if (reportType == reportTypeQuery) { // Query - optional props + optional calendar data + filter if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } filter.dump(); } else if (reportType == reportTypeMultiGet) { // Multi-get - optional props + optional calendar data + one or more hrefs if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } Iterator it = hrefs.iterator(); while (it.hasNext()) { String href = (String)it.next(); trace(" <DAV:href>" + href + "</DAV:href>"); } } else { } } return HttpServletResponse.SC_OK; } catch (WebdavException wde) { throw wde; } catch (Throwable t) { System.err.println(t.getMessage()); if (debug) { t.printStackTrace(); } throw new WebdavException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } }
| 1,118,007
|
private int processDoc(Document doc) throws WebdavException { try { WebdavNsIntf intf = getNsIntf(); Element root = doc.getDocumentElement(); /* Get hold of the PROPFIND method instance - we need it to process possible prop requests. */ PropFindMethod pm = (PropFindMethod)intf.findMethod( WebdavMethods.propFind); if (pm == null) { return HttpServletResponse.SC_INTERNAL_SERVER_ERROR; } if (nodeMatches(root, CaldavTags.calendarQuery)) { reportType = reportTypeQuery; } else if (nodeMatches(root, CaldavTags.calendarMultiget)) { reportType = reportTypeMultiGet; } else if (nodeMatches(root, CaldavTags.freeBusyQuery)) { reportType = reportTypeFreeBusy; freeBusy = new FreeBusyQuery(intf, debug); } else if (nodeMatches(root, WebdavTags.expandProperty)) { reportType = reportTypeExpandProperty; } else { throw new WebdavBadRequest(); } Element[] children = getChildren(root); for (int i = 0; i < children.length; i++) { Element curnode = children[i]; /** The names come through looking something like A:allprop etc. */ String nm = curnode.getLocalName(); String ns = curnode.getNamespaceURI(); if (debug) { trace("reqtype: " + nm + " ns: " + ns); } if (reportType == reportTypeFreeBusy) { freeBusy.parse(curnode); } else if (reportType == reportTypeExpandProperty) { } else { /* Two possibilities: <!ELEMENT calendar-multiget (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? DAV:href+> <!ELEMENT calendar-query (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? filter> */ /* First try for a property request */ PropFindMethod.PropRequest pr = pm.tryPropRequest(curnode); if (pr != null) { if (preq != null) { if (debug) { trace("REPORT: preq not null"); } throw new WebdavBadRequest(); } preq = pr; } else if (nodeMatches(curnode, CaldavTags.calendarData)) { if (caldata != null) { if (debug) { trace("REPORT: caldata not null"); } throw new WebdavBadRequest(); } caldata = new CalendarData(debug); caldata.parse(curnode); } else if ((reportType == reportTypeQuery) && nodeMatches(curnode, CaldavTags.filter)) { if (filter != null) { if (debug) { trace("REPORT: filter not null"); } throw new WebdavBadRequest(); } filter = new Filter(intf, debug); int st = filter.parse(curnode); if (st != HttpServletResponse.SC_OK) { return st; } } else if ((reportType == reportTypeMultiGet) && nodeMatches(curnode, WebdavTags.href)) { String href = XmlUtil.getElementContent(curnode); if ((href == null) || (href.length() == 0)) { throw new WebdavBadRequest(); } if (hrefs == null) { hrefs = new ArrayList(); } hrefs.add(href); } else { if (debug) { trace("REPORT: unexpected element"); } throw new WebdavBadRequest(); } } } // Final validation if (reportType == reportTypeMultiGet) { if (hrefs == null) { // need at least 1 throw new WebdavBadRequest(); } } else if (reportType == reportTypeQuery) { if (caldata == null) { // same as empty element? caldata = new CalendarData(debug); } if (filter == null) { // filter required throw new WebdavBadRequest(); } } if (debug) { trace("REPORT: "); if (reportType == reportTypeFreeBusy) { trace("free-busy"); freeBusy.dump(); } else if (reportType == reportTypeQuery) { // Query - optional props + optional calendar data + filter if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } filter.dump(); } else if (reportType == reportTypeMultiGet) { // Multi-get - optional props + optional calendar data + one or more hrefs if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } Iterator it = hrefs.iterator(); while (it.hasNext()) { String href = (String)it.next(); trace(" <DAV:href>" + href + "</DAV:href>"); } } else { } } return HttpServletResponse.SC_OK; } catch (WebdavException wde) { throw wde; } catch (Throwable t) { System.err.println(t.getMessage()); if (debug) { t.printStackTrace(); } throw new WebdavException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } }
|
private int processDoc(Document doc) throws WebdavException { try { WebdavNsIntf intf = getNsIntf(); Element root = doc.getDocumentElement(); /* Get hold of the PROPFIND method instance - we need it to process possible prop requests. */ PropFindMethod pm = (PropFindMethod)intf.findMethod( WebdavMethods.propFind); if (pm == null) { return HttpServletResponse.SC_INTERNAL_SERVER_ERROR; } if (nodeMatches(root, CaldavTags.calendarQuery)) { reportType = reportTypeQuery; } else if (nodeMatches(root, CaldavTags.calendarMultiget)) { reportType = reportTypeMultiGet; } else if (nodeMatches(root, CaldavTags.freeBusyQuery)) { reportType = reportTypeFreeBusy; freeBusy = new FreeBusyQuery(intf, debug); } else if (nodeMatches(root, WebdavTags.expandProperty)) { reportType = reportTypeExpandProperty; } else { throw new WebdavBadRequest(); } Element[] children = getChildren(root); for (int i = 0; i < children.length; i++) { Element curnode = children[i]; /** The names come through looking something like A:allprop etc. */ String nm = curnode.getLocalName(); String ns = curnode.getNamespaceURI(); if (debug) { trace("reqtype: " + nm + " ns: " + ns); } if (reportType == reportTypeFreeBusy) { freeBusy.parse(curnode); } else if (reportType == reportTypeExpandProperty) { } else { /* Two possibilities: <!ELEMENT calendar-multiget (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? DAV:href+> <!ELEMENT calendar-query (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? filter> */ /* First try for a property request */ PropFindMethod.PropRequest pr = pm.tryPropRequest(curnode); if (pr != null) { if (preq != null) { if (debug) { trace("REPORT: preq not null"); } throw new WebdavBadRequest(); } preq = pr; } else if (nodeMatches(curnode, CaldavTags.calendarData)) { if (caldata != null) { if (debug) { trace("REPORT: caldata not null"); } throw new WebdavBadRequest(); } caldata = new CalendarData(debug); caldata.parse(curnode); } else if ((reportType == reportTypeQuery) && nodeMatches(curnode, CaldavTags.filter)) { if (filter != null) { if (debug) { trace("REPORT: filter not null"); } throw new WebdavBadRequest(); } filter = new Filter(intf, debug); int st = filter.parse(curnode); if (st != HttpServletResponse.SC_OK) { return st; } } else if ((reportType == reportTypeMultiGet) && nodeMatches(curnode, WebdavTags.href)) { String href = XmlUtil.getElementContent(curnode); if ((href == null) || (href.length() == 0)) { throw new WebdavBadRequest(); } if (hrefs == null) { hrefs = new ArrayList(); } hrefs.add(href); } else { if (debug) { trace("REPORT: unexpected element"); } throw new WebdavBadRequest(); } } } // Final validation if (reportType == reportTypeMultiGet) { if (hrefs == null) { // need at least 1 throw new WebdavBadRequest(); } } else if (reportType == reportTypeQuery) { if (caldata == null) { // same as empty element? caldata = new CalendarData(debug); } if (filter == null) { // filter required throw new WebdavBadRequest(); } } if (debug) { trace("REPORT: "); if (reportType == reportTypeFreeBusy) { trace("free-busy"); freeBusy.dump(); } else if (reportType == reportTypeQuery) { // Query - optional props + optional calendar data + filter if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } filter.dump(); } else if (reportType == reportTypeMultiGet) { // Multi-get - optional props + optional calendar data + one or more hrefs if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } Iterator it = hrefs.iterator(); while (it.hasNext()) { String href = (String)it.next(); trace(" <DAV:href>" + href + "</DAV:href>"); } } else { } } return HttpServletResponse.SC_OK; } catch (WebdavException wde) { throw wde; } catch (Throwable t) { System.err.println(t.getMessage()); if (debug) { t.printStackTrace(); } throw new WebdavException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } }
| 1,118,008
|
private int processDoc(Document doc) throws WebdavException { try { WebdavNsIntf intf = getNsIntf(); Element root = doc.getDocumentElement(); /* Get hold of the PROPFIND method instance - we need it to process possible prop requests. */ PropFindMethod pm = (PropFindMethod)intf.findMethod( WebdavMethods.propFind); if (pm == null) { return HttpServletResponse.SC_INTERNAL_SERVER_ERROR; } if (nodeMatches(root, CaldavTags.calendarQuery)) { reportType = reportTypeQuery; } else if (nodeMatches(root, CaldavTags.calendarMultiget)) { reportType = reportTypeMultiGet; } else if (nodeMatches(root, CaldavTags.freeBusyQuery)) { reportType = reportTypeFreeBusy; freeBusy = new FreeBusyQuery(intf, debug); } else if (nodeMatches(root, WebdavTags.expandProperty)) { reportType = reportTypeExpandProperty; } else { throw new WebdavBadRequest(); } Element[] children = getChildren(root); for (int i = 0; i < children.length; i++) { Element curnode = children[i]; /** The names come through looking something like A:allprop etc. */ String nm = curnode.getLocalName(); String ns = curnode.getNamespaceURI(); if (debug) { trace("reqtype: " + nm + " ns: " + ns); } if (reportType == reportTypeFreeBusy) { freeBusy.parse(curnode); } else if (reportType == reportTypeExpandProperty) { } else { /* Two possibilities: <!ELEMENT calendar-multiget (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? DAV:href+> <!ELEMENT calendar-query (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? filter> */ /* First try for a property request */ PropFindMethod.PropRequest pr = pm.tryPropRequest(curnode); if (pr != null) { if (preq != null) { if (debug) { trace("REPORT: preq not null"); } throw new WebdavBadRequest(); } preq = pr; } else if (nodeMatches(curnode, CaldavTags.calendarData)) { if (caldata != null) { if (debug) { trace("REPORT: caldata not null"); } throw new WebdavBadRequest(); } caldata = new CalendarData(debug); caldata.parse(curnode); } else if ((reportType == reportTypeQuery) && nodeMatches(curnode, CaldavTags.filter)) { if (filter != null) { if (debug) { trace("REPORT: filter not null"); } throw new WebdavBadRequest(); } filter = new Filter(intf, debug); int st = filter.parse(curnode); if (st != HttpServletResponse.SC_OK) { return st; } } else if ((reportType == reportTypeMultiGet) && nodeMatches(curnode, WebdavTags.href)) { String href = XmlUtil.getElementContent(curnode); if ((href == null) || (href.length() == 0)) { throw new WebdavBadRequest(); } if (hrefs == null) { hrefs = new ArrayList(); } hrefs.add(href); } else { if (debug) { trace("REPORT: unexpected element"); } throw new WebdavBadRequest(); } } } // Final validation if (reportType == reportTypeMultiGet) { if (hrefs == null) { // need at least 1 throw new WebdavBadRequest(); } } else if (reportType == reportTypeQuery) { if (caldata == null) { // same as empty element? caldata = new CalendarData(debug); } if (filter == null) { // filter required throw new WebdavBadRequest(); } } if (debug) { trace("REPORT: "); if (reportType == reportTypeFreeBusy) { trace("free-busy"); freeBusy.dump(); } else if (reportType == reportTypeQuery) { // Query - optional props + optional calendar data + filter if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } filter.dump(); } else if (reportType == reportTypeMultiGet) { // Multi-get - optional props + optional calendar data + one or more hrefs if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } Iterator it = hrefs.iterator(); while (it.hasNext()) { String href = (String)it.next(); trace(" <DAV:href>" + href + "</DAV:href>"); } } else { } } return HttpServletResponse.SC_OK; } catch (WebdavException wde) { throw wde; } catch (Throwable t) { System.err.println(t.getMessage()); if (debug) { t.printStackTrace(); } throw new WebdavException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } }
|
private int processDoc(Document doc) throws WebdavException { try { WebdavNsIntf intf = getNsIntf(); Element root = doc.getDocumentElement(); /* Get hold of the PROPFIND method instance - we need it to process possible prop requests. */ PropFindMethod pm = (PropFindMethod)intf.findMethod( WebdavMethods.propFind); if (pm == null) { return HttpServletResponse.SC_INTERNAL_SERVER_ERROR; } if (nodeMatches(root, CaldavTags.calendarQuery)) { reportType = reportTypeQuery; } else if (nodeMatches(root, CaldavTags.calendarMultiget)) { reportType = reportTypeMultiGet; } else if (nodeMatches(root, CaldavTags.freeBusyQuery)) { reportType = reportTypeFreeBusy; freeBusy = new FreeBusyQuery(intf, debug); } else if (nodeMatches(root, WebdavTags.expandProperty)) { reportType = reportTypeExpandProperty; } else { throw new WebdavBadRequest(); } Element[] children = getChildren(root); for (int i = 0; i < children.length; i++) { Element curnode = children[i]; /** The names come through looking something like A:allprop etc. */ String nm = curnode.getLocalName(); String ns = curnode.getNamespaceURI(); if (debug) { trace("reqtype: " + nm + " ns: " + ns); } if (reportType == reportTypeFreeBusy) { freeBusy.parse(curnode); } else if (reportType == reportTypeExpandProperty) { } else { /* Two possibilities: <!ELEMENT calendar-multiget (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? DAV:href+> <!ELEMENT calendar-query (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? filter> */ /* First try for a property request */ PropFindMethod.PropRequest pr = pm.tryPropRequest(curnode); if (pr != null) { if (preq != null) { if (debug) { trace("REPORT: preq not null"); } throw new WebdavBadRequest(); } preq = pr; } else if (nodeMatches(curnode, CaldavTags.calendarData)) { if (caldata != null) { if (debug) { trace("REPORT: caldata not null"); } throw new WebdavBadRequest(); } caldata = new CalendarData(debug); caldata.parse(curnode); } else if ((reportType == reportTypeQuery) && nodeMatches(curnode, CaldavTags.filter)) { if (filter != null) { if (debug) { trace("REPORT: filter not null"); } throw new WebdavBadRequest(); } filter = new Filter(intf, debug); int st = filter.parse(curnode); if (st != HttpServletResponse.SC_OK) { return st; } } else if ((reportType == reportTypeMultiGet) && nodeMatches(curnode, WebdavTags.href)) { String href = XmlUtil.getElementContent(curnode); if ((href == null) || (href.length() == 0)) { throw new WebdavBadRequest(); } if (hrefs == null) { hrefs = new ArrayList(); } hrefs.add(href); } else { if (debug) { trace("REPORT: unexpected element"); } throw new WebdavBadRequest(); } } } // Final validation if (reportType == reportTypeMultiGet) { if (hrefs == null) { // need at least 1 throw new WebdavBadRequest(); } } else if (reportType == reportTypeQuery) { if (caldata == null) { // same as empty element? caldata = new CalendarData(debug); } if (filter == null) { // filter required throw new WebdavBadRequest(); } } if (debug) { trace("REPORT: "); if (reportType == reportTypeFreeBusy) { trace("free-busy"); freeBusy.dump(); } else if (reportType == reportTypeQuery) { // Query - optional props + optional calendar data + filter if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } filter.dump(); } else if (reportType == reportTypeMultiGet) { // Multi-get - optional props + optional calendar data + one or more hrefs if (caldata != null) { caldata.dump(); } else { trace("No caldata"); } Iterator it = hrefs.iterator(); while (it.hasNext()) { String href = (String)it.next(); trace(" <DAV:href>" + href + "</DAV:href>"); } } else { } } return HttpServletResponse.SC_OK; } catch (WebdavException wde) { throw wde; } catch (Throwable t) { System.err.println(t.getMessage()); if (debug) { t.printStackTrace(); } throw new WebdavException(HttpServletResponse.SC_INTERNAL_SERVER_ERROR); } }
| 1,118,009
|
public void processResp(HttpServletRequest req, HttpServletResponse resp, int depth) throws WebdavException { resp.setStatus(WebdavStatusCode.SC_MULTI_STATUS); resp.setContentType("text/xml; charset=UTF-8"); String resourceUri = getResourceUri(req); CaldavBWIntf intf = (CaldavBWIntf)getNsIntf(); WebdavNsNode node = intf.getNode(resourceUri); openTag(WebdavTags.multistatus); int status = HttpServletResponse.SC_OK; Collection nodes = null; if (reportType == reportTypeQuery) { try { int retrieveRecur; if (caldata.getErs() != null) { /* expand XXX use range */ retrieveRecur = CalFacadeDefs.retrieveRecurExpanded; } else if (caldata.getLrs() != null) { /* expand XXX use range */ retrieveRecur = CalFacadeDefs.retrieveRecurOverrides; } else { retrieveRecur = CalFacadeDefs.retrieveRecurMaster; } nodes = intf.query(node, retrieveRecur, filter); } catch (WebdavException wde) { status = wde.getStatusCode(); } } else if (reportType == reportTypeMultiGet) { nodes = new ArrayList(); if (hrefs != null) { Iterator it = hrefs.iterator(); while (it.hasNext()) { String href = intf.getUri((String)it.next()); try { nodes.add(intf.getNode(href)); } catch (WebdavException we) { nodes.add(new CaldavCalNode(we.getStatusCode(), debug)); } } } } else if (reportType == reportTypeExpandProperty) { } if (status != HttpServletResponse.SC_OK) { if (debug) { trace("REPORT status " + status); } // Entire request failed. node.setStatus(status); doNode(node); } else if (nodes != null) { Iterator it = nodes.iterator(); while (it.hasNext()) { WebdavNsNode curnode = (WebdavNsNode)it.next(); doNode(curnode); } } closeTag(WebdavTags.multistatus); flush(); }
|
public void processResp(HttpServletRequest req, HttpServletResponse resp, int depth) throws WebdavException { resp.setStatus(WebdavStatusCode.SC_MULTI_STATUS); resp.setContentType("text/xml; charset=UTF-8"); String resourceUri = getResourceUri(req); CaldavBWIntf intf = (CaldavBWIntf)getNsIntf(); WebdavNsNode node = intf.getNode(resourceUri); openTag(WebdavTags.multistatus); int status = HttpServletResponse.SC_OK; Collection nodes = null; if (reportType == reportTypeQuery) { try { int retrieveRecur; if (caldata == null) { retrieveRecur = CalFacadeDefs.retrieveRecurMaster; } else if (caldata.getErs() != null) { /* expand XXX use range */ retrieveRecur = CalFacadeDefs.retrieveRecurExpanded; } else if (caldata.getLrs() != null) { /* expand XXX use range */ retrieveRecur = CalFacadeDefs.retrieveRecurOverrides; } else { retrieveRecur = CalFacadeDefs.retrieveRecurMaster; } nodes = intf.query(node, retrieveRecur, filter); } catch (WebdavException wde) { status = wde.getStatusCode(); } } else if (reportType == reportTypeMultiGet) { nodes = new ArrayList(); if (hrefs != null) { Iterator it = hrefs.iterator(); while (it.hasNext()) { String href = intf.getUri((String)it.next()); try { nodes.add(intf.getNode(href)); } catch (WebdavException we) { nodes.add(new CaldavCalNode(we.getStatusCode(), debug)); } } } } else if (reportType == reportTypeExpandProperty) { } if (status != HttpServletResponse.SC_OK) { if (debug) { trace("REPORT status " + status); } // Entire request failed. node.setStatus(status); doNode(node); } else if (nodes != null) { Iterator it = nodes.iterator(); while (it.hasNext()) { WebdavNsNode curnode = (WebdavNsNode)it.next(); doNode(curnode); } } closeTag(WebdavTags.multistatus); flush(); }
| 1,118,010
|
public static Object getParameter(Element base) { String name = XMLUtil.evalString(base, "name"); NodeList typeNode = XMLUtil.evalNodeList(base, "type"); Element type = null; if(typeNode != null && typeNode.getLength() != 0) { type = (Element) typeNode.item(0); } String className = XMLUtil.evalString(type, "name"); //Class objectClass = Class.forName(className); if(className.equals("edu.sc.seis.fissuresUtil.cache.CacheEvent") ) { /* Class[] constructorArgTypes = new Class[3]; NodeList eventNode = XMLUtil.evalNodeList(base, "value/event"); Element event = (Element)eventNode.item(0); constuctorArgTypes[0] = XMLEvent.getEvent(event).class; constructorArgTypes[1] = new Origin[0].class; constructorArgTypes[2] = XMLEvent.getPreferredOrigin(event).class; Constructor constructor = objectClass.getConstructor(constructorArgTypes); Object[] constructorArgs = new Object[3]; constructorArgs[0] = XMLEvent.getEvent(event); constructorArgs[1] = new Origin[0]; constructorArgs[2] = XMLEvent.getPreferredOrigin(event); Object obj = Constructor.newInstance(constructorArgs); return obj;*/ NodeList eventNode = XMLUtil.evalNodeList(base, "value/event"); Element event = null; if(eventNode != null && eventNode.getLength() != 0) { event = (Element)eventNode.item(0); } EventAttr eventAttr = XMLEvent.getEvent(event); Origin preferred_origin = XMLEvent.getPreferredOrigin(event); return new CacheEvent(eventAttr, new Origin[0], preferred_origin); } else if(className.equals("edu.iris.fissures.network.ChannelImpl")) { NodeList channelNode = XMLUtil.evalNodeList(base, "value/channel"); if(channelNode != null && channelNode.getLength() != 0) { Channel channel = XMLChannel.getChannel((Element)channelNode.item(0)); return channel; } return null; } else { String value = XMLUtil.evalString(base, "value"); return value; } }
|
public static Object getParameter(Element base) { String name = XMLUtil.evalString(base, "name"); NodeList typeNode = XMLUtil.evalNodeList(base, "type"); Element type = null; if(typeNode != null && typeNode.getLength() != 0) { type = (Element) typeNode.item(0); } String className = XMLUtil.evalString(type, "name"); //Class objectClass = Class.forName(className); if(className.equals("edu.sc.seis.fissuresUtil.cache.CacheEvent") ) { /* Class[] constructorArgTypes = new Class[3]; NodeList eventNode = XMLUtil.evalNodeList(base, "value/event"); Element event = (Element)eventNode.item(0); constuctorArgTypes[0] = XMLEvent.getEvent(event).class; constructorArgTypes[1] = new Origin[0].class; constructorArgTypes[2] = XMLEvent.getPreferredOrigin(event).class; Constructor constructor = objectClass.getConstructor(constructorArgTypes); Object[] constructorArgs = new Object[3]; constructorArgs[0] = XMLEvent.getEvent(event); constructorArgs[1] = new Origin[0]; constructorArgs[2] = XMLEvent.getPreferredOrigin(event); Object obj = Constructor.newInstance(constructorArgs); return obj;*/ NodeList eventNode = XMLUtil.evalNodeList(base, "value/event"); Element event = null; if(eventNode != null && eventNode.getLength() != 0) { event = (Element)eventNode.item(0); } EventAttr eventAttr = XMLEvent.getEvent(event); Origin preferred_origin = XMLEvent.getPreferredOrigin(event); return new CacheEvent(eventAttr, new Origin[0], preferred_origin); } else if(className.equalsIgnoreCase("edu.iris.fissures.network.ChannelImpl")) { NodeList channelNode = XMLUtil.evalNodeList(base, "value/channel"); if(channelNode != null && channelNode.getLength() != 0) { Channel channel = XMLChannel.getChannel((Element)channelNode.item(0)); return channel; } return null; } else { String value = XMLUtil.evalString(base, "value"); return value; } }
| 1,118,011
|
public static Object getParameter(Element base) { String name = XMLUtil.evalString(base, "name"); NodeList typeNode = XMLUtil.evalNodeList(base, "type"); Element type = null; if(typeNode != null && typeNode.getLength() != 0) { type = (Element) typeNode.item(0); } String className = XMLUtil.evalString(type, "name"); //Class objectClass = Class.forName(className); if(className.equals("edu.sc.seis.fissuresUtil.cache.CacheEvent") ) { /* Class[] constructorArgTypes = new Class[3]; NodeList eventNode = XMLUtil.evalNodeList(base, "value/event"); Element event = (Element)eventNode.item(0); constuctorArgTypes[0] = XMLEvent.getEvent(event).class; constructorArgTypes[1] = new Origin[0].class; constructorArgTypes[2] = XMLEvent.getPreferredOrigin(event).class; Constructor constructor = objectClass.getConstructor(constructorArgTypes); Object[] constructorArgs = new Object[3]; constructorArgs[0] = XMLEvent.getEvent(event); constructorArgs[1] = new Origin[0]; constructorArgs[2] = XMLEvent.getPreferredOrigin(event); Object obj = Constructor.newInstance(constructorArgs); return obj;*/ NodeList eventNode = XMLUtil.evalNodeList(base, "value/event"); Element event = null; if(eventNode != null && eventNode.getLength() != 0) { event = (Element)eventNode.item(0); } EventAttr eventAttr = XMLEvent.getEvent(event); Origin preferred_origin = XMLEvent.getPreferredOrigin(event); return new CacheEvent(eventAttr, new Origin[0], preferred_origin); } else if(className.equals("edu.iris.fissures.network.ChannelImpl")) { NodeList channelNode = XMLUtil.evalNodeList(base, "value/channel"); if(channelNode != null && channelNode.getLength() != 0) { Channel channel = XMLChannel.getChannel((Element)channelNode.item(0)); return channel; } return null; } else { String value = XMLUtil.evalString(base, "value"); return value; } }
|
public static Object getParameter(Element base) { String name = XMLUtil.evalString(base, "name"); NodeList typeNode = XMLUtil.evalNodeList(base, "type"); Element type = null; if(typeNode != null && typeNode.getLength() != 0) { type = (Element) typeNode.item(0); } String className = XMLUtil.evalString(type, "name"); //Class objectClass = Class.forName(className); if(className.equals("edu.sc.seis.fissuresUtil.cache.CacheEvent") ) { /* Class[] constructorArgTypes = new Class[3]; NodeList eventNode = XMLUtil.evalNodeList(base, "value/event"); Element event = (Element)eventNode.item(0); constuctorArgTypes[0] = XMLEvent.getEvent(event).class; constructorArgTypes[1] = new Origin[0].class; constructorArgTypes[2] = XMLEvent.getPreferredOrigin(event).class; Constructor constructor = objectClass.getConstructor(constructorArgTypes); Object[] constructorArgs = new Object[3]; constructorArgs[0] = XMLEvent.getEvent(event); constructorArgs[1] = new Origin[0]; constructorArgs[2] = XMLEvent.getPreferredOrigin(event); Object obj = Constructor.newInstance(constructorArgs); return obj;*/ NodeList eventNode = XMLUtil.evalNodeList(base, "value/event"); Element event = null; if(eventNode != null && eventNode.getLength() != 0) { event = (Element)eventNode.item(0); } EventAttr eventAttr = XMLEvent.getEvent(event); Origin preferred_origin = XMLEvent.getPreferredOrigin(event); return new CacheEvent(eventAttr, new Origin[0], preferred_origin); } else if(className.equals("edu.iris.fissures.network.ChannelImpl")) { NodeList channelNode = XMLUtil.evalNodeList(base, "value/channel"); if(channelNode != null && channelNode.getLength() != 0) { Channel channel = XMLChannel.getChannel((Element)channelNode.item(0)); return channel; } return null; } else { String value = XMLUtil.evalString(base, "value"); return new ParameterRef(name, value); } }
| 1,118,012
|
available_data(RequestFilter[] a_filterseq) { return dataCenter.available_data(a_filterseq); }
|
public RequestFilter[] available_data(RequestFilter[] a_filterseq) { return dataCenter.available_data(a_filterseq); }
| 1,118,013
|
cancel_request(String a_request) throws edu.iris.Fissures.FissuresException { }
|
cancel_request(String a_request) throws edu.iris.Fissures.FissuresException { }
| 1,118,014
|
queue_seismograms(RequestFilter[] a_filterseq) throws edu.iris.Fissures.FissuresException { return getNextRequestId(); }
|
queue_seismograms(RequestFilter[] a_filterseq) throws edu.iris.Fissures.FissuresException { return getNextRequestId(); }
| 1,118,015
|
request_seismograms(RequestFilter[] a_filterseq, DataCenterCallBack a_client, boolean long_lived, edu.iris.Fissures.Time expiration_time) throws edu.iris.Fissures.FissuresException { return getNextRequestId(); }
|
request_seismograms(RequestFilter[] a_filterseq, DataCenterCallBack a_client, boolean long_lived, edu.iris.Fissures.Time expiration_time) throws edu.iris.Fissures.FissuresException { return getNextRequestId(); }
| 1,118,016
|
request_status(String a_request) throws edu.iris.Fissures.FissuresException { return new String(); }
|
request_status(String a_request) throws edu.iris.Fissures.FissuresException { return new String(); }
| 1,118,017
|
retrieve_queue(String a_request) throws edu.iris.Fissures.FissuresException { return new LocalSeismogram[0]; }
|
retrieve_queue(String a_request) throws edu.iris.Fissures.FissuresException { return new LocalSeismogram[0]; }
| 1,118,018
|
public HSQLRequestFilterDb (String directoryName, String databaseName, DataCenterOperations router) throws SQLException { super(directoryName, databaseName); this.dataCenterRouter = router; create(); }
|
public HSQLRequestFilterDb (String directoryName, String databaseName, DataCenterOperations router) throws SQLException { super(directoryName, databaseName); this.dataCenterRouter = router; create(); }
| 1,118,019
|
public static void main (String[] args) { if (args.length < 4) { System.err.println("Usage: java edu.sc.seis.fissuresUtil.sac.SacDirToDataSet -base url -dir directoryPath -name datasetname [-exclude file] [-paramRef name file]"); return; } // end of if (args.length != 2) String dirName = null; URL base = null; String baseStr = ""; String dsName = "default dataset name"; LinkedList excludes = new LinkedList(); HashMap params = new HashMap(); int i=0; while (i<args.length) { System.out.println(i+" "+args[i]); if (args[i].equals("-dir")) { dirName = args[i+1]; i+=2; } else if (args[i].equals("-name")) { dsName = args[i+1]; i+=2; } else if (args[i].equals("-base")) { baseStr = args[i+1]; System.out.println("The baseStr is "+baseStr); i+=2; } else if (args[i].equals("-exclude")) { excludes.add(args[i+1]); i+=2; } else if (args[i].equals("-paramRef")) { params.put(args[i+1], args[i+2]); i+=3; } else { System.out.println("Don't understand "+args[i++]); } } // end of for (int i=0; i<args.length; i++) try { base = new URL(baseStr); System.out.println("base is "+base.toString()); File f = new File(dirName); if (dirName != null && f.isDirectory()) { SacDirToDataSet sdir = new SacDirToDataSet(base, f, dsName, excludes, params); sdir.process(); sdir.save(); } else { System.err.println("Not a directory: "+args[0]); } // end of else } catch (Exception e) { e.printStackTrace(); } // end of try-catch } // end of main ()
|
public static void main (String[] args) { if (args.length < 4) { System.err.println("Usage: java edu.sc.seis.fissuresUtil.sac.SacDirToDataSet -base url -dir directoryPath -name datasetname [-exclude file] [-paramRef name file]"); return; } // end of if (args.length != 2) String dirName = null; URL base = null; String baseStr = ""; String dsName = "default dataset name"; LinkedList excludes = new LinkedList(); HashMap params = new HashMap(); int i=0; while (i<args.length) { System.out.println(i+" "+args[i]); if (args[i].equals("-dir")) { dirName = args[i+1]; i+=2; } else if (args[i].equals("-name")) { String tmp = args[i+1]; if (tmp.endsWith("/") || tmp.endsWith("\\") || tmp.endsWith(":") || tmp.endsWith(".") ) { tmp = tmp.substring(0, tmp.length()-1); } tmp = tmp.replace(' ','_'); if (tmp.length() > 0) { dsName = tmp; } i+=2; } else if (args[i].equals("-base")) { baseStr = args[i+1]; System.out.println("The baseStr is "+baseStr); i+=2; } else if (args[i].equals("-exclude")) { excludes.add(args[i+1]); i+=2; } else if (args[i].equals("-paramRef")) { params.put(args[i+1], args[i+2]); i+=3; } else { System.out.println("Don't understand "+args[i++]); } } // end of for (int i=0; i<args.length; i++) try { base = new URL(baseStr); System.out.println("base is "+base.toString()); File f = new File(dirName); if (dirName != null && f.isDirectory()) { SacDirToDataSet sdir = new SacDirToDataSet(base, f, dsName, excludes, params); sdir.process(); sdir.save(); } else { System.err.println("Not a directory: "+args[0]); } // end of else } catch (Exception e) { e.printStackTrace(); } // end of try-catch } // end of main ()
| 1,118,020
|
public void end(String ns, String name) throws Exception { BwTimeZone entity = (BwTimeZone)pop(); globals.timezones++; try { if (globals.rintf != null) { globals.rintf.restoreTimezone(entity); } } catch (Throwable t) { throw new Exception(t); } }
|
public void end(String ns, String name) throws Exception { BwTimeZone entity = (BwTimeZone)pop(); globals.timezones++; try { if (globals.rintf != null) { globals.rintf.restoreTimezone(entity); } } catch (Throwable t) { throw new Exception(t); } }
| 1,118,021
|
public String doRefund(String cardnumber, String monthExpires, String yearExpires, String ccVerifyNumber, double amount, String currency, Object parentDataPK, String captureProperties) throws CreditCardAuthorizationException { IWTimestamp stamp = IWTimestamp.RightNow(); strCCNumber = cardnumber; strCCExpire = yearExpires + monthExpires; strCCVerify = ccVerifyNumber; setCurrencyAndAmount(currency, amount); strCurrentDate = getDateString(stamp); try { StringBuffer logText = new StringBuffer(); Hashtable capturePropertiesHash = parseResponse(captureProperties); Hashtable properties = doRefund(getAmountWithExponents(amount), capturePropertiesHash, parentDataPK); String authCode = properties.get(PROPERTY_APPROVAL_CODE).toString(); logText.append("\nRefund successful").append("\nAuthorization Code = " + authCode); logText.append("\nAction Code = " + properties.get(PROPERTY_ACTION_CODE).toString()); try { String tmpCardNum = CreditCardBusinessBean.encodeCreditCardNumber(cardnumber); storeAuthorizationEntry(tmpCardNum, parentDataPK, properties, KortathjonustanAuthorisationEntries.AUTHORIZATION_TYPE_REFUND); logger.info(logText.toString()); } catch (Exception e) { System.err.println("Unable to save entry to database"); e.printStackTrace(); if (authCode != null) { return authCode; } else { throw new CreditCardAuthorizationException(e); } } return authCode; } catch (CreditCardAuthorizationException e) { StringBuffer logText = new StringBuffer(); logText.append("Authorization FAILED"); logText.append("\nError = " + e.getErrorMessage()); logText.append("\nNumber = " + e.getErrorNumber()); logText.append("\nDisplay error = " + e.getDisplayError()); logger.info(logText.toString()); throw e; } catch (NullPointerException n) { throw new CreditCardAuthorizationException(n); } }
|
public String doRefund(String cardnumber, String monthExpires, String yearExpires, String ccVerifyNumber, double amount, String currency, Object parentDataPK, String captureProperties) throws CreditCardAuthorizationException { IWTimestamp stamp = IWTimestamp.RightNow(); strCCNumber = cardnumber; strCCExpire = yearExpires + monthExpires; strCCVerify = ccVerifyNumber; setCurrencyAndAmount(currency, amount); strCurrentDate = getDateString(stamp); try { StringBuffer logText = new StringBuffer(); Hashtable capturePropertiesHash = parseResponse(captureProperties); Hashtable properties = doRefund(getAmountWithExponents(amount), capturePropertiesHash, parentDataPK); String authCode = properties.get(PROPERTY_APPROVAL_CODE).toString(); logText.append("\nRefund successful").append("\nAuthorization Code = " + authCode); logText.append("\nAction Code = " + properties.get(PROPERTY_ACTION_CODE).toString()); try { String tmpCardNum = CreditCardBusinessBean.encodeCreditCardNumber(cardnumber); storeAuthorizationEntry(tmpCardNum, parentDataPK, properties, KortathjonustanAuthorisationEntries.AUTHORIZATION_TYPE_REFUND); log(logText.toString()); } catch (Exception e) { System.err.println("Unable to save entry to database"); e.printStackTrace(); if (authCode != null) { return authCode; } else { throw new CreditCardAuthorizationException(e); } } return authCode; } catch (CreditCardAuthorizationException e) { StringBuffer logText = new StringBuffer(); logText.append("Authorization FAILED"); logText.append("\nError = " + e.getErrorMessage()); logText.append("\nNumber = " + e.getErrorNumber()); logText.append("\nDisplay error = " + e.getDisplayError()); log(logText.toString()); throw e; } catch (NullPointerException n) { throw new CreditCardAuthorizationException(n); } }
| 1,118,022
|
public String doSale(String nameOnCard, String cardnumber, String monthExpires, String yearExpires, String ccVerifyNumber, double amount, String currency, String referenceNumber) throws CreditCardAuthorizationException { try { IWTimestamp stamp = IWTimestamp.RightNow(); strName = nameOnCard; strCCNumber = cardnumber; strCCExpire = yearExpires + monthExpires; strCCVerify = ccVerifyNumber; setCurrencyAndAmount(currency, amount); strCurrentDate = getDateString(stamp); strReferenceNumber = convertStringToNumbers(referenceNumber); StringBuffer logText = new StringBuffer(); //System.out.println("referenceNumber => " + strReferenceNumber); Hashtable returnedProperties = getFirstResponse(); String authCode = null; if (returnedProperties != null) { logText.append("Authorization successful"); Hashtable returnedCaptureProperties = finishTransaction(returnedProperties); if (returnedCaptureProperties != null && returnedCaptureProperties.get(PROPERTY_APPROVAL_CODE).toString() != null) { //System.out.println("Approval Code = // "+returnedCaptureProperties.get(PROPERTY_APPROVAL_CODE).toString()); authCode = returnedCaptureProperties.get(PROPERTY_APPROVAL_CODE).toString();//returnedCaptureProperties; logText.append("\nCapture successful").append("\nAuthorization Code = " + authCode); logText.append("\nAction Code = " + returnedCaptureProperties.get(PROPERTY_ACTION_CODE).toString()); try { String tmpCardNum = CreditCardBusinessBean.encodeCreditCardNumber(cardnumber); this.storeAuthorizationEntry(tmpCardNum, null, returnedCaptureProperties, KortathjonustanAuthorisationEntries.AUTHORIZATION_TYPE_SALE); logger.info(logText.toString()); } catch (Exception e) { System.err.println("Unable to save entry to database"); throw new CreditCardAuthorizationException(e); } } } return authCode; } catch (CreditCardAuthorizationException e) { StringBuffer logText = new StringBuffer(); logText.append("Authorization FAILED"); logText.append("\nError = " + e.getErrorMessage()); logText.append("\nNumber = " + e.getErrorNumber()); logText.append("\nDisplay error = " + e.getDisplayError()); logger.info(logText.toString()); throw e; } }
|
public String doSale(String nameOnCard, String cardnumber, String monthExpires, String yearExpires, String ccVerifyNumber, double amount, String currency, String referenceNumber) throws CreditCardAuthorizationException { try { IWTimestamp stamp = IWTimestamp.RightNow(); strName = nameOnCard; strCCNumber = cardnumber; strCCExpire = yearExpires + monthExpires; strCCVerify = ccVerifyNumber; setCurrencyAndAmount(currency, amount); strCurrentDate = getDateString(stamp); strReferenceNumber = convertStringToNumbers(referenceNumber); StringBuffer logText = new StringBuffer(); //System.out.println("referenceNumber => " + strReferenceNumber); Hashtable returnedProperties = getFirstResponse(); String authCode = null; if (returnedProperties != null) { logText.append("Authorization successful"); Hashtable returnedCaptureProperties = finishTransaction(returnedProperties); if (returnedCaptureProperties != null && returnedCaptureProperties.get(PROPERTY_APPROVAL_CODE).toString() != null) { //System.out.println("Approval Code = // "+returnedCaptureProperties.get(PROPERTY_APPROVAL_CODE).toString()); authCode = returnedCaptureProperties.get(PROPERTY_APPROVAL_CODE).toString();//returnedCaptureProperties; logText.append("\nCapture successful").append("\nAuthorization Code = " + authCode); logText.append("\nAction Code = " + returnedCaptureProperties.get(PROPERTY_ACTION_CODE).toString()); try { String tmpCardNum = CreditCardBusinessBean.encodeCreditCardNumber(cardnumber); this.storeAuthorizationEntry(tmpCardNum, null, returnedCaptureProperties, KortathjonustanAuthorisationEntries.AUTHORIZATION_TYPE_SALE); log(logText.toString()); } catch (Exception e) { System.err.println("Unable to save entry to database"); throw new CreditCardAuthorizationException(e); } } } return authCode; } catch (CreditCardAuthorizationException e) { StringBuffer logText = new StringBuffer(); logText.append("Authorization FAILED"); logText.append("\nError = " + e.getErrorMessage()); logText.append("\nNumber = " + e.getErrorNumber()); logText.append("\nDisplay error = " + e.getDisplayError()); log(logText.toString()); throw e; } }
| 1,118,023
|
private void init(IWApplicationContext iwc) { logger = null; if (logger == null) { IWBundle bundle = iwc.getIWMainApplication().getBundle(getBundleIdentifier()); logger = Logger.getLogger(this.getClass().getName()); FileUtil.getFileSeparator(); try { //Handler fh = new FileHandler("/Users/kortathjonustan.log"); Handler fh = new FileHandler(bundle.getPropertiesRealPath() + "/kortathjonustan.log"); logger.addHandler(fh); logger.setLevel(Level.ALL); } catch (Exception e) { e.printStackTrace(); logger = null; } } }
|
private void init(IWApplicationContext iwc) { logger = null; if (logger == null) { IWBundle bundle = iwc.getIWMainApplication().getBundle(getBundleIdentifier()); logger = Logger.getLogger(this.getClass().getName()); FileUtil.getFileSeparator(); try { //Handler fh = new FileHandler("/Users/kortathjonustan.log"); Handler fh = new FileHandler(bundle.getPropertiesRealPath() + "/kortathjonustan.log"); logger.addHandler(fh); logger.setLevel(Level.ALL); } catch (Exception e) { e.printStackTrace(); logger = null; } } }
| 1,118,024
|
public Collection getProperties(String ns) throws WebdavIntfException { return new Vector(); }
|
public Collection getProperties(String ns) throws WebdavIntfException { return new ArrayList(); }
| 1,118,025
|
public String getSeismicRegionName(int seisNum) { if (seisNum > 0 && seisNum <= 50) { return feProps.getProperty("SeismicRegion"+seisNum); } // end of if (seisNum > 0 && seisNum <= 50) return "SeisRegion"+seisNum; }
|
public String getSeismicRegionName(int seisNum) { if (seisNum > 0 && seisNum <= 50) { return feProps.getProperty("SeismicRegion"+seisNum); } // end of if (seisNum > 0 && seisNum <= 50) return "SeisRegion"+seisNum; }
| 1,118,028
|
public LongShortTrigger[] calcTriggers(LocalSeismogramImpl seis) throws FissuresException { LinkedList out = new LinkedList(); float[] seisData = seis.get_as_floats(); // establish number of points in LTA and STA windows // as well as in trgdly float dt = (float)seis.getSampling().getPeriod().convertTo(UnitImpl.SECOND).get_value(); int nlta=(int)(longTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int nsta=(int)(shortTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int ntdly=(int)(delay.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int nmean=(int)(meanTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; //System.out.println("dt="+dt+" nlta="+nlta+" nsta="+nsta+" ntdly="+ntdly+" nmean="+nmean); if (seis.getEndTime().subtract(seis.getBeginTime()).lessThan(delay) || nsta > ntdly || ntdly > seis.getNumPoints()) { // seis is too short, so no trigger possible return new LongShortTrigger[0]; } /* get weighting factor */ float csta = 1.0f / nsta ; float clta = 1.0f / nlta ; float cmean = 1.0f / nmean ; float mean = 0 ; float mean1 = mean ; /* now start calculations for first two windows sta=lta */ float sta = 0 ; float lta = 0 ; float trg = 0 ; /* previous value of trigger */ float dat; float ratio; boolean hold = false; for(int i=0 ; i < 2*nsta ; i++) { mean = mean + ( seisData[i]-mean)*cmean ; dat = seisData[i] - mean ; mean1 = mean1 + (dat - mean1)*cmean ; dat = dat - mean1 ; sta = sta + (Math.abs(dat) - sta)*csta ; lta = lta + (Math.abs(dat) - lta)*csta ; ratio = sta/lta ; } long seisStart = 0; double sampling = 0; boolean samplingAndStartSet = false; /* now get rest of trace */ for(int i=2*nsta ; i < seisData.length ; i++) { /* up date mean */ mean = mean + ( seisData[i]-mean)*cmean ; dat = seisData[i] - mean ; mean1 = mean1 + (dat - mean1)*cmean ; dat = Math.abs(dat - mean1); sta = sta + (dat - sta)*csta ; if( (trg==1) && (hold==true)) { /* do not change lta */ } else { lta = lta + (dat - lta)*clta ; } ratio = sta/lta ; if (ratio >= threshold) { if(!samplingAndStartSet){ seisStart = seis.getBeginTime().getMicroSecondTime(); sampling = seis.getSampling().getPeriod().convertTo(UnitImpl.MICROSECOND).get_value(); samplingAndStartSet = true; } LongShortTrigger trigger = new LongShortTrigger(seis, i, ratio, new MicroSecondDate((long)(seisStart + sampling * i))); out.add(trigger); } } LongShortTrigger[] trigger = (LongShortTrigger[])out.toArray(new LongShortTrigger[0]); return trigger; }
|
public LongShortTrigger[] calcTriggers(LocalSeismogramImpl seis) throws FissuresException { LinkedList out = new LinkedList(); float[] seisData = seis.get_as_floats(); // establish number of points in LTA and STA windows // as well as in trgdly double dt = seis.getSampling().getPeriod().convertTo(UnitImpl.SECOND).get_value(); int nlta=(int)(longTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int nsta=(int)(shortTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int ntdly=(int)(delay.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int nmean=(int)(meanTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; //System.out.println("dt="+dt+" nlta="+nlta+" nsta="+nsta+" ntdly="+ntdly+" nmean="+nmean); if (seis.getEndTime().subtract(seis.getBeginTime()).lessThan(delay) || nsta > ntdly || ntdly > seis.getNumPoints()) { // seis is too short, so no trigger possible return new LongShortTrigger[0]; } /* get weighting factor */ float csta = 1.0f / nsta ; float clta = 1.0f / nlta ; float cmean = 1.0f / nmean ; float mean = 0 ; float mean1 = mean ; /* now start calculations for first two windows sta=lta */ float sta = 0 ; float lta = 0 ; float trg = 0 ; /* previous value of trigger */ float dat; float ratio; boolean hold = false; for(int i=0 ; i < 2*nsta ; i++) { mean = mean + ( seisData[i]-mean)*cmean ; dat = seisData[i] - mean ; mean1 = mean1 + (dat - mean1)*cmean ; dat = dat - mean1 ; sta = sta + (Math.abs(dat) - sta)*csta ; lta = lta + (Math.abs(dat) - lta)*csta ; ratio = sta/lta ; } long seisStart = 0; double sampling = 0; boolean samplingAndStartSet = false; /* now get rest of trace */ for(int i=2*nsta ; i < seisData.length ; i++) { /* up date mean */ mean = mean + ( seisData[i]-mean)*cmean ; dat = seisData[i] - mean ; mean1 = mean1 + (dat - mean1)*cmean ; dat = Math.abs(dat - mean1); sta = sta + (dat - sta)*csta ; if( (trg==1) && (hold==true)) { /* do not change lta */ } else { lta = lta + (dat - lta)*clta ; } ratio = sta/lta ; if (ratio >= threshold) { if(!samplingAndStartSet){ seisStart = seis.getBeginTime().getMicroSecondTime(); sampling = seis.getSampling().getPeriod().convertTo(UnitImpl.MICROSECOND).get_value(); samplingAndStartSet = true; } LongShortTrigger trigger = new LongShortTrigger(seis, i, ratio, new MicroSecondDate((long)(seisStart + sampling * i))); out.add(trigger); } } LongShortTrigger[] trigger = (LongShortTrigger[])out.toArray(new LongShortTrigger[0]); return trigger; }
| 1,118,029
|
public LongShortTrigger[] calcTriggers(LocalSeismogramImpl seis) throws FissuresException { LinkedList out = new LinkedList(); float[] seisData = seis.get_as_floats(); // establish number of points in LTA and STA windows // as well as in trgdly float dt = (float)seis.getSampling().getPeriod().convertTo(UnitImpl.SECOND).get_value(); int nlta=(int)(longTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int nsta=(int)(shortTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int ntdly=(int)(delay.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int nmean=(int)(meanTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; //System.out.println("dt="+dt+" nlta="+nlta+" nsta="+nsta+" ntdly="+ntdly+" nmean="+nmean); if (seis.getEndTime().subtract(seis.getBeginTime()).lessThan(delay) || nsta > ntdly || ntdly > seis.getNumPoints()) { // seis is too short, so no trigger possible return new LongShortTrigger[0]; } /* get weighting factor */ float csta = 1.0f / nsta ; float clta = 1.0f / nlta ; float cmean = 1.0f / nmean ; float mean = 0 ; float mean1 = mean ; /* now start calculations for first two windows sta=lta */ float sta = 0 ; float lta = 0 ; float trg = 0 ; /* previous value of trigger */ float dat; float ratio; boolean hold = false; for(int i=0 ; i < 2*nsta ; i++) { mean = mean + ( seisData[i]-mean)*cmean ; dat = seisData[i] - mean ; mean1 = mean1 + (dat - mean1)*cmean ; dat = dat - mean1 ; sta = sta + (Math.abs(dat) - sta)*csta ; lta = lta + (Math.abs(dat) - lta)*csta ; ratio = sta/lta ; } long seisStart = 0; double sampling = 0; boolean samplingAndStartSet = false; /* now get rest of trace */ for(int i=2*nsta ; i < seisData.length ; i++) { /* up date mean */ mean = mean + ( seisData[i]-mean)*cmean ; dat = seisData[i] - mean ; mean1 = mean1 + (dat - mean1)*cmean ; dat = Math.abs(dat - mean1); sta = sta + (dat - sta)*csta ; if( (trg==1) && (hold==true)) { /* do not change lta */ } else { lta = lta + (dat - lta)*clta ; } ratio = sta/lta ; if (ratio >= threshold) { if(!samplingAndStartSet){ seisStart = seis.getBeginTime().getMicroSecondTime(); sampling = seis.getSampling().getPeriod().convertTo(UnitImpl.MICROSECOND).get_value(); samplingAndStartSet = true; } LongShortTrigger trigger = new LongShortTrigger(seis, i, ratio, new MicroSecondDate((long)(seisStart + sampling * i))); out.add(trigger); } } LongShortTrigger[] trigger = (LongShortTrigger[])out.toArray(new LongShortTrigger[0]); return trigger; }
|
public LongShortTrigger[] calcTriggers(LocalSeismogramImpl seis) throws FissuresException { LinkedList out = new LinkedList(); float[] seisData = seis.get_as_floats(); // establish number of points in LTA and STA windows // as well as in trgdly float dt = (float)seis.getSampling().getPeriod().convertTo(UnitImpl.SECOND).get_value(); int nlta=(int)(longTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int nsta=(int)(shortTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int ntdly=(int)(delay.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int nmean=(int)(meanTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; //System.out.println("dt="+dt+" nlta="+nlta+" nsta="+nsta+" ntdly="+ntdly+" nmean="+nmean); if (seis.getEndTime().subtract(seis.getBeginTime()).lessThan(delay) || nsta > ntdly || ntdly > seis.getNumPoints()) { // seis is too short, so no trigger possible return new LongShortTrigger[0]; } /* get weighting factor */ float csta = 1.0f / nsta ; float clta = 1.0f / nlta ; float cmean = 1.0f / nmean ; float mean = 0 ; float mean1 = mean ; /* now start calculations for first two windows sta=lta */ float sta = 0 ; float lta = 0 ; float trg = 0 ; /* previous value of trigger */ float dat; float ratio; boolean hold = false; for(int i=0 ; i < 2*nsta ; i++) { mean = mean + ( seisData[i]-mean)*cmean ; dat = seisData[i] - mean ; mean1 = mean1 + (dat - mean1)*cmean ; dat = dat - mean1 ; sta = sta + (Math.abs(dat) - sta)*csta ; lta = lta + (Math.abs(dat) - lta)*csta ; ratio = sta/lta ; } long seisStart = 0; double sampling = 0; boolean samplingAndStartSet = false; /* now get rest of trace */ for(int i=2*nsta ; i < seisData.length ; i++) { /* up date mean */ mean = mean + ( seisData[i]-mean)*cmean ; dat = seisData[i] - mean ; mean1 = mean1 + (dat - mean1)*cmean ; dat = Math.abs(dat - mean1); sta = sta + (dat - sta)*csta ; if( (trg==1) && (hold==true)) { /* do not change lta */ } else { lta = lta + (dat - lta)*clta ; } ratio = sta/lta ; if (ratio >= threshold) { if(!samplingAndStartSet){ seisStart = seis.getBeginTime().getMicroSecondTime(); sampling = seis.getSampling().getPeriod().convertTo(UnitImpl.MICROSECOND).get_value(); samplingAndStartSet = true; } LongShortTrigger trigger = new LongShortTrigger(seis, i, ratio, new MicroSecondDate((long)(seisStart + sampling * i)), sta, lta); out.add(trigger); } } LongShortTrigger[] trigger = (LongShortTrigger[])out.toArray(new LongShortTrigger[0]); return trigger; }
| 1,118,030
|
public LongShortTrigger[] calcTriggersTJO(LocalSeismogramImpl seis) throws FissuresException { LinkedList out = new LinkedList(); float[] seisData = seis.get_as_floats(); // establish number of points in LTA and STA windows // as well as in trgdly float dt = (float)seis.getSampling().getPeriod().convertTo(UnitImpl.SECOND).get_value(); int nlta=(int)(longTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int nsta=(int)(shortTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int ntdly=(int)(delay.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; if (seis.getEndTime().subtract(seis.getBeginTime()).lessThan(delay) || nsta > ntdly || ntdly > seis.getNumPoints()) { // seis is too short, so no trigger possible return new LongShortTrigger[0]; } // n100 is number of data points in 100 second window // (needed for data mean calculation) int n100=(int)(100./dt) + 1; // clta and csta are constants in trigger algoritms float clta=1.0f/nlta; float csta=1.0f/nsta; float xmean=0.0f; float ylta=0; float prevylta=0; float ysta=0; float prevysta=0; // initialize STA, start at delay and sum backwards for (int j = 0; j < nsta && j < ntdly; j++) { ysta += seisData[ntdly-j-1]; } // initialize LTA, start at delay and sum backwards for (int j = 0; j < nlta && j < ntdly; j++) { ylta += seisData[ntdly-j-1]; } int nmean = 0; for (nmean = 0; nmean < n100 && nmean < ntdly; nmean++) { xmean += seisData[ntdly-nmean-1]; } // start the triggering process for (int i = ntdly; i < seisData.length; i++) { // after 100 seconds, data mean is mean of previous 100 seconds only if (nmean == n100) { xmean -= seisData[i-n100]; } else { nmean++; } xmean += seisData[i]; // LTA value calculated as per REFTEK algorithm prevylta = ylta; float nextData = Math.abs(seisData[i] - xmean/nmean); ylta = clta*nextData + (1-clta)*prevylta - (i<nlta?0:clta*Math.abs(seisData[i-nlta] - xmean/nmean)); // don't get index of of bounds // STA value calculated as per REFTEK algorithm prevysta = ysta; ysta = csta*nextData + (1-csta)*prevysta - (i<nsta?0:csta*Math.abs(seisData[i-nsta] - xmean/nmean)); // rat is STA/LTA at each time point float ratio; if (ylta != 0) { ratio=ysta/ylta; if (ratio > 10) System.out.println("ylta = "+ylta+" ysta="+ysta+" ratio="+ratio); } else { // in this case, declare a trigger if ysta != 0, otherwise not if (ysta != 0) { ratio = threshold; } else { ratio = 0; } } if (ratio >= threshold) { LongShortTrigger trigger = new LongShortTrigger(seis, i, ratio); out.add(trigger); } } LongShortTrigger[] trigger = (LongShortTrigger[])out.toArray(new LongShortTrigger[0]); return trigger; }
|
public LongShortTrigger[] calcTriggersTJO(LocalSeismogramImpl seis) throws FissuresException { LinkedList out = new LinkedList(); float[] seisData = seis.get_as_floats(); // establish number of points in LTA and STA windows // as well as in trgdly float dt = (float)seis.getSampling().getPeriod().convertTo(UnitImpl.SECOND).get_value(); int nlta=(int)(longTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int nsta=(int)(shortTime.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; int ntdly=(int)(delay.divideBy(dt).convertTo(UnitImpl.SECOND).getValue()) + 1; if (seis.getEndTime().subtract(seis.getBeginTime()).lessThan(delay) || nsta > ntdly || ntdly > seis.getNumPoints()) { // seis is too short, so no trigger possible return new LongShortTrigger[0]; } // n100 is number of data points in 100 second window // (needed for data mean calculation) int n100=(int)(100./dt) + 1; // clta and csta are constants in trigger algoritms float clta=1.0f/nlta; float csta=1.0f/nsta; float xmean=0.0f; float ylta=0; float prevylta=0; float ysta=0; float prevysta=0; // initialize STA, start at delay and sum backwards for (int j = 0; j < nsta && j < ntdly; j++) { ysta += seisData[ntdly-j-1]; } // initialize LTA, start at delay and sum backwards for (int j = 0; j < nlta && j < ntdly; j++) { ylta += seisData[ntdly-j-1]; } int nmean = 0; for (nmean = 0; nmean < n100 && nmean < ntdly; nmean++) { xmean += seisData[ntdly-nmean-1]; } // start the triggering process for (int i = ntdly; i < seisData.length; i++) { // after 100 seconds, data mean is mean of previous 100 seconds only if (nmean == n100) { xmean -= seisData[i-n100]; } else { nmean++; } xmean += seisData[i]; // LTA value calculated as per REFTEK algorithm prevylta = ylta; float nextData = Math.abs(seisData[i] - xmean/nmean); ylta = clta*nextData + (1-clta)*prevylta - (i<nlta?0:clta*Math.abs(seisData[i-nlta] - xmean/nmean)); // don't get index of of bounds // STA value calculated as per REFTEK algorithm prevysta = ysta; ysta = csta*nextData + (1-csta)*prevysta - (i<nsta?0:csta*Math.abs(seisData[i-nsta] - xmean/nmean)); // rat is STA/LTA at each time point float ratio; if (ylta != 0) { ratio=ysta/ylta; if (ratio > 10) System.out.println("ylta = "+ylta+" ysta="+ysta+" ratio="+ratio, ysta, ylta); } else { // in this case, declare a trigger if ysta != 0, otherwise not if (ysta != 0) { ratio = threshold; } else { ratio = 0; } } if (ratio >= threshold) { LongShortTrigger trigger = new LongShortTrigger(seis, i, ratio, ysta, ylta); out.add(trigger); } } LongShortTrigger[] trigger = (LongShortTrigger[])out.toArray(new LongShortTrigger[0]); return trigger; }
| 1,118,031
|
public void initialise(String userid, CallBack cb, Object val) throws CalFacadeException { curUser = userid; this.cb = cb; if (userid != null) { curUsertype = getUsertype(userid); } userAuthRO = null; debug = getLogger().isDebugEnabled(); }
|
public void initialise(String userid, CallBack cb, Object val, boolean debug) throws CalFacadeException { curUser = userid; this.cb = cb; if (userid != null) { curUsertype = getUsertype(userid); } userAuthRO = null; debug = getLogger().isDebugEnabled(); }
| 1,118,032
|
public void initialise(String userid, CallBack cb, Object val) throws CalFacadeException { curUser = userid; this.cb = cb; if (userid != null) { curUsertype = getUsertype(userid); } userAuthRO = null; debug = getLogger().isDebugEnabled(); }
|
public void initialise(String userid, CallBack cb, Object val) throws CalFacadeException { curUser = userid; this.cb = cb; if (userid != null) { curUsertype = getUsertype(userid); } userAuthRO = null; this.debug = debug; }
| 1,118,033
|
public RootedTree reconstructPhylogeny(int[] sample, List<Taxon> taxa) { SimpleRootedTree tree = new SimpleRootedTree(); Lineage[] lineages = new Lineage[sample.length]; Node[] nodes = new Node[sample.length]; for (int i = 0; i < sample.length; i++) { lineages[i] = extantLineages[sample[i]]; nodes[i] = tree.createExternalNode(taxa.get(i)); tree.setHeight(nodes[i], 0); Lineage lineage = lineages[i]; while (lineage != null) { lineage.count = 0; lineage = lineage.parent; } } int tipGeneration = lineages[0].generation; for (int i = 0; i < sample.length; i++) { Lineage lineage = lineages[i]; while (lineage != null) { lineage.count ++; lineage = lineage.parent; } } // find the next shared node for each lineage for (int i = 0; i < sample.length; i++) { Lineage lineage = lineages[i]; while (lineage != null && lineage.count == 1) { lineage = lineage.parent; } if (lineage == null) { // the phylogeny has not fully coalesced. return null; } } int lineageCount = sample.length; List<Node> children = new ArrayList<Node>(); while (lineageCount > 1) { for (int i = 0; i < lineageCount; i++) { children.clear(); // find matches int j = i + 1; while (j < lineageCount) { if (lineages[i] == lineages[j]) { children.add(nodes[j]); // move the lineage/node from the end of the arrays lineages[j] = lineages[lineageCount - 1]; nodes[j] = nodes[lineageCount - 1]; lineageCount --; } else { j++; } } // if node i matched anything then create an internal node if (children.size() > 0) { children.add(nodes[i]); Node node = tree.createInternalNode(children); tree.setHeight(node, tipGeneration - lineages[i].generation); nodes[i] = node; } } } return tree; }
|
public RootedTree reconstructPhylogeny(int[] sample, List<Taxon> taxa) { SimpleRootedTree tree = new SimpleRootedTree(); Lineage[] lineages = new Lineage[sample.length]; Node[] nodes = new Node[sample.length]; for (int i = 0; i < sample.length; i++) { lineages[i] = extantLineages[sample[i]]; nodes[i] = tree.createExternalNode(taxa.get(i)); tree.setHeight(nodes[i], 0); Lineage lineage = lineages[i]; while (lineage != null) { lineage.count = 0; lineage = lineage.parent; } } int tipGeneration = lineages[0].generation; for (int i = 0; i < sample.length; i++) { Lineage lineage = lineages[i]; while (lineage != null) { lineage.count ++; lineage = lineage.parent; } } // find the next shared node for each lineage for (int i = 0; i < sample.length; i++) { Lineage lineage = lineages[i]; while (lineage != null && lineage.count == 1) { lineage = lineage.parent; } if (lineage == null) { // the phylogeny has not fully coalesced. return null; } } int lineageCount = sample.length; List<Node> children = new ArrayList<Node>(); while (lineageCount > 1) { for (int i = 0; i < lineageCount; i++) { children.clear(); // find matches int j = i + 1; while (j < lineageCount) { if (lineages[i] == lineages[j]) { children.add(nodes[j]); // move the lineage/node from the end of the arrays lineages[j] = lineages[lineageCount - 1]; nodes[j] = nodes[lineageCount - 1]; lineageCount --; } else { j++; } } // if node i matched anything then create an internal node if (children.size() > 0) { children.add(nodes[i]); Node node = tree.createInternalNode(children); tree.setHeight(node, tipGeneration - lineages[i].generation); nodes[i] = node; } } } return tree; }
| 1,118,034
|
public RootedTree reconstructPhylogeny(int[] sample, List<Taxon> taxa) { SimpleRootedTree tree = new SimpleRootedTree(); Lineage[] lineages = new Lineage[sample.length]; Node[] nodes = new Node[sample.length]; for (int i = 0; i < sample.length; i++) { lineages[i] = extantLineages[sample[i]]; nodes[i] = tree.createExternalNode(taxa.get(i)); tree.setHeight(nodes[i], 0); Lineage lineage = lineages[i]; while (lineage != null) { lineage.count = 0; lineage = lineage.parent; } } int tipGeneration = lineages[0].generation; for (int i = 0; i < sample.length; i++) { Lineage lineage = lineages[i]; while (lineage != null) { lineage.count ++; lineage = lineage.parent; } } // find the next shared node for each lineage for (int i = 0; i < sample.length; i++) { Lineage lineage = lineages[i]; while (lineage != null && lineage.count == 1) { lineage = lineage.parent; } if (lineage == null) { // the phylogeny has not fully coalesced. return null; } } int lineageCount = sample.length; List<Node> children = new ArrayList<Node>(); while (lineageCount > 1) { for (int i = 0; i < lineageCount; i++) { children.clear(); // find matches int j = i + 1; while (j < lineageCount) { if (lineages[i] == lineages[j]) { children.add(nodes[j]); // move the lineage/node from the end of the arrays lineages[j] = lineages[lineageCount - 1]; nodes[j] = nodes[lineageCount - 1]; lineageCount --; } else { j++; } } // if node i matched anything then create an internal node if (children.size() > 0) { children.add(nodes[i]); Node node = tree.createInternalNode(children); tree.setHeight(node, tipGeneration - lineages[i].generation); nodes[i] = node; } } } return tree; }
|
public RootedTree reconstructPhylogeny(int[] sample, List<Taxon> taxa) { SimpleRootedTree tree = new SimpleRootedTree(); Lineage[] lineages = new Lineage[sample.length]; Node[] nodes = new Node[sample.length]; for (int i = 0; i < sample.length; i++) { lineages[i] = extantLineages[sample[i]]; nodes[i] = tree.createExternalNode(taxa.get(i)); tree.setHeight(nodes[i], 0); Lineage lineage = lineages[i]; while (lineage != null) { lineage.count = 0; lineage = lineage.parent; } } int tipGeneration = lineages[0].generation; for (int i = 0; i < sample.length; i++) { Lineage lineage = lineages[i]; while (lineage != null) { lineage.count ++; lineage = lineage.parent; } } // find the next shared node for each lineage for (int i = 0; i < sample.length; i++) { Lineage lineage = lineages[i]; while (lineage != null && lineage.count == 1) { lineage = lineage.parent; } if (lineages[i] == null) { // the phylogeny has not fully coalesced. return null; } } int lineageCount = sample.length; List<Node> children = new ArrayList<Node>(); while (lineageCount > 1) { for (int i = 0; i < lineageCount; i++) { children.clear(); // find matches int j = i + 1; while (j < lineageCount) { if (lineages[i] == lineages[j]) { children.add(nodes[j]); // move the lineage/node from the end of the arrays lineages[j] = lineages[lineageCount - 1]; nodes[j] = nodes[lineageCount - 1]; lineageCount --; } else { j++; } } // if node i matched anything then create an internal node if (children.size() > 0) { children.add(nodes[i]); Node node = tree.createInternalNode(children); tree.setHeight(node, tipGeneration - lineages[i].generation); nodes[i] = node; } } } return tree; }
| 1,118,035
|
public RootedTree reconstructPhylogeny(int[] sample, List<Taxon> taxa) { SimpleRootedTree tree = new SimpleRootedTree(); Lineage[] lineages = new Lineage[sample.length]; Node[] nodes = new Node[sample.length]; for (int i = 0; i < sample.length; i++) { lineages[i] = extantLineages[sample[i]]; nodes[i] = tree.createExternalNode(taxa.get(i)); tree.setHeight(nodes[i], 0); Lineage lineage = lineages[i]; while (lineage != null) { lineage.count = 0; lineage = lineage.parent; } } int tipGeneration = lineages[0].generation; for (int i = 0; i < sample.length; i++) { Lineage lineage = lineages[i]; while (lineage != null) { lineage.count ++; lineage = lineage.parent; } } // find the next shared node for each lineage for (int i = 0; i < sample.length; i++) { Lineage lineage = lineages[i]; while (lineage != null && lineage.count == 1) { lineage = lineage.parent; } if (lineage == null) { // the phylogeny has not fully coalesced. return null; } } int lineageCount = sample.length; List<Node> children = new ArrayList<Node>(); while (lineageCount > 1) { for (int i = 0; i < lineageCount; i++) { children.clear(); // find matches int j = i + 1; while (j < lineageCount) { if (lineages[i] == lineages[j]) { children.add(nodes[j]); // move the lineage/node from the end of the arrays lineages[j] = lineages[lineageCount - 1]; nodes[j] = nodes[lineageCount - 1]; lineageCount --; } else { j++; } } // if node i matched anything then create an internal node if (children.size() > 0) { children.add(nodes[i]); Node node = tree.createInternalNode(children); tree.setHeight(node, tipGeneration - lineages[i].generation); nodes[i] = node; } } } return tree; }
|
public RootedTree reconstructPhylogeny(int[] sample, List<Taxon> taxa) { SimpleRootedTree tree = new SimpleRootedTree(); Lineage[] lineages = new Lineage[sample.length]; Node[] nodes = new Node[sample.length]; for (int i = 0; i < sample.length; i++) { lineages[i] = extantLineages[sample[i]]; nodes[i] = tree.createExternalNode(taxa.get(i)); tree.setHeight(nodes[i], 0); Lineage lineage = lineages[i]; while (lineage != null) { lineage.count = 0; lineage = lineage.parent; } } int tipGeneration = lineages[0].generation; for (int i = 0; i < sample.length; i++) { Lineage lineage = lineages[i]; while (lineage != null) { lineage.count ++; lineage = lineage.parent; } } // find the next shared node for each lineage for (int i = 0; i < sample.length; i++) { Lineage lineage = lineages[i]; while (lineage != null && lineage.count == 1) { lineage = lineage.parent; } if (lineage == null) { // the phylogeny has not fully coalesced. return null; } } int lineageCount = sample.length; List<Node> children = new ArrayList<Node>(); while (lineageCount > 1) { int i = 0; while (i < lineageCount) { children.clear(); // find matches int j = i + 1; while (j < lineageCount) { if (lineages[i] == lineages[j]) { children.add(nodes[j]); // move the lineage/node from the end of the arrays lineages[j] = lineages[lineageCount - 1]; nodes[j] = nodes[lineageCount - 1]; lineageCount --; } else { j++; } } // if node i matched anything then create an internal node if (children.size() > 0) { children.add(nodes[i]); Node node = tree.createInternalNode(children); tree.setHeight(node, tipGeneration - lineages[i].generation); nodes[i] = node; } } } return tree; }
| 1,118,036
|
get_attributes() { if (attr == null) { attr = net.get_attributes(); } return attr; }
|
get_attributes() { if (attr == null) { attr = net.get_attributes(); } return attr; }
| 1,118,038
|
get_attributes() { if (attr == null) { attr = net.get_attributes(); } return attr; }
|
get_attributes() { if (attr == null) { attr = net.get_attributes(); } return attr; }
| 1,118,039
|
retrieve_for_station(StationId id) { String idStr = StationIdUtil.toString(id); if ( ! channelMap.containsKey(idStr)) { channelMap.put(idStr, net.retrieve_for_station(id)); } return (Channel[])channelMap.get(idStr); }
|
retrieve_for_station(StationId id) { String idStr = StationIdUtil.toString(id); if ( ! channelMap.containsKey(idStr)) { channelMap.put(idStr, net.retrieve_for_station(id)); } return (Channel[])channelMap.get(idStr); }
| 1,118,040
|
retrieve_for_station(StationId id) { String idStr = StationIdUtil.toString(id); if ( ! channelMap.containsKey(idStr)) { channelMap.put(idStr, net.retrieve_for_station(id)); } return (Channel[])channelMap.get(idStr); }
|
retrieve_for_station(StationId id) { String idStr = StationIdUtil.toString(id); if ( ! channelMap.containsKey(idStr)) { channelMap.put(idStr, net.retrieve_for_station(id)); } return (Channel[])channelMap.get(idStr); }
| 1,118,041
|
retrieve_stations() { if (stations == null) { stations = net.retrieve_stations(); } return stations; }
|
retrieve_stations() { if (stations == null) { stations = net.retrieve_stations(); } return stations; }
| 1,118,042
|
retrieve_stations() { if (stations == null) { stations = net.retrieve_stations(); } return stations; }
|
retrieve_stations() { if (stations == null) { stations = net.retrieve_stations(); } return stations; }
| 1,118,043
|
private void printInternal(Node node, boolean indentEndMarker) { // is there anything to do? if (node == null) { return; } // JBAS-2117 - Don't skip the DOCUMENT_NODE // if (node instanceof Document) node = ((Document)node).getDocumentElement(); if (wroteXMLDeclaration == false && writeXMLDeclaration == true && canonical == false) { out.print("<?xml version='1.0'"); if (charsetName != null) out.print(" encoding='" + charsetName + "'"); out.println("?>"); wroteXMLDeclaration = true; } int type = node.getNodeType(); boolean hasChildNodes = node.getChildNodes().getLength() > 0; String nodeName = node.getNodeName(); switch (type) { // print document case Node.DOCUMENT_NODE: { NodeList children = node.getChildNodes(); for (int iChild = 0; iChild < children.getLength(); iChild++) { printInternal(children.item(iChild), false); } out.flush(); break; } // print element with attributes case Node.ELEMENT_NODE: { Element element = (Element)node; if (prettyprint) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } prettyIndent++; } out.print('<'); out.print(nodeName); String prefix = node.getPrefix(); String nsURI = (prefix != null ? getNamespaceURI(prefix, element, rootNode) : null); Attr attrs[] = sortAttributes(node.getAttributes()); for (int i = 0; i < attrs.length; i++) { Attr attr = attrs[i]; String attrName = attr.getNodeName(); String attrValue = normalize(attr.getNodeValue()); if (prefix != null && attrName.equals("xmlns:" + prefix)) nsURI = attrValue; out.print(" " + attrName + "='" + attrValue + "'"); } // Add missing namespace declaration if (prefix != null && nsURI == null) { nsURI = getNamespaceURI(prefix, element, null); out.print(" xmlns:" + prefix + "='" + nsURI + "'"); } if (hasChildNodes) { out.print('>'); } // Find out if the end marker is indented indentEndMarker = isEndMarkerIndented(node); if (indentEndMarker) { out.print('\n'); } NodeList childNodes = node.getChildNodes(); int len = childNodes.getLength(); for (int i = 0; i < len; i++) { Node childNode = childNodes.item(i); printInternal(childNode, false); } break; } // handle entity reference nodes case Node.ENTITY_REFERENCE_NODE: { if (canonical) { NodeList children = node.getChildNodes(); if (children != null) { int len = children.getLength(); for (int i = 0; i < len; i++) { printInternal(children.item(i), false); } } } else { out.print('&'); out.print(nodeName); out.print(';'); } break; } // print cdata sections case Node.CDATA_SECTION_NODE: { if (canonical) { out.print(normalize(node.getNodeValue())); } else { out.print("<![CDATA["); out.print(node.getNodeValue()); out.print("]]>"); } break; } // print text case Node.TEXT_NODE: { String text = normalize(node.getNodeValue()); if (prettyprint == false || text.trim().length() > 0) out.print(text); break; } // print processing instruction case Node.PROCESSING_INSTRUCTION_NODE: { out.print("<?"); out.print(nodeName); String data = node.getNodeValue(); if (data != null && data.length() > 0) { out.print(' '); out.print(data); } out.print("?>"); break; } // print comment case Node.COMMENT_NODE: { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } out.print("<!--"); String data = node.getNodeValue(); if (data != null) { out.print(data); } out.print("-->"); if (prettyprint) { out.print('\n'); } break; } } if (type == Node.ELEMENT_NODE) { if (prettyprint) prettyIndent--; if (hasChildNodes == false) { out.print("/>"); } else { if (indentEndMarker) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } } out.print("</"); out.print(nodeName); out.print('>'); } if (prettyIndent > 0) { out.print('\n'); } } out.flush(); }
|
private void printInternal(Node node, boolean indentEndMarker) { // is there anything to do? if (node == null) { return; } // JBAS-2117 - Don't skip the DOCUMENT_NODE // if (node instanceof Document) node = ((Document)node).getDocumentElement(); if (wroteXMLDeclaration == false && writeXMLDeclaration == true && canonical == false) { out.print("<?xml version='1.0'"); if (charsetName != null) out.print(" encoding='" + charsetName + "'"); out.println("?>"); wroteXMLDeclaration = true; } int type = node.getNodeType(); boolean hasChildNodes = node.getChildNodes().getLength() > 0; String nodeName = node.getNodeName(); switch (type) { // print document case Node.DOCUMENT_NODE: { NodeList children = node.getChildNodes(); for (int iChild = 0; iChild < children.getLength(); iChild++) { printInternal(children.item(iChild), false); } out.flush(); break; } // print element with attributes case Node.ELEMENT_NODE: { Element element = (Element)node; if (prettyprint) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } prettyIndent++; } out.print('<'); out.print(nodeName); String prefix = node.getPrefix(); String nsURI = (prefix != null ? getNamespaceURI(prefix, element, rootNode) : null); Attr attrs[] = sortAttributes(node.getAttributes()); for (int i = 0; i < attrs.length; i++) { Attr attr = attrs[i]; String attrName = attr.getNodeName(); String attrValue = normalize(attr.getNodeValue()); if (prefix != null && attrName.equals("xmlns:" + prefix)) nsURI = attrValue; out.print(" " + attrName + "='" + attrValue + "'"); } // Add missing namespace declaration if (prefix != null && nsURI == null) { nsURI = getNamespaceURI(prefix, element, null); out.print(" xmlns:" + prefix + "='" + nsURI + "'"); } if (hasChildNodes) { out.print('>'); } // Find out if the end marker is indented indentEndMarker = isEndMarkerIndented(node); if (indentEndMarker) { out.print('\n'); } NodeList childNodes = node.getChildNodes(); int len = childNodes.getLength(); for (int i = 0; i < len; i++) { Node childNode = childNodes.item(i); printInternal(childNode, false); } break; } // handle entity reference nodes case Node.ENTITY_REFERENCE_NODE: { if (canonical) { NodeList children = node.getChildNodes(); if (children != null) { int len = children.getLength(); for (int i = 0; i < len; i++) { printInternal(children.item(i), false); } } } else { out.print('&'); out.print(nodeName); out.print(';'); } break; } // print cdata sections case Node.CDATA_SECTION_NODE: { if (canonical) { out.print(normalize(node.getNodeValue())); } else { out.print("<![CDATA["); out.print(node.getNodeValue()); out.print("]]>"); } break; } // print text case Node.TEXT_NODE: { String text = normalize(node.getNodeValue()); if (prettyprint == false || text.trim().length() > 0) out.print(text); break; } // print processing instruction case Node.PROCESSING_INSTRUCTION_NODE: { out.print("<?"); out.print(nodeName); String data = node.getNodeValue(); if (data != null && data.length() > 0) { out.print(' '); out.print(data); } out.print("?>"); break; } // print comment case Node.COMMENT_NODE: { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } out.print("<!--"); String data = node.getNodeValue(); if (data != null) { out.print(data); } out.print("-->"); if (prettyprint) { out.print('\n'); } break; } } if (type == Node.ELEMENT_NODE) { if (prettyprint) prettyIndent--; if (hasChildNodes == false) { out.print("/>"); } else { if (indentEndMarker) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } } out.print("</"); out.print(nodeName); out.print('>'); } if (prettyIndent > 0) { out.print('\n'); } } out.flush(); }
| 1,118,044
|
private void printInternal(Node node, boolean indentEndMarker) { // is there anything to do? if (node == null) { return; } // JBAS-2117 - Don't skip the DOCUMENT_NODE // if (node instanceof Document) node = ((Document)node).getDocumentElement(); if (wroteXMLDeclaration == false && writeXMLDeclaration == true && canonical == false) { out.print("<?xml version='1.0'"); if (charsetName != null) out.print(" encoding='" + charsetName + "'"); out.println("?>"); wroteXMLDeclaration = true; } int type = node.getNodeType(); boolean hasChildNodes = node.getChildNodes().getLength() > 0; String nodeName = node.getNodeName(); switch (type) { // print document case Node.DOCUMENT_NODE: { NodeList children = node.getChildNodes(); for (int iChild = 0; iChild < children.getLength(); iChild++) { printInternal(children.item(iChild), false); } out.flush(); break; } // print element with attributes case Node.ELEMENT_NODE: { Element element = (Element)node; if (prettyprint) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } prettyIndent++; } out.print('<'); out.print(nodeName); String prefix = node.getPrefix(); String nsURI = (prefix != null ? getNamespaceURI(prefix, element, rootNode) : null); Attr attrs[] = sortAttributes(node.getAttributes()); for (int i = 0; i < attrs.length; i++) { Attr attr = attrs[i]; String attrName = attr.getNodeName(); String attrValue = normalize(attr.getNodeValue()); if (prefix != null && attrName.equals("xmlns:" + prefix)) nsURI = attrValue; out.print(" " + attrName + "='" + attrValue + "'"); } // Add missing namespace declaration if (prefix != null && nsURI == null) { nsURI = getNamespaceURI(prefix, element, null); out.print(" xmlns:" + prefix + "='" + nsURI + "'"); } if (hasChildNodes) { out.print('>'); } // Find out if the end marker is indented indentEndMarker = isEndMarkerIndented(node); if (indentEndMarker) { out.print('\n'); } NodeList childNodes = node.getChildNodes(); int len = childNodes.getLength(); for (int i = 0; i < len; i++) { Node childNode = childNodes.item(i); printInternal(childNode, false); } break; } // handle entity reference nodes case Node.ENTITY_REFERENCE_NODE: { if (canonical) { NodeList children = node.getChildNodes(); if (children != null) { int len = children.getLength(); for (int i = 0; i < len; i++) { printInternal(children.item(i), false); } } } else { out.print('&'); out.print(nodeName); out.print(';'); } break; } // print cdata sections case Node.CDATA_SECTION_NODE: { if (canonical) { out.print(normalize(node.getNodeValue())); } else { out.print("<![CDATA["); out.print(node.getNodeValue()); out.print("]]>"); } break; } // print text case Node.TEXT_NODE: { String text = normalize(node.getNodeValue()); if (prettyprint == false || text.trim().length() > 0) out.print(text); break; } // print processing instruction case Node.PROCESSING_INSTRUCTION_NODE: { out.print("<?"); out.print(nodeName); String data = node.getNodeValue(); if (data != null && data.length() > 0) { out.print(' '); out.print(data); } out.print("?>"); break; } // print comment case Node.COMMENT_NODE: { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } out.print("<!--"); String data = node.getNodeValue(); if (data != null) { out.print(data); } out.print("-->"); if (prettyprint) { out.print('\n'); } break; } } if (type == Node.ELEMENT_NODE) { if (prettyprint) prettyIndent--; if (hasChildNodes == false) { out.print("/>"); } else { if (indentEndMarker) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } } out.print("</"); out.print(nodeName); out.print('>'); } if (prettyIndent > 0) { out.print('\n'); } } out.flush(); }
|
private void printInternal(Node node, boolean indentEndMarker) { // is there anything to do? if (node == null) { return; } // JBAS-2117 - Don't skip the DOCUMENT_NODE // if (node instanceof Document) node = ((Document)node).getDocumentElement(); if (wroteXMLDeclaration == false && writeXMLDeclaration == true && canonical == false) { out.print("<?xml version='1.0'"); if (charsetName != null) out.print(" encoding='" + charsetName + "'"); out.println("?>"); wroteXMLDeclaration = true; } int type = node.getNodeType(); boolean hasChildNodes = node.getChildNodes().getLength() > 0; String nodeName = node.getNodeName(); switch (type) { // print document case Node.DOCUMENT_NODE: { NodeList children = node.getChildNodes(); for (int iChild = 0; iChild < children.getLength(); iChild++) { printInternal(children.item(iChild), false); } out.flush(); break; } // print element with attributes case Node.ELEMENT_NODE: { Element element = (Element)node; if (prettyprint) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } prettyIndent++; } out.print('<'); out.print(nodeName); String prefix = node.getPrefix(); String nsURI = (prefix != null ? getNamespaceURI(prefix, element, rootNode) : null); Attr attrs[] = sortAttributes(node.getAttributes()); for (int i = 0; i < attrs.length; i++) { Attr attr = attrs[i]; String attrName = attr.getNodeName(); String attrValue = normalize(attr.getNodeValue()); if (prefix != null && attrName.equals("xmlns:" + prefix)) nsURI = attrValue; out.print(" " + attrName + "='" + attrValue + "'"); } // Add missing namespace declaration if (prefix != null && nsURI == null) { nsURI = getNamespaceURI(prefix, element, null); out.print(" xmlns:" + prefix + "='" + nsURI + "'"); } if (hasChildNodes) { out.print('>'); } // Find out if the end marker is indented indentEndMarker = isEndMarkerIndented(node); if (indentEndMarker) { out.print('\n'); } NodeList childNodes = node.getChildNodes(); int len = childNodes.getLength(); for (int i = 0; i < len; i++) { Node childNode = childNodes.item(i); printInternal(childNode, false); } break; } // handle entity reference nodes case Node.ENTITY_REFERENCE_NODE: { if (canonical) { NodeList children = node.getChildNodes(); if (children != null) { int len = children.getLength(); for (int i = 0; i < len; i++) { printInternal(children.item(i), false); } } } else { out.print('&'); out.print(nodeName); out.print(';'); } break; } // print cdata sections case Node.CDATA_SECTION_NODE: { if (canonical) { out.print(normalize(node.getNodeValue())); } else { out.print("<![CDATA["); out.print(node.getNodeValue()); out.print("]]>"); } break; } // print text case Node.TEXT_NODE: { String text = normalize(node.getNodeValue()); if (prettyprint == false || text.trim().length() > 0) out.print(text); break; } // print processing instruction case Node.PROCESSING_INSTRUCTION_NODE: { out.print("<?"); out.print(nodeName); String data = node.getNodeValue(); if (data != null && data.length() > 0) { out.print(' '); out.print(data); } out.print("?>"); break; } // print comment case Node.COMMENT_NODE: { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } out.print("<!--"); String data = node.getNodeValue(); if (data != null) { out.print(data); } out.print("-->"); if (prettyprint) { out.print('\n'); } break; } } if (type == Node.ELEMENT_NODE) { if (prettyprint) prettyIndent--; if (hasChildNodes == false) { out.print("/>"); } else { if (indentEndMarker) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } } out.print("</"); out.print(nodeName); out.print('>'); } if (prettyIndent > 0) { out.print('\n'); } } out.flush(); }
| 1,118,045
|
private void printInternal(Node node, boolean indentEndMarker) { // is there anything to do? if (node == null) { return; } // JBAS-2117 - Don't skip the DOCUMENT_NODE // if (node instanceof Document) node = ((Document)node).getDocumentElement(); if (wroteXMLDeclaration == false && writeXMLDeclaration == true && canonical == false) { out.print("<?xml version='1.0'"); if (charsetName != null) out.print(" encoding='" + charsetName + "'"); out.println("?>"); wroteXMLDeclaration = true; } int type = node.getNodeType(); boolean hasChildNodes = node.getChildNodes().getLength() > 0; String nodeName = node.getNodeName(); switch (type) { // print document case Node.DOCUMENT_NODE: { NodeList children = node.getChildNodes(); for (int iChild = 0; iChild < children.getLength(); iChild++) { printInternal(children.item(iChild), false); } out.flush(); break; } // print element with attributes case Node.ELEMENT_NODE: { Element element = (Element)node; if (prettyprint) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } prettyIndent++; } out.print('<'); out.print(nodeName); String prefix = node.getPrefix(); String nsURI = (prefix != null ? getNamespaceURI(prefix, element, rootNode) : null); Attr attrs[] = sortAttributes(node.getAttributes()); for (int i = 0; i < attrs.length; i++) { Attr attr = attrs[i]; String attrName = attr.getNodeName(); String attrValue = normalize(attr.getNodeValue()); if (prefix != null && attrName.equals("xmlns:" + prefix)) nsURI = attrValue; out.print(" " + attrName + "='" + attrValue + "'"); } // Add missing namespace declaration if (prefix != null && nsURI == null) { nsURI = getNamespaceURI(prefix, element, null); out.print(" xmlns:" + prefix + "='" + nsURI + "'"); } if (hasChildNodes) { out.print('>'); } // Find out if the end marker is indented indentEndMarker = isEndMarkerIndented(node); if (indentEndMarker) { out.print('\n'); } NodeList childNodes = node.getChildNodes(); int len = childNodes.getLength(); for (int i = 0; i < len; i++) { Node childNode = childNodes.item(i); printInternal(childNode, false); } break; } // handle entity reference nodes case Node.ENTITY_REFERENCE_NODE: { if (canonical) { NodeList children = node.getChildNodes(); if (children != null) { int len = children.getLength(); for (int i = 0; i < len; i++) { printInternal(children.item(i), false); } } } else { out.print('&'); out.print(nodeName); out.print(';'); } break; } // print cdata sections case Node.CDATA_SECTION_NODE: { if (canonical) { out.print(normalize(node.getNodeValue())); } else { out.print("<![CDATA["); out.print(node.getNodeValue()); out.print("]]>"); } break; } // print text case Node.TEXT_NODE: { String text = normalize(node.getNodeValue()); if (prettyprint == false || text.trim().length() > 0) out.print(text); break; } // print processing instruction case Node.PROCESSING_INSTRUCTION_NODE: { out.print("<?"); out.print(nodeName); String data = node.getNodeValue(); if (data != null && data.length() > 0) { out.print(' '); out.print(data); } out.print("?>"); break; } // print comment case Node.COMMENT_NODE: { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } out.print("<!--"); String data = node.getNodeValue(); if (data != null) { out.print(data); } out.print("-->"); if (prettyprint) { out.print('\n'); } break; } } if (type == Node.ELEMENT_NODE) { if (prettyprint) prettyIndent--; if (hasChildNodes == false) { out.print("/>"); } else { if (indentEndMarker) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } } out.print("</"); out.print(nodeName); out.print('>'); } if (prettyIndent > 0) { out.print('\n'); } } out.flush(); }
|
private void printInternal(Node node, boolean indentEndMarker) { // is there anything to do? if (node == null) { return; } // JBAS-2117 - Don't skip the DOCUMENT_NODE // if (node instanceof Document) node = ((Document)node).getDocumentElement(); if (wroteXMLDeclaration == false && writeXMLDeclaration == true && canonical == false) { out.print("<?xml version='1.0'"); if (charsetName != null) out.print(" encoding='" + charsetName + "'"); out.println("?>"); wroteXMLDeclaration = true; } int type = node.getNodeType(); boolean hasChildNodes = node.getChildNodes().getLength() > 0; String nodeName = node.getNodeName(); switch (type) { // print document case Node.DOCUMENT_NODE: { NodeList children = node.getChildNodes(); for (int iChild = 0; iChild < children.getLength(); iChild++) { printInternal(children.item(iChild), false); } out.flush(); break; } // print element with attributes case Node.ELEMENT_NODE: { Element element = (Element)node; if (prettyprint) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } prettyIndent++; } out.print('<'); out.print(nodeName); String prefix = node.getPrefix(); String nsURI = (prefix != null ? getNamespaceURI(prefix, element, rootNode) : null); Attr attrs[] = sortAttributes(node.getAttributes()); for (int i = 0; i < attrs.length; i++) { Attr attr = attrs[i]; String attrName = attr.getNodeName(); String attrValue = normalize(attr.getNodeValue()); if (prefix != null && attrName.equals("xmlns:" + prefix)) nsURI = attrValue; out.print(" " + attrName + "='" + attrValue + "'"); } // Add missing namespace declaration if (prefix != null && nsURI == null) { nsURI = getNamespaceURI(prefix, element, null); out.print(" xmlns:" + prefix + "='" + nsURI + "'"); } if (hasChildNodes) { out.print('>'); } // Find out if the end marker is indented indentEndMarker = isEndMarkerIndented(node); if (indentEndMarker) { out.print('\n'); } NodeList childNodes = node.getChildNodes(); int len = childNodes.getLength(); for (int i = 0; i < len; i++) { Node childNode = childNodes.item(i); printInternal(childNode, false); } break; } // handle entity reference nodes case Node.ENTITY_REFERENCE_NODE: { if (canonical) { NodeList children = node.getChildNodes(); if (children != null) { int len = children.getLength(); for (int i = 0; i < len; i++) { printInternal(children.item(i), false); } } } else { out.print('&'); out.print(nodeName); out.print(';'); } break; } // print cdata sections case Node.CDATA_SECTION_NODE: { if (canonical) { out.print(normalize(node.getNodeValue())); } else { out.print("<![CDATA["); out.print(node.getNodeValue()); out.print("]]>"); } break; } // print text case Node.TEXT_NODE: { String text = normalize(node.getNodeValue()); if (prettyprint == false || text.trim().length() > 0) out.print(text); break; } // print processing instruction case Node.PROCESSING_INSTRUCTION_NODE: { out.print("<?"); out.print(nodeName); String data = node.getNodeValue(); if (data != null && data.length() > 0) { out.print(' '); out.print(data); } out.print("?>"); break; } // print comment case Node.COMMENT_NODE: { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } out.print("<!--"); String data = node.getNodeValue(); if (data != null) { out.print(data); } out.print("-->"); if (prettyprint) { out.print('\n'); } break; } } if (type == Node.ELEMENT_NODE) { if (prettyprint) prettyIndent--; if (hasChildNodes == false) { out.print("/>"); } else { if (indentEndMarker) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } } out.print("</"); out.print(nodeName); out.print('>'); } if (prettyIndent > 0) { out.print('\n'); } } out.flush(); }
| 1,118,046
|
private void printInternal(Node node, boolean indentEndMarker) { // is there anything to do? if (node == null) { return; } // JBAS-2117 - Don't skip the DOCUMENT_NODE // if (node instanceof Document) node = ((Document)node).getDocumentElement(); if (wroteXMLDeclaration == false && writeXMLDeclaration == true && canonical == false) { out.print("<?xml version='1.0'"); if (charsetName != null) out.print(" encoding='" + charsetName + "'"); out.println("?>"); wroteXMLDeclaration = true; } int type = node.getNodeType(); boolean hasChildNodes = node.getChildNodes().getLength() > 0; String nodeName = node.getNodeName(); switch (type) { // print document case Node.DOCUMENT_NODE: { NodeList children = node.getChildNodes(); for (int iChild = 0; iChild < children.getLength(); iChild++) { printInternal(children.item(iChild), false); } out.flush(); break; } // print element with attributes case Node.ELEMENT_NODE: { Element element = (Element)node; if (prettyprint) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } prettyIndent++; } out.print('<'); out.print(nodeName); String prefix = node.getPrefix(); String nsURI = (prefix != null ? getNamespaceURI(prefix, element, rootNode) : null); Attr attrs[] = sortAttributes(node.getAttributes()); for (int i = 0; i < attrs.length; i++) { Attr attr = attrs[i]; String attrName = attr.getNodeName(); String attrValue = normalize(attr.getNodeValue()); if (prefix != null && attrName.equals("xmlns:" + prefix)) nsURI = attrValue; out.print(" " + attrName + "='" + attrValue + "'"); } // Add missing namespace declaration if (prefix != null && nsURI == null) { nsURI = getNamespaceURI(prefix, element, null); out.print(" xmlns:" + prefix + "='" + nsURI + "'"); } if (hasChildNodes) { out.print('>'); } // Find out if the end marker is indented indentEndMarker = isEndMarkerIndented(node); if (indentEndMarker) { out.print('\n'); } NodeList childNodes = node.getChildNodes(); int len = childNodes.getLength(); for (int i = 0; i < len; i++) { Node childNode = childNodes.item(i); printInternal(childNode, false); } break; } // handle entity reference nodes case Node.ENTITY_REFERENCE_NODE: { if (canonical) { NodeList children = node.getChildNodes(); if (children != null) { int len = children.getLength(); for (int i = 0; i < len; i++) { printInternal(children.item(i), false); } } } else { out.print('&'); out.print(nodeName); out.print(';'); } break; } // print cdata sections case Node.CDATA_SECTION_NODE: { if (canonical) { out.print(normalize(node.getNodeValue())); } else { out.print("<![CDATA["); out.print(node.getNodeValue()); out.print("]]>"); } break; } // print text case Node.TEXT_NODE: { String text = normalize(node.getNodeValue()); if (prettyprint == false || text.trim().length() > 0) out.print(text); break; } // print processing instruction case Node.PROCESSING_INSTRUCTION_NODE: { out.print("<?"); out.print(nodeName); String data = node.getNodeValue(); if (data != null && data.length() > 0) { out.print(' '); out.print(data); } out.print("?>"); break; } // print comment case Node.COMMENT_NODE: { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } out.print("<!--"); String data = node.getNodeValue(); if (data != null) { out.print(data); } out.print("-->"); if (prettyprint) { out.print('\n'); } break; } } if (type == Node.ELEMENT_NODE) { if (prettyprint) prettyIndent--; if (hasChildNodes == false) { out.print("/>"); } else { if (indentEndMarker) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } } out.print("</"); out.print(nodeName); out.print('>'); } if (prettyIndent > 0) { out.print('\n'); } } out.flush(); }
|
private void printInternal(Node node, boolean indentEndMarker) { // is there anything to do? if (node == null) { return; } // JBAS-2117 - Don't skip the DOCUMENT_NODE // if (node instanceof Document) node = ((Document)node).getDocumentElement(); if (wroteXMLDeclaration == false && writeXMLDeclaration == true && canonical == false) { out.print("<?xml version='1.0'"); if (charsetName != null) out.print(" encoding='" + charsetName + "'"); out.println("?>"); wroteXMLDeclaration = true; } int type = node.getNodeType(); boolean hasChildNodes = node.getChildNodes().getLength() > 0; String nodeName = node.getNodeName(); switch (type) { // print document case Node.DOCUMENT_NODE: { NodeList children = node.getChildNodes(); for (int iChild = 0; iChild < children.getLength(); iChild++) { printInternal(children.item(iChild), false); } out.flush(); break; } // print element with attributes case Node.ELEMENT_NODE: { Element element = (Element)node; if (prettyprint) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } prettyIndent++; } out.print('<'); out.print(nodeName); String prefix = node.getPrefix(); String nsURI = (prefix != null ? getNamespaceURI(prefix, element, rootNode) : null); Attr attrs[] = sortAttributes(node.getAttributes()); for (int i = 0; i < attrs.length; i++) { Attr attr = attrs[i]; String attrName = attr.getNodeName(); String attrValue = normalize(attr.getNodeValue()); if (prefix != null && attrName.equals("xmlns:" + prefix)) nsURI = attrValue; out.print(" " + atName + "='" + atValue + "'"); } // Add missing namespace declaration if (prefix != null && nsURI == null) { nsURI = getNamespaceURI(prefix, element, null); out.print(" xmlns:" + prefix + "='" + nsURI + "'"); } if (hasChildNodes) { out.print('>'); } // Find out if the end marker is indented indentEndMarker = isEndMarkerIndented(node); if (indentEndMarker) { out.print('\n'); } NodeList childNodes = node.getChildNodes(); int len = childNodes.getLength(); for (int i = 0; i < len; i++) { Node childNode = childNodes.item(i); printInternal(childNode, false); } break; } // handle entity reference nodes case Node.ENTITY_REFERENCE_NODE: { if (canonical) { NodeList children = node.getChildNodes(); if (children != null) { int len = children.getLength(); for (int i = 0; i < len; i++) { printInternal(children.item(i), false); } } } else { out.print('&'); out.print(nodeName); out.print(';'); } break; } // print cdata sections case Node.CDATA_SECTION_NODE: { if (canonical) { out.print(normalize(node.getNodeValue())); } else { out.print("<![CDATA["); out.print(node.getNodeValue()); out.print("]]>"); } break; } // print text case Node.TEXT_NODE: { String text = normalize(node.getNodeValue()); if (prettyprint == false || text.trim().length() > 0) out.print(text); break; } // print processing instruction case Node.PROCESSING_INSTRUCTION_NODE: { out.print("<?"); out.print(nodeName); String data = node.getNodeValue(); if (data != null && data.length() > 0) { out.print(' '); out.print(data); } out.print("?>"); break; } // print comment case Node.COMMENT_NODE: { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } out.print("<!--"); String data = node.getNodeValue(); if (data != null) { out.print(data); } out.print("-->"); if (prettyprint) { out.print('\n'); } break; } } if (type == Node.ELEMENT_NODE) { if (prettyprint) prettyIndent--; if (hasChildNodes == false) { out.print("/>"); } else { if (indentEndMarker) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } } out.print("</"); out.print(nodeName); out.print('>'); } if (prettyIndent > 0) { out.print('\n'); } } out.flush(); }
| 1,118,047
|
private void printInternal(Node node, boolean indentEndMarker) { // is there anything to do? if (node == null) { return; } // JBAS-2117 - Don't skip the DOCUMENT_NODE // if (node instanceof Document) node = ((Document)node).getDocumentElement(); if (wroteXMLDeclaration == false && writeXMLDeclaration == true && canonical == false) { out.print("<?xml version='1.0'"); if (charsetName != null) out.print(" encoding='" + charsetName + "'"); out.println("?>"); wroteXMLDeclaration = true; } int type = node.getNodeType(); boolean hasChildNodes = node.getChildNodes().getLength() > 0; String nodeName = node.getNodeName(); switch (type) { // print document case Node.DOCUMENT_NODE: { NodeList children = node.getChildNodes(); for (int iChild = 0; iChild < children.getLength(); iChild++) { printInternal(children.item(iChild), false); } out.flush(); break; } // print element with attributes case Node.ELEMENT_NODE: { Element element = (Element)node; if (prettyprint) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } prettyIndent++; } out.print('<'); out.print(nodeName); String prefix = node.getPrefix(); String nsURI = (prefix != null ? getNamespaceURI(prefix, element, rootNode) : null); Attr attrs[] = sortAttributes(node.getAttributes()); for (int i = 0; i < attrs.length; i++) { Attr attr = attrs[i]; String attrName = attr.getNodeName(); String attrValue = normalize(attr.getNodeValue()); if (prefix != null && attrName.equals("xmlns:" + prefix)) nsURI = attrValue; out.print(" " + attrName + "='" + attrValue + "'"); } // Add missing namespace declaration if (prefix != null && nsURI == null) { nsURI = getNamespaceURI(prefix, element, null); out.print(" xmlns:" + prefix + "='" + nsURI + "'"); } if (hasChildNodes) { out.print('>'); } // Find out if the end marker is indented indentEndMarker = isEndMarkerIndented(node); if (indentEndMarker) { out.print('\n'); } NodeList childNodes = node.getChildNodes(); int len = childNodes.getLength(); for (int i = 0; i < len; i++) { Node childNode = childNodes.item(i); printInternal(childNode, false); } break; } // handle entity reference nodes case Node.ENTITY_REFERENCE_NODE: { if (canonical) { NodeList children = node.getChildNodes(); if (children != null) { int len = children.getLength(); for (int i = 0; i < len; i++) { printInternal(children.item(i), false); } } } else { out.print('&'); out.print(nodeName); out.print(';'); } break; } // print cdata sections case Node.CDATA_SECTION_NODE: { if (canonical) { out.print(normalize(node.getNodeValue())); } else { out.print("<![CDATA["); out.print(node.getNodeValue()); out.print("]]>"); } break; } // print text case Node.TEXT_NODE: { String text = normalize(node.getNodeValue()); if (prettyprint == false || text.trim().length() > 0) out.print(text); break; } // print processing instruction case Node.PROCESSING_INSTRUCTION_NODE: { out.print("<?"); out.print(nodeName); String data = node.getNodeValue(); if (data != null && data.length() > 0) { out.print(' '); out.print(data); } out.print("?>"); break; } // print comment case Node.COMMENT_NODE: { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } out.print("<!--"); String data = node.getNodeValue(); if (data != null) { out.print(data); } out.print("-->"); if (prettyprint) { out.print('\n'); } break; } } if (type == Node.ELEMENT_NODE) { if (prettyprint) prettyIndent--; if (hasChildNodes == false) { out.print("/>"); } else { if (indentEndMarker) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } } out.print("</"); out.print(nodeName); out.print('>'); } if (prettyIndent > 0) { out.print('\n'); } } out.flush(); }
|
private void printInternal(Node node, boolean indentEndMarker) { // is there anything to do? if (node == null) { return; } // JBAS-2117 - Don't skip the DOCUMENT_NODE // if (node instanceof Document) node = ((Document)node).getDocumentElement(); if (wroteXMLDeclaration == false && writeXMLDeclaration == true && canonical == false) { out.print("<?xml version='1.0'"); if (charsetName != null) out.print(" encoding='" + charsetName + "'"); out.println("?>"); wroteXMLDeclaration = true; } int type = node.getNodeType(); boolean hasChildNodes = node.getChildNodes().getLength() > 0; String nodeName = node.getNodeName(); switch (type) { // print document case Node.DOCUMENT_NODE: { NodeList children = node.getChildNodes(); for (int iChild = 0; iChild < children.getLength(); iChild++) { printInternal(children.item(iChild), false); } out.flush(); break; } // print element with attributes case Node.ELEMENT_NODE: { Element element = (Element)node; if (prettyprint) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } prettyIndent++; } out.print('<'); out.print(nodeName); String prefix = node.getPrefix(); String nsURI = (prefix != null ? getNamespaceURI(prefix, element, rootNode) : null); Attr attrs[] = sortAttributes(node.getAttributes()); for (int i = 0; i < attrs.length; i++) { Attr attr = attrs[i]; String attrName = attr.getNodeName(); String attrValue = normalize(attr.getNodeValue()); if (prefix != null && attrName.equals("xmlns:" + prefix)) nsURI = attrValue; out.print(" " + attrName + "='" + attrValue + "'"); } // Add missing namespace declaration if (prefix != null && nsURI == null) { nsURI = getNamespaceURI(prefix, element, null); out.print(" xmlns:" + prefix + "='" + nsURI + "'"); } if (hasChildNodes) { out.print('>'); } // Find out if the end marker is indented indentEndMarker = isEndMarkerIndented(node); if (indentEndMarker) { out.print('\n'); } NodeList childNodes = node.getChildNodes(); int len = childNodes.getLength(); for (int i = 0; i < len; i++) { Node childNode = childNodes.item(i); printInternal(childNode, false); } break; } // handle entity reference nodes case Node.ENTITY_REFERENCE_NODE: { if (canonical) { NodeList children = node.getChildNodes(); if (children != null) { int len = children.getLength(); for (int i = 0; i < len; i++) { printInternal(children.item(i), false); } } } else { out.print('&'); out.print(nodeName); out.print(';'); } break; } // print cdata sections case Node.CDATA_SECTION_NODE: { if (canonical) { out.print(normalize(node.getNodeValue())); } else { out.print("<![CDATA["); out.print(node.getNodeValue()); out.print("]]>"); } break; } // print text case Node.TEXT_NODE: { String text = normalize(node.getNodeValue()); if (prettyprint == false || text.trim().length() > 0) out.print(text); break; } // print processing instruction case Node.PROCESSING_INSTRUCTION_NODE: { out.print("<?"); out.print(nodeName); String data = node.getNodeValue(); if (data != null && data.length() > 0) { out.print(' '); out.print(data); } out.print("?>"); break; } // print comment case Node.COMMENT_NODE: { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } out.print("<!--"); String data = node.getNodeValue(); if (data != null) { out.print(data); } out.print("-->"); if (prettyprint) { out.print('\n'); } break; } } if (type == Node.ELEMENT_NODE) { if (prettyprint) prettyIndent--; if (hasChildNodes == false) { out.print("/>"); } else { if (indentEndMarker) { for (int i = 0; i < prettyIndent; i++) { out.print(' '); } } out.print("</"); out.print(nodeName); out.print('>'); } if (prettyIndent > 0) { out.print('\n'); } } out.flush(); }
| 1,118,048
|
public JDBCNetwork(Connection conn) throws SQLException{ this(conn, new JDBCTime(conn)); }
|
public JDBCNetwork(Connection conn) throws SQLException{ this(conn, new JDBCTime(conn)); }
| 1,118,049
|
protected double binarySum(int start, int finish) { if (iSeries != null) { return iBinarySum(start, finish); } // end of if (iSeries != null) if (fSeries != null) { return fBinarySum(start, finish); } // end of if (iSeries != null) return 0; }
|
protected double binarySum(int start, int finish) { if (iSeries != null) { return iBinarySum(start, finish); } if (dSeries != null) { return dBinarySum(start, finish); } // end of if (iSeries != null) if (fSeries != null) { return fBinarySum(start, finish); } if (dSeries != null) { return dBinarySum(start, finish); } // end of if (iSeries != null) return 0; } if (dSeries != null) { return dBinarySum(start, finish); }
| 1,118,050
|
public static String getDayName(Date val, Locale loc) { Formatters fmt = getFormatters(loc); synchronized (fmt) { return fmt.dayFormatter.format(val); } }
|
public static String getDayName(Date val, Locale loc) { Formatters fmt = getFormatters(loc); synchronized (fmt) { return fmt.dayFormatter.format(val); } }
| 1,118,057
|
public boolean isFurtherThan(DataSetSeismogram seismo){ try{ Location eventLoc = ((XMLDataSet)dataSet).getEvent().get_preferred_origin().my_location; Location seisLoc = ((XMLDataSet)dataSet).getChannel(seis.channel_id).my_site.my_location; Location seismoLoc = ((XMLDataSet)seismo.getDataSet()).getChannel(seismo.getSeismogram().channel_id).my_site.my_location; if(SphericalCoords.distance(eventLoc.latitude, eventLoc.longitude, seisLoc.latitude, seisLoc.longitude) < SphericalCoords.distance(eventLoc.latitude, eventLoc.longitude, seismoLoc.latitude, seismoLoc.longitude)) return true; return false; }catch(Exception e){} return true; }
|
public boolean isFurtherThan(DataSetSeismogram seismo){ try{ Location eventLoc = ((XMLDataSet)dataSet).getEvent().get_preferred_origin().my_location; Location seisLoc = ((XMLDataSet)dataSet).getChannel(seis.channel_id).my_site.my_location; Location seismoLoc = ((XMLDataSet)seismo.getDataSet()).getChannel(seismo.getSeismogram().channel_id).my_site.my_location; if(SphericalCoords.distance(eventLoc.latitude, eventLoc.longitude, seisLoc.latitude, seisLoc.longitude) < SphericalCoords.distance(eventLoc.latitude, eventLoc.longitude, seismoLoc.latitude, seismoLoc.longitude)){ Date endDistance = new Date(); interval = endDistance.getTime() - beginDistance.getTime(); System.out.println("distance calc:" + interval + "ms"); return true; return false; }catch(Exception e){} return true; }
| 1,118,058
|
public boolean isFurtherThan(DataSetSeismogram seismo){ try{ Location eventLoc = ((XMLDataSet)dataSet).getEvent().get_preferred_origin().my_location; Location seisLoc = ((XMLDataSet)dataSet).getChannel(seis.channel_id).my_site.my_location; Location seismoLoc = ((XMLDataSet)seismo.getDataSet()).getChannel(seismo.getSeismogram().channel_id).my_site.my_location; if(SphericalCoords.distance(eventLoc.latitude, eventLoc.longitude, seisLoc.latitude, seisLoc.longitude) < SphericalCoords.distance(eventLoc.latitude, eventLoc.longitude, seismoLoc.latitude, seismoLoc.longitude)) return true; return false; }catch(Exception e){} return true; }
|
public boolean isFurtherThan(DataSetSeismogram seismo){ try{ Location eventLoc = ((XMLDataSet)dataSet).getEvent().get_preferred_origin().my_location; Location seisLoc = ((XMLDataSet)dataSet).getChannel(seis.channel_id).my_site.my_location; Location seismoLoc = ((XMLDataSet)seismo.getDataSet()).getChannel(seismo.getSeismogram().channel_id).my_site.my_location; if(SphericalCoords.distance(eventLoc.latitude, eventLoc.longitude, seisLoc.latitude, seisLoc.longitude) < SphericalCoords.distance(eventLoc.latitude, eventLoc.longitude, seismoLoc.latitude, seismoLoc.longitude)) return true; return false; }catch(Exception e){ e.printStackTrace(); } return true; }
| 1,118,059
|
public void actionPerformed(ActionEvent e) { Main.getMainFrame().lobby.append(this.getText() + "\n"); doAction(); }
|
public void actionPerformed(ActionEvent e) { Main.getMainFrame().lobby.append("Menu command: " + this.getText() + "\n"); doAction(); }
| 1,118,061
|
public static DataSetSeismogram[] addSuffix(DataSetSeismogram[] dss, String suffix){ DataSetSeismogram[] suffixedDss = new DataSetSeismogram[dss.length]; for(int i = 0; i < dss.length; i++){ suffixedDss[i] = new DataSetSeismogram(dss[i], dss[i].toString() + suffix); } return suffixedDss; }
|
public static DataSetSeismogram[] addSuffix(DataSetSeismogram[] dss, String suffix){ DataSetSeismogram[] suffixedDss = new DataSetSeismogram[dss.length]; for(int i = 0; i < dss.length; i++){ dss[i].setName(dss[i].getName() + suffix); } return suffixedDss; }
| 1,118,062
|
public static DataSetSeismogram[] addSuffix(DataSetSeismogram[] dss, String suffix){ DataSetSeismogram[] suffixedDss = new DataSetSeismogram[dss.length]; for(int i = 0; i < dss.length; i++){ suffixedDss[i] = new DataSetSeismogram(dss[i], dss[i].toString() + suffix); } return suffixedDss; }
|
public static DataSetSeismogram[] addSuffix(DataSetSeismogram[] dss, String suffix){ DataSetSeismogram[] suffixedDss = new DataSetSeismogram[dss.length]; for(int i = 0; i < dss.length; i++){ suffixedDss[i] = new DataSetSeismogram(dss[i], dss[i].toString() + suffix); } return dss; }
| 1,118,063
|
public void renderToGraphics(Graphics g, Dimension size){ JFrame frame = null; try { if(getRootPane() == null){ frame = new JFrame(); frame.getContentPane().add(this); frame.pack(); } Dimension curSize = getSize(); setSize(size); validate(); print(g); setSize(curSize); validate(); } finally { if (frame != null) frame.dispose(); } }
|
public void renderToGraphics(Graphics g, Dimension size){ JFrame frame = null; try { if(getRootPane() == null){ frame = new JFrame(); frame.getContentPane().add(this); frame.pack(); } Dimension curSize = getSize(); setSize(size); validate(); print(g); setSize(curSize); validate(); } finally { if (frame != null) frame.dispose(); } }
| 1,118,064
|
public MainPanel(final AudioPlayer owner) { super(new BorderLayout()); this.owner = owner; playlist.setPlayAll(Configuration.isPlayAll()); playlist.setShuffle(Configuration.isShuffle()); playlist.addListener(new IPlaylistListener() { public void playbackStarted(Player player) { URL url = player.getResource(); updatePlayingLabel(url); updateAppletTooltip(url); ListItem comp = (ListItem)list.getListElement(url); if (comp != null) { comp.update(true); } list.scrollToPlayingURL(); } public void playbackStopped(Player player) { playbackFailed(player); } public void playbackCompleted(Player player) { playbackFailed(player); } public void playbackFailed(Player player) { updatePlayingLabel(null); updateAppletTooltip(null); if (player != null) { URL url = player.getResource(); if (url != null) { ListItem comp = (ListItem)list.getListElement(url); if (comp != null) { comp.update(false); } } } } }); JButton addFile = new JButton(Messages.getString("MainPanel.ADD_FILE")); //$NON-NLS-1$ addFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setMultiSelectionEnabled(true); fileChooser.setCurrentDirectory(Configuration.getLastFile()); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory() || Util.isAudioFile(f); } public String getDescription() { return Messages.getString("MainPanel.DOT_MP3_FILES"); //$NON-NLS-1$ } }); int ret = fileChooser.showOpenDialog(owner.getPanelInstance()); if (ret == JFileChooser.APPROVE_OPTION) { File[] f = fileChooser.getSelectedFiles(); if (f != null && f.length > 0) { playlist.addElements(f); Configuration.setLastFile(f[0]); } } } }); JButton addDir = new JButton(Messages.getString("MainPanel.ADD_DIR")); //$NON-NLS-1$ addDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setMultiSelectionEnabled(true); fileChooser.setCurrentDirectory(Configuration.getLastDirectory()); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory(); } public String getDescription() { return Messages.getString("MainPanel.DIRECTORIES"); //$NON-NLS-1$ } }); int ret = fileChooser.showOpenDialog(owner.getPanelInstance()); if (ret == JFileChooser.APPROVE_OPTION) { File[] f = fileChooser.getSelectedFiles(); for (int i = 0; i < f.length; i++) { playlist.addDirectory(f[i]); } if (f.length > 0) { Configuration.setLastDirectory(f[0]); } } } }); JButton addURL = new JButton(Messages.getString("MainPanel.ADD_URL")); //$NON-NLS-1$ addURL.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = JOptionPane.showInputDialog(owner.getPanelInstance(), Messages.getString("MainPanel.INPUT_URL")); if (s != null) { try { URL url = new URL(s); playlist.addElement(url); } catch (Exception exc) { ExceptionDialog.show(exc); } } } }); JButton delAll = new JButton(Messages.getString("MainPanel.DELETE_ALL")); //$NON-NLS-1$ delAll.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { playlist.removeAll(); } }); JPanel p, sub; p = new JPanel(new GridLayout(2, 0)); sub = new JPanel(); sub.add(addFile); sub.add(addDir); sub.add(addURL); sub.add(delAll); p.add(sub); updatePlayingLabel(null); updateAppletTooltip(null); p.add(playingLabel); add(p, BorderLayout.NORTH); JScrollPane scrollPane = new JScrollPane(list); add(scrollPane, BorderLayout.CENTER); p = new JPanel(new GridLayout(2, 0)); sub = new JPanel(new BorderLayout()); sub.add(new JLabel(Messages.getString("MainPanel.SEARCH") +":"), BorderLayout.WEST); //$NON-NLS-1$ //$NON-NLS-2$ sub.add(searchField, BorderLayout.CENTER); searchField.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_DOWN) { if (playlist.getSize() > 0) { list.requestFocus(); list.setSelectedIndex(0); } } } public void keyTyped(KeyEvent e) { } public void keyReleased(KeyEvent e) { if (Configuration.isSearchDirectly()) { String query = searchField.getText(); if (query == null) { query = ""; } playlist.filter(query); } } }); searchField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String query = searchField.getText(); if (query == null) { query = ""; } playlist.filter(query); playlist.play(0); } }); JButton resetButton = new JButton(Messages.getString("MainPanel.RESETBUTTON")); //$NON-NLS-1$ resetButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { searchField.setText(""); playlist.filter(""); } }); RightClickMenu.addRightClickMenu(searchField); sub.add(resetButton, BorderLayout.EAST); p.add(sub); p.add(new ControlPanel(owner)); add(p, BorderLayout.SOUTH); }
|
public MainPanel(final AudioPlayer owner) { super(new BorderLayout()); this.owner = owner; playlist.setPlayAll(Configuration.isPlayAll()); playlist.setShuffle(Configuration.isShuffle()); playlist.addListener(new IPlaylistListener() { public void playbackStarted(Player player) { URL url = player.getResource(); updatePlayingLabel(url); updateAppletTooltip(url); ListItem comp = (ListItem)list.getListElement(url); if (comp != null) { comp.update(true); } list.scrollToPlayingURL(); } public void playbackStopped(Player player) { playbackFailed(player); } public void playbackCompleted(Player player) { playbackFailed(player); } public void playbackFailed(Player player) { updatePlayingLabel(null); updateAppletTooltip(null); if (player != null) { URL url = player.getResource(); if (url != null) { ListItem comp = (ListItem)list.getListElement(url); if (comp != null) { comp.update(false); } } } } }); JButton addFile = new JButton(Messages.getString("MainPanel.ADD_FILE")); //$NON-NLS-1$ addFile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setMultiSelectionEnabled(true); fileChooser.setCurrentDirectory(Configuration.getLastFile()); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory() || Util.isAudioFile(f); } public String getDescription() { return Messages.getString("MainPanel.DOT_MP3_FILES"); //$NON-NLS-1$ } }); int ret = fileChooser.showOpenDialog(owner.getPanelInstance()); if (ret == JFileChooser.APPROVE_OPTION) { File[] f = fileChooser.getSelectedFiles(); if (f != null && f.length > 0) { playlist.addElements(f); Configuration.setLastFile(f[0]); } } } }); JButton addDir = new JButton(Messages.getString("MainPanel.ADD_DIR")); //$NON-NLS-1$ addDir.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setMultiSelectionEnabled(true); fileChooser.setSelectedFile(Configuration.getLastDirectory()); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory(); } public String getDescription() { return Messages.getString("MainPanel.DIRECTORIES"); //$NON-NLS-1$ } }); int ret = fileChooser.showOpenDialog(owner.getPanelInstance()); if (ret == JFileChooser.APPROVE_OPTION) { File[] f = fileChooser.getSelectedFiles(); for (int i = 0; i < f.length; i++) { playlist.addDirectory(f[i]); } if (f.length > 0) { Configuration.setLastDirectory(f[0]); } } } }); JButton addURL = new JButton(Messages.getString("MainPanel.ADD_URL")); //$NON-NLS-1$ addURL.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String s = JOptionPane.showInputDialog(owner.getPanelInstance(), Messages.getString("MainPanel.INPUT_URL")); if (s != null) { try { URL url = new URL(s); playlist.addElement(url); } catch (Exception exc) { ExceptionDialog.show(exc); } } } }); JButton delAll = new JButton(Messages.getString("MainPanel.DELETE_ALL")); //$NON-NLS-1$ delAll.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { playlist.removeAll(); } }); JPanel p, sub; p = new JPanel(new GridLayout(2, 0)); sub = new JPanel(); sub.add(addFile); sub.add(addDir); sub.add(addURL); sub.add(delAll); p.add(sub); updatePlayingLabel(null); updateAppletTooltip(null); p.add(playingLabel); add(p, BorderLayout.NORTH); JScrollPane scrollPane = new JScrollPane(list); add(scrollPane, BorderLayout.CENTER); p = new JPanel(new GridLayout(2, 0)); sub = new JPanel(new BorderLayout()); sub.add(new JLabel(Messages.getString("MainPanel.SEARCH") +":"), BorderLayout.WEST); //$NON-NLS-1$ //$NON-NLS-2$ sub.add(searchField, BorderLayout.CENTER); searchField.addKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_DOWN) { if (playlist.getSize() > 0) { list.requestFocus(); list.setSelectedIndex(0); } } } public void keyTyped(KeyEvent e) { } public void keyReleased(KeyEvent e) { if (Configuration.isSearchDirectly()) { String query = searchField.getText(); if (query == null) { query = ""; } playlist.filter(query); } } }); searchField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String query = searchField.getText(); if (query == null) { query = ""; } playlist.filter(query); playlist.play(0); } }); JButton resetButton = new JButton(Messages.getString("MainPanel.RESETBUTTON")); //$NON-NLS-1$ resetButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { searchField.setText(""); playlist.filter(""); } }); RightClickMenu.addRightClickMenu(searchField); sub.add(resetButton, BorderLayout.EAST); p.add(sub); p.add(new ControlPanel(owner)); add(p, BorderLayout.SOUTH); }
| 1,118,065
|
public void actionPerformed(ActionEvent e) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setMultiSelectionEnabled(true); fileChooser.setCurrentDirectory(Configuration.getLastDirectory()); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory(); } public String getDescription() { return Messages.getString("MainPanel.DIRECTORIES"); //$NON-NLS-1$ } }); int ret = fileChooser.showOpenDialog(owner.getPanelInstance()); if (ret == JFileChooser.APPROVE_OPTION) { File[] f = fileChooser.getSelectedFiles(); for (int i = 0; i < f.length; i++) { playlist.addDirectory(f[i]); } if (f.length > 0) { Configuration.setLastDirectory(f[0]); } } }
|
public void actionPerformed(ActionEvent e) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setMultiSelectionEnabled(true); fileChooser.setSelectedFile(Configuration.getLastDirectory()); fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); fileChooser.setFileFilter(new FileFilter() { public boolean accept(File f) { return f.isDirectory(); } public String getDescription() { return Messages.getString("MainPanel.DIRECTORIES"); //$NON-NLS-1$ } }); int ret = fileChooser.showOpenDialog(owner.getPanelInstance()); if (ret == JFileChooser.APPROVE_OPTION) { File[] f = fileChooser.getSelectedFiles(); for (int i = 0; i < f.length; i++) { playlist.addDirectory(f[i]); } if (f.length > 0) { Configuration.setLastDirectory(f[0]); } } }
| 1,118,066
|
public void addElement(URL url) { int index = getSize(); addElementAt(index, url); }
|
public void addElement(URL url) { int index = getSize(); addElementAt(index, url); }
| 1,118,067
|
public synchronized void play(int index) { int size = getSize(); if (size == 0) { return; } else if (index < 0) { index = 0; } else if (index > size) { index %= size; } playingIndex = index; if (isPlaying()) { player.stop(); } try { final URL url = (URL)getElementAt(index); if (history.size() > HISTORY_SIZE) { history.removeFirst(); } history.addLast(url); /* * To avoid very much synchronizing, we do not directly manipulate the * class field "player". Instead, we firstly create a object "p" and set * "player" to this value. * Otherwise, later listener events would refer to the class field "player" * whose value might have changed already. (Then the events do not refer to * the correct Player object.) * Another way to work around this would be synchronizing, but this should * be faster, I think. */ final Player p = PlayerFactory.createPlayer(url); this.player = p; p.addListener(getPassthroughPlayerListener(player)); p.addListener(getConfigPlayerListener(player)); Thread thread = new Thread() { public void run() { try { p.play(); } catch (Exception exc) { exc.printStackTrace(); } } }; thread.setDaemon(true); thread.start(); } catch (Exception exc) { exc.printStackTrace(); firePlaybackFailed(player); } }
|
public synchronized void play(int index) { int size = getSize(); if (size == 0) { return; } else if (index < 0) { index = 0; } else if (index > size) { index %= size; } playingIndex = index; if (isPlaying()) { player.stop(); } try { final URL url = (URL)getElementAt(index); if (history.size() > HISTORY_SIZE) { history.removeFirst(); } history.addLast(url); /* * To avoid very much synchronizing, we do not directly manipulate the * class field "player". Instead, we firstly create a object "p" and set * "player" to this value. * Otherwise, later listener events would refer to the class field "player" * whose value might have changed already. (Then the events do not refer to * the correct Player object.) * Another way to work around this would be synchronizing, but this should * be faster, I think. */ final Player p = PlayerFactory.createPlayer(url); this.player = p; p.addListener(getPassthroughPlayerListener(player)); p.addListener(getConfigPlayerListener(player)); Thread thread = new Thread() { public void run() { try { p.play(); } catch (Exception exc) { exc.printStackTrace(); } } }; thread.setDaemon(true); thread.start(); } catch (Exception exc) { exc.printStackTrace(); firePlaybackFailed(player); } }
| 1,118,068
|
public synchronized void play(int index) { int size = getSize(); if (size == 0) { return; } else if (index < 0) { index = 0; } else if (index > size) { index %= size; } playingIndex = index; if (isPlaying()) { player.stop(); } try { final URL url = (URL)getElementAt(index); if (history.size() > HISTORY_SIZE) { history.removeFirst(); } history.addLast(url); /* * To avoid very much synchronizing, we do not directly manipulate the * class field "player". Instead, we firstly create a object "p" and set * "player" to this value. * Otherwise, later listener events would refer to the class field "player" * whose value might have changed already. (Then the events do not refer to * the correct Player object.) * Another way to work around this would be synchronizing, but this should * be faster, I think. */ final Player p = PlayerFactory.createPlayer(url); this.player = p; p.addListener(getPassthroughPlayerListener(player)); p.addListener(getConfigPlayerListener(player)); Thread thread = new Thread() { public void run() { try { p.play(); } catch (Exception exc) { exc.printStackTrace(); } } }; thread.setDaemon(true); thread.start(); } catch (Exception exc) { exc.printStackTrace(); firePlaybackFailed(player); } }
|
public synchronized void play(int index) { int size = getSize(); if (size == 0) { return; } else if (index < 0) { index = 0; } else if (index > size) { index %= size; } playingIndex = index; if (isPlaying()) { player.stop(); } try { final URL url = (URL)getElementAt(index); if (history.size() > HISTORY_SIZE) { history.removeFirst(); } history.addLast(url); /* * To avoid very much synchronizing, we do not directly manipulate the * class field "player". Instead, we firstly create a object "p" and set * "player" to this value. * Otherwise, later listener events would refer to the class field "player" * whose value might have changed already. (Then the events do not refer to * the correct Player object.) * Another way to work around this would be synchronizing, but this should * be faster, I think. */ final Player p = PlayerFactory.createPlayer(url); this.player = p; p.addListener(getPassthroughPlayerListener(player)); p.addListener(getConfigPlayerListener(player)); Thread thread = new Thread() { public void run() { try { p.play(); } catch (Exception exc) { exc.printStackTrace(); } } }; thread.setDaemon(true); thread.start(); } catch (Exception exc) { exc.printStackTrace(); firePlaybackFailed(player); } }
| 1,118,069
|
public Component getAppletInstance() { return null;//ctrlPanel; }
|
public Component getAppletInstance() { return ctrlPanel;//ctrlPanel; }
| 1,118,071
|
public void addDataSet(edu.sc.seis.fissuresUtil.xml.DataSet dataset, AuditInfo[] audit) { dataSetIdCache = null; if (dataset instanceof XMLDataSet) { XMLDataSet xds = (XMLDataSet)dataset; Element element = xds.getElement(); if (element.getOwnerDocument().equals(config.getOwnerDocument())) { config.appendChild(element); logger.debug("dataset append "+config.getChildNodes().getLength()); } else { // not from the same document, must clone Node copyNode = config.getOwnerDocument().importNode(element, true); config.appendChild(copyNode); logger.debug("dataset import "+config.getChildNodes().getLength()); NodeList nl = config.getChildNodes(); for (int i=0; i<nl.getLength(); i++) { logger.debug("node "+nl.item(i).getLocalName()); } // end of for (int i=0; i<nl.getLenght(); i++) } // end of else } else { logger.warn("Attempt to add non-XML dataset"); } // end of else }
|
public void addDataSet(edu.sc.seis.fissuresUtil.xml.DataSet dataset, AuditInfo[] audit) { dataSetIdCache = null; if (dataset instanceof XMLDataSet) { XMLDataSet xds = (XMLDataSet)dataset; Element element = xds.getElement(); if (element.getOwnerDocument().equals(config.getOwnerDocument())) { config.appendChild(element); } else { // not from the same document, must clone Node copyNode = config.getOwnerDocument().importNode(element, true); config.appendChild(copyNode); logger.debug("dataset import "+config.getChildNodes().getLength()); NodeList nl = config.getChildNodes(); for (int i=0; i<nl.getLength(); i++) { logger.debug("node "+nl.item(i).getLocalName()); } // end of for (int i=0; i<nl.getLenght(); i++) } // end of else } else { logger.warn("Attempt to add non-XML dataset"); } // end of else }
| 1,118,075
|
public void addDataSet(edu.sc.seis.fissuresUtil.xml.DataSet dataset, AuditInfo[] audit) { dataSetIdCache = null; if (dataset instanceof XMLDataSet) { XMLDataSet xds = (XMLDataSet)dataset; Element element = xds.getElement(); if (element.getOwnerDocument().equals(config.getOwnerDocument())) { config.appendChild(element); logger.debug("dataset append "+config.getChildNodes().getLength()); } else { // not from the same document, must clone Node copyNode = config.getOwnerDocument().importNode(element, true); config.appendChild(copyNode); logger.debug("dataset import "+config.getChildNodes().getLength()); NodeList nl = config.getChildNodes(); for (int i=0; i<nl.getLength(); i++) { logger.debug("node "+nl.item(i).getLocalName()); } // end of for (int i=0; i<nl.getLenght(); i++) } // end of else } else { logger.warn("Attempt to add non-XML dataset"); } // end of else }
|
public void addDataSet(edu.sc.seis.fissuresUtil.xml.DataSet dataset, AuditInfo[] audit) { dataSetIdCache = null; if (dataset instanceof XMLDataSet) { XMLDataSet xds = (XMLDataSet)dataset; Element element = xds.getElement(); if (element.getOwnerDocument().equals(config.getOwnerDocument())) { config.appendChild(element); logger.debug("dataset append "+config.getChildNodes().getLength()); } else { // not from the same document, must clone Node copyNode = config.getOwnerDocument().importNode(element, true); config.appendChild(copyNode); NodeList nl = config.getChildNodes(); for (int i=0; i<nl.getLength(); i++) { logger.debug("node "+nl.item(i).getLocalName()); } // end of for (int i=0; i<nl.getLenght(); i++) } // end of else } else { logger.warn("Attempt to add non-XML dataset"); } // end of else }
| 1,118,076
|
public void addDataSet(edu.sc.seis.fissuresUtil.xml.DataSet dataset, AuditInfo[] audit) { dataSetIdCache = null; if (dataset instanceof XMLDataSet) { XMLDataSet xds = (XMLDataSet)dataset; Element element = xds.getElement(); if (element.getOwnerDocument().equals(config.getOwnerDocument())) { config.appendChild(element); logger.debug("dataset append "+config.getChildNodes().getLength()); } else { // not from the same document, must clone Node copyNode = config.getOwnerDocument().importNode(element, true); config.appendChild(copyNode); logger.debug("dataset import "+config.getChildNodes().getLength()); NodeList nl = config.getChildNodes(); for (int i=0; i<nl.getLength(); i++) { logger.debug("node "+nl.item(i).getLocalName()); } // end of for (int i=0; i<nl.getLenght(); i++) } // end of else } else { logger.warn("Attempt to add non-XML dataset"); } // end of else }
|
public void addDataSet(edu.sc.seis.fissuresUtil.xml.DataSet dataset, AuditInfo[] audit) { dataSetIdCache = null; if (dataset instanceof XMLDataSet) { XMLDataSet xds = (XMLDataSet)dataset; Element element = xds.getElement(); if (element.getOwnerDocument().equals(config.getOwnerDocument())) { config.appendChild(element); logger.debug("dataset append "+config.getChildNodes().getLength()); } else { // not from the same document, must clone Node copyNode = config.getOwnerDocument().importNode(element, true); config.appendChild(copyNode); logger.debug("dataset import "+config.getChildNodes().getLength()); NodeList nl = config.getChildNodes(); for (int i=0; i<nl.getLength(); i++) { } // end of for (int i=0; i<nl.getLenght(); i++) } // end of else } else { logger.warn("Attempt to add non-XML dataset"); } // end of else }
| 1,118,077
|
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 = seis.channel_id.network_id.network_code+"."+ seis.channel_id.station_code+"."+ seis.channel_id.channel_code; //edu.iris.Fissures.network.ChannelIdUtil.toStringNoDates(seis.channel_id); } name = getUniqueName(getSeismogramNames(), 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] != null && 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."); seismogramNameCache = null; //xpath = new XPathAPI(); //xpath = new CachedXPathAPI(xpath); logger.debug("2 added seis now "+getSeismogramNames().length+" seisnogram names."); }
|
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 = seis.channel_id.network_id.network_code+"."+ seis.channel_id.station_code+"."+ seis.channel_id.channel_code; //edu.iris.Fissures.network.ChannelIdUtil.toStringNoDates(seis.channel_id); } name = getUniqueName(getSeismogramNames(), 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] != null && 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."); seismogramNameCache = null; //xpath = new XPathAPI(); //xpath = new CachedXPathAPI(xpath); logger.debug("2 added seis now "+getSeismogramNames().length+" seisnogram names."); }
| 1,118,078
|
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 = seis.channel_id.network_id.network_code+"."+ seis.channel_id.station_code+"."+ seis.channel_id.channel_code; //edu.iris.Fissures.network.ChannelIdUtil.toStringNoDates(seis.channel_id); } name = getUniqueName(getSeismogramNames(), 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] != null && 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."); seismogramNameCache = null; //xpath = new XPathAPI(); //xpath = new CachedXPathAPI(xpath); logger.debug("2 added seis now "+getSeismogramNames().length+" seisnogram names."); }
|
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 = seis.channel_id.network_id.network_code+"."+ seis.channel_id.station_code+"."+ seis.channel_id.channel_code; //edu.iris.Fissures.network.ChannelIdUtil.toStringNoDates(seis.channel_id); }*/ name = getUniqueName(getSeismogramNames(), 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] != null && 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."); seismogramNameCache = null; //xpath = new XPathAPI(); //xpath = new CachedXPathAPI(xpath); logger.debug("2 added seis now "+getSeismogramNames().length+" seisnogram names."); }*/
| 1,118,079
|
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 = seis.channel_id.network_id.network_code+"."+ seis.channel_id.station_code+"."+ seis.channel_id.channel_code; //edu.iris.Fissures.network.ChannelIdUtil.toStringNoDates(seis.channel_id); } name = getUniqueName(getSeismogramNames(), 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] != null && 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."); seismogramNameCache = null; //xpath = new XPathAPI(); //xpath = new CachedXPathAPI(xpath); logger.debug("2 added seis now "+getSeismogramNames().length+" seisnogram names."); }
|
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 = seis.channel_id.network_id.network_code+"."+ seis.channel_id.station_code+"."+ seis.channel_id.channel_code; //edu.iris.Fissures.network.ChannelIdUtil.toStringNoDates(seis.channel_id); } name = getUniqueName(getSeismogramNames(), 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] != null && 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); seismogramNameCache = null; //xpath = new XPathAPI(); //xpath = new CachedXPathAPI(xpath); logger.debug("2 added seis now "+getSeismogramNames().length+" seisnogram names."); }
| 1,118,080
|
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 = seis.channel_id.network_id.network_code+"."+ seis.channel_id.station_code+"."+ seis.channel_id.channel_code; //edu.iris.Fissures.network.ChannelIdUtil.toStringNoDates(seis.channel_id); } name = getUniqueName(getSeismogramNames(), 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] != null && 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."); seismogramNameCache = null; //xpath = new XPathAPI(); //xpath = new CachedXPathAPI(xpath); logger.debug("2 added seis now "+getSeismogramNames().length+" seisnogram names."); }
|
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 = seis.channel_id.network_id.network_code+"."+ seis.channel_id.station_code+"."+ seis.channel_id.channel_code; //edu.iris.Fissures.network.ChannelIdUtil.toStringNoDates(seis.channel_id); } name = getUniqueName(getSeismogramNames(), 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] != null && 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."); seismogramNameCache = null; //xpath = new XPathAPI(); //xpath = new CachedXPathAPI(xpath); }
| 1,118,081
|
protected String[] cacheSeismogramNames() { String[] names = getAllAsStrings("localSeismogram/seismogramAttr/property[name="+dquote+"Name"+dquote+ "]"+"/value/text()"); //String[] names = getAllAsStrings("SacSeismogram/name/text()"); logger.debug("found "+names.length+" names in xml"); logger.debug("cache has "+seismogramCache.keySet().size()); String outNames[] = new String[names.length];//+seismogramCache.keySet().size()]; System.arraycopy(names, 0, outNames, 0, names.length); /*java.util.Iterator it = seismogramCache.keySet().iterator(); int i=names.length; while (it.hasNext()) { outNames[i] = (String)it.next(); logger.debug("outNames "+outNames[i]); i++; } // end of while (it.hasNext())*/ String[] noNames = getNoNameSeismogramNames(); String[] rtnValues = new String[noNames.length + outNames.length]; //System.out.println("The length of noNames is "+noNames.length); //System.out.println("The length of nameed siesmograms is "+outNames.length); System.arraycopy(outNames, 0, rtnValues, 0, outNames.length); if(outNames.length != 0) { System.arraycopy(noNames, 0, rtnValues, rtnValues.length - 1, noNames.length); } else { System.arraycopy(noNames, 0, rtnValues, 0, noNames.length); } return rtnValues; }
|
protected String[] cacheSeismogramNames() { String[] names = getAllAsStrings("localSeismogram/seismogramAttr/property[name="+dquote+"Name"+dquote+ "]"+"/value/text()"); //String[] names = getAllAsStrings("SacSeismogram/name/text()"); logger.debug("found "+names.length+" names in xml"); logger.debug("cache has "+seismogramCache.keySet().size()); String outNames[] = new String[names.length];//+seismogramCache.keySet().size()]; System.arraycopy(names, 0, outNames, 0, names.length); /*java.util.Iterator it = seismogramCache.keySet().iterator(); int i=names.length; while (it.hasNext()) { outNames[i] = (String)it.next(); logger.debug("outNames "+outNames[i]); i++; } // end of while (it.hasNext())*/ String[] noNames = getNoNameSeismogramNames(); String[] rtnValues = new String[noNames.length + outNames.length]; //System.out.println("The length of noNames is "+noNames.length); //System.out.println("The length of nameed siesmograms is "+outNames.length); System.arraycopy(outNames, 0, rtnValues, 0, outNames.length); if(outNames.length != 0) { System.arraycopy(noNames, 0, rtnValues, rtnValues.length - 1, noNames.length); } else { System.arraycopy(noNames, 0, rtnValues, 0, noNames.length); } return rtnValues; }
| 1,118,082
|
public DataSet getDataSet(String name) { String[] ids = getDataSetIds(); for (int i=0; i<ids.length; i++) { DataSet ds = getDataSetById(ids[i]); logger.debug("++++++++ name is "+name +" the datasetID name is "+ds.getName()); if (name.equals(ds.getName())) { return ds; } } // end of for (int i=0; i<ids.length; i++) return null; }
|
public DataSet getDataSet(String name) { String[] ids = getDataSetIds(); for (int i=0; i<ids.length; i++) { DataSet ds = getDataSetById(ids[i]); if (name.equals(ds.getName())) { return ds; } } // end of for (int i=0; i<ids.length; i++) return null; }
| 1,118,083
|
public String[] getDataSetIds() { if (dataSetIdCache == null) { String[] internal = getAllAsStrings("*/@datasetid"); String[] external = getDataSetRefIds(); for (int i=0; i<external.length; i++) { logger.debug("External Dataset Id cache :'"+external[i]+"'"); } // end of for (int i=0; i<tmp.length; i++) String[] tmp = new String[internal.length+external.length]; System.arraycopy(internal, 0, tmp, 0, internal.length); System.arraycopy(external, 0, tmp, internal.length, external.length); for (int i=0; i<tmp.length; i++) { logger.debug("Dataset Id cache :'"+tmp[i]+"'"); } // end of for (int i=0; i<tmp.length; i++) dataSetIdCache = tmp; } // end of if (dataSetIdCache == null) return dataSetIdCache; }
|
public String[] getDataSetIds() { if (dataSetIdCache == null) { String[] internal = getAllAsStrings("*/@datasetid"); String[] external = getDataSetRefIds(); for (int i=0; i<external.length; i++) { } // end of for (int i=0; i<tmp.length; i++) String[] tmp = new String[internal.length+external.length]; System.arraycopy(internal, 0, tmp, 0, internal.length); System.arraycopy(external, 0, tmp, internal.length, external.length); for (int i=0; i<tmp.length; i++) { logger.debug("Dataset Id cache :'"+tmp[i]+"'"); } // end of for (int i=0; i<tmp.length; i++) dataSetIdCache = tmp; } // end of if (dataSetIdCache == null) return dataSetIdCache; }
| 1,118,085
|
public String[] getDataSetIds() { if (dataSetIdCache == null) { String[] internal = getAllAsStrings("*/@datasetid"); String[] external = getDataSetRefIds(); for (int i=0; i<external.length; i++) { logger.debug("External Dataset Id cache :'"+external[i]+"'"); } // end of for (int i=0; i<tmp.length; i++) String[] tmp = new String[internal.length+external.length]; System.arraycopy(internal, 0, tmp, 0, internal.length); System.arraycopy(external, 0, tmp, internal.length, external.length); for (int i=0; i<tmp.length; i++) { logger.debug("Dataset Id cache :'"+tmp[i]+"'"); } // end of for (int i=0; i<tmp.length; i++) dataSetIdCache = tmp; } // end of if (dataSetIdCache == null) return dataSetIdCache; }
|
public String[] getDataSetIds() { if (dataSetIdCache == null) { String[] internal = getAllAsStrings("*/@datasetid"); String[] external = getDataSetRefIds(); for (int i=0; i<external.length; i++) { logger.debug("External Dataset Id cache :'"+external[i]+"'"); } // end of for (int i=0; i<tmp.length; i++) String[] tmp = new String[internal.length+external.length]; System.arraycopy(internal, 0, tmp, 0, internal.length); System.arraycopy(external, 0, tmp, internal.length, external.length); for (int i=0; i<tmp.length; i++) { } // end of for (int i=0; i<tmp.length; i++) dataSetIdCache = tmp; } // end of if (dataSetIdCache == null) return dataSetIdCache; }
| 1,118,086
|
String[] getDataSetRefIds() { String[] xlinktmps = getAllAsStrings("datasetRef"); String xlinkNS= "http://www.w3.org/1999/xlink"; NodeList nodes = evalNodeList(config, "datasetRef"); if (nodes == null) { return new String[0]; } // end of if (nodes == null) System.out.println("the length of the nodes is "+nodes.getLength()); String[] xlinks = new String[nodes.getLength()]; String[] ids = new String[nodes.getLength()]; for (int i=0; i<nodes.getLength(); i++) { Node n = nodes.item(i); NamedNodeMap map = n.getAttributes(); for (int j=0; j<map.getLength(); j++) { logger.debug("attribute: "+map.item(j).getLocalName()); } // end of for (int j=0; j<map.getLength(); j++) try { if (n instanceof Element) { Element e = (Element)n; String href = e.getAttribute("xlink:href"); logger.debug("got href="+href+" base="+getBase()); SimpleXLink sl = new SimpleXLink(docBuilder, e, getBase()); Element referredElement = sl.retrieve(); logger.debug("simpleLink element is"+referredElement.toString()); XMLDataSet ds = new XMLDataSet(docBuilder, new URL(getBase(), href), referredElement); dataSetCache.put(ds.getId(), ds); ids[i] = ds.getId(); } else { ids[i] = null; } // end of else } catch (Exception e) { logger.error("can't get dataset for "+xlinks[i], e); ids[i] = null; } // end of try-catch } // end of for (int i=0; i<xlinks.length; i++) logger.debug("got "+xlinks.length+" datasetRef ids from "+xlinktmps.length+" datasetRefs"); return ids; }
|
String[] getDataSetRefIds() { String[] xlinktmps = getAllAsStrings("datasetRef"); String xlinkNS= "http://www.w3.org/1999/xlink"; NodeList nodes = evalNodeList(config, "datasetRef"); if (nodes == null) { return new String[0]; } // end of if (nodes == null) String[] xlinks = new String[nodes.getLength()]; String[] ids = new String[nodes.getLength()]; for (int i=0; i<nodes.getLength(); i++) { Node n = nodes.item(i); NamedNodeMap map = n.getAttributes(); for (int j=0; j<map.getLength(); j++) { logger.debug("attribute: "+map.item(j).getLocalName()); } // end of for (int j=0; j<map.getLength(); j++) try { if (n instanceof Element) { Element e = (Element)n; String href = e.getAttribute("xlink:href"); logger.debug("got href="+href+" base="+getBase()); SimpleXLink sl = new SimpleXLink(docBuilder, e, getBase()); Element referredElement = sl.retrieve(); logger.debug("simpleLink element is"+referredElement.toString()); XMLDataSet ds = new XMLDataSet(docBuilder, new URL(getBase(), href), referredElement); dataSetCache.put(ds.getId(), ds); ids[i] = ds.getId(); } else { ids[i] = null; } // end of else } catch (Exception e) { logger.error("can't get dataset for "+xlinks[i], e); ids[i] = null; } // end of try-catch } // end of for (int i=0; i<xlinks.length; i++) logger.debug("got "+xlinks.length+" datasetRef ids from "+xlinktmps.length+" datasetRefs"); return ids; }
| 1,118,087
|
String[] getDataSetRefIds() { String[] xlinktmps = getAllAsStrings("datasetRef"); String xlinkNS= "http://www.w3.org/1999/xlink"; NodeList nodes = evalNodeList(config, "datasetRef"); if (nodes == null) { return new String[0]; } // end of if (nodes == null) System.out.println("the length of the nodes is "+nodes.getLength()); String[] xlinks = new String[nodes.getLength()]; String[] ids = new String[nodes.getLength()]; for (int i=0; i<nodes.getLength(); i++) { Node n = nodes.item(i); NamedNodeMap map = n.getAttributes(); for (int j=0; j<map.getLength(); j++) { logger.debug("attribute: "+map.item(j).getLocalName()); } // end of for (int j=0; j<map.getLength(); j++) try { if (n instanceof Element) { Element e = (Element)n; String href = e.getAttribute("xlink:href"); logger.debug("got href="+href+" base="+getBase()); SimpleXLink sl = new SimpleXLink(docBuilder, e, getBase()); Element referredElement = sl.retrieve(); logger.debug("simpleLink element is"+referredElement.toString()); XMLDataSet ds = new XMLDataSet(docBuilder, new URL(getBase(), href), referredElement); dataSetCache.put(ds.getId(), ds); ids[i] = ds.getId(); } else { ids[i] = null; } // end of else } catch (Exception e) { logger.error("can't get dataset for "+xlinks[i], e); ids[i] = null; } // end of try-catch } // end of for (int i=0; i<xlinks.length; i++) logger.debug("got "+xlinks.length+" datasetRef ids from "+xlinktmps.length+" datasetRefs"); return ids; }
|
String[] getDataSetRefIds() { String[] xlinktmps = getAllAsStrings("datasetRef"); String xlinkNS= "http://www.w3.org/1999/xlink"; NodeList nodes = evalNodeList(config, "datasetRef"); if (nodes == null) { return new String[0]; } // end of if (nodes == null) System.out.println("the length of the nodes is "+nodes.getLength()); String[] xlinks = new String[nodes.getLength()]; String[] ids = new String[nodes.getLength()]; for (int i=0; i<nodes.getLength(); i++) { Node n = nodes.item(i); NamedNodeMap map = n.getAttributes(); for (int j=0; j<map.getLength(); j++) { } // end of for (int j=0; j<map.getLength(); j++) try { if (n instanceof Element) { Element e = (Element)n; String href = e.getAttribute("xlink:href"); logger.debug("got href="+href+" base="+getBase()); SimpleXLink sl = new SimpleXLink(docBuilder, e, getBase()); Element referredElement = sl.retrieve(); logger.debug("simpleLink element is"+referredElement.toString()); XMLDataSet ds = new XMLDataSet(docBuilder, new URL(getBase(), href), referredElement); dataSetCache.put(ds.getId(), ds); ids[i] = ds.getId(); } else { ids[i] = null; } // end of else } catch (Exception e) { logger.error("can't get dataset for "+xlinks[i], e); ids[i] = null; } // end of try-catch } // end of for (int i=0; i<xlinks.length; i++) logger.debug("got "+xlinks.length+" datasetRef ids from "+xlinktmps.length+" datasetRefs"); return ids; }
| 1,118,088
|
String[] getDataSetRefIds() { String[] xlinktmps = getAllAsStrings("datasetRef"); String xlinkNS= "http://www.w3.org/1999/xlink"; NodeList nodes = evalNodeList(config, "datasetRef"); if (nodes == null) { return new String[0]; } // end of if (nodes == null) System.out.println("the length of the nodes is "+nodes.getLength()); String[] xlinks = new String[nodes.getLength()]; String[] ids = new String[nodes.getLength()]; for (int i=0; i<nodes.getLength(); i++) { Node n = nodes.item(i); NamedNodeMap map = n.getAttributes(); for (int j=0; j<map.getLength(); j++) { logger.debug("attribute: "+map.item(j).getLocalName()); } // end of for (int j=0; j<map.getLength(); j++) try { if (n instanceof Element) { Element e = (Element)n; String href = e.getAttribute("xlink:href"); logger.debug("got href="+href+" base="+getBase()); SimpleXLink sl = new SimpleXLink(docBuilder, e, getBase()); Element referredElement = sl.retrieve(); logger.debug("simpleLink element is"+referredElement.toString()); XMLDataSet ds = new XMLDataSet(docBuilder, new URL(getBase(), href), referredElement); dataSetCache.put(ds.getId(), ds); ids[i] = ds.getId(); } else { ids[i] = null; } // end of else } catch (Exception e) { logger.error("can't get dataset for "+xlinks[i], e); ids[i] = null; } // end of try-catch } // end of for (int i=0; i<xlinks.length; i++) logger.debug("got "+xlinks.length+" datasetRef ids from "+xlinktmps.length+" datasetRefs"); return ids; }
|
String[] getDataSetRefIds() { String[] xlinktmps = getAllAsStrings("datasetRef"); String xlinkNS= "http://www.w3.org/1999/xlink"; NodeList nodes = evalNodeList(config, "datasetRef"); if (nodes == null) { return new String[0]; } // end of if (nodes == null) System.out.println("the length of the nodes is "+nodes.getLength()); String[] xlinks = new String[nodes.getLength()]; String[] ids = new String[nodes.getLength()]; for (int i=0; i<nodes.getLength(); i++) { Node n = nodes.item(i); NamedNodeMap map = n.getAttributes(); for (int j=0; j<map.getLength(); j++) { logger.debug("attribute: "+map.item(j).getLocalName()); } // end of for (int j=0; j<map.getLength(); j++) try { if (n instanceof Element) { Element e = (Element)n; String href = e.getAttribute("xlink:href"); logger.debug("got href="+href+" base="+getBase()); SimpleXLink sl = new SimpleXLink(docBuilder, e, getBase()); Element referredElement = sl.retrieve(); logger.debug("simpleLink element is"+referredElement.toString()); XMLDataSet ds = new XMLDataSet(docBuilder, new URL(getBase(), href), referredElement); dataSetCache.put(ds.getId(), ds); ids[i] = ds.getId(); } else { ids[i] = null; } // end of else } catch (Exception e) { logger.error("can't get dataset for "+xlinks[i], e); ids[i] = null; } // end of try-catch } // end of for (int i=0; i<xlinks.length; i++) logger.debug("got "+xlinks.length+" datasetRef ids from "+xlinktmps.length+" datasetRefs"); return ids; }
| 1,118,089
|
String[] getDataSetRefIds() { String[] xlinktmps = getAllAsStrings("datasetRef"); String xlinkNS= "http://www.w3.org/1999/xlink"; NodeList nodes = evalNodeList(config, "datasetRef"); if (nodes == null) { return new String[0]; } // end of if (nodes == null) System.out.println("the length of the nodes is "+nodes.getLength()); String[] xlinks = new String[nodes.getLength()]; String[] ids = new String[nodes.getLength()]; for (int i=0; i<nodes.getLength(); i++) { Node n = nodes.item(i); NamedNodeMap map = n.getAttributes(); for (int j=0; j<map.getLength(); j++) { logger.debug("attribute: "+map.item(j).getLocalName()); } // end of for (int j=0; j<map.getLength(); j++) try { if (n instanceof Element) { Element e = (Element)n; String href = e.getAttribute("xlink:href"); logger.debug("got href="+href+" base="+getBase()); SimpleXLink sl = new SimpleXLink(docBuilder, e, getBase()); Element referredElement = sl.retrieve(); logger.debug("simpleLink element is"+referredElement.toString()); XMLDataSet ds = new XMLDataSet(docBuilder, new URL(getBase(), href), referredElement); dataSetCache.put(ds.getId(), ds); ids[i] = ds.getId(); } else { ids[i] = null; } // end of else } catch (Exception e) { logger.error("can't get dataset for "+xlinks[i], e); ids[i] = null; } // end of try-catch } // end of for (int i=0; i<xlinks.length; i++) logger.debug("got "+xlinks.length+" datasetRef ids from "+xlinktmps.length+" datasetRefs"); return ids; }
|
String[] getDataSetRefIds() { String[] xlinktmps = getAllAsStrings("datasetRef"); String xlinkNS= "http://www.w3.org/1999/xlink"; NodeList nodes = evalNodeList(config, "datasetRef"); if (nodes == null) { return new String[0]; } // end of if (nodes == null) System.out.println("the length of the nodes is "+nodes.getLength()); String[] xlinks = new String[nodes.getLength()]; String[] ids = new String[nodes.getLength()]; for (int i=0; i<nodes.getLength(); i++) { Node n = nodes.item(i); NamedNodeMap map = n.getAttributes(); for (int j=0; j<map.getLength(); j++) { logger.debug("attribute: "+map.item(j).getLocalName()); } // end of for (int j=0; j<map.getLength(); j++) try { if (n instanceof Element) { Element e = (Element)n; String href = e.getAttribute("xlink:href"); logger.debug("got href="+href+" base="+getBase()); SimpleXLink sl = new SimpleXLink(docBuilder, e, getBase()); Element referredElement = sl.retrieve(); XMLDataSet ds = new XMLDataSet(docBuilder, new URL(getBase(), href), referredElement); dataSetCache.put(ds.getId(), ds); ids[i] = ds.getId(); } else { ids[i] = null; } // end of else } catch (Exception e) { logger.error("can't get dataset for "+xlinks[i], e); ids[i] = null; } // end of try-catch } // end of for (int i=0; i<xlinks.length; i++) logger.debug("got "+xlinks.length+" datasetRef ids from "+xlinktmps.length+" datasetRefs"); return ids; }
| 1,118,090
|
String[] getDataSetRefIds() { String[] xlinktmps = getAllAsStrings("datasetRef"); String xlinkNS= "http://www.w3.org/1999/xlink"; NodeList nodes = evalNodeList(config, "datasetRef"); if (nodes == null) { return new String[0]; } // end of if (nodes == null) System.out.println("the length of the nodes is "+nodes.getLength()); String[] xlinks = new String[nodes.getLength()]; String[] ids = new String[nodes.getLength()]; for (int i=0; i<nodes.getLength(); i++) { Node n = nodes.item(i); NamedNodeMap map = n.getAttributes(); for (int j=0; j<map.getLength(); j++) { logger.debug("attribute: "+map.item(j).getLocalName()); } // end of for (int j=0; j<map.getLength(); j++) try { if (n instanceof Element) { Element e = (Element)n; String href = e.getAttribute("xlink:href"); logger.debug("got href="+href+" base="+getBase()); SimpleXLink sl = new SimpleXLink(docBuilder, e, getBase()); Element referredElement = sl.retrieve(); logger.debug("simpleLink element is"+referredElement.toString()); XMLDataSet ds = new XMLDataSet(docBuilder, new URL(getBase(), href), referredElement); dataSetCache.put(ds.getId(), ds); ids[i] = ds.getId(); } else { ids[i] = null; } // end of else } catch (Exception e) { logger.error("can't get dataset for "+xlinks[i], e); ids[i] = null; } // end of try-catch } // end of for (int i=0; i<xlinks.length; i++) logger.debug("got "+xlinks.length+" datasetRef ids from "+xlinktmps.length+" datasetRefs"); return ids; }
|
String[] getDataSetRefIds() { String[] xlinktmps = getAllAsStrings("datasetRef"); String xlinkNS= "http://www.w3.org/1999/xlink"; NodeList nodes = evalNodeList(config, "datasetRef"); if (nodes == null) { return new String[0]; } // end of if (nodes == null) System.out.println("the length of the nodes is "+nodes.getLength()); String[] xlinks = new String[nodes.getLength()]; String[] ids = new String[nodes.getLength()]; for (int i=0; i<nodes.getLength(); i++) { Node n = nodes.item(i); NamedNodeMap map = n.getAttributes(); for (int j=0; j<map.getLength(); j++) { logger.debug("attribute: "+map.item(j).getLocalName()); } // end of for (int j=0; j<map.getLength(); j++) try { if (n instanceof Element) { Element e = (Element)n; String href = e.getAttribute("xlink:href"); logger.debug("got href="+href+" base="+getBase()); SimpleXLink sl = new SimpleXLink(docBuilder, e, getBase()); Element referredElement = sl.retrieve(); logger.debug("simpleLink element is"+referredElement.toString()); XMLDataSet ds = new XMLDataSet(docBuilder, new URL(getBase(), href), referredElement); dataSetCache.put(ds.getId(), ds); ids[i] = ds.getId(); } else { ids[i] = null; } // end of else } catch (Exception e) { logger.error("can't get dataset for "+xlinks[i], e); ids[i] = null; } // end of try-catch } // end of for (int i=0; i<xlinks.length; i++) return ids; }
| 1,118,091
|
public String[] getNoNameSeismogramNames() { NodeList nList; nList = evalNodeList(config, "localSeismogram/seismogramAttr/property"); if(nList == null || (nList != null && nList.getLength() == 0)) { nList = evalNodeList(config, "localSeismogram/seismogramAttr"); //System.out.println("ONLY SEIS ATTR EXISTS"); } else { nList = evalNodeList(config, "localSeismogram/seismogramAttr/property[name!="+dquote+"Name"+dquote+ "]"+"/../"); System.out.println("PROPERTY TAG EXISTS"); } String[] rtn; if(nList != null) { rtn = new String[nList.getLength()]; } else { rtn = new String[0]; } if(nList != null && nList.getLength() != 0) { int size = nList.getLength(); // for( int counter = 0; counter < size; counter++) { // Node n = nList.item(counter);// if(n instanceof Element) {// Element subElement = (Element)n;// String name = getAsString(subElement, "channel_id/network_id/network_code/text()");// name = name + getAsString(subElement, "channel_id/station_code/text()"); // name = name + getAsString(subElement, "channel_id/site_code/text()"); // name = name + getAsString(subElement, "channel_id/channel_code/text()"); // rtn[counter] = name;// }// } for(int counter = 0; counter < size; counter++) { Node n = nList.item(counter); if(n instanceof Element) { NodeList channelIdNode = evalNodeList((Element)n, "channel_id"); Element subElement = (Element)channelIdNode.item(0); // SeismogramAttr seismogramAttr = XMLSeismogramAttr.getSeismogramAttr(subElement); ChannelId channel_id = XMLChannelId.getChannelId(subElement); String name = edu.iris.Fissures.network.ChannelIdUtil.toStringNoDates(channel_id); rtn[counter] = name; } } } //System.out.println("The length of the no Name SeismogramNames is "+rtn.length); return rtn; }
|
public String[] getNoNameSeismogramNames() { NodeList nList; nList = evalNodeList(config, "localSeismogram/seismogramAttr/property"); if(nList == null || (nList != null && nList.getLength() == 0)) { nList = evalNodeList(config, "localSeismogram/seismogramAttr"); //System.out.println("ONLY SEIS ATTR EXISTS"); } else { nList = evalNodeList(config, "localSeismogram/seismogramAttr/property[name!="+dquote+"Name"+dquote+ "]"+"/../"); } String[] rtn; if(nList != null) { rtn = new String[nList.getLength()]; } else { rtn = new String[0]; } if(nList != null && nList.getLength() != 0) { int size = nList.getLength(); // for( int counter = 0; counter < size; counter++) { // Node n = nList.item(counter);// if(n instanceof Element) {// Element subElement = (Element)n;// String name = getAsString(subElement, "channel_id/network_id/network_code/text()");// name = name + getAsString(subElement, "channel_id/station_code/text()"); // name = name + getAsString(subElement, "channel_id/site_code/text()"); // name = name + getAsString(subElement, "channel_id/channel_code/text()"); // rtn[counter] = name;// }// } for(int counter = 0; counter < size; counter++) { Node n = nList.item(counter); if(n instanceof Element) { NodeList channelIdNode = evalNodeList((Element)n, "channel_id"); Element subElement = (Element)channelIdNode.item(0); // SeismogramAttr seismogramAttr = XMLSeismogramAttr.getSeismogramAttr(subElement); ChannelId channel_id = XMLChannelId.getChannelId(subElement); String name = edu.iris.Fissures.network.ChannelIdUtil.toStringNoDates(channel_id); rtn[counter] = name; } } } //System.out.println("The length of the no Name SeismogramNames is "+rtn.length); return rtn; }
| 1,118,092
|
public Object getParameter(String name) { if (parameterCache.containsKey(name)) { return parameterCache.get(name); } // end of if (parameterCache.containsKey(name)) NodeList nList = evalNodeList(config, "parameter[name/text()="+ dquote+name+dquote+"]"); if (nList != null && nList.getLength() != 0) { logger.debug("getting the parameter "+name); Node n = nList.item(0); if (n instanceof Element) { Object r = XMLParameter.getParameter((Element)n); parameterCache.put(name, r); return r; } } else { logger.debug("THE NODE LIST IS NULL for parameter "+name); } // not a parameter, try parameterRef nList = evalNodeList(config, "parameterRef[text()="+dquote+name+dquote+"]"); if (nList != null && nList.getLength() != 0) { Node n = nList.item(0); if (n instanceof Element) { SimpleXLink sl = new SimpleXLink(docBuilder, (Element)n); try { Element e = sl.retrieve(); parameterCache.put(name, e); return e; } catch (Exception e) { logger.error("can't get paramterRef for "+name, e); } // end of try-catch } } logger.warn("can't find paramter for "+name); //can't find that name??? return null; }
|
public Object getParameter(String name) { if (parameterCache.containsKey(name)) { return parameterCache.get(name); } // end of if (parameterCache.containsKey(name)) NodeList nList = evalNodeList(config, "parameter[name/text()="+ dquote+name+dquote+"]"); if (nList != null && nList.getLength() != 0) { Node n = nList.item(0); if (n instanceof Element) { Object r = XMLParameter.getParameter((Element)n); parameterCache.put(name, r); return r; } } else { logger.debug("THE NODE LIST IS NULL for parameter "+name); } // not a parameter, try parameterRef nList = evalNodeList(config, "parameterRef[text()="+dquote+name+dquote+"]"); if (nList != null && nList.getLength() != 0) { Node n = nList.item(0); if (n instanceof Element) { SimpleXLink sl = new SimpleXLink(docBuilder, (Element)n); try { Element e = sl.retrieve(); parameterCache.put(name, e); return e; } catch (Exception e) { logger.error("can't get paramterRef for "+name, e); } // end of try-catch } } logger.warn("can't find paramter for "+name); //can't find that name??? return null; }
| 1,118,093
|
public LocalSeismogramImpl getSeismogram(String name) { if (seismogramCache.containsKey(name)) { logger.debug("getting the seismogram fromt the cache"); return (LocalSeismogramImpl)seismogramCache.get(name); } // end of if (seismogramCache.containsKey(name)) logger.debug("The name of the data set is "+getName()); logger.debug("The name of the seismogram is "+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 LocalSeismogramImpl getSeismogram(String name) { if (seismogramCache.containsKey(name)) { logger.debug("getting the seismogram fromt the cache"); return (LocalSeismogramImpl)seismogramCache.get(name); } // end of if (seismogramCache.containsKey(name)) logger.debug("The name of the data set is "+getName()); logger.debug("The name of the seismogram is "+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; }
| 1,118,094
|
public LocalSeismogramImpl getSeismogram(String name) { if (seismogramCache.containsKey(name)) { logger.debug("getting the seismogram fromt the cache"); return (LocalSeismogramImpl)seismogramCache.get(name); } // end of if (seismogramCache.containsKey(name)) logger.debug("The name of the data set is "+getName()); logger.debug("The name of the seismogram is "+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 LocalSeismogramImpl getSeismogram(String name) { if (seismogramCache.containsKey(name)) { logger.debug("getting the seismogram fromt the cache"); return (LocalSeismogramImpl)seismogramCache.get(name); } // end of if (seismogramCache.containsKey(name)) logger.debug("The name of the data set is "+getName()); logger.debug("The name of the seismogram is "+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; }
| 1,118,095
|
public LocalSeismogramImpl getSeismogram(String name) { if (seismogramCache.containsKey(name)) { logger.debug("getting the seismogram fromt the cache"); return (LocalSeismogramImpl)seismogramCache.get(name); } // end of if (seismogramCache.containsKey(name)) logger.debug("The name of the data set is "+getName()); logger.debug("The name of the seismogram is "+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 LocalSeismogramImpl getSeismogram(String name) { if (seismogramCache.containsKey(name)) { logger.debug("getting the seismogram fromt the cache"); return (LocalSeismogramImpl)seismogramCache.get(name); } // end of if (seismogramCache.containsKey(name)) logger.debug("The name of the data set is "+getName()); logger.debug("The name of the seismogram is "+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; }
| 1,118,096
|
static void testDataSet(DataSet dataset, String indent) { indent = indent+" "; String[] names = dataset.getSeismogramNames(); System.out.println(indent+" has "+names.length+" seismograms."); for (int num=0; num<names.length; num++) { // System.out.println(indent+" Seismogram name="+names[num]); LocalSeismogramImpl seis = dataset.getSeismogram(names[num]); //System.out.println(seis.getNumPoints()); } names = dataset.getDataSetNames(); //System.out.println(indent+" has "+names.length+" datasets."); for (int num=0; num<names.length; num++) { // System.out.println(indent+" Dataset name="+names[num]); testDataSet(dataset.getDataSet(names[num]), indent); } }
|
static void testDataSet(DataSet dataset, String indent) { indent = indent+" "; String[] names = dataset.getSeismogramNames(); for (int num=0; num<names.length; num++) { // System.out.println(indent+" Seismogram name="+names[num]); LocalSeismogramImpl seis = dataset.getSeismogram(names[num]); //System.out.println(seis.getNumPoints()); } names = dataset.getDataSetNames(); //System.out.println(indent+" has "+names.length+" datasets."); for (int num=0; num<names.length; num++) { // System.out.println(indent+" Dataset name="+names[num]); testDataSet(dataset.getDataSet(names[num]), indent); } }
| 1,118,097
|
protected Logger getLogger() { if (log == null) { log = Logger.getLogger(this.getClass()); } return log; }
|
protected Logger getLogger() { if (log == null) { log = Logger.getLogger(getClass()); } return log; }
| 1,118,099
|
public boolean init(String authenticatedUser, String user, boolean publicAdmin, Groups groups, String synchId, boolean debug) throws CalFacadeException { this.debug = debug; boolean userCreated = false; try { objTimestamp = new Timestamp(System.currentTimeMillis()); this.synchId = synchId; if ((synchId != null) && publicAdmin) { throw new CalFacadeException("synch only valid for non admin"); } } catch (Throwable t) { throw new CalFacadeException(t); } if (user == null) { user = authenticatedUser; } return userCreated; }
|
public boolean init(String url, String authenticatedUser, String user, boolean publicAdmin, Groups groups, String synchId, boolean debug) throws CalFacadeException { this.debug = debug; boolean userCreated = false; try { objTimestamp = new Timestamp(System.currentTimeMillis()); this.synchId = synchId; if ((synchId != null) && publicAdmin) { throw new CalFacadeException("synch only valid for non admin"); } } catch (Throwable t) { throw new CalFacadeException(t); } if (user == null) { user = authenticatedUser; } return userCreated; }
| 1,118,100
|
public void setUser(String val) throws CalFacadeException { refreshEvents(); user = getUser(val); if (this.user == null) { throw new CalFacadeException("User " + val + " does not exist."); } logon(user); if (debug) { log.debug("User " + val + " set in calintf"); } }
|
public void setUser(String val) throws CalFacadeException { refreshEvents(); user = getUser(val); if (this.user == null) { throw new CalFacadeException(CalFacadeException.noSuchAccount, val); } logon(user); if (debug) { log.debug("User " + val + " set in calintf"); } }
| 1,118,102
|
private void updateParameterNameCache(String paramName) { String[] temp = parameterNameCache; if(temp == null) { temp = new String[0]; temp[0] = paramName; } else { temp = new String[parameterNameCache.length + 1]; System.arraycopy(parameterNameCache,0, temp, 0, parameterNameCache.length); temp[parameterNameCache.length] = paramName; } parameterNameCache = new String[temp.length]; System.arraycopy(temp, 0, parameterNameCache, 0, temp.length); }
|
private void updateParameterNameCache(String paramName) { String[] temp = parameterNameCache; if(temp == null) { temp = new String[1]; temp[0] = paramName; } else { temp = new String[parameterNameCache.length + 1]; System.arraycopy(parameterNameCache,0, temp, 0, parameterNameCache.length); temp[parameterNameCache.length] = paramName; } parameterNameCache = new String[temp.length]; System.arraycopy(temp, 0, parameterNameCache, 0, temp.length); }
| 1,118,103
|
private void updateParameterNameCache(String paramName) { String[] temp = parameterNameCache; if(temp == null) { temp = new String[0]; temp[0] = paramName; } else { temp = new String[parameterNameCache.length + 1]; System.arraycopy(parameterNameCache,0, temp, 0, parameterNameCache.length); temp[parameterNameCache.length] = paramName; } parameterNameCache = new String[temp.length]; System.arraycopy(temp, 0, parameterNameCache, 0, temp.length); }
|
private void updateParameterNameCache(String paramName) { String[] temp = parameterNameCache; if(temp == null) { temp = new String[0]; temp[0] = paramName; } else { temp = new String[parameterNameCache.length + 1]; System.arraycopy(parameterNameCache,0, temp, 0, parameterNameCache.length); temp[parameterNameCache.length] = paramName; } parameterNameCache = new String[temp.length]; System.arraycopy(temp, 0, parameterNameCache, 0, temp.length); }
| 1,118,104
|
Calintf getCal() throws CalFacadeException { if (cali != null) { return cali; } try { cali = (Calintf)CalEnv.getGlobalObject("calintfclass", Calintf.class); } catch (Throwable t) { throw new CalFacadeException(t); } try { cali.open(); // Just for the user interactions cali.beginTransaction(); boolean userCreated = cali.init(pars.getAuthUser(), pars.getUser(), pars.getPublicAdmin(), pars.isSuperUser(), getGroups(), pars.getSynchId(), debug); // Prepare for call below. publicUserAccount = cali.getSyspars().getPublicUser(); BwUser auth; if (isPublicAdmin() || isGuest()) { auth = getPublicUser(); } else { auth = cali.getUser(pars.getAuthUser()); } dbi = new CalSvcDb(this, auth); if (userCreated) { // Add preferences BwPreferences prefs = new BwPreferences(); BwCalendar cal = cali.getDefaultCalendar(); prefs.setOwner(auth); prefs.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); setupOwnedEntity(sub); prefs.addSubscription(sub); // Add default subscription for trash calendar. cal = cali.getTrashCalendar(); sub = BwSubscription.makeSubscription(cal, cal.getName(), false, false, false); setupOwnedEntity(sub); prefs.addSubscription(sub); dbi.updatePreferences(prefs); } return cali; } finally { cali.endTransaction(); cali.close(); } }
|
Calintf getCal() throws CalFacadeException { if (cali != null) { return cali; } try { cali = (Calintf)CalEnv.getGlobalObject("calintfclass", Calintf.class); } catch (Throwable t) { throw new CalFacadeException(t); } try { cali.open(); // Just for the user interactions cali.beginTransaction(); boolean userCreated = cali.init(pars.getAuthUser(), pars.getUser(), pars.getPublicAdmin(), pars.isSuperUser(), getGroups(), pars.getSynchId(), debug); // Prepare for call below. publicUserAccount = cali.getSyspars().getPublicUser(); BwUser auth; if (isGuest()) { auth = getPublicUser(); } else { auth = cali.getUser(pars.getAuthUser()); } dbi = new CalSvcDb(this, auth); if (userCreated) { // Add preferences BwPreferences prefs = new BwPreferences(); BwCalendar cal = cali.getDefaultCalendar(); prefs.setOwner(auth); prefs.setDefaultCalendar(cal); // Add default subscription for default calendar. BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(), true, true, false); setupOwnedEntity(sub); prefs.addSubscription(sub); // Add default subscription for trash calendar. cal = cali.getTrashCalendar(); sub = BwSubscription.makeSubscription(cal, cal.getName(), false, false, false); setupOwnedEntity(sub); prefs.addSubscription(sub); dbi.updatePreferences(prefs); } return cali; } finally { cali.endTransaction(); cali.close(); } }
| 1,118,105
|
private void addBrowser(JPanel p) { JPanel row = new JPanel(new GridLayout(0, 2)); row.add(new JLabel("Browser:")); row.add(browser); p.add(row); }
|
private void addBrowser(JPanel p) { JPanel row = new JPanel(new GridLayout(0, 2)); row.add(new JLabel("Browser:")); row.add(sub); p.add(row); }
| 1,118,107
|
private void addLoggingDir(JPanel p) { JPanel row = new JPanel(new GridLayout(0, 2)); row.add(new JLabel("Logging Directory:")); row.add(loggingDir); p.add(row); }
|
private void addLoggingDir(JPanel p) { JPanel row = new JPanel(new GridLayout(0, 2)); row.add(new JLabel("Logging Directory:")); row.add(sub); p.add(row); }
| 1,118,108
|
public Font getFont(String key) { return getFont(key, new Font("SansSerif", 12, Font.PLAIN)); }
|
public Font getFont(String key) { return getFont(key, new Font("SansSerif", Font.PLAIN, 12)); }
| 1,118,109
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.