rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
public boolean contains(String[] names){ for(int i = 0; i < names.length; i++){ if(this.names.contains(names[i]))
public boolean contains(DataSetSeismogram[] seismos){ for(int i = 0; i < seismos.length; i++){ if(this.names.contains(seismos[i].toString()))
public boolean contains(String[] names){ for(int i = 0; i < names.length; i++){ if(this.names.contains(names[i])) return true; } return false; }
public int sort(DataSetSeismogram[] seismograms, String[] names){ this.names.add(names);
public int sort(DataSetSeismogram[] seismograms){ for(int i = 0; i < seismograms.length; i++){ names.add(seismograms[i].getName()); }
public int sort(DataSetSeismogram[] seismograms, String[] names){ this.names.add(names); return this.names.size() - 1; }
String content = null;
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(); }
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); } } } }
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(); }
property(CaldavTags.calendarData, content);
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(); }
<!ELEMENT calendar-multiget (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? DAV:href+>
<!ELEMENT calendar-multiget ((DAV:allprop | DAV:propname | DAV:prop)?, DAV:href+)>
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); } }
<!ELEMENT calendar-query (DAV:allprop | DAV:propname | DAV:prop)? calendar-data? filter>
<!ELEMENT calendar-query ((DAV:allprop | DAV:propname | DAV:prop)?, filter, timezone?)>
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); } }
} 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);
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); } }
if (caldata == null) { caldata = new CalendarData(debug); }
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); } }
if (caldata != null) { caldata.dump(); } else { trace("No caldata"); }
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); } }
if (caldata.getErs() != null) {
if (caldata == null) { retrieveRecur = CalFacadeDefs.retrieveRecurMaster; } else if (caldata.getErs() != null) {
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(); }
} else if(className.equals("edu.iris.fissures.network.ChannelImpl")) {
} else if(className.equalsIgnoreCase("edu.iris.fissures.network.ChannelImpl")) {
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; } }
return value;
return new ParameterRef(name, 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 value; } }
available_data(RequestFilter[] a_filterseq) {
public RequestFilter[] available_data(RequestFilter[] a_filterseq) {
available_data(RequestFilter[] a_filterseq) { return dataCenter.available_data(a_filterseq); }
cancel_request(String a_request) throws edu.iris.Fissures.FissuresException {
public void cancel_request(String a_request) throws edu.iris.Fissures.FissuresException {
cancel_request(String a_request) throws edu.iris.Fissures.FissuresException { }
queue_seismograms(RequestFilter[] a_filterseq) throws edu.iris.Fissures.FissuresException {
public String queue_seismograms(RequestFilter[] a_filterseq) throws edu.iris.Fissures.FissuresException {
queue_seismograms(RequestFilter[] a_filterseq) 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 {
public String request_seismograms(RequestFilter[] a_filterseq, DataCenterCallBack a_client, boolean long_lived, edu.iris.Fissures.Time expiration_time) throws edu.iris.Fissures.FissuresException {
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_status(String a_request) throws edu.iris.Fissures.FissuresException {
public String request_status(String a_request) throws edu.iris.Fissures.FissuresException {
request_status(String a_request) throws edu.iris.Fissures.FissuresException { return new String(); }
retrieve_queue(String a_request) throws edu.iris.Fissures.FissuresException {
public LocalSeismogram[] retrieve_queue(String a_request) throws edu.iris.Fissures.FissuresException {
retrieve_queue(String a_request) throws edu.iris.Fissures.FissuresException { return new LocalSeismogram[0]; }
public HSQLRequestFilterDb (String directoryName, String databaseName, DataCenterOperations router) throws SQLException { super(directoryName, databaseName); this.dataCenterRouter = router; create();
public HSQLRequestFilterDb(String directoryName, String databaseName) throws SQLException { this(directoryName, databaseName, null);
public HSQLRequestFilterDb (String directoryName, String databaseName, DataCenterOperations router) throws SQLException { super(directoryName, databaseName); this.dataCenterRouter = router; create(); }
dsName = args[i+1];
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; }
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 ()
if (globals.rintf != null) { globals.rintf.restoreTimezone(entity); }
globals.getTzcache().saveTimeZone(entity.getTzid(), (VTimeZone)o);
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); } }
logger.info(logText.toString());
log(logText.toString());
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); } }
logger.info(logText.toString());
log(logText.toString());
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; } }
logger = null; if (logger == null) { IWBundle bundle = iwc.getIWMainApplication().getBundle(getBundleIdentifier()); logger = Logger.getLogger(this.getClass().getName()); FileUtil.getFileSeparator(); try { Handler fh = new FileHandler(bundle.getPropertiesRealPath() + "/kortathjonustan.log"); logger.addHandler(fh); logger.setLevel(Level.ALL); } catch (Exception e) { e.printStackTrace(); logger = null; } }
bundle = iwc.getIWMainApplication().getBundle(getBundleIdentifier());
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; } } }
return new Vector();
return new ArrayList();
public Collection getProperties(String ns) throws WebdavIntfException { return new Vector(); }
((SeismogramDisplay)basicDisplays.getLast()).addBottomTimeBorder();
public void removeSeismogram(MouseEvent me){ BasicSeismogramDisplay clicked = ((BasicSeismogramDisplay)me.getComponent()); clicked.removeAllSeismograms(); seismograms.remove(clicked); basicDisplays.remove(clicked); ((SeismogramDisplay)basicDisplays.getFirst()).addTopTimeBorder(); this.redraw(); seismograms.revalidate(); }
imageMaker.remove(imagePainter);
public void removeAllSeismograms(){ Iterator e = plotters.keySet().iterator(); while(e.hasNext()){ LocalSeismogram current = ((SeismogramPlotter)e.next()).getSeismogram(); timeConfig.removeSeismogram(current); ampConfig.removeSeismogram(current); } timeConfig.removeTimeSyncListener(this); ampConfig.removeAmpSyncListener(this); }
if (seisNum > 0 && seisNum <= 50) { return feProps.getProperty("SeismicRegion"+seisNum); }
String propValue = feProps.getProperty("SeismicRegion"+seisNum); if (propValue != null && propValue.length > 1) { return propValue; }
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; }
float dt = (float)seis.getSampling().getPeriod().convertTo(UnitImpl.SECOND).get_value();
double dt = seis.getSampling().getPeriod().convertTo(UnitImpl.SECOND).get_value();
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; }
new MicroSecondDate((long)(seisStart + sampling * i)));
new MicroSecondDate((long)(seisStart + sampling * i)), sta, lta);
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; }
ratio);
ratio, ysta, ylta);
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; }
Object val) throws CalFacadeException {
Object val, boolean debug) throws CalFacadeException {
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(); }
debug = getLogger().isDebugEnabled();
this.debug = debug;
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(); }
Lineage lineage = lineages[i]; while (lineage != null && lineage.count == 1) { lineage = lineage.parent;
while (lineages[i] != null && lineages[i].count == 1) { lineages[i] = lineages[i].parent;
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; }
if (lineage == null) {
if (lineages[i] == null) {
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; }
for (int i = 0; i < lineageCount; i++) {
int i = 0; while (i < lineageCount) {
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; }
if (lineageCount > 1) { int currentCount = lineages[i].count; lineages[i] = lineages[i].parent; while (lineages[i] != null && lineages[i].count == currentCount) { lineages[i] = lineages[i].parent; } if (lineages[i] == null) { return null; } } } else { i++;
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; }
if (attr == null) { attr = net.get_attributes();
if (attr == null) { attr = net.get_attributes(); } return attr;
get_attributes() { if (attr == null) { attr = net.get_attributes(); } return attr; }
return attr; }
get_attributes() { if (attr == null) { attr = net.get_attributes(); } return attr; }
String idStr = StationIdUtil.toString(id); if ( ! channelMap.containsKey(idStr)) { channelMap.put(idStr, net.retrieve_for_station(id));
String idStr = StationIdUtil.toString(id); if ( ! channelMap.containsKey(idStr)) { Channel[] chans = net.retrieve_for_station(id); clean(chans); channelMap.put(idStr, chans); } 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); }
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); }
if (stations == null) { stations = net.retrieve_stations();
if (stations == null) { stations = net.retrieve_stations(); clean(stations); } return stations;
retrieve_stations() { if (stations == null) { stations = net.retrieve_stations(); } return stations; }
return stations; }
retrieve_stations() { if (stations == null) { stations = net.retrieve_stations(); } return stations; }
String prefix = node.getPrefix(); String nsURI = (prefix != null ? getNamespaceURI(prefix, element, rootNode) : null);
Map nsMap = new HashMap(); String elPrefix = node.getPrefix(); if (elPrefix != null) { String nsURI = getNamespaceURI(elPrefix, element, rootNode); nsMap.put(elPrefix, nsURI); }
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(); }
String attrName = attr.getNodeName(); String attrValue = normalize(attr.getNodeValue());
String atPrefix = attr.getPrefix(); String atName = attr.getNodeName(); String atValue = normalize(attr.getNodeValue());
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(); }
if (prefix != null && attrName.equals("xmlns:" + prefix)) nsURI = attrValue;
if (atPrefix != null && atPrefix.equals("xmlns") == false) { String nsURI = getNamespaceURI(atPrefix, element, rootNode); nsMap.put(atPrefix, nsURI); }
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(); }
out.print(" " + attrName + "='" + attrValue + "'");
out.print(" " + atName + "='" + atValue + "'");
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(); }
if (prefix != null && nsURI == null) { nsURI = getNamespaceURI(prefix, element, null); out.print(" xmlns:" + prefix + "='" + nsURI + "'");
Iterator itPrefix = nsMap.keySet().iterator(); while (itPrefix.hasNext()) { String prefix = (String)itPrefix.next(); String nsURI = (String)nsMap.get(prefix); if (nsURI == null) { nsURI = getNamespaceURI(prefix, element, null); out.print(" xmlns:" + prefix + "='" + nsURI + "'"); }
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(); }
public JDBCNetwork(Connection conn) throws SQLException{ this(conn, new JDBCTime(conn));
public JDBCNetwork() throws SQLException{ this(ConnMgr.createConnection());
public JDBCNetwork(Connection conn) throws SQLException{ this(conn, new JDBCTime(conn)); }
}
} if (dSeries != null) { return dBinarySum(start, finish); }
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; }
if (dSeries != null) { return dBinarySumDevLag(start, finish, mean, lag); }
protected double binarySumDevLag(int start, int finish, double mean, int lag) { if (iSeries != null) { return iBinarySumDevLag(start, finish, mean, lag); } // end of if (iSeries != null) if (fSeries != null) { return fBinarySumDevLag(start, finish, mean, lag); } // end of if (iSeries != null) return 0; }
if (dSeries != null) { return dBinarySumDevSqr(start, finish, mean); }
protected double binarySumDevSqr(int start, int finish, double mean) { if (iSeries != null) { return iBinarySumDevSqr(start, finish, mean); } // end of if (iSeries != null) if (fSeries != null) { return fBinarySumDevSqr(start, finish, mean); } // end of if (iSeries != null) return 0; }
} else if (dSeries != null) { for (int i = beginIndex; i < endIndex; i++) { minMaxMean[0] = Math.min(minMaxMean[0], dSeries[i]); minMaxMean[1] = Math.max(minMaxMean[1], dSeries[i]); minMaxMean[2] += dSeries[i]; }
private double[] calculateMinMaxMean(int beginIndex, int endIndex){ minMaxMean[0] = Double.POSITIVE_INFINITY; minMaxMean[1] = Double.NEGATIVE_INFINITY; minMaxMean[2] = 0; if (iSeries != null) { for (int i = beginIndex; i < endIndex; i++) { minMaxMean[0] = Math.min(minMaxMean[0], iSeries[i]); minMaxMean[1] = Math.max(minMaxMean[1], iSeries[i]); minMaxMean[2] += iSeries[i]; } // end of for (int i=0; i<iSeries.length; i++) } else if (fSeries != null) { for (int i = beginIndex; i < endIndex; i++) { minMaxMean[0] = Math.min(minMaxMean[0], fSeries[i]); minMaxMean[1] = Math.max(minMaxMean[1], fSeries[i]); minMaxMean[2] += fSeries[i]; } // end of for (int i=0; i<fSeries.length; i++) } minMaxMean[2] /= (endIndex - beginIndex); this.beginIndex = beginIndex; this.endIndex = endIndex; minMaxMeanCalculated = true; return minMaxMean; }
if (dSeries != null) { return dSeries.length; }
public int getLength() { if (iSeries != null) { return iSeries.length; } if (fSeries != null) { return fSeries.length; } return 0; }
if (dSeries != null) { for (int i=0; i< dSeries.length; i++) { bin = (int)Math.floor((dSeries[i]-start)/width); if (bin >= 0 && bin < number) { histo[bin]++; } } return histo; }
public int[] histogram(double start, double width, int number) { int[] histo = new int[number]; int bin; if (iSeries != null) { for (int i=0; i< iSeries.length; i++) { bin = (int)Math.floor((iSeries[i]-start)/width); if (bin >= 0 && bin < number) { histo[bin]++; } // end of if (bin >= 0 && bin < number) } // end of for (int i=0; i< iSeries.length; i++) return histo; } if (fSeries != null) { for (int i=0; i< fSeries.length; i++) { bin = (int)Math.floor((fSeries[i]-start)/width); if (bin >= 0 && bin < number) { histo[bin]++; } // end of if (bin >= 0 && bin < number) } // end of for (int i=0; i< iSeries.length; i++) return histo; } return new int[0]; }
c.set(Calendar.DAY_OF_MONTH, 1);
public CalendarInfo(Locale locale) { this.locale = locale; /** Set the localized names */// SimpleDateFormat dayFormat = new SimpleDateFormat("EEEE", getLocale());// SimpleDateFormat shortDayFormat = new SimpleDateFormat("E", getLocale()); Calendar c = Calendar.getInstance(getLocale()); ArrayList dow = new ArrayList(); ArrayList sdow = new ArrayList(); /* ********************* Day of Week ************************* */ firstDayOfWeek = c.getFirstDayOfWeek(); /** Get the number of days in a week. Is this ever anything other than 7? */ numberDaysInWeek = getRangeSize(c, Calendar.DAY_OF_WEEK); lastDayOfWeek = firstDayOfWeek - 1; if (lastDayOfWeek < 1) { lastDayOfWeek += numberDaysInWeek; } for (int i = 0; i < 7; i++) { c.set(Calendar.DAY_OF_WEEK, i + 1); Date dt = c.getTime(); dayNames[i] = DateTimeFormatter.getDayName(dt, getLocale()); shortDayNames[i] = DateTimeFormatter.getShortDayName(dt, getLocale()); dow.add(dayNames[i]); sdow.add(shortDayNames[i]); } if (firstDayOfWeek != 1) { /* Rotate the days of the week so that the first day is at the beginning */ int fdow = firstDayOfWeek; while (fdow > 1) { Object o = dow.remove(0); dow.add(o); o = sdow.remove(0); sdow.add(o); fdow--; } dayNamesAdjusted = (String[])dow.toArray(new String[dow.size()]); shortDayNamesAdjusted = (String[])sdow.toArray(new String[sdow.size()]); } else { dayNamesAdjusted = dayNames; shortDayNamesAdjusted = shortDayNames; } /* ****************** Day of Month ***************************** */ dayLabels = new String[getRangeSize(c, Calendar.DAY_OF_MONTH)]; dayVals = new String[getRangeSize(c, Calendar.DAY_OF_MONTH)]; int dom = c.getMinimum(Calendar.DAY_OF_MONTH); for (int i = 0; i < dayLabels.length; i++) { dayLabels[i] = String.valueOf(dom); dayVals[i] = twoDigit(dom); dom++; } /* *********************** Months ***************************** */ monthLabels = new String[getRangeSize(c, Calendar.MONTH)]; monthVals = new String[getRangeSize(c, Calendar.MONTH)]; c.set(Calendar.MONTH, c.getMinimum(Calendar.MONTH)); c.getTime(); // force recompute for (int i = 0; i < monthLabels.length; i++) { // this gives abbreviated form of month name monthLabels[i] = String.valueOf(getComponent(c, DateFormat.MONTH_FIELD, DateFormat.MEDIUM)); /* Calendar class month numbers start at 0 */ monthVals[i] = twoDigit(c.get(Calendar.MONTH) + 1); c.add(Calendar.MONTH, 1); } /* *********************** Hours ***************************** */ hourLabels = new String[getRangeSize(c, Calendar.HOUR)]; hourVals = new String[getRangeSize(c, Calendar.HOUR)]; /* Calendar.HOUR is 0 for 12 o'clock. Skip 0, then add it to the end labeled as 12, but with value 0 */ hourLabels[hourLabels.length - 1] = String.valueOf(hourLabels.length - 1); hourVals[hourLabels.length - 1] = twoDigit(0); int hour = c.getMinimum(Calendar.HOUR) + 1; for (int i = 1; i < hourLabels.length - 1; i++) { hourLabels[i] = String.valueOf(hour); hourVals[i] = twoDigit(hour); hour++; } hour24Labels = new String[getRangeSize(c, Calendar.HOUR_OF_DAY)]; hour24Vals = new String[getRangeSize(c, Calendar.HOUR_OF_DAY)]; int hourOfDay = c.getMinimum(Calendar.HOUR_OF_DAY); for (int i = 0; i < hour24Labels.length; i++) { hour24Labels[i] = twoDigit(hourOfDay); hour24Vals[i] = twoDigit(hourOfDay); hourOfDay++; } /* *********************** Minutes ***************************** */ minuteLabels = new String[getRangeSize(c, Calendar.MINUTE)]; minuteVals = new String[getRangeSize(c, Calendar.MINUTE)]; int minute = c.getMinimum(Calendar.MINUTE); for (int i=0; i < minuteLabels.length; i++) { minuteLabels[i] = twoDigit(minute); minuteVals[i] = twoDigit(minute); minute++; } }
public static String getDayName(Date val, Locale loc) { Formatters fmt = getFormatters(loc); synchronized (fmt) { return fmt.dayFormatter.format(val); }
public String getDayName() { return calInfo.getDayName(getDayOfWeek());
public static String getDayName(Date val, Locale loc) { Formatters fmt = getFormatters(loc); synchronized (fmt) { return fmt.dayFormatter.format(val); } }
SphericalCoords.distance(eventLoc.latitude, eventLoc.longitude, seismoLoc.latitude, seismoLoc.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");
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; }
}catch(Exception e){}
}catch(Exception e){ e.printStackTrace(); }
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; }
image = null;
protected void resize() { Insets insets = getInsets(); synchronized(imagePainter){ Dimension d = getSize(); int w = (d.width - insets.left - insets.right) * 5, h = d.height - insets.top - insets.bottom; imageSize = new Dimension(w, h); displaySize = new Dimension(d.width - insets.left - insets.right, d.height - insets.top - insets.bottom); timeScaleMap.setTotalPixels(d.width-insets.left-insets.right); ampScaleMap.setTotalPixels(d.height-insets.top-insets.bottom); } redo = true; repaint(); }
Main.getMainFrame().lobby.append(this.getText() + "\n");
Main.getMainFrame().lobby.append("Menu command: " + this.getText() + "\n");
public void actionPerformed(ActionEvent e) { Main.getMainFrame().lobby.append(this.getText() + "\n"); doAction(); }
suffixedDss[i] = new DataSetSeismogram(dss[i], dss[i].toString() + suffix);
dss[i].setName(dss[i].getName() + suffix);
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; }
return suffixedDss;
return dss;
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 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){ renderToGraphics(g, getPreferredSize());
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(); } }
fileChooser.setCurrentDirectory(Configuration.getLastDirectory());
fileChooser.setSelectedFile(Configuration.getLastDirectory());
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); }
fileChooser.setCurrentDirectory(Configuration.getLastDirectory());
fileChooser.setSelectedFile(Configuration.getLastDirectory());
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 addElement(URL url) { int index = getSize(); addElementAt(index, url);
public void addElement(File f) { try { int index = getSize(); addElementAt(index, f.toURL()); } catch (Exception exc) { throw new RuntimeException(exc); }
public void addElement(URL url) { int index = getSize(); addElementAt(index, url); }
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;
public synchronized void play() { if (playingIndex < 0) { playingIndex = 0;
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); } }
playingIndex = index; if (isPlaying()) { player.stop(); } try { final URL url = (URL)getElementAt(index); if (history.size() > HISTORY_SIZE) { history.removeFirst(); } history.addLast(url); 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); }
play(playingIndex);
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); } }
if (playerThread != null && !playerThread.isInterrupted()) { playerThread.interrupt(); }
public synchronized void stop() { if (player != null) { player.stop(); player = null; } }
return null;
return ctrlPanel;
public Component getAppletInstance() { return null;//ctrlPanel; }
_reportFilePathsMap.put(PDF_FORMAT, business.getPdfReport(print, "report"));
private void generateReport(IWContext iwc) throws RemoteException, JRException { if (_dataSource != null && _design != null) { JasperReportBusiness business = getReportBusiness(); _parameterMap.put(DynamicReportDesign.PRM_REPORT_NAME, _reportName); JasperPrint print = business.getReport(_dataSource, _parameterMap, _design); if (_reportFilePathsMap == null) { _reportFilePathsMap = new HashMap(); } //_reportFilePathsMap.put(PDF_FORMAT, business.getPdfReport(print, "report")); _reportFilePathsMap.put(EXCEL_FORMAT, business.getExcelReport(print, "report")); _reportFilePathsMap.put(HTML_FORMAT, business.getHtmlReport(print, "report")); } }
Link pdf = new Link(_reportName, (String) _reportFilePathsMap.get(PDF_FORMAT));
private PresentationObject getReportLink(IWContext iwc) { Table reports = new Table(2, 4); reports.mergeCells(1, 1, 2, 1); Link excel = new Link(_reportName, (String) _reportFilePathsMap.get(EXCEL_FORMAT)); excel.setTarget(Link.TARGET_NEW_WINDOW); //Link pdf = new Link(_reportName, (String) _reportFilePathsMap.get(PDF_FORMAT)); Link html = new Link(_reportName, (String) _reportFilePathsMap.get(HTML_FORMAT)); html.setTarget(Link.TARGET_NEW_WINDOW); reports.add( getResourceBundle(iwc).getLocalizedString("ReportGenerator.click_on_format", "Select a link for the desired output format."), 1, 1); reports.add("Excel : ", 1, 2); reports.add(excel, 2, 2); reports.add("PDF : ", 1, 3); //reports.add(pdf, 2, 3); reports.add("HTML : ", 1, 4); reports.add(html, 2, 4); return reports; }
reports.add(pdf, 2, 3);
private PresentationObject getReportLink(IWContext iwc) { Table reports = new Table(2, 4); reports.mergeCells(1, 1, 2, 1); Link excel = new Link(_reportName, (String) _reportFilePathsMap.get(EXCEL_FORMAT)); excel.setTarget(Link.TARGET_NEW_WINDOW); //Link pdf = new Link(_reportName, (String) _reportFilePathsMap.get(PDF_FORMAT)); Link html = new Link(_reportName, (String) _reportFilePathsMap.get(HTML_FORMAT)); html.setTarget(Link.TARGET_NEW_WINDOW); reports.add( getResourceBundle(iwc).getLocalizedString("ReportGenerator.click_on_format", "Select a link for the desired output format."), 1, 1); reports.add("Excel : ", 1, 2); reports.add(excel, 2, 2); reports.add("PDF : ", 1, 3); //reports.add(pdf, 2, 3); reports.add("HTML : ", 1, 4); reports.add(html, 2, 4); return reports; }
logger.debug("dataset append "+config.getChildNodes().getLength());
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 }
logger.debug("dataset import "+config.getChildNodes().getLength());
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 }
logger.debug("node "+nl.item(i).getLocalName());
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 }
Property[] props = seis.getProperties();
/*Property[] props = seis.getProperties();
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."); }
logger.debug("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."); }
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."); }
logger.debug("found "+names.length+" names in xml"); logger.debug("cache has "+seismogramCache.keySet().size());
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; }
logger.debug("++++++++ name is "+name +" the datasetID name is "+ds.getName());
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; }
NodeList nodes = evalNodeList(config, "datasetRef"); if (nodes == null) { return null; } for (int i=0; i<nodes.getLength(); i++) { Node n = nodes.item(i); NamedNodeMap map = n.getAttributes(); try { if (n instanceof Element) { Element e = (Element)n; String href = e.getAttribute("xlink:href"); SimpleXLink sl = new SimpleXLink(docBuilder, e, getBase()); Element referredElement = sl.retrieve(); XMLDataSet ds = new XMLDataSet(docBuilder, new URL(getBase(), href), referredElement); if(id.equals(ds.getId())) { dataSetCache.put(ds.getId(), ds); return ds; } } else { return null; } } catch (Exception e) { e.printStackTrace(); return null; } }
public DataSet getDataSetById(String id) { if (dataSetCache.containsKey(id)) { return (DataSet)dataSetCache.get(id); } NodeList nList = evalNodeList(config, "//dataset[@datasetid="+dquote+id+dquote+"]"); if (nList != null && nList.getLength() != 0) { Node n = nList.item(0); if (n instanceof Element) { XMLDataSet dataset = new XMLDataSet(docBuilder, base, (Element)n); dataSetCache.put(id, dataset); return dataset; } } // not an embedded dataset, try datasetRef // getIds adds to cache String[] ids = getDataSetRefIds(); if (dataSetCache.containsKey(id)) { return (DataSet)dataSetCache.get(id); } logger.error("Couldn't get datasetRef :"+id); // can't find it return null; }
logger.debug("External Dataset Id cache :'"+external[i]+"'");
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; }
logger.debug("Dataset Id cache :'"+tmp[i]+"'");
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; }
System.out.println("the length of the nodes is "+nodes.getLength());
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; }
logger.debug("attribute: "+map.item(j).getLocalName());
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; }
logger.debug("got href="+href+" base="+getBase()); SimpleXLink sl = new SimpleXLink(docBuilder, e, getBase());
SimpleXLink sl = new SimpleXLink(docBuilder, e, getBase());
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; }
logger.debug("simpleLink element is"+referredElement.toString());
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; }
logger.debug("got "+xlinks.length+" datasetRef ids from "+xlinktmps.length+" datasetRefs");
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; }
System.out.println("PROPERTY TAG EXISTS");
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; }
logger.debug("getting the parameter "+name);
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; }
logger.debug("The name of the data set is "+getName()); logger.debug("The name of the seismogram is "+name);
public LocalSeismogramImpl getSeismogram(String name) { if (seismogramCache.containsKey(name)) { 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; }
logger.debug("The &&&&&&&&&&&&&&&&&&& chan_cdoe from dsml file is "+ ((SeismogramAttrImpl)seisAttr).getChannelID().channel_code);
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; }
logger.debug("The &&&&&&&&&&&&&&&&&&& chan_code after setting is "+ seis.getChannelID().channel_code);
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; }
System.out.println(indent+" has "+names.length+" seismograms.");
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); } }
setDocument(new IdeaDocument()); selectIdea(this.getSelectedView().getIdea());
public IdeaMap() { text = new JTextField(""); setLayout(new BorderLayout()); add(text, BorderLayout.NORTH); controller = new IdeaMapController(this); setBackground(DEFAULT_BACKGROUND); JLayeredPane mapArea = new JLayeredPane(); mapArea.setBackground(new Color(0, 0, 0, 0)); add(mapArea, BorderLayout.CENTER); setPropertiesPanel(new FloatingPanel()); getPropertiesPanel().setCaption("Properties"); getPropertiesPanel().setBounds(50, 50, 200, 200); JLabel labTest = new JLabel("Test"); labTest.setForeground(null); getPropertiesPanel().getContentPane().add(labTest); mapArea.add(getPropertiesPanel()); this.setPropertiesVisible(false); viewport.addPropertyChangeListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { repaint(); } }); }
log = Logger.getLogger(this.getClass());
log = Logger.getLogger(getClass());
protected Logger getLogger() { if (log == null) { log = Logger.getLogger(this.getClass()); } return log; }