rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
public NamedColor(int r, int b, int g, int a, String name){ super(r, g, b, a); this.name = name;
public NamedColor(Color color, String name){ this(color.getRed(), color.getBlue(), color.getGreen(), color.getAlpha(), name);
public NamedColor(int r, int b, int g, int a, String name){ super(r, g, b, a); this.name = name; }
calculateTicks();
TimeScaleCalc (int totalPixels, TimeConfigRegistrar tr){ this.totalPixels = totalPixels; this.timeRegistrar = new TimeConfigRegistrar(tr, this); setTimes(); calculateTicks(); }
left = 10;
left = 15;
public LeftTitleBorder(String title) { top = 0; left = 10; right = 0; bottom = 0; this.title = title; isChannelTitle = false; }
public void removeSelectionDisplay(){ if(selectionDisplay != null){ Iterator e = basicDisplays.iterator(); while(e.hasNext()){ ((BasicSeismogramDisplay)e.next()).clearRegSelections(); } selectionWindow.dispose(); selectionDisplay.parent = null; selectionDisplay.removeAll(); selectionDisplay = null;
public void removeSelectionDisplay(VerticalSeismogramDisplay display){ if(display == selectionDisplay){ removeSelectionDisplay(); }else if(display == threeSelectionDisplay){ remove3CSelectionDisplay();
public void removeSelectionDisplay(){ if(selectionDisplay != null){ Iterator e = basicDisplays.iterator(); while(e.hasNext()){ ((BasicSeismogramDisplay)e.next()).clearRegSelections(); } selectionWindow.dispose(); selectionDisplay.parent = null; selectionDisplay.removeAll(); selectionDisplay = null; } }
if(threeSelectionDisplay != null){ Iterator e = basicDisplays.iterator(); while(e.hasNext()){ ((BasicSeismogramDisplay)e.next()).clear3CSelections(); }
Iterator e = basicDisplays.iterator(); while(e.hasNext()){ ((BasicSeismogramDisplay)e.next()).clear3CSelections(); } if(threeSelectionWindow != null){
public void remove3CSelectionDisplay(){ if(threeSelectionDisplay != null){ Iterator e = basicDisplays.iterator(); while(e.hasNext()){ ((BasicSeismogramDisplay)e.next()).clear3CSelections(); } threeSelectionWindow.dispose(); threeSelectionDisplay.parent = null; threeSelectionDisplay.removeAll(); threeSelectionDisplay = null; } }
threeSelectionDisplay.parent = null;
threeSelectionWindow = null;
public void remove3CSelectionDisplay(){ if(threeSelectionDisplay != null){ Iterator e = basicDisplays.iterator(); while(e.hasNext()){ ((BasicSeismogramDisplay)e.next()).clear3CSelections(); } threeSelectionWindow.dispose(); threeSelectionDisplay.parent = null; threeSelectionDisplay.removeAll(); threeSelectionDisplay = null; } }
protected void setUp() throws Exception { super.setUp(); short size = 40; intTestData = new int[size]; shortTestData = new short[size]; floatTestData = new float[size]; doubleTestData = new double[size]; for (short i=0; i<size; i++) { shortTestData[i] = 1; intTestData[i] = i; floatTestData[i] = i; doubleTestData[i] = i; } rtrend = createInstance(); }
protected void setUp() throws Exception { super.setUp(); short size = 40; intTestData = new int[size]; shortTestData = new short[size]; floatTestData = new float[size]; doubleTestData = new double[size]; for (short i=0; i<size; i++) { shortTestData[i] = i; intTestData[i] = i; floatTestData[i] = i; doubleTestData[i] = i; } rtrend = createInstance(); }
protected void setUp() throws Exception { // JUnitDoclet begin method testcase.setUp super.setUp(); short size = 40; intTestData = new int[size]; shortTestData = new short[size]; floatTestData = new float[size]; doubleTestData = new double[size]; for (short i=0; i<size; i++) { shortTestData[i] = 1; intTestData[i] = i; floatTestData[i] = i; doubleTestData[i] = i; } // end of for (int i=0; i<intTestData.length; i++) rtrend = createInstance(); // JUnitDoclet end method testcase.setUp }
form.getMsg().emit("org.bedework.message.added.locations", 1);
form.getMsg().emit("org.bedework.client.message.added.locations", 1);
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } BwLocation l = form.getNewLocation(); if (l == null) { return "success"; } form.getCalSvcI().addLocation(l); form.getMsg().emit("org.bedework.message.added.locations", 1); return "success"; }
return new Vector();
return new ArrayList();
public Collection getEventFormatters() throws Throwable { try { getEvents(); if (eventFormatters == null) { if (events == null) { return new Vector(); } eventFormatters = new Vector(); Iterator it = events.iterator(); while (it.hasNext()) { eventFormatters.add(new EventFormatter((EventInfo)it.next(), view, calInfo, view.getTimezones())); } } } catch (Throwable t) { Logger.getLogger(this.getClass()).error("getEventFormatters", t); throw t; } return eventFormatters; }
eventFormatters = new Vector();
eventFormatters = new ArrayList();
public Collection getEventFormatters() throws Throwable { try { getEvents(); if (eventFormatters == null) { if (events == null) { return new Vector(); } eventFormatters = new Vector(); Iterator it = events.iterator(); while (it.hasNext()) { eventFormatters.add(new EventFormatter((EventInfo)it.next(), view, calInfo, view.getTimezones())); } } } catch (Throwable t) { Logger.getLogger(this.getClass()).error("getEventFormatters", t); throw t; } return eventFormatters; }
dataSetIdCache = null; if (dataset instanceof XMLDataSet) {
if (dataset instanceof XMLDataSet) {
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 }
parameterNameCache = null;
public void addParameter(String name, Object value, AuditInfo[] audit) { parameterNameCache = null; parameterCache.put(name, value); //if (value instanceof Element) { Element parameter = config.getOwnerDocument().createElement("parameter"); XMLParameter.insert(parameter, name, value); // Object cacheEvent = XMLParameter.getParameter(parameter);// if(cacheEvent instanceof edu.sc.seis.fissuresUtil.cache.CacheEvent) {// System.out.println("Instance of CaCHE EVENT -----------"); // } else {// System.out.println(" NOt an Instance of CACHE EVENT ------");// } config.appendChild(parameter); //} else { // logger.warn("Parameter is only stored in memory."); //} // end of else }
parameterNameCache = null;
public void addParameterRef(URL paramURL, String name, AuditInfo[] audit) { parameterNameCache = null; String baseStr = base.toString(); String paramStr = paramURL.toString(); if (paramStr.startsWith(baseStr)) { // use relative URL paramStr = paramStr.substring(baseStr.length()); } // end of if (paramStr.startsWith(baseStr)) //System.out.println("inside the addParameterRef"); Document doc = config.getOwnerDocument(); Element param = doc.createElement("parameterRef"); param.setAttributeNS(xlinkNS, "xlink:type", "simple"); param.setAttributeNS(xlinkNS, "xlink:href", paramStr); Text text = doc.createTextNode(name); param.appendChild(text); config.appendChild(param); }
seismogramNameCache = null;
public void addSeismogram(LocalSeismogramImpl seis, AuditInfo[] audit) { seismogramNameCache = null; // Note this does not set the xlink, as the seis has not been saved anywhere yet. Document doc = config.getOwnerDocument(); Element localSeismogram = doc.createElement("localSeismogram");//doc.createElement("SacSeismogram"); String name =seis.getProperty(seisNameKey); if (name == null || name.length() == 0) { name = edu.iris.Fissures.network.ChannelIdUtil.toStringNoDates(seis.channel_id); } Element seismogramAttr = doc.createElement("seismogramAttr"); XMLSeismogramAttr.insert(seismogramAttr, (LocalSeismogram)seis); localSeismogram.appendChild(seismogramAttr); Element nameE = doc.createElement("name"); nameE.setNodeValue(name); localSeismogram.appendChild(nameE); Property[] props = seis.getProperties(); //System.out.println("the length of the Properties of the seismogram are "+props.length); Element propE, propNameE, propValueE; for (int i=0; i<props.length; i++) { if (props[i].name != seisNameKey) { propE = doc.createElement("property"); propNameE = doc.createElement("name"); propNameE.setNodeValue(props[i].name); propValueE = doc.createElement("value"); propValueE.setNodeValue(props[i].value); propE.appendChild(propNameE); propE.appendChild(propValueE); localSeismogram.appendChild(propE); } } config.appendChild(localSeismogram); seismogramCache.put(name, seis); logger.debug("added seis now "+getSeismogramNames().length+" seisnogram names."); //xpath = new CachedXPathAPI(xpath); logger.debug("2 added seis now "+getSeismogramNames().length+" seisnogram names."); }
seismogramNameCache = null;
public void addSeismogramRef(LocalSeismogramImpl seis, URL seisURL, String name, Property[] props, ParameterRef[] parm_ids, AuditInfo[] audit) { seismogramNameCache = null; String baseStr = base.toString(); String seisStr = seisURL.toString(); if (seisStr.startsWith(baseStr)) { // use relative URL seisStr = seisStr.substring(baseStr.length()); } // end of if (seisStr.startsWith(baseStr)) Document doc = config.getOwnerDocument(); Element localSeismogram = doc.createElement("localSeismogram"); Element seismogramAttr = doc.createElement("seismogramAttr"); XMLSeismogramAttr.insert(seismogramAttr, (LocalSeismogram)seis); localSeismogram.appendChild(seismogramAttr); Element data = doc.createElement("data"); data.setAttributeNS(xlinkNS, "xlink:type", "simple"); data.setAttributeNS(xlinkNS, "xlink:href", seisStr); data.setAttribute("seisType", "sac"); //Element nameE = doc.createElement("name"); // Text text = doc.createTextNode(name); //nameE.appendChild(text); //localSeismogram.appendChild(nameE); localSeismogram.appendChild(data); /* Element propE, propNameE, propValueE; for (int i=0; i<props.length; i++) { if (props[i].name != seisNameKey) { propE = doc.createElement("property"); propNameE = doc.createElement("name"); text = doc.createTextNode(props[i].name); propNameE.appendChild(text); propValueE = doc.createElement("value"); text = doc.createTextNode(props[i].value); propValueE.appendChild(text); propE.appendChild(propNameE); propE.appendChild(propValueE); sac.appendChild(propE); } }*/ config.appendChild(localSeismogram); }
dataSetIdCache = null;
public DataSet createChildDataSet(String id, String name, String owner, AuditInfo[] audit) { dataSetIdCache = null; XMLDataSet dataset = new XMLDataSet(docBuilder, base, id, name, owner); addDataSet(dataset, audit); return dataset; }
channelId.station_code = channelId.station_code.toLowerCase();
public edu.iris.Fissures.IfNetwork.Channel getChannel(ChannelId channelId) { //System.out.println("-------- "+StdDataSetParamNames.CHANNEL+ChannelIdUtil.toString(channelId)); Object obj = getParameter(StdDataSetParamNames.CHANNEL+ChannelIdUtil.toString(channelId)); return (edu.iris.Fissures.IfNetwork.Channel)obj; }
if (dataSetIdCache == null) { dataSetIdCache = getAllAsStrings("*/@datasetid"); } return dataSetIdCache;
return getAllAsStrings("*/@datasetid");
public String[] getDataSetIds() { if (dataSetIdCache == null) { dataSetIdCache = getAllAsStrings("*/@datasetid"); } // end of if (dataSetIdCache == null) return dataSetIdCache; }
boolean found;
/*boolean found;
public edu.sc.seis.fissuresUtil.cache.CacheEvent getEvent() { boolean found; NodeList paramList = evalNodeList(config, "parameter"); if(paramList != null && paramList.getLength() != 0) { for(int counter = 0; counter < paramList.getLength(); counter++) { Object object = XMLParameter.getParameter((Element)paramList.item(counter)); if(object instanceof edu.sc.seis.fissuresUtil.cache.CacheEvent){ return (edu.sc.seis.fissuresUtil.cache.CacheEvent)object; } } } return null; }
return null;
return null;*/ return (edu.sc.seis.fissuresUtil.cache.CacheEvent)getParameter(StdDataSetParamNames.EVENT);
public edu.sc.seis.fissuresUtil.cache.CacheEvent getEvent() { boolean found; NodeList paramList = evalNodeList(config, "parameter"); if(paramList != null && paramList.getLength() != 0) { for(int counter = 0; counter < paramList.getLength(); counter++) { Object object = XMLParameter.getParameter((Element)paramList.item(counter)); if(object instanceof edu.sc.seis.fissuresUtil.cache.CacheEvent){ return (edu.sc.seis.fissuresUtil.cache.CacheEvent)object; } } } return null; }
logger.debug("getting the parameter "+name);
System.out.println("getting the parameter");
public Object getParameter(String name) { //ChannelProxy channelProxy = new ChannelProxy(); //ChannelId[] channelIds = getChannelIds(); //channelProxy.retrieve_grouping(channelIds, channelIds[0]); ///************************************************ 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) { return XMLParameter.getParameter((Element)n); //System.out.println("THe tag name is "+((Element)n).getTagName()); // parameterCache.put(name, n); // return (Element)n; } } 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 NODE LIST IS NULL for parameter "+name);
System.out.println("THE NODELIST IS NULL");
public Object getParameter(String name) { //ChannelProxy channelProxy = new ChannelProxy(); //ChannelId[] channelIds = getChannelIds(); //channelProxy.retrieve_grouping(channelIds, channelIds[0]); ///************************************************ 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) { return XMLParameter.getParameter((Element)n); //System.out.println("THe tag name is "+((Element)n).getTagName()); // parameterCache.put(name, n); // return (Element)n; } } 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.error("can't get paramterRef for "+name, e);
logger.error("can't get paramterRef", e);
public Object getParameter(String name) { //ChannelProxy channelProxy = new ChannelProxy(); //ChannelId[] channelIds = getChannelIds(); //channelProxy.retrieve_grouping(channelIds, channelIds[0]); ///************************************************ 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) { return XMLParameter.getParameter((Element)n); //System.out.println("THe tag name is "+((Element)n).getTagName()); // parameterCache.put(name, n); // return (Element)n; } } 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.warn("can't find paramter for "+name);
public Object getParameter(String name) { //ChannelProxy channelProxy = new ChannelProxy(); //ChannelId[] channelIds = getChannelIds(); //channelProxy.retrieve_grouping(channelIds, channelIds[0]); ///************************************************ 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) { return XMLParameter.getParameter((Element)n); //System.out.println("THe tag name is "+((Element)n).getTagName()); // parameterCache.put(name, n); // return (Element)n; } } 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; }
if (parameterNameCache == null) { parameterNameCache = cacheParameterNames(); } return parameterNameCache;
String[] params = getAllAsStrings("parameter/name/text()"); String[] paramRefs = getAllAsStrings("parameterRef/text()"); String[] all = new String[params.length+paramRefs.length]; System.arraycopy(params, 0, all, 0, params.length); System.arraycopy(paramRefs, 0, all, params.length, paramRefs.length); return all;
public String[] getParameterNames() { if (parameterNameCache == null) { parameterNameCache = cacheParameterNames(); } // end of if (parameterNameCache == null) return parameterNameCache; }
NodeList seisAttrNode = XMLUtil.evalNodeList(e, "seismogramAttr"); if(seisAttrNode != null && seisAttrNode.getLength() != 0) { seis.setAttributes(XMLSeismogramAttr.getSeismogramAttr((Element)seisAttrNode.item(0))); }
public LocalSeismogramImpl getSeismogram(String name) { if (seismogramCache.containsKey(name)) { return (LocalSeismogramImpl)seismogramCache.get(name); } // end of if (seismogramCache.containsKey(name)) String urlString = "NONE"; NodeList nList = evalNodeList(config, "localSeismogram/seismogramAttr/property[name="+dquote+"Name"+dquote+ "]"+"[value="+dquote+name+dquote+"]"+"/../../data"); if(nList == null || (nList != null && nList.getLength() == 0)) { nList = getNoNameSeismogram(name); } if (nList != null && nList.getLength() != 0) { try { Node n = nList.item(0); if (n instanceof Element) { Element e = (Element)n; //System.out.println("**********************The name of the element is "+e.getTagName()); urlString = e.getAttribute("xlink:href"); if (urlString == null || urlString == "") { throw new MalformedURLException(name+" does not have an xlink:href attribute"); } // end of if (urlString == null || urlString == "") URL sacURL = new URL(base, urlString); DataInputStream dis = new DataInputStream(new BufferedInputStream(sacURL.openStream())); SacTimeSeries sac = new SacTimeSeries(); sac.read(dis); LocalSeismogramImpl seis = SacToFissures.getSeismogram(sac); //get the Seismogram Attributes from the xml .. only the data must // must be obtained fromt the SAC. /*SeismogramAttr[] seismogramAttributes = getSeismogramAttrs(); for(int counter = 0; counter < seismogramAttributes.length; counter++) { if(ChannelIdUtil.toStringNoDates(((SeismogramAttrImpl)seismogramAttributes[counter]).getChannelID()).equals(name)) { logger.debug("************* IN XML DATASET changing the SeismogramAttr to be from the xml "); seis.setAttributes(seismogramAttributes[counter]); break; } }*/ 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; }
if (seismogramNameCache == null) { seismogramNameCache = cacheSeismogramNames(); } return seismogramNameCache;
String[] names = getAllAsStrings("localSeismogram/seismogramAttr/property[name="+dquote+"Name"+dquote+ "]"+"/value/text()"); logger.debug("found "+names.length+" names in xml"); logger.debug("cache has "+seismogramCache.keySet().size()); String outNames[] = new String[names.length]; 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++; } String[] noNames = getNoNameSeismogramNames(); String[] rtnValues = new String[noNames.length + 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;
public String[] getSeismogramNames() { if (seismogramNameCache == null) { seismogramNameCache = cacheSeismogramNames(); } // end of if (seismogramNameCache == null) return seismogramNameCache; }
form.getMsg().emit("org.bedework.pubevents.message.category.referenced");
form.getErr().emit("org.bedework.client.error.category.referenced");
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access */ if (!form.getAuthorisedUser()) { return "noAccess"; } BwCategory key = form.getCategory(); int delResult = form.getCalSvcI().deleteCategory(key); if (delResult == 2) { form.getMsg().emit("org.bedework.pubevents.message.category.referenced"); return "inUse"; } if (delResult == 1) { form.getErr().emit("org.bedework.pubevents.error.nosuchcategory", key); return "notFound"; } form.getMsg().emit("org.bedework.pubevents.message.category.deleted"); return "continue"; }
form.getErr().emit("org.bedework.pubevents.error.nosuchcategory", key);
form.getErr().emit("org.bedework.client.error.nosuchcategory", key);
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access */ if (!form.getAuthorisedUser()) { return "noAccess"; } BwCategory key = form.getCategory(); int delResult = form.getCalSvcI().deleteCategory(key); if (delResult == 2) { form.getMsg().emit("org.bedework.pubevents.message.category.referenced"); return "inUse"; } if (delResult == 1) { form.getErr().emit("org.bedework.pubevents.error.nosuchcategory", key); return "notFound"; } form.getMsg().emit("org.bedework.pubevents.message.category.deleted"); return "continue"; }
form.getMsg().emit("org.bedework.pubevents.message.category.deleted");
form.getMsg().emit("org.bedework.client.message.category.deleted");
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access */ if (!form.getAuthorisedUser()) { return "noAccess"; } BwCategory key = form.getCategory(); int delResult = form.getCalSvcI().deleteCategory(key); if (delResult == 2) { form.getMsg().emit("org.bedework.pubevents.message.category.referenced"); return "inUse"; } if (delResult == 1) { form.getErr().emit("org.bedework.pubevents.error.nosuchcategory", key); return "notFound"; } form.getMsg().emit("org.bedework.pubevents.message.category.deleted"); return "continue"; }
dataset.addDataSet(new URLDataSet(childElement.getAttribute("xlink:title)"), new URL(base, childElement.getAttribute("xlink:href"))),
dataset.addDataSet(new URLDataSet(childElement.getAttribute("xlink:title"), new URL(base, childElement.getAttribute("xlink:href"))),
public DataSet extract(URL base, Element element) throws MalformedURLException{ String name = ""; String owner = ""; String id = element.getAttribute("datasetid"); Node temp; NodeList children = element.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { if (children.item(i) instanceof Element) { Element child = (Element)children.item(i); if (child.getNodeName().equals("name")) { name = XMLUtil.getText(child); } else if (child.getNodeName().equals("owner")) { owner = XMLUtil.getText(child); } } } // all 3 should be populated now AuditInfo[] audit = new AuditInfo[1]; audit[0] = new AuditInfo("loaded from "+base.toString(), System.getProperty("user.name")); if (id == null || id.length() == 0) { id = "autogen_id-"+Math.random(); } MemoryDataSet dataset = new MemoryDataSet(id, name, owner, audit); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if (child.getNodeName().equals("dataset")) { dataset.addDataSet(extract(base, (Element)child), audit); } else if (child.getNodeName().equals("datasetRef")) { Element childElement = (Element)child; dataset.addDataSet(new URLDataSet(childElement.getAttribute("xlink:title)"), new URL(base, childElement.getAttribute("xlink:href"))), audit); } else if (child.getNodeName().equals("urlDataSetSeismogram")) { dataset.addDataSetSeismogram(URLDataSetSeismogram.getURLDataSetSeismogram(base, (Element)child), audit); } else if (child.getNodeName().equals("parameter")) { String paramName = XMLUtil.getText(XMLUtil.getElement((Element)child, "name")); Object o = XMLParameter.getParameter((Element)child); dataset.addParameter(paramName, o, audit); } } return dataset; }
logger.debug("Not a 2.0 dsml. "+docElement.getTagName()+" "+docElement.getAttribute("xsi:schemaLocation"));
logger.warn("Not a 2.0 dsml. "+docElement.getTagName()+" "+docElement.getAttribute("xsi:schemaLocation"));
public static DataSet load(URL datasetURL) throws IOException, ParserConfigurationException, SAXException { DataSet dataset = null; DocumentBuilder docBuilder = XMLDataSet.getDocumentBuilder(); Document doc = docBuilder.parse(new BufferedInputStream(datasetURL.openStream())); Element docElement = doc.getDocumentElement(); if (docElement.getTagName().equals("dataset") && docElement.getAttribute("xsi:schemaLocation").equals(DSML_SCHEMA2_0)) { DataSetToXML dataSetToXML = new DataSetToXML(); dataset = dataSetToXML.extract(datasetURL, docElement); } else { logger.debug("Not a 2.0 dsml. "+docElement.getTagName()+" "+docElement.getAttribute("xsi:schemaLocation")); dataset = new XMLDataSet(docBuilder, datasetURL, docElement); } return dataset; }
return seismogramNameCache;
public String[] getDataSetSeismogramNames() { if(dssNames.size() == 0) { // for(int counter = 0; counter < seismogramNameCache.length; counter++) {// dssNames.add(seismogramNameCache[counter]);// } } return ((String[])dssNames.toArray(new String[0])); }
public static LocalSeismogramImpl steim1(LocalSeismogramImpl seis) throws SteimException, IOException { int[] data = seis.get_as_longs(); LinkedList allBlocks = new LinkedList(); SteimFrameBlock block = Steim1.encode(data, 63); allBlocks.addLast(block); while (block.getNumSamples() < data.length) { int[] tmpData = new int[data.length-block.getNumSamples()]; System.arraycopy(data, block.getNumSamples(), tmpData, 0, tmpData.length); data = tmpData; block = Steim1.encode(data, 63); allBlocks.addLast(block); } EncodedData[] edata = new EncodedData[allBlocks.size()]; for (int i = 0; i < edata.length; i++) { block = (SteimFrameBlock)allBlocks.get(i); edata[i] = new EncodedData((short)B1000Types.STEIM1, block.getEncodedData(), block.getNumSamples(), false); } TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); dataSel.encoded_values(edata); LocalSeismogramImpl out = new LocalSeismogramImpl(seis, dataSel); return out;
public static LocalSeismogramImpl steim1(LocalSeismogramImpl seis) throws SteimException, IOException, CodecException, IOException { return steim1(seis, false);
public static LocalSeismogramImpl steim1(LocalSeismogramImpl seis) throws SteimException, IOException { int[] data = seis.get_as_longs(); LinkedList allBlocks = new LinkedList(); SteimFrameBlock block = Steim1.encode(data, 63); allBlocks.addLast(block); while (block.getNumSamples() < data.length) { // not all data encoded, make a new block int[] tmpData = new int[data.length-block.getNumSamples()]; System.arraycopy(data, block.getNumSamples(), tmpData, 0, tmpData.length); data = tmpData; block = Steim1.encode(data, 63); allBlocks.addLast(block); } EncodedData[] edata = new EncodedData[allBlocks.size()]; for (int i = 0; i < edata.length; i++) { block = (SteimFrameBlock)allBlocks.get(i); edata[i] = new EncodedData((short)B1000Types.STEIM1, block.getEncodedData(), block.getNumSamples(), false); } TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); dataSel.encoded_values(edata); LocalSeismogramImpl out = new LocalSeismogramImpl(seis, dataSel); return out; }
throw new RuntimeException("Immutable");
if (!CalFacadeUtil.eqObjval(ref.getOwner(), val)) { ref.setOwner(val); setRefChanged(true); }
public void setOwner(BwUser val) { throw new RuntimeException("Immutable"); }
Column date = new Column(COLUMN_DATE); Column code = new Column(COLUMN_TRANSACTION_TYPE);
Column date = new Column(table, COLUMN_DATE); Column code = new Column(table, COLUMN_TRANSACTION_TYPE);
public Collection ejbFindRefunds(IWTimestamp from, IWTimestamp to) throws FinderException { to.addDays(1); Table table = new Table(this); Column date = new Column(COLUMN_DATE); Column code = new Column(COLUMN_TRANSACTION_TYPE); SelectQuery query = new SelectQuery(table); query.addColumn(new WildCardColumn(table)); query.addCriteria(new MatchCriteria(code, MatchCriteria.EQUALS, KortathjonustanAuthorisationEntries.AUTHORIZATION_TYPE_REFUND)); query.addCriteria(new MatchCriteria(date, MatchCriteria.GREATEREQUAL, from.getDate().toString())); query.addCriteria(new MatchCriteria(date, MatchCriteria.LESSEQUAL, to.getDate().toString())); return this.idoFindPKsByQuery(query); }
query.addColumn(new WildCardColumn(table));
query.addColumn(new Column(table, getIDColumnName()));
public Collection ejbFindRefunds(IWTimestamp from, IWTimestamp to) throws FinderException { to.addDays(1); Table table = new Table(this); Column date = new Column(COLUMN_DATE); Column code = new Column(COLUMN_TRANSACTION_TYPE); SelectQuery query = new SelectQuery(table); query.addColumn(new WildCardColumn(table)); query.addCriteria(new MatchCriteria(code, MatchCriteria.EQUALS, KortathjonustanAuthorisationEntries.AUTHORIZATION_TYPE_REFUND)); query.addCriteria(new MatchCriteria(date, MatchCriteria.GREATEREQUAL, from.getDate().toString())); query.addCriteria(new MatchCriteria(date, MatchCriteria.LESSEQUAL, to.getDate().toString())); return this.idoFindPKsByQuery(query); }
return getComponents(dataSet, rf);
Set componentSeismograms = new HashSet(); MicroSecondTimeRange tr = new MicroSecondTimeRange(rf); ChannelId chanId = rf.channel_id; String[] names = dataSet.getDataSetSeismogramNames(); for (int i = 0; i < names.length; i++ ) { DataSetSeismogram currentSeis = dataSet.getDataSetSeismogram(names[i]); RequestFilter currentRF = currentSeis.getRequestFilter(); MicroSecondTimeRange curTr = new MicroSecondTimeRange(currentRF); if(areFriends(chanId,currentRF.channel_id) && tr.equals(curTr)) componentSeismograms.add(currentSeis); } if(componentSeismograms.size() < 3) for (int i = 0; i < names.length; i++ ) { DataSetSeismogram currentSeis = dataSet.getDataSetSeismogram(names[i]); RequestFilter currentRF = currentSeis.getRequestFilter(); MicroSecondTimeRange curTr = new MicroSecondTimeRange(currentRF); if(areFriends(chanId,currentRF.channel_id) && areOverlapping(tr, curTr)) componentSeismograms.add(currentSeis); } DataSetSeismogram[] components = new DataSetSeismogram[componentSeismograms.size()]; componentSeismograms.toArray(components); return components;
public static DataSetSeismogram[] getComponents(DataSetSeismogram seismogram){ DataSet dataSet = seismogram.getDataSet(); RequestFilter rf = seismogram.getRequestFilter(); return getComponents(dataSet, rf); }
public boolean equals(MicroSecondTimeRange otherTime){ if(this == otherTime){ return true; } return false; }
public boolean equals(Object otherTime){ if(this == otherTime){ return true; } if(!(otherTime instanceof MicroSecondTimeRange)){ return false; } MicroSecondTimeRange mstrTime = (MicroSecondTimeRange)otherTime; if(beginTime.equals(mstrTime.getBeginTime()) && endTime.equals(mstrTime.getEndTime())){ return true; } return false; }
public boolean equals(MicroSecondTimeRange otherTime){ if(this == otherTime){ return true; } return false; }
if(!clipTicks) { minTickValue = 0; maxTickValue = Double.MAX_VALUE; }
public void draw(UnitRangeImpl range, Graphics2D g2d) { Iterator it = titles.iterator(); int cumulativeTitleHeight = 0; while(it.hasNext()) { TitleProvider tp = (TitleProvider)it.next(); g2d.setFont(tp.getTitleFont()); FontMetrics fm = g2d.getFontMetrics(); Rectangle2D titleBounds = fm.getStringBounds(tp.getTitle(), g2d); cumulativeTitleHeight += titleBounds.getHeight(); if(direction == VERTICAL) { double y = (int)(getSize().height / 2 + titleBounds.getWidth() / 2); double x; if(side == LEFT) x = cumulativeTitleHeight - 5; else x = getWidth() - cumulativeTitleHeight + (int)titleBounds.getHeight() - 5; g2d.translate(x, y); g2d.rotate(-Math.PI / 2); g2d.drawString(tp.getTitle(), 0, 0); g2d.rotate(Math.PI / 2); g2d.translate(-x, -y); } else { int x = (int)(getWidth() / 2 - titleBounds.getWidth() / 2); int y; if(side == TOP) y = cumulativeTitleHeight - 5; else y = getHeight() - cumulativeTitleHeight + (int)titleBounds.getHeight() - 5; g2d.drawString(tp.getTitle(), x, y); } } if(range != null) { double numDivisions = (range.max_value - range.min_value) / divSize; double pixelsPerLabelTick = getLimitingSize() / numDivisions; double pixelsPerMinorTick = pixelsPerLabelTick / ticksPerDiv; double labelValPerTick = divSize / ticksPerDiv; int numLabelTicks = (int)Math.ceil(numDivisions) + 1; //Create tick shapes GeneralPath labelTickShape = new GeneralPath(); GeneralPath minorTickShape = new GeneralPath(); float[] nextLabelPoint = getFirstPoint(); double labelValue = getFirstLabelValue(range); if(!clipTicks) { minTickValue = 0; maxTickValue = Double.MAX_VALUE; } for(int i = 0; i < numLabelTicks; i++) { if((labelValue >= minTickValue && labelValue <= maxTickValue)) { labelTickShape.moveTo(nextLabelPoint[0], nextLabelPoint[1]); labelTickShape.lineTo(nextLabelPoint[0] + labelTickWidth, nextLabelPoint[1] + labelTickHeight); float[] nextMinorPoint = getNextPoint((float)pixelsPerMinorTick, nextLabelPoint); double tempVal = labelValue; for(int j = 0; j < ticksPerDiv - 1; j++) { if(tempVal >= maxTickValue) { break; } minorTickShape.moveTo(nextMinorPoint[0], nextMinorPoint[1]); minorTickShape.lineTo(nextMinorPoint[0] + tickWidth, nextMinorPoint[1] + tickHeight); nextMinorPoint = getNextPoint((float)pixelsPerMinorTick, nextMinorPoint); tempVal += labelValPerTick; } } nextLabelPoint = getNextPoint((float)pixelsPerLabelTick, nextLabelPoint); labelValue += divSize; } //Figure out how much to translate this generic tick shape to // match //the actual time double[] translation = getTranslation(range); //Casing the translation to an int removes tick jitter in // borders //where the values have changed, but the range hasn't. Since // they //move by an integral amount, they move in lockstep. This // introduces //inaccuracy in translations that wouldn't naturally be an int. //Be forewarned! g2d.translate((int)translation[0], (int)translation[1]); g2d.setStroke(DisplayUtils.TWO_PIXEL_STROKE); g2d.draw(labelTickShape); g2d.setStroke(DisplayUtils.ONE_PIXEL_STROKE); g2d.draw(minorTickShape); double value = getFirstLabelValue(range); nextLabelPoint = getFirstPoint(); g2d.setFont(getFont()); for(int i = 0; i < numLabelTicks; i++) { if((value >= minTickValue && value <= maxTickValue)) { label(getLabel(value), nextLabelPoint, g2d, translation[1]); } value += divSize; nextLabelPoint = getNextPoint((float)pixelsPerLabelTick, nextLabelPoint); } g2d.translate(-(int)translation[0], -(int)translation[1]); } }
int width = 50 + labelTickLength + tpHeight;
int width = 6 * getMaxLengthFormattedString().length() + labelTickLength + tpHeight;
private void fixSize() { int tpHeight = 0; Iterator it = titles.iterator(); while(it.hasNext()) { //TODO - calculate based on actual string, font metrics TitleProvider tp = (TitleProvider)it.next(); tpHeight += tp.getTitleFont().getSize(); } if(direction == HORIZONTAL) { int height = 25 + labelTickLength + tpHeight; if(labelTickLength == 0) { height = tpHeight + 10; } setMinimumSize(new Dimension(0, height)); setPreferredSize(new Dimension(100, height)); } else { int width = 50 + labelTickLength + tpHeight; if(labelTickLength == 0) { width = tpHeight + 10; } setMinimumSize(new Dimension(width, 0)); setPreferredSize(new Dimension(width, 100)); } }
for (int i = sb.length() - 1; i >= 0; i--) { if (sb.charAt(i) == 0) { sb.deleteCharAt(i); } }
public static String decode(String str) { char[] src = str.toCharArray(); int len = src.length; byte[] g = new byte[4]; StringBuffer sb = new StringBuffer(len * 3 / 4 + 5); for (int i = 0, j = 0; i < len; i += 4, j += 3) { g[0] = getTableIndex(src[i]); g[1] = (i+1 < len) ? getTableIndex(src[i+1]) : 0; g[2] = (i+2 < len) ? getTableIndex(src[i+2]) : 0; g[3] = (i+3 < len) ? getTableIndex(src[i+3]) : 0; sb.append((char)((g[0] << 2 | (g[1] >> 4 & 3)) & 127)); sb.append((char)((g[1] << 4 | (g[2] >> 2 & 15)) & 127)); sb.append((char)((g[2] << 6 | (g[3] & 63)) & 127)); } return sb.toString(); }
for (int i = sb.length() - 1; i >= 0; i--) { if (sb.charAt(i) == 0) { sb.deleteCharAt(i); } }
public static String encode(String str) { char[] src = str.toCharArray(); int len = src.length; byte[] g = new byte[3]; StringBuffer sb = new StringBuffer(len * 4 / 3 + 4); for (int i = 0, j = 0; i < len; i += 3, j += 4) { g[0] = (byte)src[i]; g[1] = (i+1 < len) ? (byte)src[i+1] : 0; g[2] = (i+2 < len) ? (byte)src[i+2] : 0; sb.append(table[(g[0] >> 2) & 63]); sb.append(table[(g[0] << 4 | g[1] >> 4) & 63]); sb.append(table[(g[1] << 2 | g[2] >> 6) & 63]); sb.append(table[g[2] & 63]); } return sb.toString(); }
if (cb.isDataFlavorAvailable(ideaFlavour)){
if (isIdea){
public void pasteIdea() { DataFlavor ideaFlavour = new DataFlavor(Idea.class, "Idea"); Clipboard cb = getToolkit().getSystemClipboard(); try { if (cb.isDataFlavorAvailable(ideaFlavour)){ Idea idea = (Idea)getToolkit().getSystemClipboard( ).getContents(this).getTransferData(ideaFlavour); ideaMap.getSelected().add(idea.clone()); } else if (cb.isDataFlavorAvailable( DataFlavor.javaFileListFlavor)){ boolean err = false; final Object os = getToolkit().getSystemClipboard( ).getContents(this).getTransferData( DataFlavor.javaFileListFlavor); File f = (File)((Collection)os).iterator().next(); boolean isOpml = f.getName().toUpperCase().endsWith(".OPML"); if (isOpml) { ReaderFactory factory = ReaderFactory.getInstance(); IdeaDocument document = factory.read(f); if (ideaMap.getSelected() != null) { int answer = JOptionPane.showConfirmDialog(ideaMap, resBundle.getString("insert_drag_question"), resBundle.getString("app.name"), JOptionPane.YES_NO_CANCEL_OPTION); if (answer == JOptionPane.YES_OPTION) { ideaMap.getSelected().add(document.getIdea()); } else if (answer == JOptionPane.NO_OPTION) { this.setDocument(document); } } else { Main.getMainframe().setDocument(document); } } else if (ideaMap.getSelected() != null) { Idea idea = new Idea(f.getName()); idea.setDescription(f.toString()); String url = Utilities.toStringUrl(f); idea.setUrl(url); ideaMap.getSelected().add(idea); } } else if (cb.isDataFlavorAvailable( DataFlavor.stringFlavor)){ String s = getToolkit().getSystemClipboard( ).getContents(this).getTransferData( DataFlavor.stringFlavor).toString(); boolean isURLFormatted = (s.indexOf(':') >= 2); if (isURLFormatted) { // DnD from firefox introduces a \n followed by the anchor label (like "RSS feed") // that appears on the page. Hence, use only the substring upto the \n int linebreakIndex = s.indexOf('\n'); String insertText = null; Idea idea = new Idea(s); if (s.startsWith("http") && (linebreakIndex != -1)) { insertText = s.substring(0,linebreakIndex); idea.setText(s.substring(linebreakIndex + 1)); } else { //DnD from IE and other browsers;use the string as it is. insertText = s; } if (insertText.startsWith("x-yojimbo-item:")) { idea.setText("Yojimbo item"); } idea.setUrl(insertText); ideaMap.getSelected().add(idea); } } } catch (Exception e) { } }
public IdeaReader read(File f) throws ReaderException {
public Idea read(File f) throws ReaderException {
public IdeaReader read(File f) throws ReaderException { try { if (f.getName().toLowerCase().endsWith(".opml")) { return new OPMLReader(new FileInputStream(f)); } } catch (Exception e) { throw new ReaderException("Unable to read file " + f, e); } throw new ReaderException("Unknown file type for " + f, null); }
return new OPMLReader(new FileInputStream(f));
reader = new OPMLReader(new FileInputStream(f)); } if (reader != null) { return reader.getIdea();
public IdeaReader read(File f) throws ReaderException { try { if (f.getName().toLowerCase().endsWith(".opml")) { return new OPMLReader(new FileInputStream(f)); } } catch (Exception e) { throw new ReaderException("Unable to read file " + f, e); } throw new ReaderException("Unknown file type for " + f, null); }
Arrival[] arrivals = timeCalc.calcTravelTimes(stationLoc, origin, new String[] {beginPhase, endPhase});
Arrival[] beginArrivals = timeCalc.calcTravelTimes(stationLoc, origin, new String[] {beginPhase}); Arrival[] endArrivals = timeCalc.calcTravelTimes(stationLoc, origin, new String[] {endPhase});
public LocalSeismogramImpl cut(Location stationLoc, Origin origin, LocalSeismogramImpl seis) throws TauModelException, PhaseNonExistent, FissuresException { Arrival[] arrivals = timeCalc.calcTravelTimes(stationLoc, origin, new String[] {beginPhase, endPhase}); MicroSecondDate beginTime = null; MicroSecondDate endTime = null; MicroSecondDate originTime = new MicroSecondDate(origin.origin_time); for (int i=0; i< arrivals.length; i++) { if (arrivals[i].getName().equals(beginPhase)) { beginTime = originTime.add(new TimeInterval(arrivals[i].getTime(), UnitImpl.SECOND)); break; } } if (beginTime == null) { DistAz distAz = new DistAz(stationLoc.latitude, stationLoc.longitude, origin.my_location.latitude, origin.my_location.longitude); throw new PhaseNonExistent("Phase "+beginPhase+ " does not exist at this distance, "+ distAz.delta+" degrees"); } beginTime = beginTime.add(beginOffset); for (int i=0; i< arrivals.length; i++) { if (arrivals[i].getName().equals(endPhase)) { endTime = originTime.add(new TimeInterval(arrivals[i].getTime(), UnitImpl.SECOND)); break; } } if (endTime == null) { DistAz distAz = new DistAz(stationLoc.latitude, stationLoc.longitude, origin.my_location.latitude, origin.my_location.longitude); throw new PhaseNonExistent("Phase "+endPhase+ " does not exist at this distance, "+ distAz.delta+" degrees"); } endTime = endTime.add(endOffset); logger.debug("Phase cut from "+beginTime+" to "+endTime); Cut cut = new Cut(beginTime, endTime); return cut.apply(seis); }
for (int i=0; i< arrivals.length; i++) { if (arrivals[i].getName().equals(beginPhase)) { beginTime = originTime.add(new TimeInterval(arrivals[i].getTime(), UnitImpl.SECOND)); break; } } if (beginTime == null) { DistAz distAz = new DistAz(stationLoc.latitude, stationLoc.longitude, origin.my_location.latitude, origin.my_location.longitude);
if (beginArrivals.length != 0) { beginTime = originTime.add(new TimeInterval(beginArrivals[0].getTime(), UnitImpl.SECOND)); beginTime = beginTime.add(beginOffset); } else { DistAz distAz = timeCalc.calcDistAz(stationLoc, origin);
public LocalSeismogramImpl cut(Location stationLoc, Origin origin, LocalSeismogramImpl seis) throws TauModelException, PhaseNonExistent, FissuresException { Arrival[] arrivals = timeCalc.calcTravelTimes(stationLoc, origin, new String[] {beginPhase, endPhase}); MicroSecondDate beginTime = null; MicroSecondDate endTime = null; MicroSecondDate originTime = new MicroSecondDate(origin.origin_time); for (int i=0; i< arrivals.length; i++) { if (arrivals[i].getName().equals(beginPhase)) { beginTime = originTime.add(new TimeInterval(arrivals[i].getTime(), UnitImpl.SECOND)); break; } } if (beginTime == null) { DistAz distAz = new DistAz(stationLoc.latitude, stationLoc.longitude, origin.my_location.latitude, origin.my_location.longitude); throw new PhaseNonExistent("Phase "+beginPhase+ " does not exist at this distance, "+ distAz.delta+" degrees"); } beginTime = beginTime.add(beginOffset); for (int i=0; i< arrivals.length; i++) { if (arrivals[i].getName().equals(endPhase)) { endTime = originTime.add(new TimeInterval(arrivals[i].getTime(), UnitImpl.SECOND)); break; } } if (endTime == null) { DistAz distAz = new DistAz(stationLoc.latitude, stationLoc.longitude, origin.my_location.latitude, origin.my_location.longitude); throw new PhaseNonExistent("Phase "+endPhase+ " does not exist at this distance, "+ distAz.delta+" degrees"); } endTime = endTime.add(endOffset); logger.debug("Phase cut from "+beginTime+" to "+endTime); Cut cut = new Cut(beginTime, endTime); return cut.apply(seis); }
beginTime = beginTime.add(beginOffset);
public LocalSeismogramImpl cut(Location stationLoc, Origin origin, LocalSeismogramImpl seis) throws TauModelException, PhaseNonExistent, FissuresException { Arrival[] arrivals = timeCalc.calcTravelTimes(stationLoc, origin, new String[] {beginPhase, endPhase}); MicroSecondDate beginTime = null; MicroSecondDate endTime = null; MicroSecondDate originTime = new MicroSecondDate(origin.origin_time); for (int i=0; i< arrivals.length; i++) { if (arrivals[i].getName().equals(beginPhase)) { beginTime = originTime.add(new TimeInterval(arrivals[i].getTime(), UnitImpl.SECOND)); break; } } if (beginTime == null) { DistAz distAz = new DistAz(stationLoc.latitude, stationLoc.longitude, origin.my_location.latitude, origin.my_location.longitude); throw new PhaseNonExistent("Phase "+beginPhase+ " does not exist at this distance, "+ distAz.delta+" degrees"); } beginTime = beginTime.add(beginOffset); for (int i=0; i< arrivals.length; i++) { if (arrivals[i].getName().equals(endPhase)) { endTime = originTime.add(new TimeInterval(arrivals[i].getTime(), UnitImpl.SECOND)); break; } } if (endTime == null) { DistAz distAz = new DistAz(stationLoc.latitude, stationLoc.longitude, origin.my_location.latitude, origin.my_location.longitude); throw new PhaseNonExistent("Phase "+endPhase+ " does not exist at this distance, "+ distAz.delta+" degrees"); } endTime = endTime.add(endOffset); logger.debug("Phase cut from "+beginTime+" to "+endTime); Cut cut = new Cut(beginTime, endTime); return cut.apply(seis); }
for (int i=0; i< arrivals.length; i++) { if (arrivals[i].getName().equals(endPhase)) { endTime = originTime.add(new TimeInterval(arrivals[i].getTime(), UnitImpl.SECOND)); break; } } if (endTime == null) { DistAz distAz = new DistAz(stationLoc.latitude, stationLoc.longitude, origin.my_location.latitude, origin.my_location.longitude);
if (endArrivals.length != 0) { endTime = originTime.add(new TimeInterval(endArrivals[0].getTime(), UnitImpl.SECOND)); endTime = endTime.add(endOffset); } else { DistAz distAz = timeCalc.calcDistAz(stationLoc, origin);
public LocalSeismogramImpl cut(Location stationLoc, Origin origin, LocalSeismogramImpl seis) throws TauModelException, PhaseNonExistent, FissuresException { Arrival[] arrivals = timeCalc.calcTravelTimes(stationLoc, origin, new String[] {beginPhase, endPhase}); MicroSecondDate beginTime = null; MicroSecondDate endTime = null; MicroSecondDate originTime = new MicroSecondDate(origin.origin_time); for (int i=0; i< arrivals.length; i++) { if (arrivals[i].getName().equals(beginPhase)) { beginTime = originTime.add(new TimeInterval(arrivals[i].getTime(), UnitImpl.SECOND)); break; } } if (beginTime == null) { DistAz distAz = new DistAz(stationLoc.latitude, stationLoc.longitude, origin.my_location.latitude, origin.my_location.longitude); throw new PhaseNonExistent("Phase "+beginPhase+ " does not exist at this distance, "+ distAz.delta+" degrees"); } beginTime = beginTime.add(beginOffset); for (int i=0; i< arrivals.length; i++) { if (arrivals[i].getName().equals(endPhase)) { endTime = originTime.add(new TimeInterval(arrivals[i].getTime(), UnitImpl.SECOND)); break; } } if (endTime == null) { DistAz distAz = new DistAz(stationLoc.latitude, stationLoc.longitude, origin.my_location.latitude, origin.my_location.longitude); throw new PhaseNonExistent("Phase "+endPhase+ " does not exist at this distance, "+ distAz.delta+" degrees"); } endTime = endTime.add(endOffset); logger.debug("Phase cut from "+beginTime+" to "+endTime); Cut cut = new Cut(beginTime, endTime); return cut.apply(seis); }
endTime = endTime.add(endOffset);
public LocalSeismogramImpl cut(Location stationLoc, Origin origin, LocalSeismogramImpl seis) throws TauModelException, PhaseNonExistent, FissuresException { Arrival[] arrivals = timeCalc.calcTravelTimes(stationLoc, origin, new String[] {beginPhase, endPhase}); MicroSecondDate beginTime = null; MicroSecondDate endTime = null; MicroSecondDate originTime = new MicroSecondDate(origin.origin_time); for (int i=0; i< arrivals.length; i++) { if (arrivals[i].getName().equals(beginPhase)) { beginTime = originTime.add(new TimeInterval(arrivals[i].getTime(), UnitImpl.SECOND)); break; } } if (beginTime == null) { DistAz distAz = new DistAz(stationLoc.latitude, stationLoc.longitude, origin.my_location.latitude, origin.my_location.longitude); throw new PhaseNonExistent("Phase "+beginPhase+ " does not exist at this distance, "+ distAz.delta+" degrees"); } beginTime = beginTime.add(beginOffset); for (int i=0; i< arrivals.length; i++) { if (arrivals[i].getName().equals(endPhase)) { endTime = originTime.add(new TimeInterval(arrivals[i].getTime(), UnitImpl.SECOND)); break; } } if (endTime == null) { DistAz distAz = new DistAz(stationLoc.latitude, stationLoc.longitude, origin.my_location.latitude, origin.my_location.longitude); throw new PhaseNonExistent("Phase "+endPhase+ " does not exist at this distance, "+ distAz.delta+" degrees"); } endTime = endTime.add(endOffset); logger.debug("Phase cut from "+beginTime+" to "+endTime); Cut cut = new Cut(beginTime, endTime); return cut.apply(seis); }
outSeis.begin_time = seis.getBeginTime().add((TimeInterval)sampPeriod.multiplyBy(beginIndex)).getFissuresTime();
public LocalSeismogramImpl apply(LocalSeismogramImpl seis) { if ( begin.after(seis.getEndTime()) || end.before(seis.getBeginTime())) { return null; } // end of if () TimeInterval sampPeriod = seis.getSampling().getPeriod(); QuantityImpl beginShift = begin.subtract(seis.getBeginTime()); beginShift = beginShift.divideBy(sampPeriod); beginShift = beginShift.convertTo(secPerSec); //should be dimensonless int beginIndex = (int)Math.ceil(beginShift.value); if (beginIndex < 0) { beginIndex = 0; } // end of if (beginIndex < 0) if (beginIndex >= seis.getNumPoints()) { beginIndex = seis.getNumPoints()-1; } QuantityImpl endShift = seis.getEndTime().subtract(end); endShift = endShift.divideBy(sampPeriod); endShift = endShift.convertTo(secPerSec); //should be dimensonless int endIndex = seis.getNumPoints() - (int)Math.floor(endShift.value); if (endIndex < 0) { endIndex = 0; } if (endIndex > seis.getNumPoints()) { endIndex = seis.getNumPoints(); } logger.debug("cut is "+beginIndex+" to "+endIndex+" "+seis.getEndTime()+" "+endShift); LocalSeismogramImpl outSeis; if (seis.can_convert_to_short()) { short[] outS = new short[endIndex-beginIndex]; short[] inS = seis.get_as_shorts(); System.arraycopy(inS, beginIndex, outS, 0, endIndex-beginIndex); outSeis = new LocalSeismogramImpl(seis, outS); } else if (seis.can_convert_to_long()) { int[] outI = new int[endIndex-beginIndex]; int[] inI = seis.get_as_longs(); System.arraycopy(inI, beginIndex, outI, 0, endIndex-beginIndex); outSeis = new LocalSeismogramImpl(seis, outI); logger.debug("out num_points="+seis.num_points+" out data length="+outI.length); } else if (seis.can_convert_to_float()) { float[] outF = new float[endIndex-beginIndex]; float[] inF = seis.get_as_floats(); System.arraycopy(inF, beginIndex, outF, 0, endIndex-beginIndex); outSeis = new LocalSeismogramImpl(seis, outF); } else { double[] outD = new double[endIndex-beginIndex]; double[] inD = seis.get_as_doubles(); System.arraycopy(inD, beginIndex, outD, 0, endIndex-beginIndex); outSeis = new LocalSeismogramImpl(seis, outD); } // end of else return outSeis; }
ATObject newhost = initargs.base_at(NATNumber.ONE); return new NATField(name_, (NATCallframe) newhost);
if (initargs.base_getLength() != NATNumber.ONE) { return super.meta_newInstance(initargs); } else { ATObject newhost = initargs.base_at(NATNumber.ONE); return new NATField(name_, (NATCallframe) newhost); }
public ATObject meta_newInstance(ATTable initargs) throws InterpreterException { ATObject newhost = initargs.base_at(NATNumber.ONE); return new NATField(name_, (NATCallframe) newhost); }
report.outputReport();
report.outputReport(null);
public void testMakeReportImage() { report.addMSeedSeismogram(); report.addMSeedSeismogram(); report.addMSeedSeismogram(); report.addSacSeismogram(); report.addSacSeismogram(); report.addSacSeismogram(); report.addFileFormatException("File location01", "Problem description01"); report.addMalformedFileNameException("File location02", "Problem description02"); report.addUnsupportedFileException("File location03", "Problem description03"); Channel channel1 = MockChannel.createChannel(); Channel channel2 = MockChannel.createOtherNetChan(); ISOTime beginTime1 = new ISOTime(2005, 115, 12, 30, (float)15.0); ISOTime endTime1 = new ISOTime(2005, 115, 13, 30, (float)15.0); ISOTime beginTime2 = new ISOTime(2005, 115, 13, 30, (float)15.0); ISOTime endTime2 = new ISOTime(2005, 115, 14, 30, (float)15.0); ISOTime beginTime3 = new ISOTime(2005, 115, 15, 30, (float)15.0); ISOTime endTime3 = new ISOTime(2005, 115, 16, 30, (float)15.0); report.addRefTekSeismogram(channel1, beginTime1.getDate(), endTime1.getDate()); report.addRefTekSeismogram(channel1, beginTime2.getDate(), endTime2.getDate()); report.addRefTekSeismogram(channel2, beginTime1.getDate(), endTime1.getDate()); report.addRefTekSeismogram(channel2, beginTime3.getDate(), endTime3.getDate()); report.outputReport(); }
report.outputReport();
report.outputReport(null);
public void testPrintReport() { report.addMSeedSeismogram(); report.addMSeedSeismogram(); report.addMSeedSeismogram(); report.addSacSeismogram(); report.addSacSeismogram(); report.addSacSeismogram(); report.addFileFormatException("File location01", "Problem description01"); report.addMalformedFileNameException("File location02", "Problem description02"); report.addUnsupportedFileException("File location03", "Problem description03"); Channel channel1 = MockChannel.createChannel(); Channel channel2 = MockChannel.createOtherNetChan(); ISOTime beginTime1 = new ISOTime(2005, 115, 12, 30, (float)15.0); ISOTime endTime1 = new ISOTime(2005, 115, 13, 30, (float)15.0); ISOTime beginTime2 = new ISOTime(2005, 115, 13, 30, (float)15.0); ISOTime endTime2 = new ISOTime(2005, 115, 14, 30, (float)15.0); ISOTime beginTime3 = new ISOTime(2005, 115, 15, 30, (float)15.0); ISOTime endTime3 = new ISOTime(2005, 115, 16, 30, (float)15.0); report.addRefTekSeismogram(channel1, beginTime1.getDate(), endTime1.getDate()); report.addRefTekSeismogram(channel1, beginTime2.getDate(), endTime2.getDate()); report.addRefTekSeismogram(channel2, beginTime1.getDate(), endTime1.getDate()); report.addRefTekSeismogram(channel2, beginTime3.getDate(), endTime3.getDate()); report.outputReport(); }
MockSite.createSite());
MockSite.createSite(), VERTICAL);
public static Channel createChannel() { return createChannel(MockChannelId.createVerticalChanId(), "Vertical Channel", MockSite.createSite()); }
MockSite.createOtherSite());
MockSite.createOtherSite(), VERTICAL);
public static Channel createOtherNetChan() { return createChannel(MockChannelId.createOtherNetChanId(), "Other Net Vertical Channel", MockSite.createOtherSite()); }
MockSite.createSite());
MockSite.createSite(), EAST);
public static Channel createEastChannel() { return createChannel(MockChannelId.createEastChanId(), "East Channel", MockSite.createSite()); }
public static Channel[] createMotionVector(Station station) { Channel[] channels = new Channel[3]; Site s = MockSite.createSite(station); String[] codes = {"BHZ", "BHN", "BHE"}; for(int i = 0; i < codes.length; i++) { channels[i] = createChannel(MockChannelId.createChanId(codes[i], s), "Motion Vector Channel " + codes[i], s); } return channels;
public static Channel[] createMotionVector() { return createMotionVector(MockStation.createStation());
public static Channel[] createMotionVector(Station station) { Channel[] channels = new Channel[3]; Site s = MockSite.createSite(station); String[] codes = {"BHZ", "BHN", "BHE"}; for(int i = 0; i < codes.length; i++) { channels[i] = createChannel(MockChannelId.createChanId(codes[i], s), "Motion Vector Channel " + codes[i], s); } return channels; }
MockSite.createSite());
MockSite.createSite(), NORTH);
public static Channel createNorthChannel() { return createChannel(MockChannelId.createNorthChanId(), "North Channel", MockSite.createSite()); }
for (int i = 0; i < 3; i++){ logger.info("run " + (i + 1) + " of " + repeats + " for " + r); r.run();
int i = 0; try { for (i = 0; i < repeats; i++){ logger.info("run " + (i + 1) + " of " + repeats + " for " + r); r.run(); logger.info("finished " + (i + 1) + " of " + repeats + " for " + r); } } catch (Throwable e) { logger.warn("fail " + (i + 1) + " of " + repeats + " for " + r, e);
public void run() { for (int i = 0; i < 3; i++){ logger.info("run " + (i + 1) + " of " + repeats + " for " + r); r.run(); } }
logger.info("leave thread for "+r);
public void run() { for (int i = 0; i < 3; i++){ logger.info("run " + (i + 1) + " of " + repeats + " for " + r); r.run(); } }
if (backgrounded.containsKey(events[row])) { return false; } if ( ! cachedEvents.containsKey(events[row])) { CacheEvent cache; if (events[row] instanceof CacheEvent){ cache = (CacheEvent)events[row]; } else{ cache = new CacheEvent(events[row]); } backgrounded.put(events[row], cache); System.out.println("ETM 173: events[row]: " + events[row]); System.out.println("ETM 174: cache: " + cache); rowNumber.put(events[row], new Integer(row)); loader.getEvent(events[row], cache, this); return false; } else { return true; }
if (backgrounded.containsKey(events[row])) { return false; } if ( ! cachedEvents.containsKey(events[row])) { CacheEvent cache; if (events[row] instanceof CacheEvent){ cache = (CacheEvent)events[row]; } else{ cache = new CacheEvent(events[row]); } backgrounded.put(events[row], cache); rowNumber.put(events[row], new Integer(row)); loader.getEvent(events[row], cache, this); return false; } else { return true; }
public boolean isRowCached(int row) { if (backgrounded.containsKey(events[row])) { return false; } if ( ! cachedEvents.containsKey(events[row])) { // load in background CacheEvent cache; if (events[row] instanceof CacheEvent){ cache = (CacheEvent)events[row]; } else{ cache = new CacheEvent(events[row]); } backgrounded.put(events[row], cache); System.out.println("ETM 173: events[row]: " + events[row]); System.out.println("ETM 174: cache: " + cache); rowNumber.put(events[row], new Integer(row)); loader.getEvent(events[row], cache, this); return false; } else { return true; } }
if (geoNum > 0 && geoNum <= 729) { return feProps.getProperty("GeogRegion"+geoNum); }
String propValue = feProps.getProperty("GeogRegion"+geoNum); if (propValue != null && propValue.length > 1) { return propValue; }
public String getGeographicRegionName(int geoNum) { if (geoNum > 0 && geoNum <= 729) { return feProps.getProperty("GeogRegion"+geoNum); } // end of if (geoNum > 0 && geoNum <= 729) return "GeoRegion"+geoNum; }
System.out.println(query.toString());
public Collection ejbFindRefunds(IWTimestamp from, IWTimestamp to) throws FinderException { to.addDays(1); Table table = new Table(this); Column date = new Column(COLUMN_DATE); Column code = new Column(COLUMN_TRANSACTION_TYPE); SelectQuery query = new SelectQuery(table); query.addColumn(new WildCardColumn(table)); query.addCriteria(new MatchCriteria(code, MatchCriteria.EQUALS, this.AUTHORIZATION_TYPE_REFUND)); query.addCriteria(new MatchCriteria(date, MatchCriteria.GREATEREQUAL, from.getDate().toString())); query.addCriteria(new MatchCriteria(date, MatchCriteria.LESSEQUAL, to.getDate().toString())); System.out.println(query.toString()); return this.idoFindIDsBySQL(query.toString()); }
pj.setPrintable(new SeismogramPrinter(getDisplayArray(),1));
SeismogramPrinter printer = new SeismogramPrinter(getDisplayArray()); pj.setPrintable(printer);
public void print(){ PrinterJob pj = PrinterJob.getPrinterJob(); pj.setPrintable(new SeismogramPrinter(getDisplayArray(),1)); if(pj.printDialog()){ try { pj.print(); } catch(Exception e){ e.printStackTrace(); } } }
printer.restore(); revalidate();
public void print(){ PrinterJob pj = PrinterJob.getPrinterJob(); pj.setPrintable(new SeismogramPrinter(getDisplayArray(),1)); if(pj.printDialog()){ try { pj.print(); } catch(Exception e){ e.printStackTrace(); } } }
public SeismogramPrinter (BasicSeismogramDisplay[] displays, int seisPerPage){
public SeismogramPrinter(BasicSeismogramDisplay[] displays){
public SeismogramPrinter (BasicSeismogramDisplay[] displays, int seisPerPage){ this.displays = displays; System.out.println("number of displays: " + displays.length + " number of displays per page: " + seisPerPage); this.seisPerPage = seisPerPage; }
System.out.println("number of displays: " + displays.length + " number of displays per page: " + seisPerPage); this.seisPerPage = seisPerPage;
sizes = new Dimension[displays.length]; bottomBorder = new boolean[displays.length]; topBorder = new boolean[displays.length]; for(int i = 0; i < displays.length; i++){ disableDoubleBuffering(displays[i]); sizes[i] = displays[i].getSize(); bottomBorder[i] = displays[i].hasBottomTimeBorder(); topBorder[i] = displays[i].hasTopTimeBorder(); displays[i].addBottomTimeBorder(); displays[i].addTopTimeBorder(); }
public SeismogramPrinter (BasicSeismogramDisplay[] displays, int seisPerPage){ this.displays = displays; System.out.println("number of displays: " + displays.length + " number of displays per page: " + seisPerPage); this.seisPerPage = seisPerPage; }
meta_invoke(this, AGSymbol.alloc("asBegin"), NATTable.EMPTY),
this.meta_invoke(this, AGSymbol.alloc("asBegin"), NATTable.EMPTY),
public ATBegin asBegin() throws XTypeMismatch { try { return (ATBegin) meta_respondsTo(AGSymbol.alloc("asBegin")).base_ifTrue_( new JavaClosure(null) { public ATObject meta_apply(NATTable arguments) throws NATException { return NATMirageFactory.createMirageForInterface( meta_invoke(this, AGSymbol.alloc("asBegin"), NATTable.EMPTY), ATBegin.class); } }); } catch (NATException e) { return super.asBegin(); } }
meta_invoke(this, AGSymbol.alloc("asBegin"), NATTable.EMPTY),
this.meta_invoke(this, AGSymbol.alloc("asBegin"), NATTable.EMPTY),
public ATObject meta_apply(NATTable arguments) throws NATException { return NATMirageFactory.createMirageForInterface( meta_invoke(this, AGSymbol.alloc("asBegin"), NATTable.EMPTY), ATBegin.class); }
meta_invoke(this, AGSymbol.alloc("asBoolean"), NATTable.EMPTY),
this.meta_invoke(this, AGSymbol.alloc("asBoolean"), NATTable.EMPTY),
public ATBoolean asBoolean() throws XTypeMismatch { try { return (ATBoolean) meta_respondsTo(AGSymbol.alloc("asBoolean")).base_ifTrue_( new JavaClosure(null) { public ATObject meta_apply(NATTable arguments) throws NATException { return NATMirageFactory.createMirageForInterface( meta_invoke(this, AGSymbol.alloc("asBoolean"), NATTable.EMPTY), ATBegin.class); } }); } catch (NATException e) { return super.asBoolean(); } }
meta_invoke(this, AGSymbol.alloc("asBoolean"), NATTable.EMPTY),
this.meta_invoke(this, AGSymbol.alloc("asBoolean"), NATTable.EMPTY),
public ATObject meta_apply(NATTable arguments) throws NATException { return NATMirageFactory.createMirageForInterface( meta_invoke(this, AGSymbol.alloc("asBoolean"), NATTable.EMPTY), ATBegin.class); }
ATAbstractGrammar body = code.getMethod().getBody();
ATAbstractGrammar body = code.getMethod().getBodyExpression();
private ATObject createChild(ATClosure code, boolean parentPointerType) throws NATException { NATObject extension = new NATObject( /* dynamic parent */ this, /* lexical parent */ code.getContext().getLexicalScope(), /* parent porinter type */ parentPointerType); ATAbstractGrammar body = code.getMethod().getBody(); body.meta_eval(new NATContext(extension, extension, this)); return extension; }
System.out.println("total paint(Graphics g) time: " + (paintTime/count) + " plotter iteration time: " + (plotTime/count) + " name paint time: " + (nameTime/count));
public void paint(Graphics g){ Date begin = new Date(); Graphics2D g2 = (Graphics2D)g; Dimension size = getSize(); TimeSnapshot timeState = timeRegistrar.takeSnapshot(); AmpSnapshot ampState = ampRegistrar.takeSnapshot(); Iterator e = plotters.iterator(); Date plotBegin = new Date(); while(e.hasNext()){ ((Plotter)e.next()).draw(g2, size, timeState, ampState); } Date plotEnd = new Date(); if(name != null){ g2.setPaint(new Color(0, 0, 0, 128)); g2.drawString(name, 5, getSize().height - 3); } Date end = new Date(); count++; nameTime += end.getTime() - plotEnd.getTime(); paintTime += end.getTime() - begin.getTime(); plotTime += plotEnd.getTime() - plotBegin.getTime(); //System.out.println("total paint time: " + (paintTime/count) + // " plot time: " + (plotTime/count) + // " name time: " + (nameTime/count)); }
if(!get3CSelections().contains(newSelection))
if(!get3CSelections().contains(newSelection)){
public void add3CSelection(Selection newSelection){ if(!get3CSelections().contains(newSelection)) get3CSelections().add(newSelection); repaint(); }
repaint();
selection3CCount++; repaint(); }
public void add3CSelection(Selection newSelection){ if(!get3CSelections().contains(newSelection)) get3CSelections().add(newSelection); repaint(); }
if(!getSelections().contains(newSelection))
if(!getSelections().contains(newSelection)){
public void addSelection(Selection newSelection){ if(!getSelections().contains(newSelection)) getSelections().add(newSelection); repaint(); }
repaint();
selectionCount++; repaint(); }
public void addSelection(Selection newSelection){ if(!getSelections().contains(newSelection)) getSelections().add(newSelection); repaint(); }
public LinkedList get3CSelections(){ return (LinkedList)plotters.subList(plotters.size() - selection3CCount, plotters.size());
public java.util.List get3CSelections(){ return plotters.subList(plotters.size() - selection3CCount, plotters.size());
public LinkedList get3CSelections(){ return (LinkedList)plotters.subList(plotters.size() - selection3CCount, plotters.size()); }
public LinkedList getAllSelections(){ return (LinkedList)plotters.subList(plotters.size() - selectionCount - selection3CCount, plotters.size());
public java.util.List getAllSelections(){ return plotters.subList(plotters.size() - selectionCount - selection3CCount, plotters.size());
public LinkedList getAllSelections(){ return (LinkedList)plotters.subList(plotters.size() - selectionCount - selection3CCount, plotters.size()); }
public LinkedList getSelections(){ return (LinkedList)plotters.subList(plotters.size() - selectionCount - selection3CCount, plotters.size());
public java.util.List getSelections(){ return plotters.subList(plotters.size() - selectionCount - selection3CCount, plotters.size() - selection3CCount);
public LinkedList getSelections(){ return (LinkedList)plotters.subList(plotters.size() - selectionCount - selection3CCount, plotters.size()); }
get3CSelections().remove(oldSelection); repaint();
if(get3CSelections().remove(oldSelection));{ selection3CCount--; repaint(); }
public void remove3CSelection(Selection oldSelection){ get3CSelections().remove(oldSelection); repaint(); }
getSelections().remove(oldSelection); repaint();
if(getSelections().remove(oldSelection)){ selectionCount--; repaint(); }
public void removeSelection(Selection oldSelection){ getSelections().remove(oldSelection); repaint(); }
JButton zoomIn = new JButton("zoomIn"); JButton zoomOut = new JButton("zoomOut");
JButton zoomIn = new JButton("Zoom In"); JButton zoomOut = new JButton("Zoom Out");
public void createParticleDisplay(BasicSeismogramDisplay creator, boolean advancedOption){ if(particleAllowed){ if(particleDisplay == null){ logger.debug("creating particle display"); particleWindow = new JFrame(particleWindowName); particleWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { particleDisplay.removeAll(); particleDisplays--; } }); particleDisplay = new ParticleMotionDisplay((DataSetSeismogram)creator.getSeismograms()[0], creator.getRegistrar(), advancedOption); JPanel displayPanel = new JPanel(); JButton zoomIn = new JButton("zoomIn"); JButton zoomOut = new JButton("zoomOut"); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout()); buttonPanel.add(zoomIn); buttonPanel.add(zoomOut); displayPanel.setLayout(new BorderLayout()); displayPanel.add(particleDisplay, java.awt.BorderLayout.CENTER); displayPanel.add(buttonPanel, java.awt.BorderLayout.SOUTH); java.awt.Dimension size = new java.awt.Dimension(400, 400); displayPanel.setSize(size); particleWindow.getContentPane().add(displayPanel); particleWindow.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { particleWindow.dispose(); particleDisplay = null; } }); particleWindow.setSize(size); zoomIn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { particleDisplay.setZoomIn(true); // particleDisplay.setZoomOut(false); } }); zoomOut.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { particleDisplay.setZoomOut(true); // particleDisplay.setZoomIn(false); } }); Toolkit tk = Toolkit.getDefaultToolkit(); if(particleWindow.getSize().width*particleDisplays < tk.getScreenSize().width){ particleWindow.setLocation(particleWindow.getSize().width * particleDisplays, tk.getScreenSize().height - particleWindow.getSize().width); }else{ particleWindow.setLocation(tk.getScreenSize().width - particleWindow.getSize().width, tk.getScreenSize().height - particleWindow.getSize().height); } particleDisplays++; particleWindow.setVisible(true); }else { particleDisplay.addParticleMotionDisplay((DataSetSeismogram)creator.getSeismograms()[0], creator.getRegistrar()); particleWindow.toFront(); } // end of else }else{ JOptionPane.showMessageDialog(null, "Particle motion isn't allowed from this display!", "Particle Motion Display Creation", JOptionPane.ERROR_MESSAGE); } }
public UnitRangeImpl getAmpRange(){ return ampConfig.getAmpRange(); }
public UnitRangeImpl getAmpRange(DataSetSeismogram seis){ return ampConfig.getAmpRange(seis); }
public UnitRangeImpl getAmpRange(){ return ampConfig.getAmpRange(); }
System.out.println("set waiting"); mComponent.setSize(new Dimension(648, 468));
public ComponentPrintable (Component c){ mComponent = c; System.out.println("set waiting"); mComponent.setSize(new Dimension(648, 468)); }
selectionWindow.dispose();
if(selectionWindow != null){ selectionWindow.dispose(); }
public void removeAll(){ logger.debug("removing all displays"); if(parent != null){ parent.removeSelectionDisplay(this); } super.removeAll(); basicDisplays.clear(); sorter = new SeismogramSorter(); globalRegistrar = null; this.time.setText(" Time: "); this.amp.setText(" Amplitude: "); if(selectionDisplay != null){ selectionDisplay.removeAll(); selectionWindow.dispose(); selectionDisplay = null; } if(threeSelectionDisplay != null){ threeSelectionDisplay.removeAll(); threeSelectionWindow.dispose(); selectionDisplay = null; } if(particleDisplay != null){ particleWindow.dispose(); particleDisplays--; particleDisplay.removeAll(); particleDisplay = null; } repaint(); }
threeSelectionDisplay.removeAll(); threeSelectionWindow.dispose(); selectionDisplay = null;
threeSelectionDisplay.removeAll(); if(threeSelectionWindow != null){ threeSelectionWindow.dispose(); } threeSelectionDisplay = null;
public void removeAll(){ logger.debug("removing all displays"); if(parent != null){ parent.removeSelectionDisplay(this); } super.removeAll(); basicDisplays.clear(); sorter = new SeismogramSorter(); globalRegistrar = null; this.time.setText(" Time: "); this.amp.setText(" Amplitude: "); if(selectionDisplay != null){ selectionDisplay.removeAll(); selectionWindow.dispose(); selectionDisplay = null; } if(threeSelectionDisplay != null){ threeSelectionDisplay.removeAll(); threeSelectionWindow.dispose(); selectionDisplay = null; } if(particleDisplay != null){ particleWindow.dispose(); particleDisplays--; particleDisplay.removeAll(); particleDisplay = null; } repaint(); }
if(spz.constant != constant || spz.poles.length != poles.length
if((Math.abs(spz.constant - constant) / constant) > .001) { System.out.println("const not equal"); return false; } else if(spz.poles.length != poles.length
public boolean equals(Object obj) { if(super.equals(obj)) { return true; } if(obj instanceof SacPoleZero) { SacPoleZero spz = (SacPoleZero)obj; if(spz.constant != constant || spz.poles.length != poles.length || spz.zeros.length != zeros.length) { return false; } else { for(int i = 0; i < poles.length; i++) { if(spz.poles[i].i != poles[i].i || spz.poles[i].r != poles[i].r) { return false; } } for(int i = 0; i < zeros.length; i++) { if(spz.zeros[i].i != zeros[i].i || spz.zeros[i].r != zeros[i].r) { return false; } } return true; } } else { return false; } }
System.out.println("zero " + i + " not equal");
public boolean equals(Object obj) { if(super.equals(obj)) { return true; } if(obj instanceof SacPoleZero) { SacPoleZero spz = (SacPoleZero)obj; if(spz.constant != constant || spz.poles.length != poles.length || spz.zeros.length != zeros.length) { return false; } else { for(int i = 0; i < poles.length; i++) { if(spz.poles[i].i != poles[i].i || spz.poles[i].r != poles[i].r) { return false; } } for(int i = 0; i < zeros.length; i++) { if(spz.zeros[i].i != zeros[i].i || spz.zeros[i].r != zeros[i].r) { return false; } } return true; } } else { return false; } }
lines.add(s);
lines.add(s.trim());
public static SacPoleZero read(BufferedReader in) throws IOException { ArrayList lines = new ArrayList(); String s; while((s = in.readLine()) != null) { lines.add(s); } Cmplx[] poles = new Cmplx[0]; Cmplx[] zeros = new Cmplx[0]; float constant = 1; Iterator it = lines.iterator(); while(it.hasNext()) { String line = (String)it.next(); if(line.startsWith(POLES)) { String num = line.substring(POLES.length()).trim(); int numPoles = Integer.parseInt(num); poles = initCmplx(numPoles); for(int i = 0; i < poles.length && it.hasNext(); i++) { line = (String)it.next(); if(line.matches("^-?\\d+\\.\\d+\\s+-?\\d+\\.\\d+\\s+")) { poles[i] = parseCmplx(line); } else { break; } } } else if(line.startsWith(ZEROS)) { String num = line.substring(ZEROS.length()).trim(); int numZeros = Integer.parseInt(num); zeros = initCmplx(numZeros); for(int i = 0; i < zeros.length && it.hasNext(); i++) { line = (String)it.next(); if(line.matches("^-?\\d+\\.\\d+\\s+-?\\d+\\.\\d+\\s+")) { zeros[i] = parseCmplx(line); } else { break; } } } else if(line.startsWith(CONSTANT)) { line = line.replaceAll("\\s+", " "); String[] sline = line.split(" "); constant = Float.parseFloat(sline[1]); } } return new SacPoleZero(poles, zeros, constant); }
while(it.hasNext()) { String line = (String)it.next();
String line = nextLine(it); while(!line.equals("")) {
public static SacPoleZero read(BufferedReader in) throws IOException { ArrayList lines = new ArrayList(); String s; while((s = in.readLine()) != null) { lines.add(s); } Cmplx[] poles = new Cmplx[0]; Cmplx[] zeros = new Cmplx[0]; float constant = 1; Iterator it = lines.iterator(); while(it.hasNext()) { String line = (String)it.next(); if(line.startsWith(POLES)) { String num = line.substring(POLES.length()).trim(); int numPoles = Integer.parseInt(num); poles = initCmplx(numPoles); for(int i = 0; i < poles.length && it.hasNext(); i++) { line = (String)it.next(); if(line.matches("^-?\\d+\\.\\d+\\s+-?\\d+\\.\\d+\\s+")) { poles[i] = parseCmplx(line); } else { break; } } } else if(line.startsWith(ZEROS)) { String num = line.substring(ZEROS.length()).trim(); int numZeros = Integer.parseInt(num); zeros = initCmplx(numZeros); for(int i = 0; i < zeros.length && it.hasNext(); i++) { line = (String)it.next(); if(line.matches("^-?\\d+\\.\\d+\\s+-?\\d+\\.\\d+\\s+")) { zeros[i] = parseCmplx(line); } else { break; } } } else if(line.startsWith(CONSTANT)) { line = line.replaceAll("\\s+", " "); String[] sline = line.split(" "); constant = Float.parseFloat(sline[1]); } } return new SacPoleZero(poles, zeros, constant); }
line = (String)it.next(); if(line.matches("^-?\\d+\\.\\d+\\s+-?\\d+\\.\\d+\\s+")) {
if(line.matches("^-?\\d+\\.\\d+\\s+-?\\d+\\.\\d+")) {
public static SacPoleZero read(BufferedReader in) throws IOException { ArrayList lines = new ArrayList(); String s; while((s = in.readLine()) != null) { lines.add(s); } Cmplx[] poles = new Cmplx[0]; Cmplx[] zeros = new Cmplx[0]; float constant = 1; Iterator it = lines.iterator(); while(it.hasNext()) { String line = (String)it.next(); if(line.startsWith(POLES)) { String num = line.substring(POLES.length()).trim(); int numPoles = Integer.parseInt(num); poles = initCmplx(numPoles); for(int i = 0; i < poles.length && it.hasNext(); i++) { line = (String)it.next(); if(line.matches("^-?\\d+\\.\\d+\\s+-?\\d+\\.\\d+\\s+")) { poles[i] = parseCmplx(line); } else { break; } } } else if(line.startsWith(ZEROS)) { String num = line.substring(ZEROS.length()).trim(); int numZeros = Integer.parseInt(num); zeros = initCmplx(numZeros); for(int i = 0; i < zeros.length && it.hasNext(); i++) { line = (String)it.next(); if(line.matches("^-?\\d+\\.\\d+\\s+-?\\d+\\.\\d+\\s+")) { zeros[i] = parseCmplx(line); } else { break; } } } else if(line.startsWith(CONSTANT)) { line = line.replaceAll("\\s+", " "); String[] sline = line.split(" "); constant = Float.parseFloat(sline[1]); } } return new SacPoleZero(poles, zeros, constant); }
line = nextLine(it); } else { throw new IOException("Unknown line in SAC polezero file: " + line);
public static SacPoleZero read(BufferedReader in) throws IOException { ArrayList lines = new ArrayList(); String s; while((s = in.readLine()) != null) { lines.add(s); } Cmplx[] poles = new Cmplx[0]; Cmplx[] zeros = new Cmplx[0]; float constant = 1; Iterator it = lines.iterator(); while(it.hasNext()) { String line = (String)it.next(); if(line.startsWith(POLES)) { String num = line.substring(POLES.length()).trim(); int numPoles = Integer.parseInt(num); poles = initCmplx(numPoles); for(int i = 0; i < poles.length && it.hasNext(); i++) { line = (String)it.next(); if(line.matches("^-?\\d+\\.\\d+\\s+-?\\d+\\.\\d+\\s+")) { poles[i] = parseCmplx(line); } else { break; } } } else if(line.startsWith(ZEROS)) { String num = line.substring(ZEROS.length()).trim(); int numZeros = Integer.parseInt(num); zeros = initCmplx(numZeros); for(int i = 0; i < zeros.length && it.hasNext(); i++) { line = (String)it.next(); if(line.matches("^-?\\d+\\.\\d+\\s+-?\\d+\\.\\d+\\s+")) { zeros[i] = parseCmplx(line); } else { break; } } } else if(line.startsWith(CONSTANT)) { line = line.replaceAll("\\s+", " "); String[] sline = line.split(" "); constant = Float.parseFloat(sline[1]); } } return new SacPoleZero(poles, zeros, constant); }
public Cmplx(double re, double im)
Cmplx()
public Cmplx(double re, double im) { this.r = re; this.i = im; }
this.r = re; this.i = im;
public Cmplx(double re, double im) { this.r = re; this.i = im; }
public static final Cmplx sub(Cmplx a, Cmplx b)
public static final Cmplx sub(double a, Cmplx b)
public static final Cmplx sub(Cmplx a, Cmplx b) { Cmplx c = new Cmplx(); c.r = a.r - b.r; c.i = a.i - b.i; return c; }
Cmplx c = new Cmplx(); c.r = a.r - b.r; c.i = a.i - b.i; return c;
return Cmplx.sub(new Cmplx(a, 0), b);
public static final Cmplx sub(Cmplx a, Cmplx b) { Cmplx c = new Cmplx(); c.r = a.r - b.r; c.i = a.i - b.i; return c; }
public static final Cmplx mul(Cmplx a, Cmplx b)
public static final Cmplx mul(double a, Cmplx b)
public static final Cmplx mul(Cmplx a, Cmplx b) { Cmplx c = new Cmplx(); c.r = a.r * b.r - a.i * b.i; c.i = a.i * b.r + a.r * b.i; return c; }