rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
AGSymbol.alloc("clone"), | AGSymbol.jAlloc("clone"), | public ATObject meta_clone() throws InterpreterException { return Reflection.downObject(mirror_.meta_invoke( mirror_, AGSymbol.alloc("clone"), NATTable.EMPTY )); } |
AGSymbol.alloc("defineField"), | AGSymbol.jAlloc("defineField"), | public ATNil meta_defineField(ATSymbol name, ATObject value) throws InterpreterException { mirror_.meta_invoke( mirror_, AGSymbol.alloc("defineField"), new NATTable(new ATObject[] { name, value }) ); return NATNil._INSTANCE_; } |
AGSymbol.alloc("doesNotUnderstand"), | AGSymbol.jAlloc("doesNotUnderstand"), | public ATObject meta_doesNotUnderstand(ATSymbol selector) throws InterpreterException { return Reflection.downObject(mirror_.meta_invoke( mirror_, AGSymbol.alloc("doesNotUnderstand"), new NATTable(new ATObject[] { selector }) )); } |
AGSymbol.alloc("eval"), | AGSymbol.jAlloc("eval"), | public ATObject meta_eval(ATContext ctx) throws InterpreterException { return Reflection.downObject(mirror_.meta_invoke( mirror_, AGSymbol.alloc("eval"), new NATTable(new ATObject[] { ctx }) )); } |
AGSymbol.alloc("extend"), | AGSymbol.jAlloc("extend"), | public ATObject meta_extend(ATClosure code) throws InterpreterException { return Reflection.downObject(mirror_.meta_invoke( mirror_, AGSymbol.alloc("extend"), new NATTable(new ATObject[] { code }) )); } |
AGSymbol.alloc("dynamicParent"))); | AGSymbol.jAlloc("dynamicParent"))); | public ATObject meta_getDynamicParent() throws InterpreterException { return Reflection.downObject(mirror_.meta_select( mirror_, AGSymbol.alloc("dynamicParent"))); } |
AGSymbol.alloc("lexicalParent"))); | AGSymbol.jAlloc("lexicalParent"))); | public ATObject meta_getLexicalParent() throws InterpreterException { return Reflection.downObject(mirror_.meta_select( mirror_, AGSymbol.alloc("lexicalParent"))); } |
AGSymbol.alloc("getField"), | AGSymbol.jAlloc("getField"), | public ATField meta_grabField(ATSymbol selector) throws InterpreterException { return Reflection.downObject(mirror_.meta_invoke( mirror_, AGSymbol.alloc("getField"), new NATTable(new ATObject[] { selector }) )).base_asField(); } |
AGSymbol.alloc("getMethod"), | AGSymbol.jAlloc("getMethod"), | public ATMethod meta_grabMethod(ATSymbol selector) throws InterpreterException { return Reflection.downObject(mirror_.meta_invoke( mirror_, AGSymbol.alloc("getMethod"), new NATTable(new ATObject[] { selector }) )).base_asMethod(); } |
AGSymbol.alloc("invoke"), | AGSymbol.jAlloc("invoke"), | public ATObject meta_invoke(ATObject receiver, ATSymbol selector, ATTable arguments) throws InterpreterException { return Reflection.downObject(mirror_.meta_invoke( mirror_, AGSymbol.alloc("invoke"), new NATTable(new ATObject[] { receiver, selector, arguments }) )); } |
AGSymbol.alloc("listFields"), | AGSymbol.jAlloc("listFields"), | public ATTable meta_listFields() throws InterpreterException { return Reflection.downObject(mirror_.meta_invoke( mirror_, AGSymbol.alloc("listFields"), NATTable.EMPTY )).base_asTable(); } |
AGSymbol.alloc("listMethods"), | AGSymbol.jAlloc("listMethods"), | public ATTable meta_listMethods() throws InterpreterException { return Reflection.downObject(mirror_.meta_invoke( mirror_, AGSymbol.alloc("listMethods"), NATTable.EMPTY )).base_asTable(); } |
AGSymbol.alloc("lookup"), | AGSymbol.jAlloc("lookup"), | public ATObject meta_lookup(ATSymbol selector) throws InterpreterException { return Reflection.downObject(mirror_.meta_invoke( mirror_, AGSymbol.alloc("lookup"), new NATTable(new ATObject[] { selector }) )); } |
AGSymbol.alloc("newInstance"), | AGSymbol.jAlloc("newInstance"), | public ATObject meta_newInstance(ATTable initargs) throws InterpreterException { return Reflection.downObject(mirror_.meta_invoke( mirror_, AGSymbol.alloc("newInstance"), new NATTable(new ATObject[] { initargs }) )); } |
AGSymbol.alloc("quote"), | AGSymbol.jAlloc("quote"), | public ATObject meta_quote(ATContext ctx) throws InterpreterException { return Reflection.downObject(mirror_.meta_invoke( mirror_, AGSymbol.alloc("quote"), new NATTable(new ATObject[] { ctx }) )); } |
AGSymbol.alloc("respondsTo"), | AGSymbol.jAlloc("respondsTo"), | public ATBoolean meta_respondsTo(ATSymbol selector) throws InterpreterException { return Reflection.downObject(mirror_.meta_invoke( mirror_, AGSymbol.alloc("respondsTo"), new NATTable(new ATObject[] { selector }) )).base_asBoolean(); } |
AGSymbol.alloc("select"), | AGSymbol.jAlloc("select"), | public ATObject meta_select(ATObject receiver, ATSymbol selector) throws InterpreterException { return Reflection.downObject(mirror_.meta_invoke( mirror_, AGSymbol.alloc("select"), new NATTable(new ATObject[] { receiver, selector }) )); } |
AGSymbol.alloc("send"), | AGSymbol.jAlloc("send"), | public ATNil meta_send(ATAsyncMessage message) throws InterpreterException { mirror_.meta_invoke( mirror_, AGSymbol.alloc("send"), new NATTable(new ATObject[] { message }) ); return NATNil._INSTANCE_; } |
AGSymbol.alloc("share"), | AGSymbol.jAlloc("share"), | public ATObject meta_share(ATClosure code) throws InterpreterException { return Reflection.downObject(mirror_.meta_invoke( mirror_, AGSymbol.alloc("share"), new NATTable(new ATObject[] { code }) )); } |
textField.setPreferredSize( new Dimension(275, 25) ); | textField.setPreferredSize( new Dimension(250, 25) ); | FilterPanel( SortedSet tags, DataDictionary dataDictionary ) { setLayout( new FlowLayout() ); enablePanel( false ); checkBox.setPreferredSize( new Dimension(25, 25) ); add( checkBox ); comboBox.setPreferredSize( new Dimension(200, 25) ); add( comboBox ); operatorComboBox.setPreferredSize( new Dimension(50, 25) ); add( operatorComboBox ); textField.setPreferredSize( new Dimension(275, 25) ); add( textField ); add( new JLabel() ); TreeSet sortedTags = new TreeSet(tags); Iterator i = sortedTags.iterator(); while( i.hasNext() ) { comboBox.addItem( new ComboBoxItem((Integer)i.next(), dataDictionary )); } checkBox.addChangeListener( this ); } |
testParse("closures.at(closures.length)()", "(begin (apply (send (symbol closures) (message (apply (symbol at) (table (select (symbol closures) (symbol length)))))) (table)))"); testParse("closures[closures.length]()", "(begin (apply (table-get (symbol closures) (select (symbol closures) (symbol length))) (table)))"); | public void testCurrying() { testParse( "[ { display: \"test\" }, { | x, y | x < y } ][2](a ,b)", " ( begin ( apply ( table-get ( table ( closure (table ) ( begin ( apply (symbol display:) (table (text \"test\" ) ) ) ) ) ( closure ( table (symbol x) (symbol y) ) ( begin ( < (symbol x) (symbol y) ) ) ) ) (number 2) ) ( table (symbol a) (symbol b) ) ) )"); } |
|
this(owner, PREV | PLAY | NEXT | RANDOM); | this(owner, PREV | PLAY | NEXT | PLAYALL | RANDOM); | public ControlPanel(final AudioPlayer owner) { this(owner, PREV | PLAY | NEXT | RANDOM); } |
mainPanel.getPlaylist().setRandom(random.isSelected()); | mainPanel.getPlaylist().setPlayAll(playAll.isSelected()); | public void actionPerformed(ActionEvent e) { MainPanel mainPanel = (MainPanel)owner.getPanelInstance(); mainPanel.getPlaylist().setRandom(random.isSelected()); } |
return NATMirrorFactory._INSTANCE_.base_createMirror(reflectee); | return NATIntrospectiveMirror.atValue(reflectee); | public ATObject base_reflect_(ATObject reflectee) throws InterpreterException { return NATMirrorFactory._INSTANCE_.base_createMirror(reflectee); } |
if (request.isUserInRole(roles[i])) | if (request.isUserInRole(roles[i].trim())) | public int doStartTag() throws JspException { HttpServletRequest request = (HttpServletRequest) pageContext.getRequest(); String[] roles = role.split(","); for (int i = 0; i < roles.length; i++) { if (request.isUserInRole(roles[i])) return EVAL_BODY_INCLUDE; } return SKIP_BODY; } |
Document doc = docBuilder.newDocument(); config = doc.createElement("dataset"); config.setAttribute("xmlns:xlink", "http: | public XMLDataSet(DocumentBuilder docBuilder, URL datasetURL) { this.base = datasetURL; this.docBuilder = docBuilder; } |
|
return xpath.eval(config, "@datasetid").str(); | return xpath.eval(config, path).str(); | protected String evalString(Node context, String path) { try { return xpath.eval(config, "@datasetid").str(); } catch (javax.xml.transform.TransformerException e) { logger.error("Couldn't get String", e); } // end of try-catch return null; } |
"dataset/parameter[name/text()="+ | "parameter[name/text()="+ | public Object getParamter(String name) { if (parameterCache.containsKey(name)) { return parameterCache.get(name); } // end of if (parameterCache.containsKey(name)) NodeList nList = evalNodeList(config, "dataset/parameter[name/text()="+ dquote+name+dquote+"]"); if (nList != null && nList.getLength() != 0) { Node n = nList.item(0); if (n instanceof Element) { parameterCache.put(name, n); return (Element)n; } } // not a parameter, try parameterRef nList = evalNodeList(config, "dataset/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", e); } // end of try-catch } } //can't find that name??? return null; } |
"dataset/parameterRef[text()="+dquote+name+dquote+"]"); | "parameterRef[text()="+dquote+name+dquote+"]"); | public Object getParamter(String name) { if (parameterCache.containsKey(name)) { return parameterCache.get(name); } // end of if (parameterCache.containsKey(name)) NodeList nList = evalNodeList(config, "dataset/parameter[name/text()="+ dquote+name+dquote+"]"); if (nList != null && nList.getLength() != 0) { Node n = nList.item(0); if (n instanceof Element) { parameterCache.put(name, n); return (Element)n; } } // not a parameter, try parameterRef nList = evalNodeList(config, "dataset/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", e); } // end of try-catch } } //can't find that name??? return null; } |
cal.setCalendarCollection(newCC); | private boolean validateCalendar(HttpServletRequest request, BwActionFormBase form, boolean add) throws Throwable { boolean ok = true; BwCalendar cal = form.getCalendar(); Boolean cc = getBooleanReqPar(request, "calendarCollection"); if (add) { cal.setName(Util.checkNull(cal.getName())); if (cc != null) { cal.setCalendarCollection(cc.booleanValue()); } } else { // Update if (cc != null) { boolean newCC = cc.booleanValue(); if (newCC != cal.getCalendarCollection()) { // Can only change for an empty object. if ((cal.getChildren().size() != 0) || form.fetchSvci().getCalendarInuse(cal)) { form.getErr().emit("org.bedework.validation.error.forbidden.calmode"); return false; } } } } cal.setSummary(Util.checkNull(cal.getSummary())); cal.setDescription(Util.checkNull(cal.getDescription())); if (cal.getName() == null) { form.getErr().emit("org.bedework.validation.error.missingfield", "name"); ok = false; } form.setCalendar(cal); return ok; } |
|
BwFreeBusy fb = svci.getFreeBusy(cal, user, | if (svci.isUserRoot(cal)) { cal = null; } BwFreeBusy fb = svci.getFreeBusy(null, cal, user, | public BwFreeBusy getFreeBusy(CalSvcI svci, BwCalendar cal, String account) throws WebdavException { try { BwUser user = svci.findUser(account); if (user == null) { throw WebdavIntfException.unauthorized(); } BwFreeBusy fb = svci.getFreeBusy(cal, user, timeRange.getStart(), timeRange.getEnd(), null, false); if (debug) { trace("Got " + fb); } return fb; } catch (Throwable t) { throw new WebdavException(t); } } |
boolean superUser, | public boolean init(String authenticatedUser, String user, boolean publicAdmin, boolean superUser, Groups groups, String synchId, boolean debug) throws CalFacadeException { boolean userAdded = super.init(authenticatedUser, user, publicAdmin, superUser, groups, synchId, debug); if (httpManager == null) { synchronized (this) { if (httpManager == null) { httpManager = new HttpManager("org.bedework.http.client.caldav.CaldavClient"); } } } return userAdded; } |
|
superUser, groups, synchId, debug); | groups, synchId, debug); | public boolean init(String authenticatedUser, String user, boolean publicAdmin, boolean superUser, Groups groups, String synchId, boolean debug) throws CalFacadeException { boolean userAdded = super.init(authenticatedUser, user, publicAdmin, superUser, groups, synchId, debug); if (httpManager == null) { synchronized (this) { if (httpManager == null) { httpManager = new HttpManager("org.bedework.http.client.caldav.CaldavClient"); } } } return userAdded; } |
seismograms[counter] = new DataSetSeismogram(hseis.getDataSet().getSeismogram(getSeismogramName(channelGroup[counter], hseis.getDataSet(), new edu.iris.Fissures.TimeRange(seis.getBeginTime().getFissuresTime(), seis.getEndTime().getFissuresTime()))), hseis.getDataSet()); | String name = DisplayUtils.getSeismogramName(channelGroup[counter], hseis.getDataSet(), new edu.iris.Fissures.TimeRange(seis.getBeginTime().getFissuresTime(), seis.getEndTime().getFissuresTime())); seismograms[counter] = new DataSetSeismogram(hseis.getDataSet().getSeismogram(name), hseis.getDataSet()); | public void addParticleMotionDisplay(DataSetSeismogram hseis, TimeConfigRegistrar timeConfigRegistrar, AmpConfigRegistrar hAmpConfigRegistrar, AmpConfigRegistrar vAmpConfigRegistrar) { LocalSeismogramImpl seis = hseis.getSeismogram(); ChannelId[] channelIds = ((edu.sc.seis.fissuresUtil.xml.XMLDataSet)hseis.getDataSet()).getChannelIds(); ChannelGrouperImpl channelProxy = new ChannelGrouperImpl(); logger.debug("the original channel_code from the seismogram is "+ seis.getChannelID().channel_code); ChannelId[] channelGroup = channelProxy.retrieve_grouping(channelIds, seis.getChannelID()); System.out.println("THe length of the channel group is "+channelGroup.length); edu.iris.Fissures.Time startTime; edu.iris.Fissures.Time endTime; DataSetSeismogram[] seismograms = new DataSetSeismogram[3]; if(timeConfigRegistrar != null) { startTime = timeConfigRegistrar.getTimeRange().getBeginTime().getFissuresTime(); endTime = timeConfigRegistrar.getTimeRange().getEndTime().getFissuresTime(); } else { startTime = seis.getBeginTime().getFissuresTime(); endTime = seis.getEndTime().getFissuresTime(); } System.out.println("Start Time is "+new MicroSecondDate(startTime)); System.out.println("end Time is "+new MicroSecondDate(endTime)); try { for(int counter = 0; counter < channelGroup.length; counter++) { seismograms[counter] = new DataSetSeismogram(hseis.getDataSet().getSeismogram(getSeismogramName(channelGroup[counter], hseis.getDataSet(), new edu.iris.Fissures.TimeRange(seis.getBeginTime().getFissuresTime(), seis.getEndTime().getFissuresTime()))), hseis.getDataSet()); //ChannelIdUtil.toStringNoDates(channelGroup[counter])); timeConfigRegistrar.addSeismogram(seismograms[counter]); //hAmpRangeConfigRegistrar.addSeismogram(seismograms if(seismograms[counter] == null) logger.debug(" seismograms["+counter+"] is NULL"); else logger.debug(" seismograms["+counter+"] is NOT NULL"); } } catch(Exception e) { e.printStackTrace(); } boolean horizPlane = isHorizontalPlane( ((LocalSeismogramImpl)seismograms[0].getSeismogram()).getChannelID(), ((LocalSeismogramImpl)seismograms[1].getSeismogram()).getChannelID(), hseis.getDataSet()); addParticleMotionDisplay(seismograms[0], seismograms[1], timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, null, channelGroup[0].channel_code+"-"+channelGroup[1].channel_code, horizPlane); //updateTimeRange(); System.out.println(" ADDED THe first seismograme "); horizPlane = isHorizontalPlane(((LocalSeismogramImpl)seismograms[1].getSeismogram()).getChannelID(), ((LocalSeismogramImpl)seismograms[2].getSeismogram()).getChannelID(), hseis.getDataSet()); addParticleMotionDisplay(seismograms[1], seismograms[2], timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, null, channelGroup[1].channel_code+"-"+channelGroup[2].channel_code, horizPlane); System.out.println(" ADDED he second SEismograme"); horizPlane = isHorizontalPlane(((LocalSeismogramImpl)seismograms[0].getSeismogram()).getChannelID(), ((LocalSeismogramImpl)seismograms[2].getSeismogram()).getChannelID(), hseis.getDataSet()); addParticleMotionDisplay(seismograms[0], seismograms[2], timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, null, channelGroup[0].channel_code+"-"+channelGroup[2].channel_code, horizPlane); System.out.println("Added the third display "); } |
EventInfo ei = svci.getEvent(id); | EventInfo ei = findEvent(request, form); | public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } String idstr = getReqPar(request, "cal"); boolean calid = idstr != null; if (!calid) { idstr = getReqPar(request, "event"); } if (idstr == null) { form.getErr().emit("org.bedework.client.error.noentityid"); return "error"; } int id; try { id = Integer.parseInt(idstr); } catch (Throwable t) { form.getErr().emit("org.bedework.client.error.badentityid"); return "error"; } CalSvcI svci = form.fetchSvci(); BwCalendar cal = null; BwEvent ev = null; if (calid) { cal = svci.getCalendar(id); if (cal == null) { // Do nothing form.getErr().emit("org.bedework.client.error.nosuchcalendar", id); return "doNothing"; } } else { EventInfo ei = svci.getEvent(id); if (ei == null) { // Do nothing form.getErr().emit("org.bedework.client.error.nosuchevent", id); return "doNothing"; } ev = ei.getEvent(); } String how = request.getParameter("how"); if (how == null) { form.getErr().emit("org.bedework.client.error.noentityid"); return "error"; } int desiredAccess = -1; //boolean defaultAccess = false; if (how.equals("r")) { desiredAccess = PrivilegeDefs.privRead; } else if (how.equals("w")) { desiredAccess = PrivilegeDefs.privWrite; } else if (how.equals("f")) { desiredAccess = PrivilegeDefs.privReadFreeBusy; } else if (how.equals("d")) { //defaultAccess = true; form.getErr().emit("org.bedework.client.error.unimplemented"); return "error"; } else { form.getErr().emit("org.bedework.client.error.badhow"); return "error"; } String whoTypeStr = request.getParameter("whoType"); int whoType = -1; if (whoTypeStr == null) { whoType = Ace.whoTypeOwner; } else if (whoTypeStr.equals("user")) { whoType = Ace.whoTypeUser; } else if (whoTypeStr.equals("group")) { whoType = Ace.whoTypeGroup; form.getErr().emit("org.bedework.client.error.unimplemented"); return "error"; } else if (whoTypeStr.equals("unauth")) { whoType = Ace.whoTypeUnauthenticated; } else if (whoTypeStr.equals("other")) { whoType = Ace.whoTypeOther; } else { form.getErr().emit("org.bedework.client.error.badwhotype"); return "error"; } String who = request.getParameter("who"); if (who != null) { BwUser user = svci.findUser(who); if (user == null) { form.getErr().emit("org.bedework.client.error.usernotfound"); return "notFound"; } } else { who = null; } ArrayList aces = new ArrayList(); aces.add(new Ace(who, false, whoType, Privileges.makePriv(desiredAccess))); if (calid) { svci.changeAccess(cal, aces); svci.updateCalendar(cal); } else { svci.changeAccess(ev, aces); svci.updateEvent(ev); } return "success"; } |
pane.setLayout(new BorderLayout()); | private MainFrame() { super(EVI.TITLE); setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); addWindowListener(new WindowListener() { public void windowActivated(WindowEvent arg0) { } public void windowClosed(WindowEvent arg0) { } public void windowClosing(WindowEvent arg0) { Util.askToExit(); } public void windowDeactivated(WindowEvent arg0) { } public void windowDeiconified(WindowEvent arg0) { } public void windowIconified(WindowEvent arg0) { } public void windowOpened(WindowEvent arg0) { } }); pane.setLayout(new BorderLayout()); addComponentListener(new ComponentListener() { public void componentHidden(ComponentEvent arg0) { } public void componentMoved(ComponentEvent arg0) { Point p = new Point(getX(), getY()); MainConfiguration.PROPS.setPoint("gui.topleft", p); } public void componentResized(ComponentEvent arg0) { Dimension d = getSize(); MainConfiguration.PROPS.setDimension("gui.size", d); } public void componentShown(ComponentEvent arg0) { } }); setMainMenuBar(new MenuBar()); setMainToolBar(new ToolBar()); setMainTabBar(new TabBar()); loadIcon(); } |
|
warn("Unable to restore " + entity); | public void end(String ns, String name) throws Exception { BwSponsor entity = (BwSponsor)pop(); globals.sponsors++; globals.sponsorsTbl.put(entity); fixSharableEntity(entity, "Sponsor"); try { if (globals.rintf != null) { for (;;) { Integer i = globals.rintf.restoreSponsor(entity); if (i == null) { break; } warn("Sponsor " + entity.getId() + " has same key fields as " + i + ". Prefixing name with _"); entity.setName("_" + entity.getName()); } } } catch (Throwable t) { throw new Exception(t); } } |
|
String name = Util.checkNull(request.getParameter("name")); | String name = getReqPar(request, "name"); | public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svc = form.fetchSvci(); String name = Util.checkNull(request.getParameter("name")); if (name == null) { form.getErr().emit("org.bedework.client.error.missingfield", "name"); return "error"; } String add = Util.checkNull(request.getParameter("add")); String remove = Util.checkNull(request.getParameter("remove")); if (add != null) { BwSubscription sub = svc.findSubscription(add); if (sub == null) { form.getErr().emit("org.bedework.client.error.nosuchsubscription", add); return "notFound"; } if (!svc.addViewSubscription(name, sub)) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } } if (remove != null) { BwSubscription sub = svc.findSubscription(remove); if (sub == null) { form.getErr().emit("org.bedework.client.error.nosuchsubscription", remove); return "notFound"; } if (!svc.removeViewSubscription(name, sub)) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } } /* boolean makeDefaultView = false; String str = request.getParameter("makedefaultview"); if (str != null) { makeDefaultView = str.equals("true"); } /* XXX Update prefs here * / if (changed) { form.getErr().emit("org.bedework.client.notadded"); return "notAdded"; } */ BwView view = svc.findView(name); if (view == null) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } form.setView(view); return "success"; } |
return "error"; | return "retry"; | public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svc = form.fetchSvci(); String name = Util.checkNull(request.getParameter("name")); if (name == null) { form.getErr().emit("org.bedework.client.error.missingfield", "name"); return "error"; } String add = Util.checkNull(request.getParameter("add")); String remove = Util.checkNull(request.getParameter("remove")); if (add != null) { BwSubscription sub = svc.findSubscription(add); if (sub == null) { form.getErr().emit("org.bedework.client.error.nosuchsubscription", add); return "notFound"; } if (!svc.addViewSubscription(name, sub)) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } } if (remove != null) { BwSubscription sub = svc.findSubscription(remove); if (sub == null) { form.getErr().emit("org.bedework.client.error.nosuchsubscription", remove); return "notFound"; } if (!svc.removeViewSubscription(name, sub)) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } } /* boolean makeDefaultView = false; String str = request.getParameter("makedefaultview"); if (str != null) { makeDefaultView = str.equals("true"); } /* XXX Update prefs here * / if (changed) { form.getErr().emit("org.bedework.client.notadded"); return "notAdded"; } */ BwView view = svc.findView(name); if (view == null) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } form.setView(view); return "success"; } |
String add = Util.checkNull(request.getParameter("add")); String remove = Util.checkNull(request.getParameter("remove")); | String add = getReqPar(request, "add"); String remove = getReqPar(request, "remove"); | public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } CalSvcI svc = form.fetchSvci(); String name = Util.checkNull(request.getParameter("name")); if (name == null) { form.getErr().emit("org.bedework.client.error.missingfield", "name"); return "error"; } String add = Util.checkNull(request.getParameter("add")); String remove = Util.checkNull(request.getParameter("remove")); if (add != null) { BwSubscription sub = svc.findSubscription(add); if (sub == null) { form.getErr().emit("org.bedework.client.error.nosuchsubscription", add); return "notFound"; } if (!svc.addViewSubscription(name, sub)) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } } if (remove != null) { BwSubscription sub = svc.findSubscription(remove); if (sub == null) { form.getErr().emit("org.bedework.client.error.nosuchsubscription", remove); return "notFound"; } if (!svc.removeViewSubscription(name, sub)) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } } /* boolean makeDefaultView = false; String str = request.getParameter("makedefaultview"); if (str != null) { makeDefaultView = str.equals("true"); } /* XXX Update prefs here * / if (changed) { form.getErr().emit("org.bedework.client.notadded"); return "notAdded"; } */ BwView view = svc.findView(name); if (view == null) { form.getErr().emit("org.bedework.client.error.viewnotfound", name); return "notFound"; } form.setView(view); return "success"; } |
int selected = 0; | int selected = -1; | private JPanel makeProfileConnectPanel() { JPanel p = new JPanel(); p.setBorder(new TitledBorder("Connect Profile")); p.setLayout(new GridLayout(2, 0)); Profile[] profiles = Profile.getProfiles(); String lastProfile = Configuration.getLastProfile(); int selected = 0; for (int i = 0; i < profiles.length; i++) { if (profiles[i].toString().equals(lastProfile)) { selected = i; break; } } final JComboBox profileBox = new JComboBox(profiles); profileBox.setSelectedIndex(selected); final JButton connectButton = new JButton("Connect"); connectButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Configuration.setLastProfile(profileBox.getSelectedItem().toString()); } }); JPanel row, sub; sub = new JPanel(new BorderLayout()); sub.add(profileBox, BorderLayout.CENTER); row = new JPanel(new GridLayout(0, 2)); row.add(new JLabel("Profile:")); row.add(sub); p.add(row); row = new JPanel(); row.add(connectButton); p.add(row); JPanel tmp1 = new JPanel(new BorderLayout()); tmp1.add(p, BorderLayout.WEST); JPanel tmp2 = new JPanel(new BorderLayout()); tmp2.add(tmp1, BorderLayout.NORTH); return tmp2; } |
profileBox.setSelectedIndex(selected); | if (selected != -1) { profileBox.setSelectedIndex(selected); } | private JPanel makeProfileConnectPanel() { JPanel p = new JPanel(); p.setBorder(new TitledBorder("Connect Profile")); p.setLayout(new GridLayout(2, 0)); Profile[] profiles = Profile.getProfiles(); String lastProfile = Configuration.getLastProfile(); int selected = 0; for (int i = 0; i < profiles.length; i++) { if (profiles[i].toString().equals(lastProfile)) { selected = i; break; } } final JComboBox profileBox = new JComboBox(profiles); profileBox.setSelectedIndex(selected); final JButton connectButton = new JButton("Connect"); connectButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Configuration.setLastProfile(profileBox.getSelectedItem().toString()); } }); JPanel row, sub; sub = new JPanel(new BorderLayout()); sub.add(profileBox, BorderLayout.CENTER); row = new JPanel(new GridLayout(0, 2)); row.add(new JLabel("Profile:")); row.add(sub); p.add(row); row = new JPanel(); row.add(connectButton); p.add(row); JPanel tmp1 = new JPanel(new BorderLayout()); tmp1.add(p, BorderLayout.WEST); JPanel tmp2 = new JPanel(new BorderLayout()); tmp2.add(tmp1, BorderLayout.NORTH); return tmp2; } |
logger.debug("Body content: " + content); | public int doEndTag() throws JspException { try { CalendarTag cal = (CalendarTag) findAncestorWithClass(this, CalendarTag.class); if (cal == null) return Tag.EVAL_PAGE; // can't use this String content = null; if (day != null && day >= 1 && day <= 31) { BodyContent body = getBodyContent(); if (body != null) content = body.getString(); logger.debug("Body content: " + content); if (content == null || content.trim().length() == 0) content = null; } CalendarDaySpec spec = new CalendarDaySpec( showLink, link, encodeLink, monthParam, dayParam, yearParam, title, dayClass, dayId, content ); cal.setDaySpec(day, spec); return Tag.EVAL_PAGE; } finally { cleanup(); } } |
|
getParentPage().setOnLoad("window.open('" + uri + "' , 'newWin', 'width=600,height=400,scrollbars=yes')"); | getParentPage().setOnLoad(" openwindow('" + uri + "','IdegaWeb Generated Report','0','0','0','0','0','1','1','1','800','600') "); | private boolean executeQueries(SQLQuery query, QueryToSQLBridge bridge, List executedSQLQueries) throws RemoteException { QueryResult queryResult = bridge.executeQueries(query, executedSQLQueries); // check if everything is fine if (queryResult == null || queryResult.isEmpty()) { // nothing to do return false; } // get the design of the report JasperReportBusiness reportBusiness = getReportBusiness(); int designId = ((Integer) parameterMap.get(CURRENT_LAYOUT_ID)).intValue(); JasperDesign design = reportBusiness.getDesign(designId); // synchronize design and result Map designParameters = new HashMap(); designParameters.put(REPORT_HEADLINE_KEY, query.getName()); JasperPrint print = reportBusiness.printSynchronizedReport(queryResult, designParameters, design); // create html report String uri; String format = (String) parameterMap.get(CURRENT_OUTPUT_FORMAT); if (PDF_KEY.equals(format)) { uri = reportBusiness.getPdfReport(print, "report"); } else if (EXCEL_KEY.equals(format)) { uri = reportBusiness.getExcelReport(print, "report"); } else { uri = reportBusiness.getHtmlReport(print, "report"); } // open an extra window with scrollbars getParentPage().setOnLoad("window.open('" + uri + "' , 'newWin', 'width=600,height=400,scrollbars=yes')"); return true; } |
sb.append("AclVO{"); | sb.append("Acl{"); | public String toString() { StringBuffer sb = new StringBuffer(); sb.append("AclVO{"); if (!empty()) { sb.append("encoded=["); rewind(); while (hasMore()) { sb.append(getChar()); } sb.append("] "); rewind(); try { if (aces == null) { decode(getEncoded()); } Iterator it = aces.iterator(); while (it.hasNext()) { Ace ace = (Ace)it.next(); sb.append("\n"); sb.append(ace.toString()); } } catch (Throwable t) { error(t); sb.append("Decode exception " + t.getMessage()); } } sb.append("}"); return sb.toString(); } |
null, | private void init() throws Throwable { svci = new CalSvc(); CalSvcIPars pars = new CalSvcIPars(account, account, null, // XXX needs envPrefix true, // public false, // caldav null, // synchId debug); svci.init(pars); } |
|
form.getErr().emit("org.bedework.error.usernotfound"); | form.getErr().emit("org.bedework.client.error.usernotfound"); | public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { String userId = request.getParameter("userid"); BwUser user; CalSvcI svci = form.getCalSvcI(); if (userId != null) { user = svci.findUser(userId); if (user == null) { form.getErr().emit("org.bedework.error.usernotfound"); return "notFound"; } } else { user = svci.getUser(); } Calendar start = Calendar.getInstance(request.getLocale()); //BwDateTime startDt = form.getEventStartDate().getDateTime(); Calendar end = Calendar.getInstance(request.getLocale()); //BwDateTime endDt = form.getEventEndDate().getDateTime(); int interval = 1; String intstr = request.getParameter("interval"); if (intstr != null) { try { interval = Integer.parseInt(intstr); } catch (Throwable t) { form.getErr().emit("org.bedework.error.badinterval"); return "error"; } } if (interval <= 0) { form.getErr().emit("org.bedework.error.badinterval"); return "error"; } int intunit = Calendar.HOUR; String intunitStr = request.getParameter("intunit"); if (intunitStr != null) { if ("minutes".equals(intunitStr)) { intunit = Calendar.MINUTE; } else if ("hours".equals(intunitStr)) { intunit = Calendar.HOUR; } else if ("days".equals(intunitStr)) { intunit = Calendar.DAY_OF_MONTH; } else if ("weeks".equals(intunitStr)) { intunit = Calendar.WEEK_OF_YEAR; } else if ("months".equals(intunitStr)) { intunit = Calendar.MONTH; } else { form.getErr().emit("org.bedework.error.badintervalunit"); return "error"; } } //int maxRequests = 1000; BwFreeBusy fb = null; while (start.before(end)) { Date sdt = start.getTime(); start.add(intunit, interval); if (debug) { debugMsg("getFreeBusy for start = " + sdt + " end = " + start.getTime()); } BwFreeBusy fb1 = svci.getFreeBusy(user, CalFacadeUtil.getDateTime(sdt, false, true, svci.getTimezones()), CalFacadeUtil.getDateTime(start.getTime(), false, true, svci.getTimezones())); if (fb == null) { fb = fb1; } else { Iterator it = fb1.iterateTimes(); while (it.hasNext()) { BwFreeBusyComponent fbc = (BwFreeBusyComponent)it.next(); if (!fbc.getEmpty()) { fb.addTime(fbc); } } } } fb.setEnd(form.getEventEndDate().getDateTime()); form.assignFreeBusy(fb); return "success"; } |
form.getErr().emit("org.bedework.error.badinterval"); | form.getErr().emit("org.bedework.client.error.badinterval"); | public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { String userId = request.getParameter("userid"); BwUser user; CalSvcI svci = form.getCalSvcI(); if (userId != null) { user = svci.findUser(userId); if (user == null) { form.getErr().emit("org.bedework.error.usernotfound"); return "notFound"; } } else { user = svci.getUser(); } Calendar start = Calendar.getInstance(request.getLocale()); //BwDateTime startDt = form.getEventStartDate().getDateTime(); Calendar end = Calendar.getInstance(request.getLocale()); //BwDateTime endDt = form.getEventEndDate().getDateTime(); int interval = 1; String intstr = request.getParameter("interval"); if (intstr != null) { try { interval = Integer.parseInt(intstr); } catch (Throwable t) { form.getErr().emit("org.bedework.error.badinterval"); return "error"; } } if (interval <= 0) { form.getErr().emit("org.bedework.error.badinterval"); return "error"; } int intunit = Calendar.HOUR; String intunitStr = request.getParameter("intunit"); if (intunitStr != null) { if ("minutes".equals(intunitStr)) { intunit = Calendar.MINUTE; } else if ("hours".equals(intunitStr)) { intunit = Calendar.HOUR; } else if ("days".equals(intunitStr)) { intunit = Calendar.DAY_OF_MONTH; } else if ("weeks".equals(intunitStr)) { intunit = Calendar.WEEK_OF_YEAR; } else if ("months".equals(intunitStr)) { intunit = Calendar.MONTH; } else { form.getErr().emit("org.bedework.error.badintervalunit"); return "error"; } } //int maxRequests = 1000; BwFreeBusy fb = null; while (start.before(end)) { Date sdt = start.getTime(); start.add(intunit, interval); if (debug) { debugMsg("getFreeBusy for start = " + sdt + " end = " + start.getTime()); } BwFreeBusy fb1 = svci.getFreeBusy(user, CalFacadeUtil.getDateTime(sdt, false, true, svci.getTimezones()), CalFacadeUtil.getDateTime(start.getTime(), false, true, svci.getTimezones())); if (fb == null) { fb = fb1; } else { Iterator it = fb1.iterateTimes(); while (it.hasNext()) { BwFreeBusyComponent fbc = (BwFreeBusyComponent)it.next(); if (!fbc.getEmpty()) { fb.addTime(fbc); } } } } fb.setEnd(form.getEventEndDate().getDateTime()); form.assignFreeBusy(fb); return "success"; } |
form.getErr().emit("org.bedework.error.badintervalunit"); | form.getErr().emit("org.bedework.client.error.badintervalunit"); | public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { String userId = request.getParameter("userid"); BwUser user; CalSvcI svci = form.getCalSvcI(); if (userId != null) { user = svci.findUser(userId); if (user == null) { form.getErr().emit("org.bedework.error.usernotfound"); return "notFound"; } } else { user = svci.getUser(); } Calendar start = Calendar.getInstance(request.getLocale()); //BwDateTime startDt = form.getEventStartDate().getDateTime(); Calendar end = Calendar.getInstance(request.getLocale()); //BwDateTime endDt = form.getEventEndDate().getDateTime(); int interval = 1; String intstr = request.getParameter("interval"); if (intstr != null) { try { interval = Integer.parseInt(intstr); } catch (Throwable t) { form.getErr().emit("org.bedework.error.badinterval"); return "error"; } } if (interval <= 0) { form.getErr().emit("org.bedework.error.badinterval"); return "error"; } int intunit = Calendar.HOUR; String intunitStr = request.getParameter("intunit"); if (intunitStr != null) { if ("minutes".equals(intunitStr)) { intunit = Calendar.MINUTE; } else if ("hours".equals(intunitStr)) { intunit = Calendar.HOUR; } else if ("days".equals(intunitStr)) { intunit = Calendar.DAY_OF_MONTH; } else if ("weeks".equals(intunitStr)) { intunit = Calendar.WEEK_OF_YEAR; } else if ("months".equals(intunitStr)) { intunit = Calendar.MONTH; } else { form.getErr().emit("org.bedework.error.badintervalunit"); return "error"; } } //int maxRequests = 1000; BwFreeBusy fb = null; while (start.before(end)) { Date sdt = start.getTime(); start.add(intunit, interval); if (debug) { debugMsg("getFreeBusy for start = " + sdt + " end = " + start.getTime()); } BwFreeBusy fb1 = svci.getFreeBusy(user, CalFacadeUtil.getDateTime(sdt, false, true, svci.getTimezones()), CalFacadeUtil.getDateTime(start.getTime(), false, true, svci.getTimezones())); if (fb == null) { fb = fb1; } else { Iterator it = fb1.iterateTimes(); while (it.hasNext()) { BwFreeBusyComponent fbc = (BwFreeBusyComponent)it.next(); if (!fbc.getEmpty()) { fb.addTime(fbc); } } } } fb.setEnd(form.getEventEndDate().getDateTime()); form.assignFreeBusy(fb); return "success"; } |
logger.debug("creating an image with " + numLeft + " in the queue"); | begin = new Date(); | public void run(){ PlotInfo currentRequirements; BasicSeismogramDisplay.ImagePainter currentPatron; int numLeft; Graphics2D graphic; Image currentImage = null; BufferedImage buffCurrentImage = null; Dimension size; HashMap plotters; numLeft = requests.size(); while(numLeft > 0){ logger.debug("creating an image with " + numLeft + " in the queue"); synchronized(this){ currentPatron = ((BasicSeismogramDisplay.ImagePainter)requests.getFirst()); currentRequirements = ((PlotInfo)patrons.get(currentPatron)); size = currentRequirements.getSize(); plotters = ((HashMap)currentRequirements.getPlotters().clone()); if(requests.contains(currentPatron) && size.width > 0){ if(bufferedImage){ buffCurrentImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_BYTE_INDEXED); graphic = buffCurrentImage.createGraphics(); }else{ currentImage = currentPatron.createImage(size.width, size.height); graphic = (Graphics2D)currentImage.getGraphics(); } } else{ numLeft = requests.size(); break; } } Iterator e = plotters.keySet().iterator(); LinkedList afterSeismograms = new LinkedList(); if(bufferedImage){ graphic.setColor(Color.white); graphic.fill(new Rectangle(0, 0, size.width, size.height)); } while(e.hasNext()){ Plotter current = ((Plotter)e.next()); if(current instanceof SeismogramPlotter){ graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); }else{ afterSeismograms.add(current); } } e = afterSeismograms.iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); } synchronized(this){ if(currentRequirements.getDisplayInterval().getValue() == currentPatron.getTimeConfig().getTimeRange().getInterval().getValue() && requests.contains(currentPatron)){ requests.removeFirst(); if(bufferedImage) currentPatron.setImage(buffCurrentImage); else currentPatron.setImage(currentImage); } numLeft = requests.size(); } } logger.debug("image creation thread is finished"); } |
buffCurrentImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_BYTE_INDEXED); | buffCurrentImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_INT_BGR); | public void run(){ PlotInfo currentRequirements; BasicSeismogramDisplay.ImagePainter currentPatron; int numLeft; Graphics2D graphic; Image currentImage = null; BufferedImage buffCurrentImage = null; Dimension size; HashMap plotters; numLeft = requests.size(); while(numLeft > 0){ logger.debug("creating an image with " + numLeft + " in the queue"); synchronized(this){ currentPatron = ((BasicSeismogramDisplay.ImagePainter)requests.getFirst()); currentRequirements = ((PlotInfo)patrons.get(currentPatron)); size = currentRequirements.getSize(); plotters = ((HashMap)currentRequirements.getPlotters().clone()); if(requests.contains(currentPatron) && size.width > 0){ if(bufferedImage){ buffCurrentImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_BYTE_INDEXED); graphic = buffCurrentImage.createGraphics(); }else{ currentImage = currentPatron.createImage(size.width, size.height); graphic = (Graphics2D)currentImage.getGraphics(); } } else{ numLeft = requests.size(); break; } } Iterator e = plotters.keySet().iterator(); LinkedList afterSeismograms = new LinkedList(); if(bufferedImage){ graphic.setColor(Color.white); graphic.fill(new Rectangle(0, 0, size.width, size.height)); } while(e.hasNext()){ Plotter current = ((Plotter)e.next()); if(current instanceof SeismogramPlotter){ graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); }else{ afterSeismograms.add(current); } } e = afterSeismograms.iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); } synchronized(this){ if(currentRequirements.getDisplayInterval().getValue() == currentPatron.getTimeConfig().getTimeRange().getInterval().getValue() && requests.contains(currentPatron)){ requests.removeFirst(); if(bufferedImage) currentPatron.setImage(buffCurrentImage); else currentPatron.setImage(currentImage); } numLeft = requests.size(); } } logger.debug("image creation thread is finished"); } |
} | } Date endPlotting = new Date(); long interval = (endPlotting.getTime() - beginPlotting.getTime()); logger.debug("plotting: " + interval + "ms"); plottingTotals += interval; | public void run(){ PlotInfo currentRequirements; BasicSeismogramDisplay.ImagePainter currentPatron; int numLeft; Graphics2D graphic; Image currentImage = null; BufferedImage buffCurrentImage = null; Dimension size; HashMap plotters; numLeft = requests.size(); while(numLeft > 0){ logger.debug("creating an image with " + numLeft + " in the queue"); synchronized(this){ currentPatron = ((BasicSeismogramDisplay.ImagePainter)requests.getFirst()); currentRequirements = ((PlotInfo)patrons.get(currentPatron)); size = currentRequirements.getSize(); plotters = ((HashMap)currentRequirements.getPlotters().clone()); if(requests.contains(currentPatron) && size.width > 0){ if(bufferedImage){ buffCurrentImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_BYTE_INDEXED); graphic = buffCurrentImage.createGraphics(); }else{ currentImage = currentPatron.createImage(size.width, size.height); graphic = (Graphics2D)currentImage.getGraphics(); } } else{ numLeft = requests.size(); break; } } Iterator e = plotters.keySet().iterator(); LinkedList afterSeismograms = new LinkedList(); if(bufferedImage){ graphic.setColor(Color.white); graphic.fill(new Rectangle(0, 0, size.width, size.height)); } while(e.hasNext()){ Plotter current = ((Plotter)e.next()); if(current instanceof SeismogramPlotter){ graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); }else{ afterSeismograms.add(current); } } e = afterSeismograms.iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); } synchronized(this){ if(currentRequirements.getDisplayInterval().getValue() == currentPatron.getTimeConfig().getTimeRange().getInterval().getValue() && requests.contains(currentPatron)){ requests.removeFirst(); if(bufferedImage) currentPatron.setImage(buffCurrentImage); else currentPatron.setImage(currentImage); } numLeft = requests.size(); } } logger.debug("image creation thread is finished"); } |
logger.debug("image creation thread is finished"); | logger.debug("image total " + imageTotals + " plot total " + plottingTotals); | public void run(){ PlotInfo currentRequirements; BasicSeismogramDisplay.ImagePainter currentPatron; int numLeft; Graphics2D graphic; Image currentImage = null; BufferedImage buffCurrentImage = null; Dimension size; HashMap plotters; numLeft = requests.size(); while(numLeft > 0){ logger.debug("creating an image with " + numLeft + " in the queue"); synchronized(this){ currentPatron = ((BasicSeismogramDisplay.ImagePainter)requests.getFirst()); currentRequirements = ((PlotInfo)patrons.get(currentPatron)); size = currentRequirements.getSize(); plotters = ((HashMap)currentRequirements.getPlotters().clone()); if(requests.contains(currentPatron) && size.width > 0){ if(bufferedImage){ buffCurrentImage = new BufferedImage(size.width, size.height, BufferedImage.TYPE_BYTE_INDEXED); graphic = buffCurrentImage.createGraphics(); }else{ currentImage = currentPatron.createImage(size.width, size.height); graphic = (Graphics2D)currentImage.getGraphics(); } } else{ numLeft = requests.size(); break; } } Iterator e = plotters.keySet().iterator(); LinkedList afterSeismograms = new LinkedList(); if(bufferedImage){ graphic.setColor(Color.white); graphic.fill(new Rectangle(0, 0, size.width, size.height)); } while(e.hasNext()){ Plotter current = ((Plotter)e.next()); if(current instanceof SeismogramPlotter){ graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); }else{ afterSeismograms.add(current); } } e = afterSeismograms.iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); } synchronized(this){ if(currentRequirements.getDisplayInterval().getValue() == currentPatron.getTimeConfig().getTimeRange().getInterval().getValue() && requests.contains(currentPatron)){ requests.removeFirst(); if(bufferedImage) currentPatron.setImage(buffCurrentImage); else currentPatron.setImage(currentImage); } numLeft = requests.size(); } } logger.debug("image creation thread is finished"); } |
return super.meta_eval(ctx); | return null; | public ATObject meta_eval(ATContext ctx) { // TODO Auto-generated method stub return super.meta_eval(ctx); } |
return super.meta_quote(ctx); | return null; | public ATAbstractGrammar meta_quote(ATContext ctx) { // TODO Auto-generated method stub return super.meta_quote(ctx); } |
svci.addEvent(cal, proxy, null); | public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } CalSvcI svci = form.fetchSvci(); EventInfo ei = findEvent(request, form); if (ei == null) { // Do nothing return "doNothing"; } /* Create an event to act as a reference to the targeted event and copy * the appropriate fields from the target */ BwEventProxy proxy = BwEventProxy.makeAnnotation(ei.getEvent(), ei.getEvent().getOwner()); BwCalendar cal = svci.getPreferredCalendar(); proxy.setOwner(svci.getUser()); svci.addEvent(cal, proxy, null); form.getMsg().emit("org.bedework.client.message.added.eventrefs", 1); BwGoToAction.gotoDateView(this, form, proxy.getDtstart().getDate().substring(0, 8), BedeworkDefs.dayView, debug); form.refreshIsNeeded(); return "success"; } |
|
form.getMsg().emit("org.bedework.client.message.added.eventrefs", 1); | try { svci.addEvent(cal, proxy, null); form.getMsg().emit("org.bedework.client.message.added.eventrefs", 1); | public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } CalSvcI svci = form.fetchSvci(); EventInfo ei = findEvent(request, form); if (ei == null) { // Do nothing return "doNothing"; } /* Create an event to act as a reference to the targeted event and copy * the appropriate fields from the target */ BwEventProxy proxy = BwEventProxy.makeAnnotation(ei.getEvent(), ei.getEvent().getOwner()); BwCalendar cal = svci.getPreferredCalendar(); proxy.setOwner(svci.getUser()); svci.addEvent(cal, proxy, null); form.getMsg().emit("org.bedework.client.message.added.eventrefs", 1); BwGoToAction.gotoDateView(this, form, proxy.getDtstart().getDate().substring(0, 8), BedeworkDefs.dayView, debug); form.refreshIsNeeded(); return "success"; } |
return "success"; | return "success"; } catch (CalFacadeException cfe) { if (CalFacadeException.duplicateGuid.equals(cfe.getMessage())) { form.getErr().emit("org.bedework.client.error.duplicate.guid"); return "duplicate"; } throw cfe; } | public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } CalSvcI svci = form.fetchSvci(); EventInfo ei = findEvent(request, form); if (ei == null) { // Do nothing return "doNothing"; } /* Create an event to act as a reference to the targeted event and copy * the appropriate fields from the target */ BwEventProxy proxy = BwEventProxy.makeAnnotation(ei.getEvent(), ei.getEvent().getOwner()); BwCalendar cal = svci.getPreferredCalendar(); proxy.setOwner(svci.getUser()); svci.addEvent(cal, proxy, null); form.getMsg().emit("org.bedework.client.message.added.eventrefs", 1); BwGoToAction.gotoDateView(this, form, proxy.getDtstart().getDate().substring(0, 8), BedeworkDefs.dayView, debug); form.refreshIsNeeded(); return "success"; } |
svci.addEvent(null, proxy.getTarget(), null); | BwCalendar cal = svci.getPreferredCalendar(); proxy.setOwner(svci.getUser()); svci.addEvent(cal, proxy, null); | public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } CalSvcI svci = form.fetchSvci(); EventInfo ei = findEvent(request, form); if (ei == null) { // Do nothing return "doNothing"; } /* Create an event to act as a reference to the targeted event and copy * the appropriate fields from the target */ BwEventProxy proxy = BwEventProxy.makeAnnotation(ei.getEvent(), ei.getEvent().getOwner()); svci.addEvent(null, proxy.getTarget(), null); form.getMsg().emit("org.bedework.client.message.added.eventrefs", 1); BwGoToAction.gotoDateView(this, form, proxy.getDtstart().getDate().substring(0, 8), BedeworkDefs.dayView, debug); form.refreshIsNeeded(); return "success"; } |
char[] encoded = logEncoded(acl, "default encoded"); | char[] encoded = logEncoded(acl, "default"); | public void testBasics() { try { // Make sonme test objects BwUser unauth = new BwUser(); BwUser owner = new BwUser("anowner"); BwUser auser = new BwUser("auser"); BwUser auserInGroup = new BwUser("auseringroup"); BwGroup agroup = new BwGroup("agroup"); BwGroup bgroup = new BwGroup("bgroup"); auserInGroup.addGroup(agroup); auserInGroup.addGroup(bgroup); Privilege read = Privileges.makePriv(Privileges.privRead); Privilege write = Privileges.makePriv(Privileges.privWrite); Privilege[] privSetRead = {read}; Privilege[] privSetReadWrite = {read, write}; /* See what we get when we encode a null - that's default - acl. */ Acl acl = new Acl(debug); char[] encoded = logEncoded(acl, "default encoded"); tryDecode(encoded, "default"); tryEvaluateAccess(owner, owner, privSetRead, encoded, true, "Owner access for default"); tryEvaluateAccess(auser, owner, privSetRead, encoded, false, "User access for default"); log("---------------------------------------------------------"); /* read others - i.e. not owner */ acl.clear(); acl.addAce(new Ace(null, false, Ace.whoTypeOther, Privileges.makePriv(Privileges.privRead))); encoded = logEncoded(acl, "read others"); tryDecode(encoded, "read others"); tryEvaluateAccess(owner, owner, privSetReadWrite, encoded, true, "Owner access for read others"); tryEvaluateAccess(auser, owner, privSetRead, encoded, true, "User access for read others"); tryEvaluateAccess(unauth, owner, privSetRead, encoded, false, "Unauthenticated access for read others"); log("---------------------------------------------------------"); /* read for group "agroup", rw for user "auser" */ acl.clear(); Ace ace = new Ace("agroup", false, Ace.whoTypeGroup, Privileges.makePriv(Privileges.privRead)); acl.addAce(ace); ace = new Ace("auser", false, Ace.whoTypeUser); ace.addPriv(Privileges.makePriv(Privileges.privRead)); ace.addPriv(Privileges.makePriv(Privileges.privWrite)); acl.addAce(ace); encoded = logEncoded(acl, "read g=agroup,rw auser"); tryDecode(encoded, "read g=agroup,rw auser"); tryEvaluateAccess(owner, owner, privSetReadWrite, encoded, true, "Owner access for read g=agroup,rw auser"); tryEvaluateAccess(auserInGroup, owner, privSetRead, encoded, true, "User access for read g=agroup,rw auser"); } catch (Throwable t) { t.printStackTrace(); fail("Exception testing access: " + t.getMessage()); } } |
acl.clear(); | acl = new Acl(debug); | public void testBasics() { try { // Make sonme test objects BwUser unauth = new BwUser(); BwUser owner = new BwUser("anowner"); BwUser auser = new BwUser("auser"); BwUser auserInGroup = new BwUser("auseringroup"); BwGroup agroup = new BwGroup("agroup"); BwGroup bgroup = new BwGroup("bgroup"); auserInGroup.addGroup(agroup); auserInGroup.addGroup(bgroup); Privilege read = Privileges.makePriv(Privileges.privRead); Privilege write = Privileges.makePriv(Privileges.privWrite); Privilege[] privSetRead = {read}; Privilege[] privSetReadWrite = {read, write}; /* See what we get when we encode a null - that's default - acl. */ Acl acl = new Acl(debug); char[] encoded = logEncoded(acl, "default encoded"); tryDecode(encoded, "default"); tryEvaluateAccess(owner, owner, privSetRead, encoded, true, "Owner access for default"); tryEvaluateAccess(auser, owner, privSetRead, encoded, false, "User access for default"); log("---------------------------------------------------------"); /* read others - i.e. not owner */ acl.clear(); acl.addAce(new Ace(null, false, Ace.whoTypeOther, Privileges.makePriv(Privileges.privRead))); encoded = logEncoded(acl, "read others"); tryDecode(encoded, "read others"); tryEvaluateAccess(owner, owner, privSetReadWrite, encoded, true, "Owner access for read others"); tryEvaluateAccess(auser, owner, privSetRead, encoded, true, "User access for read others"); tryEvaluateAccess(unauth, owner, privSetRead, encoded, false, "Unauthenticated access for read others"); log("---------------------------------------------------------"); /* read for group "agroup", rw for user "auser" */ acl.clear(); Ace ace = new Ace("agroup", false, Ace.whoTypeGroup, Privileges.makePriv(Privileges.privRead)); acl.addAce(ace); ace = new Ace("auser", false, Ace.whoTypeUser); ace.addPriv(Privileges.makePriv(Privileges.privRead)); ace.addPriv(Privileges.makePriv(Privileges.privWrite)); acl.addAce(ace); encoded = logEncoded(acl, "read g=agroup,rw auser"); tryDecode(encoded, "read g=agroup,rw auser"); tryEvaluateAccess(owner, owner, privSetReadWrite, encoded, true, "Owner access for read g=agroup,rw auser"); tryEvaluateAccess(auserInGroup, owner, privSetRead, encoded, true, "User access for read g=agroup,rw auser"); } catch (Throwable t) { t.printStackTrace(); fail("Exception testing access: " + t.getMessage()); } } |
log("---------------------------------------------------------"); acl = new Acl(debug); acl.addAce(new Ace(null, false, Ace.whoTypeAll, Privileges.makePriv(Privileges.privRead))); acl.addAce(new Ace(null, false, Ace.whoTypeUnauthenticated, Privileges.makePriv(Privileges.privNone))); encoded = logEncoded(acl, "read others,none unauthenticated"); tryDecode(encoded, "read others,none unauthenticated"); tryEvaluateAccess(owner, owner, privSetReadWrite, encoded, true, "Owner access for read others,none unauthenticated"); tryEvaluateAccess(auser, owner, privSetRead, encoded, true, "User access for read others,none unauthenticated"); tryEvaluateAccess(unauth, owner, privSetRead, encoded, false, "Unauthenticated access for read others,none unauthenticated"); | public void testBasics() { try { // Make sonme test objects BwUser unauth = new BwUser(); BwUser owner = new BwUser("anowner"); BwUser auser = new BwUser("auser"); BwUser auserInGroup = new BwUser("auseringroup"); BwGroup agroup = new BwGroup("agroup"); BwGroup bgroup = new BwGroup("bgroup"); auserInGroup.addGroup(agroup); auserInGroup.addGroup(bgroup); Privilege read = Privileges.makePriv(Privileges.privRead); Privilege write = Privileges.makePriv(Privileges.privWrite); Privilege[] privSetRead = {read}; Privilege[] privSetReadWrite = {read, write}; /* See what we get when we encode a null - that's default - acl. */ Acl acl = new Acl(debug); char[] encoded = logEncoded(acl, "default encoded"); tryDecode(encoded, "default"); tryEvaluateAccess(owner, owner, privSetRead, encoded, true, "Owner access for default"); tryEvaluateAccess(auser, owner, privSetRead, encoded, false, "User access for default"); log("---------------------------------------------------------"); /* read others - i.e. not owner */ acl.clear(); acl.addAce(new Ace(null, false, Ace.whoTypeOther, Privileges.makePriv(Privileges.privRead))); encoded = logEncoded(acl, "read others"); tryDecode(encoded, "read others"); tryEvaluateAccess(owner, owner, privSetReadWrite, encoded, true, "Owner access for read others"); tryEvaluateAccess(auser, owner, privSetRead, encoded, true, "User access for read others"); tryEvaluateAccess(unauth, owner, privSetRead, encoded, false, "Unauthenticated access for read others"); log("---------------------------------------------------------"); /* read for group "agroup", rw for user "auser" */ acl.clear(); Ace ace = new Ace("agroup", false, Ace.whoTypeGroup, Privileges.makePriv(Privileges.privRead)); acl.addAce(ace); ace = new Ace("auser", false, Ace.whoTypeUser); ace.addPriv(Privileges.makePriv(Privileges.privRead)); ace.addPriv(Privileges.makePriv(Privileges.privWrite)); acl.addAce(ace); encoded = logEncoded(acl, "read g=agroup,rw auser"); tryDecode(encoded, "read g=agroup,rw auser"); tryEvaluateAccess(owner, owner, privSetReadWrite, encoded, true, "Owner access for read g=agroup,rw auser"); tryEvaluateAccess(auserInGroup, owner, privSetRead, encoded, true, "User access for read g=agroup,rw auser"); } catch (Throwable t) { t.printStackTrace(); fail("Exception testing access: " + t.getMessage()); } } |
|
CurrentAccess ca = new Acl().evaluateAccess(who, owner.getAccount(), how, encoded, null); | CurrentAccess ca = new Acl(debug).evaluateAccess(who, owner.getAccount(), how, encoded, null); | private void tryEvaluateAccess(BwPrincipal who, BwPrincipal owner, Privilege[] how,char[] encoded, boolean expected, String title) throws Throwable { CurrentAccess ca = new Acl().evaluateAccess(who, owner.getAccount(), how, encoded, null); if (debug) { log(title + " got " + ca.accessAllowed + " and expected " + expected); } assertEquals(title, expected, ca.accessAllowed); } |
this.displayKeys.add(key); | if(!this.displayKeys.contains(key)) { this.displayKeys.add(key); } | public void addDisplayKey(String key) { this.displayKeys.add(key); } |
if(min > max) ampRange = new UnitRangeImpl(min, -min, seis.getAmplitudeRange().getUnit()); else ampRange = new UnitRangeImpl(-max, max, seis.getAmplitudeRange().getUnit()); | double mean = seis.getMeanValue(beginIndex, endIndex).getValue(); double meanDiff = (Math.abs(mean - min) > Math.abs(mean - max) ? Math.abs(mean - min) : Math.abs(mean - max)); ampRange = new UnitRangeImpl(-meanDiff, meanDiff, seis.getAmplitudeRange().getUnit()); | public OffsetMeanAmpConfig(LocalSeismogram aSeis, MicroSecondTimeRange range){ LocalSeismogramImpl seis = (LocalSeismogramImpl)aSeis; int beginIndex = SeisPlotUtil.getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), range.getBeginTime()); if (beginIndex < 0) beginIndex = 0; if (beginIndex > seis.getNumPoints()) beginIndex = seis.getNumPoints(); int endIndex = SeisPlotUtil.getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), range.getEndTime()); if (endIndex < 0) endIndex = 0; if (endIndex > seis.getNumPoints()) endIndex = seis.getNumPoints(); if (endIndex == beginIndex) { ampRange = new UnitRangeImpl(-500, 500, UnitImpl.COUNT); } try { double min = seis.getMinValue(beginIndex, endIndex).getValue(); double max = seis.getMaxValue(beginIndex, endIndex).getValue(); if(min > max) ampRange = new UnitRangeImpl(min, -min, seis.getAmplitudeRange().getUnit()); else ampRange = new UnitRangeImpl(-max, max, seis.getAmplitudeRange().getUnit()); }catch (Exception e) { ampRange = new UnitRangeImpl(-500, 500, UnitImpl.COUNT); } } |
if (pos == 0) return; | public void keyPressed(KeyEvent e) { int key = e.getKeyCode(); if (key == KeyEvent.VK_UP) { String current = getText(); if (current != null && current.length() > 0 && history.isBehind()) { history.append(current); } if (history.previous() != null) { setText((String)history.current()); } else { setText(""); } } else if (key == KeyEvent.VK_DOWN) { if (history.next() != null) { setText((String)history.current()); } else { setText(""); } } else if (key == KeyEvent.VK_RIGHT) { int pos = getCaretPosition(); if (charAt(pos - 1) == ' ') return; int c = charAt(pos); int prevSpace = previousIndexOf(pos-1, ' '); if (prevSpace == -1) prevSpace = 0; if (c == ' ' || c == '\n') { String s = getText(prevSpace, pos - prevSpace); System.out.println("Completing '"+ s +"'"); try { getDocument().insertString(pos, "TABCOMPL", null); } catch (Exception exc) { exc.printStackTrace(); } } } } |
|
boolean nonNull = false; for (int i = 0; i < array.length && !nonNull; i++ ) { | boolean allNull = true; for (int i = 0; i < array.length && allNull; i++ ) { | public static boolean allNull(Object[] array){ boolean nonNull = false; for (int i = 0; i < array.length && !nonNull; i++ ) { if(array[i] != null){ nonNull = true; } } return nonNull; } |
nonNull = true; | allNull = false; | public static boolean allNull(Object[] array){ boolean nonNull = false; for (int i = 0; i < array.length && !nonNull; i++ ) { if(array[i] != null){ nonNull = true; } } return nonNull; } |
return nonNull; | return allNull; | public static boolean allNull(Object[] array){ boolean nonNull = false; for (int i = 0; i < array.length && !nonNull; i++ ) { if(array[i] != null){ nonNull = true; } } return nonNull; } |
Dimension size = currentRequirements.getSize(); | public void run(){ PlotInfo currentRequirements; BasicSeismogramDisplay.ImagePainter currentPatron; int numLeft; Graphics2D graphic; Image currentImage; numLeft = requests.size(); while(numLeft > 0){ synchronized(this){ currentPatron = ((BasicSeismogramDisplay.ImagePainter)requests.getFirst()); currentRequirements = ((PlotInfo)patrons.get(currentPatron)); } HashMap plotters = currentRequirements.getPlotters(); Dimension size = currentRequirements.getSize(); if(size.height <= 0 || size.width <= 0){ numLeft = requests.size(); break; } synchronized(this){ if(requests.contains(currentPatron)){ currentImage = currentPatron.createImage(size.width, size.height); graphic = (Graphics2D)currentImage.getGraphics(); }else{ numLeft = requests.size(); break; } } Iterator e = plotters.keySet().iterator(); while(e.hasNext()){ Plotter current = ((Plotter)e.next()); graphic.setColor((Color)plotters.get(current)); graphic.draw(current.draw(size)); } synchronized(this){ if(currentRequirements.getDisplayInterval().getValue() == currentPatron.getTimeConfig().getTimeRange().getInterval().getValue() && requests.contains(currentPatron)){ requests.removeFirst(); currentPatron.setImage(currentImage); } } numLeft = requests.size(); } logger.debug("image creation thread is finished"); } |
|
public static boolean getBoolProperty(String name) throws CalEnvException { | public boolean getBoolProperty(String name) throws CalEnvException { | public static boolean getBoolProperty(String name) throws CalEnvException { String val = getProperty(name); val = val.toLowerCase(); return "true".equals(val) || "yes".equals(val); } |
public static boolean getGlobalBoolProperty(String name) throws CalEnvException { | public boolean getGlobalBoolProperty(String name) throws CalEnvException { | public static boolean getGlobalBoolProperty(String name) throws CalEnvException { return getBoolProperty(globalPrefix + name); } |
public static int getGlobalIntProperty(String name) throws CalEnvException { | public int getGlobalIntProperty(String name) throws CalEnvException { | public static int getGlobalIntProperty(String name) throws CalEnvException { return getIntProperty(globalPrefix + name); } |
public static Object getGlobalObject(String name, Class cl) throws CalEnvException { | public Object getGlobalObject(String name, Class cl) throws CalEnvException { | public static Object getGlobalObject(String name, Class cl) throws CalEnvException { try { String className = getGlobalProperty(name); Object o = Class.forName(className).newInstance(); if (o == null) { throw new CalEnvException("Class " + className + " not found"); } if (!cl.isInstance(o)) { throw new CalEnvException("Class " + className + " is not a subclass of " + cl.getName()); } return o; } catch (CalEnvException ce) { throw ce; } catch (Throwable t) { throw new CalEnvException(t); } } |
public static String getGlobalProperty(String name) throws CalEnvException { | public String getGlobalProperty(String name) throws CalEnvException { | public static String getGlobalProperty(String name) throws CalEnvException { return getProperty(globalPrefix + name); } |
public static int getIntProperty(String name) throws CalEnvException { | public int getIntProperty(String name) throws CalEnvException { | public static int getIntProperty(String name) throws CalEnvException { String val = getProperty(name); try { return Integer.valueOf(val).intValue(); } catch (Throwable t) { throw new CalEnvException("Invalid property " + name + " = " + val); } } |
public static String getOptProperty(String name) throws CalEnvException { | public String getOptProperty(String name) throws CalEnvException { | public static String getOptProperty(String name) throws CalEnvException { String val = getPr().getProperty(name); return val; } |
public static Properties getProperties() throws CalEnvException { | public Properties getProperties() throws CalEnvException { | public static Properties getProperties() throws CalEnvException { return getPr(); } |
public static String getProperty(String name) throws CalEnvException { | public String getProperty(String name) throws CalEnvException { | public static String getProperty(String name) throws CalEnvException { String val = getPr().getProperty(name); if (val == null) { throw new CalEnvException("Missing property " + name); } return val; } |
addExecutedSQLQueries(executedSQLStatements); | if("true".equals(getBundle(iwc).getProperty(ADD_QUERY_SQL_FOR_DEBUG,"false"))){ addExecutedSQLQueries(executedSQLStatements); } | private void getSingleQueryView(IWBundle bundle, IWResourceBundle resourceBundle, String action, IWContext iwc) throws RemoteException { String errorMessage = null; QueryService queryService = getQueryService(); int currentQueryId = ((Integer) parameterMap.get(CURRENT_QUERY_ID)).intValue(); QueryHelper queryHelper = queryService.getQueryHelper(currentQueryId); QueryToSQLBridge bridge = getQueryToSQLBridge(); SQLQuery query = null; try { query = bridge.createQuerySQL(queryHelper, iwc); } catch (QueryGenerationException ex) { String message = "[ReportOverview]: Can't generate query."; System.err.println(message + " Message is: " + ex.getMessage()); ex.printStackTrace(System.err); errorMessage = resourceBundle.getLocalizedString("ro_query_could not_be_created", "Query could not be created"); } // execute query if the query was successfully created if (errorMessage == null) { // // query is dynamic // if (query.isDynamic()) { Map identifierValueMap = query.getIdentifierValueMap(); Map identifierInputDescriptionMap = query.getIdentifierInputDescriptionMap(); boolean calculateAccess = false; boolean containsOnlyAccessVariable = ( (calculateAccess = identifierValueMap.containsKey(USER_ACCESS_VARIABLE)) || (calculateAccess = identifierValueMap.containsKey(GROUP_ACCESS_VARIABLE))) && (identifierValueMap.size() == 1); if (SHOW_SINGLE_QUERY_CHECK_IF_DYNAMIC.equals(action) && ! containsOnlyAccessVariable) { // show input fields showInputFields(query, identifierValueMap, identifierInputDescriptionMap, resourceBundle, iwc); } else { // get the values of the input fields Map modifiedValues = getModifiedIdentiferValueMapByParsingRequest(identifierValueMap, identifierInputDescriptionMap, iwc); if (calculateAccess) { setAccessCondition(modifiedValues, iwc); } query.setIdentifierValueMap(modifiedValues); // show result of query List executedSQLStatements = new ArrayList(); boolean isOkay = executeQueries(query, bridge, executedSQLStatements); addExecutedSQLQueries(executedSQLStatements); if (! isOkay) { errorMessage = resourceBundle.getLocalizedString("ro_result_of_query_is_empty", "Result of query is empty"); } // show again the input fields if (errorMessage != null) { addErrorMessage(errorMessage); } if ( ! containsOnlyAccessVariable) { showInputFields(query, modifiedValues, identifierInputDescriptionMap, resourceBundle, iwc); } else { getListOfQueries(bundle, resourceBundle, iwc); } } // // good bye - query is dynamic // return; } // // query is not dynamic // else { List executedSQLStatements = new ArrayList(); boolean isOkay = executeQueries(query, bridge, executedSQLStatements); addExecutedSQLQueries(executedSQLStatements); if (! isOkay) { errorMessage = resourceBundle.getLocalizedString("ro_result_of_query_is_empty", "Result of query is empty"); } } } // show list if query is not dynamic and if an error occurred if (errorMessage != null) { addErrorMessage(errorMessage); } getListOfQueries(bundle, resourceBundle, iwc); } |
Enumeration en = getNsIntf().getProperties(node); | Iterator it = getNsIntf().iterateProperties(node); | private void doNodeNsProperties(WebdavNsNode node) throws WebdavException { Enumeration en = getNsIntf().getProperties(node); WebdavNsIntf intf = getNsIntf(); while (en.hasMoreElements()) { WebdavProperty prop = (WebdavProperty)en.nextElement(); intf.generatePropValue(node, prop); } } |
while (en.hasMoreElements()) { WebdavProperty prop = (WebdavProperty)en.nextElement(); | while (it.hasNext()) { WebdavProperty prop = (WebdavProperty)it.next(); | private void doNodeNsProperties(WebdavNsNode node) throws WebdavException { Enumeration en = getNsIntf().getProperties(node); WebdavNsIntf intf = getNsIntf(); while (en.hasMoreElements()) { WebdavProperty prop = (WebdavProperty)en.nextElement(); intf.generatePropValue(node, prop); } } |
WebdavProperty prop = new WebdavProperty( new QName(propnode.getNamespaceURI(), propnode.getLocalName()), null); | WebdavProperty prop = makeProp(propnode); | public PropRequest parseProps(Node nd) throws WebdavException { PropRequest pr = new PropRequest(PropRequest.reqProp); pr.props = new ArrayList(); Element[] children = getChildren(nd); for (int i = 0; i < children.length; i++) { Element propnode = children[i]; WebdavProperty prop = new WebdavProperty( new QName(propnode.getNamespaceURI(), propnode.getLocalName()), null); if (debug) { trace("prop: " + prop.getTag()); } addNs(prop.getTag().getNamespaceURI()); pr.props.add(prop); } return pr; } |
calendars.addNewCalendars(); | calendars.addNewCalendars(user); | public void addUser(BwUser user) throws CalFacadeException { addNewUser(user); calendars.addNewCalendars(); } |
calendars.addNewCalendars(); | calendars.addNewCalendars(authUser); | public boolean init(String authenticatedUser, String user, boolean publicAdmin, boolean superUser, Groups groups, String synchId, boolean debug) throws CalFacadeException { this.debug = debug; boolean userCreated = false; if (authenticatedUser == null) { this.superUser = false; // be safe } BwUser authUser; try { access = new AccessUtil(superUser, debug); objTimestamp = new Timestamp(System.currentTimeMillis()); this.superUser = superUser; this.synchId = synchId; log = Logger.getLogger(getClass()); if ((synchId != null) && publicAdmin) { throw new CalFacadeException("synch only valid for non admin"); } } catch (Throwable t) { throw new CalFacadeException(t); } if (user == null) { user = authenticatedUser; } ignoreCreator = false; if (authenticatedUser == null) { // Unauthenticated use // Ensure no guest mods// this.readOnly = true; currentMode = CalintfUtil.guestMode; authUser = new BwUser(); this.user = getUser(user); } else {// this.readOnly = false; authUser = getUser(authenticatedUser); if (authUser == null) { /* Add the user to the database. Presumably this is first logon */ getLogger().info("Add new user " + authenticatedUser); addNewUser(new BwUser(authenticatedUser)); authUser = getUser(authenticatedUser); userCreated = true; } if (!publicAdmin) { currentMode = CalintfUtil.userMode; } else { currentMode = CalintfUtil.publicAdminMode; } logon(authUser); getLogger().info("Authenticated user " + authenticatedUser + " logged on"); ignoreCreator = superUser; if (authenticatedUser.equals(user)) { this.user = authUser; } else { this.user = getUser(user); if (this.user == null) { throw new CalFacadeException("User " + user + " does not exist."); } } } authUser.setGroups(groups.getAllGroups(authUser)); access.setAuthUser(authUser); events = new Events(this, access, this.user, debug); calendars = new Calendars(this, access, this.user, debug); categories = new EventProperties(this, access, this.user, "word", BwCategory.class.getName(), "getCategoryRefs", -1, debug); locations = new EventProperties(this, access, this.user, "address", BwLocation.class.getName(), "getLocationRefs", CalFacadeDefs.maxReservedLocationId, debug); sponsors = new EventProperties(this, access, this.user, "name", BwSponsor.class.getName(), "getSponsorRefs", CalFacadeDefs.maxReservedSponsorId, debug); timezones = new CalTimezonesImpl(this, getStats(), publicAdmin, debug); timezones.setDefaultTimeZoneId(getSyspars().getTzid()); if (userCreated) { calendars.addNewCalendars(); } return userCreated; } |
if (MethodBase.nodeMatches(curnode, CaldavTags.isDefined)) { | if (MethodBase.nodeMatches(curnode, CaldavTags.isNotDefined)) { | private CompFilter parseCompFilter(Node nd) throws WebdavException { String name = getOnlyAttrVal(nd, "name"); if (name == null) { throw new WebdavBadRequest(); } CompFilter cf = new CompFilter(name); Element[] children = getChildren(nd); try { for (int i = 0; i < children.length; i++) { Node curnode = children[i]; if (debug) { trace("compFilter element: " + curnode.getNamespaceURI() + " " + curnode.getLocalName()); } if (MethodBase.nodeMatches(curnode, CaldavTags.isDefined)) { if (cf.getTimeRange() != null) { throw new WebdavBadRequest(); } cf.setIsDefined(true); } else if (MethodBase.nodeMatches(curnode, CaldavTags.timeRange)) { if (cf.getIsDefined()) { throw new WebdavBadRequest(); } cf.setTimeRange(CalDavParseUtil.parseTimeRange(curnode, intf.getSvci().getTimezones())); if (cf.getTimeRange() == null) { return null; } } else if (MethodBase.nodeMatches(curnode, CaldavTags.compFilter)) { CompFilter chcf = parseCompFilter(curnode); if (chcf == null) { return null; } cf.addCompFilter(chcf); } else if (MethodBase.nodeMatches(curnode, CaldavTags.propFilter)) { PropFilter chpf = parsePropFilter(curnode); if (chpf == null) { return null; } cf.addPropFilter(chpf); } else { throw new WebdavBadRequest(); } } } catch (WebdavBadRequest wbr) { throw wbr; } catch (Throwable t) { throw new WebdavBadRequest(); } return cf; } |
cf.setIsDefined(true); | cf.setIsNotDefined(true); | private CompFilter parseCompFilter(Node nd) throws WebdavException { String name = getOnlyAttrVal(nd, "name"); if (name == null) { throw new WebdavBadRequest(); } CompFilter cf = new CompFilter(name); Element[] children = getChildren(nd); try { for (int i = 0; i < children.length; i++) { Node curnode = children[i]; if (debug) { trace("compFilter element: " + curnode.getNamespaceURI() + " " + curnode.getLocalName()); } if (MethodBase.nodeMatches(curnode, CaldavTags.isDefined)) { if (cf.getTimeRange() != null) { throw new WebdavBadRequest(); } cf.setIsDefined(true); } else if (MethodBase.nodeMatches(curnode, CaldavTags.timeRange)) { if (cf.getIsDefined()) { throw new WebdavBadRequest(); } cf.setTimeRange(CalDavParseUtil.parseTimeRange(curnode, intf.getSvci().getTimezones())); if (cf.getTimeRange() == null) { return null; } } else if (MethodBase.nodeMatches(curnode, CaldavTags.compFilter)) { CompFilter chcf = parseCompFilter(curnode); if (chcf == null) { return null; } cf.addCompFilter(chcf); } else if (MethodBase.nodeMatches(curnode, CaldavTags.propFilter)) { PropFilter chpf = parsePropFilter(curnode); if (chpf == null) { return null; } cf.addPropFilter(chpf); } else { throw new WebdavBadRequest(); } } } catch (WebdavBadRequest wbr) { throw wbr; } catch (Throwable t) { throw new WebdavBadRequest(); } return cf; } |
if (cf.getIsDefined()) { | if (cf.getIsNotDefined()) { | private CompFilter parseCompFilter(Node nd) throws WebdavException { String name = getOnlyAttrVal(nd, "name"); if (name == null) { throw new WebdavBadRequest(); } CompFilter cf = new CompFilter(name); Element[] children = getChildren(nd); try { for (int i = 0; i < children.length; i++) { Node curnode = children[i]; if (debug) { trace("compFilter element: " + curnode.getNamespaceURI() + " " + curnode.getLocalName()); } if (MethodBase.nodeMatches(curnode, CaldavTags.isDefined)) { if (cf.getTimeRange() != null) { throw new WebdavBadRequest(); } cf.setIsDefined(true); } else if (MethodBase.nodeMatches(curnode, CaldavTags.timeRange)) { if (cf.getIsDefined()) { throw new WebdavBadRequest(); } cf.setTimeRange(CalDavParseUtil.parseTimeRange(curnode, intf.getSvci().getTimezones())); if (cf.getTimeRange() == null) { return null; } } else if (MethodBase.nodeMatches(curnode, CaldavTags.compFilter)) { CompFilter chcf = parseCompFilter(curnode); if (chcf == null) { return null; } cf.addCompFilter(chcf); } else if (MethodBase.nodeMatches(curnode, CaldavTags.propFilter)) { PropFilter chpf = parsePropFilter(curnode); if (chpf == null) { return null; } cf.addPropFilter(chpf); } else { throw new WebdavBadRequest(); } } } catch (WebdavBadRequest wbr) { throw wbr; } catch (Throwable t) { throw new WebdavBadRequest(); } return cf; } |
if (MethodBase.nodeMatches(child, CaldavTags.isDefined)) { | if (MethodBase.nodeMatches(child, CaldavTags.isNotDefined)) { | private ParamFilter parseParamFilter(Node nd) throws WebdavException { String name = getOnlyAttrVal(nd, "name"); if (name == null) { status = HttpServletResponse.SC_BAD_REQUEST; return null; } // Only one child - either is-defined | text-match Element child = getOnlyChild(nd); if (debug) { trace("paramFilter element: " + child.getNamespaceURI() + " " + child.getLocalName()); } if (MethodBase.nodeMatches(child, CaldavTags.isDefined)) { return new ParamFilter(name, true); } if (MethodBase.nodeMatches(child, CaldavTags.textMatch)) { TextMatch match = parseTextMatch(child); if (match == null) { return null; } return new ParamFilter(name, match); } status = HttpServletResponse.SC_BAD_REQUEST; return null; } |
if (MethodBase.nodeMatches(curnode, CaldavTags.isDefined)) { pf.setIsDefined(true); | if (MethodBase.nodeMatches(curnode, CaldavTags.isNotDefined)) { pf.setIsNotDefined(true); | private PropFilter parsePropFilter(Node nd) throws WebdavException { String name = getOnlyAttrVal(nd, "name"); if (name == null) { status = HttpServletResponse.SC_BAD_REQUEST; return null; } PropFilter pf = new PropFilter(name); Element[] children = getChildren(nd); boolean idTrTm = false; // flag is-defined | time-range | text-match try { for (int i = 0; i < children.length; i++) { Node curnode = children[i]; if (debug) { trace("propFilter element: " + curnode.getNamespaceURI() + " " + curnode.getLocalName()); } if (idTrTm) { // Only have param-filter* if (MethodBase.nodeMatches(curnode, CaldavTags.paramFilter)) { ParamFilter parf = parseParamFilter(curnode); if (parf == null) { return null; } pf.addParamFilter(parf); } else { status = HttpServletResponse.SC_BAD_REQUEST; return null; } } else { idTrTm = true; // one of is-defined | time-range | text-match if (MethodBase.nodeMatches(curnode, CaldavTags.isDefined)) { pf.setIsDefined(true); } else if (MethodBase.nodeMatches(curnode, CaldavTags.timeRange)) { pf.setTimeRange(CalDavParseUtil.parseTimeRange(curnode, intf.getSvci().getTimezones())); } else if (MethodBase.nodeMatches(curnode, CaldavTags.textMatch)) { pf.setMatch(parseTextMatch(curnode)); if (pf.getMatch() == null) { return null; } } else { // Effectively is-defined pf.setIsDefined(true);// status = HttpServletResponse.SC_BAD_REQUEST;// return null; } } } } catch (WebdavException we) { throw we; } catch (Throwable t) { throw new WebdavException(t); } return pf; } |
pf.setIsDefined(true); | private PropFilter parsePropFilter(Node nd) throws WebdavException { String name = getOnlyAttrVal(nd, "name"); if (name == null) { status = HttpServletResponse.SC_BAD_REQUEST; return null; } PropFilter pf = new PropFilter(name); Element[] children = getChildren(nd); boolean idTrTm = false; // flag is-defined | time-range | text-match try { for (int i = 0; i < children.length; i++) { Node curnode = children[i]; if (debug) { trace("propFilter element: " + curnode.getNamespaceURI() + " " + curnode.getLocalName()); } if (idTrTm) { // Only have param-filter* if (MethodBase.nodeMatches(curnode, CaldavTags.paramFilter)) { ParamFilter parf = parseParamFilter(curnode); if (parf == null) { return null; } pf.addParamFilter(parf); } else { status = HttpServletResponse.SC_BAD_REQUEST; return null; } } else { idTrTm = true; // one of is-defined | time-range | text-match if (MethodBase.nodeMatches(curnode, CaldavTags.isDefined)) { pf.setIsDefined(true); } else if (MethodBase.nodeMatches(curnode, CaldavTags.timeRange)) { pf.setTimeRange(CalDavParseUtil.parseTimeRange(curnode, intf.getSvci().getTimezones())); } else if (MethodBase.nodeMatches(curnode, CaldavTags.textMatch)) { pf.setMatch(parseTextMatch(curnode)); if (pf.getMatch() == null) { return null; } } else { // Effectively is-defined pf.setIsDefined(true);// status = HttpServletResponse.SC_BAD_REQUEST;// return null; } } } } catch (WebdavException we) { throw we; } catch (Throwable t) { throw new WebdavException(t); } return pf; } |
|
d.addRule("caldata/*/owner-key", new OwnerRule(globals)); d.addRule("caldata/*/owner-key/*", new OwnerFieldRule(globals)); | public void addRuleInstances(Digester d) { d.addRule("caldata/syspars/system", new SysparsRule(globals)); d.addRule("caldata/syspars/system/*", new SysparsFieldRule(globals)); UserFieldRule ufr = new UserFieldRule(globals); d.addRule("caldata/users/user", new UserRule(globals)); d.addRule("caldata/users/user/*", ufr); d.addRule("caldata/timezones/timezone", new TimeZoneRule(globals)); d.addRule("caldata/timezones/timezone/*", new TimeZoneFieldRule(globals)); d.addRule("caldata/calendars/calendar", new CalendarRule(globals)); d.addRule("caldata/calendars/calendar/*", new CalendarFieldRule(globals)); d.addRule("caldata/locations/location", new LocationRule(globals)); d.addRule("caldata/locations/location/*", new LocationFieldRule(globals)); d.addRule("caldata/sponsors/sponsor", new SponsorRule(globals)); d.addRule("caldata/sponsors/sponsor/*", new SponsorFieldRule(globals)); d.addRule("caldata/organizers/organizer", new OrganizerRule(globals)); d.addRule("caldata/organizers/organizer/*", new OrganizerFieldRule(globals)); d.addRule("caldata/attendees/attendee", new AttendeeRule(globals)); d.addRule("caldata/attendees/attendee/*", new AttendeeFieldRule(globals)); /* 2.3.2 d.addRule("caldata/dblastmods/dblastmod", new DbLastmodRule(globals)); d.addRule("caldata/dblastmods/dblastmod/*", new DbLastmodFieldRule(globals)); */ d.addRule("caldata/eventRefs/eventRef", new EventRefRule(globals)); d.addRule("caldata/eventRefs/eventRef/*", new EventRefFieldRule(globals)); /* 2.3.2 */ KeywordFieldRule kfr = new KeywordFieldRule(globals); d.addRule("caldata/keywords/keyword", new KeywordRule(globals)); d.addRule("caldata/keywords/keyword/*", kfr); CategoryFieldRule catfr = new CategoryFieldRule(globals); d.addRule("caldata/categories/category", new CategoryRule(globals)); d.addRule("caldata/categories/category/*", catfr); AdminGroupFieldRule agfr = new AdminGroupFieldRule(globals); d.addRule("caldata/adminGroups/adminGroup", new AdminGroupRule(globals)); d.addRule("caldata/adminGroups/adminGroup/*", agfr); AuthUserFieldRule aufr = new AuthUserFieldRule(globals); d.addRule("caldata/authusers/authuser", new AuthUserRule(globals)); d.addRule("caldata/authusers/authuser/*", aufr); UserPrefsFieldRule upfr = new UserPrefsFieldRule(globals); d.addRule("caldata/user-preferences/user-prefs", new UserPrefsRule(globals)); d.addRule("caldata/user-preferences/user-prefs/*", upfr); EventFieldRule efr = new EventFieldRule(globals); d.addRule("caldata/events/event", new EventRule(globals)); d.addRule("caldata/events/event/*", efr); d.addRule("caldata/event-annotations/event-annotation", new EventRule(globals)); d.addRule("caldata/event-annotations/event-annotation/*", efr); AlarmRule alr = new AlarmRule(globals); AlarmFieldRule alfr = new AlarmFieldRule(globals); d.addRule("caldata/alarms/event-alarm", alr); d.addRule("caldata/alarms/event-alarm/*", alfr); d.addRule("caldata/alarms/todo-alarm", alr); d.addRule("caldata/alarms/todo-alarm/*", alfr); FilterRule fr = new FilterRule(globals); d.addRule("caldata/filters/aliasFilter", fr); d.addRule("caldata/filters/andFilter", fr); d.addRule("caldata/filters/creatorFilter", fr); d.addRule("caldata/filters/keyFilter", fr); d.addRule("caldata/filters/locationFilter", fr); d.addRule("caldata/filters/notFilter", fr); d.addRule("caldata/filters/orFilter", fr); d.addRule("caldata/filters/sponsorFilter", fr); d.addRule("caldata/filters/*", new FilterFieldRule(globals)); d.addRule("caldata/filters", new FiltersRule(globals)); } |
|
if (selected == null || selected.length == 0) { return; } | public void shiftSelectedDown() { int[] selected = table.getSelectedRows(); for (int i = selected.length - 1; i >= 0; i--) { model.swap(selected[i], selected[i]+1); } int first = selected[0] + 1; int last = selected[selected.length - 1] + 1; try { table.setRowSelectionInterval(first, last); } catch (Exception exc) { } } |
|
if (selected == null || selected.length == 0) { return; } | public void shiftSelectedUp() { int[] selected = table.getSelectedRows(); for (int i = 0; i < selected.length; i++) { model.swap(selected[i]-1, selected[i]); } int first = selected[0] - 1; int last = selected[selected.length - 1] - 1; try { table.setRowSelectionInterval(first, last); } catch (Exception exc) { } } |
|
if (seis.getEndTime().subtract(seis.getBeginTime()).lessThan(delay) || nsta > ntdly) { | if (seis.getEndTime().subtract(seis.getBeginTime()).lessThan(delay) || nsta > ntdly || ntdly > seis.getNumPoints()) { | 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; if (seis.getEndTime().subtract(seis.getBeginTime()).lessThan(delay) || nsta > ntdly) { // seis is too short, so no trigger possible System.out.println("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[nlta-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; ylta = clta*Math.abs(seisData[i] - xmean/nmean) + (1-clta)*prevylta; // STA value calculated as per REFTEK algorithm prevysta = ysta; ysta = csta*Math.abs(seisData[i] - xmean/nmean) + (1-csta)*prevysta; // rat is STA/LTA at each time point float ratio; if (ylta != 0) { ratio=ysta/ylta; } else { // in this case, declare a trigger if ysta != 0, otherwise not if (ysta != 0) { ratio = threshold; } else { ratio = 0; } } System.out.println("i="+i+" xmean="+xmean+" nmean="+nmean+" ylta="+ylta+" ysta="+ysta+" ratio="+ratio); if (ratio >= threshold) { LongShortTrigger trigger = new LongShortTrigger(seis, i, ratio); out.add(trigger); } } LongShortTrigger[] trigger = (LongShortTrigger[])out.toArray(new LongShortTrigger[0]); return trigger; } |
System.out.println("seis is too short, so no trigger possible"); | 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; if (seis.getEndTime().subtract(seis.getBeginTime()).lessThan(delay) || nsta > ntdly) { // seis is too short, so no trigger possible System.out.println("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[nlta-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; ylta = clta*Math.abs(seisData[i] - xmean/nmean) + (1-clta)*prevylta; // STA value calculated as per REFTEK algorithm prevysta = ysta; ysta = csta*Math.abs(seisData[i] - xmean/nmean) + (1-csta)*prevysta; // rat is STA/LTA at each time point float ratio; if (ylta != 0) { ratio=ysta/ylta; } else { // in this case, declare a trigger if ysta != 0, otherwise not if (ysta != 0) { ratio = threshold; } else { ratio = 0; } } System.out.println("i="+i+" xmean="+xmean+" nmean="+nmean+" ylta="+ylta+" ysta="+ysta+" ratio="+ratio); if (ratio >= threshold) { LongShortTrigger trigger = new LongShortTrigger(seis, i, ratio); out.add(trigger); } } LongShortTrigger[] trigger = (LongShortTrigger[])out.toArray(new LongShortTrigger[0]); return trigger; } |
|
xmean += seisData[nlta-nmean-1]; | xmean += seisData[ntdly-nmean-1]; | 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; if (seis.getEndTime().subtract(seis.getBeginTime()).lessThan(delay) || nsta > ntdly) { // seis is too short, so no trigger possible System.out.println("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[nlta-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; ylta = clta*Math.abs(seisData[i] - xmean/nmean) + (1-clta)*prevylta; // STA value calculated as per REFTEK algorithm prevysta = ysta; ysta = csta*Math.abs(seisData[i] - xmean/nmean) + (1-csta)*prevysta; // rat is STA/LTA at each time point float ratio; if (ylta != 0) { ratio=ysta/ylta; } else { // in this case, declare a trigger if ysta != 0, otherwise not if (ysta != 0) { ratio = threshold; } else { ratio = 0; } } System.out.println("i="+i+" xmean="+xmean+" nmean="+nmean+" ylta="+ylta+" ysta="+ysta+" ratio="+ratio); if (ratio >= threshold) { LongShortTrigger trigger = new LongShortTrigger(seis, i, ratio); out.add(trigger); } } LongShortTrigger[] trigger = (LongShortTrigger[])out.toArray(new LongShortTrigger[0]); return trigger; } |
System.out.println("i="+i+" xmean="+xmean+" nmean="+nmean+" ylta="+ylta+" ysta="+ysta+" ratio="+ratio); | 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; if (seis.getEndTime().subtract(seis.getBeginTime()).lessThan(delay) || nsta > ntdly) { // seis is too short, so no trigger possible System.out.println("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[nlta-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; ylta = clta*Math.abs(seisData[i] - xmean/nmean) + (1-clta)*prevylta; // STA value calculated as per REFTEK algorithm prevysta = ysta; ysta = csta*Math.abs(seisData[i] - xmean/nmean) + (1-csta)*prevysta; // rat is STA/LTA at each time point float ratio; if (ylta != 0) { ratio=ysta/ylta; } else { // in this case, declare a trigger if ysta != 0, otherwise not if (ysta != 0) { ratio = threshold; } else { ratio = 0; } } System.out.println("i="+i+" xmean="+xmean+" nmean="+nmean+" ylta="+ylta+" ysta="+ysta+" ratio="+ratio); if (ratio >= threshold) { LongShortTrigger trigger = new LongShortTrigger(seis, i, ratio); out.add(trigger); } } LongShortTrigger[] trigger = (LongShortTrigger[])out.toArray(new LongShortTrigger[0]); return trigger; } |
|
assertEquals("stat["+i+"]", n*(n+1)*(2*n+1)/6, (int)stat[i].binaryIndexSum(0, stat[i].getLength())); | double sumSquare = 1.0*n*(n+1)*(2*n+1)/6; assertEquals("stat["+i+"]", sumSquare, stat[i].binaryIndexSum(0, stat[i].getLength()), 0.00001*sumSquare); | public void testBinaryIndexSum() throws Exception { // JUnitDoclet begin method binaryIndexSum for ( int i = 0; i<stat.length; i++) { int n=stat[i].getLength()-1; assertEquals("stat["+i+"]", n*(n+1)*(2*n+1)/6, (int)stat[i].binaryIndexSum(0, stat[i].getLength())); } // end of for () // JUnitDoclet end method binaryIndexSum } |
double out = stat[i].binarySum(0, intTestData.length); | double out = stat[i].binarySum(0, stat[i].getLength()); | public void testBinarySum() throws Exception { for ( int i = 0; i<stat.length; i++) { int n=stat[i].getLength()-1; double out = stat[i].binarySum(0, intTestData.length); assertEquals("BinarySum", n*(n+1)/2, out, 0.0000001); } // end of for () } |
Subsets and Splits
No saved queries yet
Save your SQL queries to embed, download, and access them later. Queries will appear here once saved.