bugged
stringlengths 6
599k
| fixed
stringlengths 10
599k
| __index_level_0__
int64 0
1.13M
|
|---|---|---|
public void add(DataSetSeismogram[] seismos){ for(int i = 0; i < seismos.length; i++){ ampData.put(seismos[i], new AmpConfigData(seismos[i], new UnitRangeImpl(-1, 1, edu.iris.Fissures.model.UnitImpl.COUNT), null, shift, scale)); seismos[i].addSeisDataChangeListener(this); seismos[i].retrieveData(this); } }
|
public void add(DataSetSeismogram[] seismos){ for(int i = 0; i < seismos.length; i++){ ampData.put(seismos[i], new AmpConfigData(seismos[i], new UnitRangeImpl(-1, 1, edu.iris.Fissures.model.UnitImpl.COUNT), null, shift, scale)); seismos[i].addSeisDataChangeListener(this); seismos[i].retrieveData(this); } }
| 1,118,576
|
private boolean setAmpRange(DataSetSeismogram seismo){ AmpConfigData data = (AmpConfigData)ampData.get(seismo); if ( data.getSeismograms().length == 0) { return data.setCleanRange(DisplayUtils.ZERO_RANGE); } // end of if () LocalSeismogramImpl seismogram = (LocalSeismogramImpl)data.getSeismograms()[0]; int[] seisIndex = DisplayUtils.getSeisPoints(seismogram, data.getTime()); if(seisIndex[1] < 0 || seisIndex[0] >= seismogram.getNumPoints()) { //no data points in window, set range to 0 data.setCalcIndex(seisIndex); return data.setCleanRange(DisplayUtils.ZERO_RANGE); } if(seisIndex[0] < 0){ seisIndex[0] = 0; } if(seisIndex[1] >= seismogram.getNumPoints()){ seisIndex[1] = seismogram.getNumPoints() -1; } double[] minMax = data.getStatistics(seismogram).minMaxMean(seisIndex[0], seisIndex[1]); data.setCalcIndex(seisIndex); return data.setCleanRange(new UnitRangeImpl(minMax[0], minMax[1], UnitImpl.COUNT)); }
|
private boolean setAmpRange(DataSetSeismogram seismo){ AmpConfigData data = (AmpConfigData)ampData.get(seismo); if ( data.getSeismograms().length == 0) { return data.setCleanRange(DisplayUtils.ZERO_RANGE); } // end of if () LocalSeismogramImpl seismogram = (LocalSeismogramImpl)data.getSeismograms()[0]; int[] seisIndex = DisplayUtils.getSeisPoints(seismogram, data.getTime()); if(seisIndex[1] < 0 || seisIndex[0] >= seismogram.getNumPoints()) { //no data points in window, set range to 0 data.setCalcIndex(seisIndex); return data.setCleanRange(DisplayUtils.ZERO_RANGE); } if(seisIndex[0] < 0){ seisIndex[0] = 0; } if(seisIndex[1] >= seismogram.getNumPoints()){ seisIndex[1] = seismogram.getNumPoints() -1; } double[] minMax = data.getStatistics(seismogram).minMaxMean(seisIndex[0], seisIndex[1]); data.setCalcIndex(seisIndex); return data.setCleanRange(new UnitRangeImpl(minMax[0], minMax[1], UnitImpl.COUNT)); }
| 1,118,577
|
public Set entrySet() { Set result = new HashSet(); Set keys = internal_.keySet(); for (Iterator iter = keys.iterator(); iter.hasNext();) { Object key = iter.next(); Set values = (Set)get(key); for (Iterator iterator = values.iterator(); iterator.hasNext();) { Object value = iterator.next(); result.add(new Entry(key, value)); } } return null; }
|
public Set entrySet() { Set result = new HashSet(); Set keys = internal_.keySet(); for (Iterator iter = keys.iterator(); iter.hasNext();) { Object key = iter.next(); Set values = (Set)get(key); for (Iterator iterator = values.iterator(); iterator.hasNext();) { Object value = iterator.next(); result.add(new Entry(key, value)); } } return result; }
| 1,118,578
|
public Chronology getChronology(Object object, Chronology chrono) { if (chrono == null) { return ISOChronology.getInstance(); } return chrono; }
|
public Chronology getChronology(Object object, Chronology chrono) { if (chrono == null) { return ISOChronology.getInstance(); } return chrono; }
| 1,118,579
|
public void addDisplay(LocalSeismogram seis){ if(basicDisplays.size() > 0) this.addDisplay((LocalSeismogramImpl)seis,((SeismogramDisplay)basicDisplays.getFirst()).getTimeConfig(), ((SeismogramDisplay)basicDisplays.getFirst()).getAmpConfig()); else this.addDisplay((LocalSeismogramImpl)seis, new BoundedTimeConfig(), new RMeanAmpConfig()); }
|
public void addDisplay(LocalSeismogram seis){ if(basicDisplays.size() > 0) this.addDisplay((LocalSeismogramImpl)seis,((SeismogramDisplay)basicDisplays.getFirst()).getTimeConfig(), ((SeismogramDisplay)basicDisplays.getFirst()).getAmpConfig()); else this.addDisplay((LocalSeismogramImpl)seis, new BoundedTimeConfig(), new RMeanAmpConfig()); }
| 1,118,580
|
public void removeSeismogram(MouseEvent me){ if(basicDisplays.size() == 1){ this.removeAll(); return; } BasicSeismogramDisplay clicked = ((BasicSeismogramDisplay)me.getComponent()); seismograms.remove(clicked); basicDisplays.remove(clicked); ((SeismogramDisplay)basicDisplays.getFirst()).addTopTimeBorder(); this.redraw(); seismograms.revalidate(); }
|
public void removeSeismogram(MouseEvent me){ if(basicDisplays.size() == 1){ this.removeAll(); return; } BasicSeismogramDisplay clicked = ((BasicSeismogramDisplay)me.getComponent()); seismograms.remove(clicked); basicDisplays.remove(clicked); ((SeismogramDisplay)basicDisplays.getFirst()).addTopTimeBorder(); this.redraw(); seismograms.revalidate(); }
| 1,118,582
|
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } BwCalendar cal = form.getCalendar(); int delResult = form.getCalSvcI().deleteCalendar(cal); if (delResult == 2) { form.getMsg().emit("org.bedework.client.message.calendar.referenced"); return "inUse"; } if (delResult == 1) { form.getErr().emit("org.bedework.client.error.nosuchcalendar", cal.getId()); return "notFound"; } form.getMsg().emit("org.bedework.client.message.calendar.deleted"); return "continue"; }
|
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { if (form.getGuest()) { return "noAccess"; // First line of defence } BwCalendar cal = form.getCalendar(); int delResult = form.getCalSvcI().deleteCalendar(cal); if (delResult == 2) { form.getErr().emit("org.bedework.client.error.calendar.referenced"); return "inUse"; } if (delResult == 1) { form.getErr().emit("org.bedework.client.error.nosuchcalendar", cal.getId()); return "notFound"; } form.getMsg().emit("org.bedework.client.message.calendar.deleted"); return "continue"; }
| 1,118,584
|
protected static int[][] scaleXvalues(LocalSeismogram seismogram, MicroSecondTimeRange timeRange, UnitRangeImpl ampRange, Dimension size) throws UnsupportedDataEncoding { LocalSeismogramImpl seis = (LocalSeismogramImpl)seismogram; int[][] out = new int[2][]; int seisIndex = 0; int pixelIndex = 0; int numAdded = 0; if ( seis.getEndTime().before(timeRange.getBeginTime()) || seis.getBeginTime().after(timeRange.getEndTime()) ) { out[0] = new int[0]; out[1] = new int[0]; logger.info("The end time is before the beginTime in simple seismogram"); return out; } MicroSecondDate tMin = timeRange.getBeginTime(); MicroSecondDate tMax = timeRange.getEndTime(); double yMin = ampRange.getMinValue(); double yMax = ampRange.getMaxValue(); int seisStartIndex = getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), tMin); int seisEndIndex = getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), tMax); if (seisStartIndex < 0) { seisStartIndex = 0; } if (seisEndIndex >= seis.getNumPoints()) { seisEndIndex = seis.getNumPoints()-1; } MicroSecondDate tempdate = getValue(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), seisStartIndex); int pixelStartIndex = getPixel(size.width, tMin, tMax, tempdate); tempdate = getValue(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), seisEndIndex); int pixelEndIndex = getPixel(size.width, tMin, tMax, tempdate); int pixels = size.width; out[0] = new int[2*pixels]; out[1] = new int[out[0].length]; int tempYvalues[] = new int [out[0].length]; seisIndex = seisStartIndex; numAdded = 0; int xvalue = 0; int tempValue = 0; xvalue = Math.round((float)(linearInterp(seisStartIndex, pixelStartIndex, seisEndIndex, pixelEndIndex, seisIndex))); seisIndex++; int j; j = 0; while (seisIndex <= seisEndIndex) { tempValue = Math.round((float)(linearInterp(seisStartIndex, pixelStartIndex, seisEndIndex, pixelEndIndex, seisIndex))); tempYvalues[j++] = (int)seis.getValueAt(seisIndex).getValue(); if(tempValue != xvalue) { out[0][numAdded] = xvalue; out[0][numAdded+1] = xvalue; out[1][numAdded] = getMinValue(tempYvalues, 0, j-1); out[1][numAdded+1] = (int)getMaxValue(tempYvalues, 0, j-1); j = 0; xvalue = tempValue; numAdded = numAdded+2; } seisIndex++; } xvalue = tempValue; /*if(j == 0){ out[1][numAdded] = getMinValue(tempYvalues, 0, 0); out[1][numAdded+1] = (int)getMaxValue(tempYvalues, 0, 0); } else{ out[1][numAdded] = getMinValue(tempYvalues, 0, j-1); out[1][numAdded + 1] = (int)getMaxValue(tempYvalues, 0, j-1); }*/ int temp[][] = new int[2][numAdded]; System.arraycopy(out[0], 0, temp[0], 0, numAdded); System.arraycopy(out[1], 0, temp[1], 0, numAdded); return temp; }
|
protected static int[][] scaleXvalues(LocalSeismogram seismogram, MicroSecondTimeRange timeRange, UnitRangeImpl ampRange, Dimension size) throws UnsupportedDataEncoding { LocalSeismogramImpl seis = (LocalSeismogramImpl)seismogram; int[][] out = new int[2][]; int seisIndex = 0; int pixelIndex = 0; int numAdded = 0; if ( seis.getEndTime().before(timeRange.getBeginTime()) || seis.getBeginTime().after(timeRange.getEndTime()) ) { out[0] = new int[0]; out[1] = new int[0]; logger.info("The end time is before the beginTime in simple seismogram"); return out; } MicroSecondDate tMin = timeRange.getBeginTime(); MicroSecondDate tMax = timeRange.getEndTime(); double yMin = ampRange.getMinValue(); double yMax = ampRange.getMaxValue(); int seisStartIndex = getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), tMin); int seisEndIndex = getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), tMax); if (seisStartIndex < 0) { seisStartIndex = 0; } if (seisEndIndex >= seis.getNumPoints()) { seisEndIndex = seis.getNumPoints()-1; } MicroSecondDate tempdate = getValue(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), seisStartIndex); int pixelStartIndex = getPixel(size.width, tMin, tMax, tempdate); tempdate = getValue(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), seisEndIndex); int pixelEndIndex = getPixel(size.width, tMin, tMax, tempdate); int pixels = seisEndIndex - seisStartIndex + 1; out[0] = new int[2*pixels]; out[1] = new int[out[0].length]; int tempYvalues[] = new int [out[0].length]; seisIndex = seisStartIndex; numAdded = 0; int xvalue = 0; int tempValue = 0; xvalue = Math.round((float)(linearInterp(seisStartIndex, pixelStartIndex, seisEndIndex, pixelEndIndex, seisIndex))); seisIndex++; int j; j = 0; while (seisIndex <= seisEndIndex) { tempValue = Math.round((float)(linearInterp(seisStartIndex, pixelStartIndex, seisEndIndex, pixelEndIndex, seisIndex))); tempYvalues[j++] = (int)seis.getValueAt(seisIndex).getValue(); if(tempValue != xvalue) { out[0][numAdded] = xvalue; out[0][numAdded+1] = xvalue; out[1][numAdded] = getMinValue(tempYvalues, 0, j-1); out[1][numAdded+1] = (int)getMaxValue(tempYvalues, 0, j-1); j = 0; xvalue = tempValue; numAdded = numAdded+2; } seisIndex++; } xvalue = tempValue; /*if(j == 0){ out[1][numAdded] = getMinValue(tempYvalues, 0, 0); out[1][numAdded+1] = (int)getMaxValue(tempYvalues, 0, 0); } else{ out[1][numAdded] = getMinValue(tempYvalues, 0, j-1); out[1][numAdded + 1] = (int)getMaxValue(tempYvalues, 0, j-1); }*/ int temp[][] = new int[2][numAdded]; System.arraycopy(out[0], 0, temp[0], 0, numAdded); System.arraycopy(out[1], 0, temp[1], 0, numAdded); return temp; }
| 1,118,585
|
public static Cmplx evalPoleZeroInverse(SacPoleZero pz, double freq) { Cmplx s = new Cmplx(0, 2 * Math.PI * freq); Cmplx zeroOut = new Cmplx(1, 0); Cmplx poleOut = new Cmplx(1, 0); for(int i = 0; i < pz.getPoles().length; i++) { poleOut = Cmplx.mul(poleOut, Cmplx.sub(s, pz.getPoles()[i])); } for(int i = 0; i < pz.getZeros().length; i++) { if(s.real() == pz.getZeros()[i].real() && s.imag() == pz.getZeros()[i].imag()) { return ZERO; } zeroOut = Cmplx.mul(zeroOut, Cmplx.sub(s, pz.getZeros()[i])); if (false && freq < 0.01) { System.out.println("zero "+i+" freq "+freq+" "+zeroOut+" pz "+pz.getZeros()[i]);} } Cmplx out = Cmplx.div(poleOut, zeroOut); return Cmplx.div(out, pz.getConstant()).conjg(); }
|
public static Cmplx evalPoleZeroInverse(SacPoleZero pz, double freq) { Cmplx s = new Cmplx(0, 2 * Math.PI * freq); Cmplx zeroOut = new Cmplx(1, 0); Cmplx poleOut = new Cmplx(1, 0); for(int i = 0; i < pz.getPoles().length; i++) { poleOut = Cmplx.mul(poleOut, Cmplx.sub(s, pz.getPoles()[i])); } for(int i = 0; i < pz.getZeros().length; i++) { if(s.real() == pz.getZeros()[i].real() && s.imag() == pz.getZeros()[i].imag()) { return ZERO; } zeroOut = Cmplx.mul(zeroOut, Cmplx.sub(s, pz.getZeros()[i])); } Cmplx out = Cmplx.div(poleOut, zeroOut); return Cmplx.div(out, pz.getConstant()).conjg(); }
| 1,118,587
|
public ATNil meta_addField(ATField field) throws NATException { return this.meta_defineField(field.base_getName(), field.base_getFieldValue()); }
|
public ATNil meta_addField(ATField field) throws NATException { return this.meta_defineField(field.base_getName(), field.base_getValue()); }
| 1,118,589
|
public ATNil meta_addMethod(ATMethod method) throws NATException { throw new XIllegalOperation("Cannot add method "+ method.base_getName().getText().asNativeText().javaValue + " to a call frame. Add it as a closure field instead."); }
|
public ATNil meta_addMethod(ATMethod method) throws NATException { throw new XIllegalOperation("Cannot add method "+ method.base_getName().base_getText().asNativeText().javaValue + " to a call frame. Add it as a closure field instead."); }
| 1,118,590
|
public ATNil meta_defineField(ATSymbol name, ATObject value) throws NATException { boolean fieldAdded = variableMap_.put(name); if (!fieldAdded) { // field already exists... throw new XDuplicateSlot("field ", name.getText().asNativeText().javaValue); } else { // field now defined, add its value to the state vector stateVector_.add(value); } return NATNil._INSTANCE_; }
|
public ATNil meta_defineField(ATSymbol name, ATObject value) throws NATException { boolean fieldAdded = variableMap_.put(name); if (!fieldAdded) { // field already exists... throw new XDuplicateSlot("field ", name.base_getText().asNativeText().javaValue); } else { // field now defined, add its value to the state vector stateVector_.add(value); } return NATNil._INSTANCE_; }
| 1,118,591
|
private void addLinks() { for (int i = 0; i < links.size(); i++) { IdeaLink link = links.get(i); System.out.println("0 link = " + link); int linkIndex = linkTos.get(i); Idea linkTo = ideaIndex.get(linkIndex); System.out.println("linkTo = " + linkTo); link.setTo(linkTo); System.out.println("1 link = " + link); link.getFrom().addLink(link); System.out.println("2 link = " + link); } }
|
private void addLinks() { for (int i = 0; i < links.size(); i++) { IdeaLink link = links.get(i); int linkIndex = linkTos.get(i); Idea linkTo = ideaIndex.get(linkIndex); System.out.println("linkTo = " + linkTo); link.setTo(linkTo); System.out.println("1 link = " + link); link.getFrom().addLink(link); System.out.println("2 link = " + link); } }
| 1,118,595
|
private void addLinks() { for (int i = 0; i < links.size(); i++) { IdeaLink link = links.get(i); System.out.println("0 link = " + link); int linkIndex = linkTos.get(i); Idea linkTo = ideaIndex.get(linkIndex); System.out.println("linkTo = " + linkTo); link.setTo(linkTo); System.out.println("1 link = " + link); link.getFrom().addLink(link); System.out.println("2 link = " + link); } }
|
private void addLinks() { for (int i = 0; i < links.size(); i++) { IdeaLink link = links.get(i); System.out.println("0 link = " + link); int linkIndex = linkTos.get(i); Idea linkTo = ideaIndex.get(linkIndex); link.setTo(linkTo); System.out.println("1 link = " + link); link.getFrom().addLink(link); System.out.println("2 link = " + link); } }
| 1,118,596
|
private void addLinks() { for (int i = 0; i < links.size(); i++) { IdeaLink link = links.get(i); System.out.println("0 link = " + link); int linkIndex = linkTos.get(i); Idea linkTo = ideaIndex.get(linkIndex); System.out.println("linkTo = " + linkTo); link.setTo(linkTo); System.out.println("1 link = " + link); link.getFrom().addLink(link); System.out.println("2 link = " + link); } }
|
private void addLinks() { for (int i = 0; i < links.size(); i++) { IdeaLink link = links.get(i); System.out.println("0 link = " + link); int linkIndex = linkTos.get(i); Idea linkTo = ideaIndex.get(linkIndex); System.out.println("linkTo = " + linkTo); link.setTo(linkTo); link.getFrom().addLink(link); System.out.println("2 link = " + link); } }
| 1,118,597
|
private void addLinks() { for (int i = 0; i < links.size(); i++) { IdeaLink link = links.get(i); System.out.println("0 link = " + link); int linkIndex = linkTos.get(i); Idea linkTo = ideaIndex.get(linkIndex); System.out.println("linkTo = " + linkTo); link.setTo(linkTo); System.out.println("1 link = " + link); link.getFrom().addLink(link); System.out.println("2 link = " + link); } }
|
private void addLinks() { for (int i = 0; i < links.size(); i++) { IdeaLink link = links.get(i); System.out.println("0 link = " + link); int linkIndex = linkTos.get(i); Idea linkTo = ideaIndex.get(linkIndex); System.out.println("linkTo = " + linkTo); link.setTo(linkTo); System.out.println("1 link = " + link); link.getFrom().addLink(link); } }
| 1,118,598
|
public void startElement(String namespaceURI, String sName, // simple name (localName) String qName, // qualified name Attributes attrs) throws SAXException { if ("outline".equals(qName)) { if (attrs != null) { String type = attrs.getValue("type"); if (type != null) { type = type.toUpperCase(); } else { type = ""; } String url = attrs.getValue("url"); if (url == null) { url = ""; } if (!url.startsWith("#")) { String text = attrs.getValue("text"); Idea i = new Idea(text); i.setUrl(url); String id = attrs.getValue("id"); if ((id != null) && (id.length() > 0)) { ideaIndex.put(new Integer(id), i); } String notes = attrs.getValue("notes"); if (notes == null) { notes = ""; } i.setNotes(notes); String description = attrs.getValue("description"); if (description == null) { description = ""; } i.setDescription(description); String angleString = attrs.getValue("angle"); if ((angleString != null) && (angleString.length() > 0)) { i.setAngle(Double.valueOf(angleString)); anglesRead = true; } if (idea == null) { idea = i; } else if (current != null) { current.add(i); } else { Idea i2 = new Idea("root"); i2.add(idea); idea = i2; stack.push(idea); idea.add(i); } current = i; stack.push(current); } else { String indexNo = url.substring(1); System.out.println("linking from " + current); System.out.println("current class = " + current.getClass()); IdeaLink link = new IdeaLink(current, null); System.out.println("link initially " + link); String description = attrs.getValue("description"); if (description == null) { description = ""; } link.setDescription(description); links.add(link); linkTos.add(new Integer(indexNo)); stack.push(null); } } } }
|
public void startElement(String namespaceURI, String sName, // simple name (localName) String qName, // qualified name Attributes attrs) throws SAXException { if ("outline".equals(qName)) { if (attrs != null) { String type = attrs.getValue("type"); if (type != null) { type = type.toUpperCase(); } else { type = ""; } String url = attrs.getValue("url"); if (url == null) { url = ""; } if (!url.startsWith("#")) { String text = attrs.getValue("text"); Idea i = new Idea(text); i.setUrl(url); String id = attrs.getValue("id"); if ((id != null) && (id.length() > 0)) { ideaIndex.put(new Integer(id), i); } String notes = attrs.getValue("notes"); if (notes == null) { notes = ""; } i.setNotes(notes); String description = attrs.getValue("description"); if (description == null) { description = ""; } i.setDescription(description); String angleString = attrs.getValue("angle"); if ((angleString != null) && (angleString.length() > 0)) { i.setAngle(Double.valueOf(angleString)); anglesRead = true; } if (idea == null) { idea = i; } else if (current != null) { current.add(i); } else { Idea i2 = new Idea("root"); i2.add(idea); idea = i2; stack.push(idea); idea.add(i); } current = i; stack.push(current); } else { String indexNo = url.substring(1); System.out.println("linking from " + current); System.out.println("current class = " + current.getClass()); IdeaLink link = new IdeaLink(current, null); System.out.println("link initially " + link); String description = attrs.getValue("description"); if (description == null) { description = ""; } link.setDescription(description); links.add(link); linkTos.add(new Integer(indexNo)); stack.push(null); } } } }
| 1,118,599
|
public void startElement(String namespaceURI, String sName, // simple name (localName) String qName, // qualified name Attributes attrs) throws SAXException { if ("outline".equals(qName)) { if (attrs != null) { String type = attrs.getValue("type"); if (type != null) { type = type.toUpperCase(); } else { type = ""; } String url = attrs.getValue("url"); if (url == null) { url = ""; } if (!url.startsWith("#")) { String text = attrs.getValue("text"); Idea i = new Idea(text); i.setUrl(url); String id = attrs.getValue("id"); if ((id != null) && (id.length() > 0)) { ideaIndex.put(new Integer(id), i); } String notes = attrs.getValue("notes"); if (notes == null) { notes = ""; } i.setNotes(notes); String description = attrs.getValue("description"); if (description == null) { description = ""; } i.setDescription(description); String angleString = attrs.getValue("angle"); if ((angleString != null) && (angleString.length() > 0)) { i.setAngle(Double.valueOf(angleString)); anglesRead = true; } if (idea == null) { idea = i; } else if (current != null) { current.add(i); } else { Idea i2 = new Idea("root"); i2.add(idea); idea = i2; stack.push(idea); idea.add(i); } current = i; stack.push(current); } else { String indexNo = url.substring(1); System.out.println("linking from " + current); System.out.println("current class = " + current.getClass()); IdeaLink link = new IdeaLink(current, null); System.out.println("link initially " + link); String description = attrs.getValue("description"); if (description == null) { description = ""; } link.setDescription(description); links.add(link); linkTos.add(new Integer(indexNo)); stack.push(null); } } } }
|
public void startElement(String namespaceURI, String sName, // simple name (localName) String qName, // qualified name Attributes attrs) throws SAXException { if ("outline".equals(qName)) { if (attrs != null) { String type = attrs.getValue("type"); if (type != null) { type = type.toUpperCase(); } else { type = ""; } String url = attrs.getValue("url"); if (url == null) { url = ""; } if (!url.startsWith("#")) { String text = attrs.getValue("text"); Idea i = new Idea(text); i.setUrl(url); String id = attrs.getValue("id"); if ((id != null) && (id.length() > 0)) { ideaIndex.put(new Integer(id), i); } String notes = attrs.getValue("notes"); if (notes == null) { notes = ""; } i.setNotes(notes); String description = attrs.getValue("description"); if (description == null) { description = ""; } i.setDescription(description); String angleString = attrs.getValue("angle"); if ((angleString != null) && (angleString.length() > 0)) { i.setAngle(Double.valueOf(angleString)); anglesRead = true; } if (idea == null) { idea = i; } else if (current != null) { current.add(i); } else { Idea i2 = new Idea("root"); i2.add(idea); idea = i2; stack.push(idea); idea.add(i); } current = i; stack.push(current); } else { String indexNo = url.substring(1); System.out.println("linking from " + current); System.out.println("current class = " + current.getClass()); IdeaLink link = new IdeaLink(current, null); String description = attrs.getValue("description"); if (description == null) { description = ""; } link.setDescription(description); links.add(link); linkTos.add(new Integer(indexNo)); stack.push(null); } } } }
| 1,118,600
|
public LocalSeismogramImpl apply(LocalSeismogramImpl seis) { if ( begin.after(seis.getEndTime()) || end.before(seis.getBeginTime())) { return null; } // end of if () TimeInterval sampPeriod = seis.getSampling().getPeriod(); QuantityImpl beginShift = begin.subtract(seis.getBeginTime()); beginShift = beginShift.divideBy(sampPeriod); beginShift = beginShift.convertTo(secPerSec); //should be dimensonless int beginIndex = (int)Math.ceil(beginShift.value); if (beginIndex < 0) { beginIndex = 0; } // end of if (beginIndex < 0) if (beginIndex >= seis.getNumPoints()) { beginIndex = seis.getNumPoints()-1; } QuantityImpl endShift = seis.getEndTime().subtract(end); endShift = endShift.divideBy(sampPeriod); endShift = endShift.convertTo(secPerSec); //should be dimensonless int endIndex = seis.getNumPoints() - (int)Math.floor(endShift.value); if (endIndex < 0) { endIndex = 0; } if (endIndex > seis.getNumPoints()) { endIndex = seis.getNumPoints(); } logger.debug("cut is "+beginIndex+" to "+endIndex+" "+seis.getEndTime()+" "+endShift); TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); if (seis.can_convert_to_short()) { short[] outS = new short[endIndex-beginIndex]; short[] inS = seis.get_as_shorts(); System.arraycopy(inS, beginIndex, outS, 0, endIndex-beginIndex); dataSel.sht_values(outS); } else if (seis.can_convert_to_long()) { int[] outI = new int[endIndex-beginIndex]; int[] inI = seis.get_as_longs(); System.arraycopy(inI, beginIndex, outI, 0, endIndex-beginIndex); dataSel.int_values(outI); } else if (seis.can_convert_to_float()) { float[] outF = new float[endIndex-beginIndex]; float[] inF = seis.get_as_floats(); System.arraycopy(inF, beginIndex, outF, 0, endIndex-beginIndex); dataSel.flt_values(outF); } else { double[] outD = new double[endIndex-beginIndex]; double[] inD = seis.get_as_doubles(); System.arraycopy(inD, beginIndex, outD, 0, endIndex-beginIndex); dataSel.dbl_values(outD); } // end of else TimeSeriesType dataType = seis.getDataType(); return new LocalSeismogramImpl(seis, dataSel); }
|
public LocalSeismogramImpl apply(LocalSeismogramImpl seis) { if ( begin.after(seis.getEndTime()) || end.before(seis.getBeginTime())) { return null; } // end of if () TimeInterval sampPeriod = seis.getSampling().getPeriod(); QuantityImpl beginShift = begin.subtract(seis.getBeginTime()); beginShift = beginShift.divideBy(sampPeriod); beginShift = beginShift.convertTo(secPerSec); //should be dimensonless int beginIndex = (int)Math.ceil(beginShift.value); if (beginIndex < 0) { beginIndex = 0; } // end of if (beginIndex < 0) if (beginIndex >= seis.getNumPoints()) { beginIndex = seis.getNumPoints()-1; } QuantityImpl endShift = seis.getEndTime().subtract(end); endShift = endShift.divideBy(sampPeriod); endShift = endShift.convertTo(secPerSec); //should be dimensonless int endIndex = seis.getNumPoints() - (int)Math.floor(endShift.value); if (endIndex < 0) { endIndex = 0; } if (endIndex > seis.getNumPoints()) { endIndex = seis.getNumPoints(); } logger.debug("cut is "+beginIndex+" to "+endIndex+" "+seis.getEndTime()+" "+endShift); LocalSeismogramImpl outSeis; if (seis.can_convert_to_short()) { short[] outS = new short[endIndex-beginIndex]; short[] inS = seis.get_as_shorts(); System.arraycopy(inS, beginIndex, outS, 0, endIndex-beginIndex); dataSel.sht_values(outS); } else if (seis.can_convert_to_long()) { int[] outI = new int[endIndex-beginIndex]; int[] inI = seis.get_as_longs(); System.arraycopy(inI, beginIndex, outI, 0, endIndex-beginIndex); dataSel.int_values(outI); } else if (seis.can_convert_to_float()) { float[] outF = new float[endIndex-beginIndex]; float[] inF = seis.get_as_floats(); System.arraycopy(inF, beginIndex, outF, 0, endIndex-beginIndex); dataSel.flt_values(outF); } else { double[] outD = new double[endIndex-beginIndex]; double[] inD = seis.get_as_doubles(); System.arraycopy(inD, beginIndex, outD, 0, endIndex-beginIndex); dataSel.dbl_values(outD); } // end of else TimeSeriesType dataType = seis.getDataType(); return new LocalSeismogramImpl(seis, dataSel); }
| 1,118,601
|
public LocalSeismogramImpl apply(LocalSeismogramImpl seis) { if ( begin.after(seis.getEndTime()) || end.before(seis.getBeginTime())) { return null; } // end of if () TimeInterval sampPeriod = seis.getSampling().getPeriod(); QuantityImpl beginShift = begin.subtract(seis.getBeginTime()); beginShift = beginShift.divideBy(sampPeriod); beginShift = beginShift.convertTo(secPerSec); //should be dimensonless int beginIndex = (int)Math.ceil(beginShift.value); if (beginIndex < 0) { beginIndex = 0; } // end of if (beginIndex < 0) if (beginIndex >= seis.getNumPoints()) { beginIndex = seis.getNumPoints()-1; } QuantityImpl endShift = seis.getEndTime().subtract(end); endShift = endShift.divideBy(sampPeriod); endShift = endShift.convertTo(secPerSec); //should be dimensonless int endIndex = seis.getNumPoints() - (int)Math.floor(endShift.value); if (endIndex < 0) { endIndex = 0; } if (endIndex > seis.getNumPoints()) { endIndex = seis.getNumPoints(); } logger.debug("cut is "+beginIndex+" to "+endIndex+" "+seis.getEndTime()+" "+endShift); TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); if (seis.can_convert_to_short()) { short[] outS = new short[endIndex-beginIndex]; short[] inS = seis.get_as_shorts(); System.arraycopy(inS, beginIndex, outS, 0, endIndex-beginIndex); dataSel.sht_values(outS); } else if (seis.can_convert_to_long()) { int[] outI = new int[endIndex-beginIndex]; int[] inI = seis.get_as_longs(); System.arraycopy(inI, beginIndex, outI, 0, endIndex-beginIndex); dataSel.int_values(outI); } else if (seis.can_convert_to_float()) { float[] outF = new float[endIndex-beginIndex]; float[] inF = seis.get_as_floats(); System.arraycopy(inF, beginIndex, outF, 0, endIndex-beginIndex); dataSel.flt_values(outF); } else { double[] outD = new double[endIndex-beginIndex]; double[] inD = seis.get_as_doubles(); System.arraycopy(inD, beginIndex, outD, 0, endIndex-beginIndex); dataSel.dbl_values(outD); } // end of else TimeSeriesType dataType = seis.getDataType(); return new LocalSeismogramImpl(seis, dataSel); }
|
public LocalSeismogramImpl apply(LocalSeismogramImpl seis) { if ( begin.after(seis.getEndTime()) || end.before(seis.getBeginTime())) { return null; } // end of if () TimeInterval sampPeriod = seis.getSampling().getPeriod(); QuantityImpl beginShift = begin.subtract(seis.getBeginTime()); beginShift = beginShift.divideBy(sampPeriod); beginShift = beginShift.convertTo(secPerSec); //should be dimensonless int beginIndex = (int)Math.ceil(beginShift.value); if (beginIndex < 0) { beginIndex = 0; } // end of if (beginIndex < 0) if (beginIndex >= seis.getNumPoints()) { beginIndex = seis.getNumPoints()-1; } QuantityImpl endShift = seis.getEndTime().subtract(end); endShift = endShift.divideBy(sampPeriod); endShift = endShift.convertTo(secPerSec); //should be dimensonless int endIndex = seis.getNumPoints() - (int)Math.floor(endShift.value); if (endIndex < 0) { endIndex = 0; } if (endIndex > seis.getNumPoints()) { endIndex = seis.getNumPoints(); } logger.debug("cut is "+beginIndex+" to "+endIndex+" "+seis.getEndTime()+" "+endShift); TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); if (seis.can_convert_to_short()) { short[] outS = new short[endIndex-beginIndex]; short[] inS = seis.get_as_shorts(); System.arraycopy(inS, beginIndex, outS, 0, endIndex-beginIndex); outSeis = new LocalSeismogramImpl(seis, outS); } else if (seis.can_convert_to_long()) { int[] outI = new int[endIndex-beginIndex]; int[] inI = seis.get_as_longs(); System.arraycopy(inI, beginIndex, outI, 0, endIndex-beginIndex); dataSel.int_values(outI); } else if (seis.can_convert_to_float()) { float[] outF = new float[endIndex-beginIndex]; float[] inF = seis.get_as_floats(); System.arraycopy(inF, beginIndex, outF, 0, endIndex-beginIndex); dataSel.flt_values(outF); } else { double[] outD = new double[endIndex-beginIndex]; double[] inD = seis.get_as_doubles(); System.arraycopy(inD, beginIndex, outD, 0, endIndex-beginIndex); dataSel.dbl_values(outD); } // end of else TimeSeriesType dataType = seis.getDataType(); return new LocalSeismogramImpl(seis, dataSel); }
| 1,118,602
|
public LocalSeismogramImpl apply(LocalSeismogramImpl seis) { if ( begin.after(seis.getEndTime()) || end.before(seis.getBeginTime())) { return null; } // end of if () TimeInterval sampPeriod = seis.getSampling().getPeriod(); QuantityImpl beginShift = begin.subtract(seis.getBeginTime()); beginShift = beginShift.divideBy(sampPeriod); beginShift = beginShift.convertTo(secPerSec); //should be dimensonless int beginIndex = (int)Math.ceil(beginShift.value); if (beginIndex < 0) { beginIndex = 0; } // end of if (beginIndex < 0) if (beginIndex >= seis.getNumPoints()) { beginIndex = seis.getNumPoints()-1; } QuantityImpl endShift = seis.getEndTime().subtract(end); endShift = endShift.divideBy(sampPeriod); endShift = endShift.convertTo(secPerSec); //should be dimensonless int endIndex = seis.getNumPoints() - (int)Math.floor(endShift.value); if (endIndex < 0) { endIndex = 0; } if (endIndex > seis.getNumPoints()) { endIndex = seis.getNumPoints(); } logger.debug("cut is "+beginIndex+" to "+endIndex+" "+seis.getEndTime()+" "+endShift); TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); if (seis.can_convert_to_short()) { short[] outS = new short[endIndex-beginIndex]; short[] inS = seis.get_as_shorts(); System.arraycopy(inS, beginIndex, outS, 0, endIndex-beginIndex); dataSel.sht_values(outS); } else if (seis.can_convert_to_long()) { int[] outI = new int[endIndex-beginIndex]; int[] inI = seis.get_as_longs(); System.arraycopy(inI, beginIndex, outI, 0, endIndex-beginIndex); dataSel.int_values(outI); } else if (seis.can_convert_to_float()) { float[] outF = new float[endIndex-beginIndex]; float[] inF = seis.get_as_floats(); System.arraycopy(inF, beginIndex, outF, 0, endIndex-beginIndex); dataSel.flt_values(outF); } else { double[] outD = new double[endIndex-beginIndex]; double[] inD = seis.get_as_doubles(); System.arraycopy(inD, beginIndex, outD, 0, endIndex-beginIndex); dataSel.dbl_values(outD); } // end of else TimeSeriesType dataType = seis.getDataType(); return new LocalSeismogramImpl(seis, dataSel); }
|
public LocalSeismogramImpl apply(LocalSeismogramImpl seis) { if ( begin.after(seis.getEndTime()) || end.before(seis.getBeginTime())) { return null; } // end of if () TimeInterval sampPeriod = seis.getSampling().getPeriod(); QuantityImpl beginShift = begin.subtract(seis.getBeginTime()); beginShift = beginShift.divideBy(sampPeriod); beginShift = beginShift.convertTo(secPerSec); //should be dimensonless int beginIndex = (int)Math.ceil(beginShift.value); if (beginIndex < 0) { beginIndex = 0; } // end of if (beginIndex < 0) if (beginIndex >= seis.getNumPoints()) { beginIndex = seis.getNumPoints()-1; } QuantityImpl endShift = seis.getEndTime().subtract(end); endShift = endShift.divideBy(sampPeriod); endShift = endShift.convertTo(secPerSec); //should be dimensonless int endIndex = seis.getNumPoints() - (int)Math.floor(endShift.value); if (endIndex < 0) { endIndex = 0; } if (endIndex > seis.getNumPoints()) { endIndex = seis.getNumPoints(); } logger.debug("cut is "+beginIndex+" to "+endIndex+" "+seis.getEndTime()+" "+endShift); TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); if (seis.can_convert_to_short()) { short[] outS = new short[endIndex-beginIndex]; short[] inS = seis.get_as_shorts(); System.arraycopy(inS, beginIndex, outS, 0, endIndex-beginIndex); dataSel.sht_values(outS); } else if (seis.can_convert_to_long()) { int[] outI = new int[endIndex-beginIndex]; int[] inI = seis.get_as_longs(); System.arraycopy(inI, beginIndex, outI, 0, endIndex-beginIndex); outSeis = new LocalSeismogramImpl(seis, outI); logger.debug("out num_points="+seis.num_points+" out data length="+outI.length); } else if (seis.can_convert_to_float()) { float[] outF = new float[endIndex-beginIndex]; float[] inF = seis.get_as_floats(); System.arraycopy(inF, beginIndex, outF, 0, endIndex-beginIndex); dataSel.flt_values(outF); } else { double[] outD = new double[endIndex-beginIndex]; double[] inD = seis.get_as_doubles(); System.arraycopy(inD, beginIndex, outD, 0, endIndex-beginIndex); dataSel.dbl_values(outD); } // end of else TimeSeriesType dataType = seis.getDataType(); return new LocalSeismogramImpl(seis, dataSel); }
| 1,118,603
|
public LocalSeismogramImpl apply(LocalSeismogramImpl seis) { if ( begin.after(seis.getEndTime()) || end.before(seis.getBeginTime())) { return null; } // end of if () TimeInterval sampPeriod = seis.getSampling().getPeriod(); QuantityImpl beginShift = begin.subtract(seis.getBeginTime()); beginShift = beginShift.divideBy(sampPeriod); beginShift = beginShift.convertTo(secPerSec); //should be dimensonless int beginIndex = (int)Math.ceil(beginShift.value); if (beginIndex < 0) { beginIndex = 0; } // end of if (beginIndex < 0) if (beginIndex >= seis.getNumPoints()) { beginIndex = seis.getNumPoints()-1; } QuantityImpl endShift = seis.getEndTime().subtract(end); endShift = endShift.divideBy(sampPeriod); endShift = endShift.convertTo(secPerSec); //should be dimensonless int endIndex = seis.getNumPoints() - (int)Math.floor(endShift.value); if (endIndex < 0) { endIndex = 0; } if (endIndex > seis.getNumPoints()) { endIndex = seis.getNumPoints(); } logger.debug("cut is "+beginIndex+" to "+endIndex+" "+seis.getEndTime()+" "+endShift); TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); if (seis.can_convert_to_short()) { short[] outS = new short[endIndex-beginIndex]; short[] inS = seis.get_as_shorts(); System.arraycopy(inS, beginIndex, outS, 0, endIndex-beginIndex); dataSel.sht_values(outS); } else if (seis.can_convert_to_long()) { int[] outI = new int[endIndex-beginIndex]; int[] inI = seis.get_as_longs(); System.arraycopy(inI, beginIndex, outI, 0, endIndex-beginIndex); dataSel.int_values(outI); } else if (seis.can_convert_to_float()) { float[] outF = new float[endIndex-beginIndex]; float[] inF = seis.get_as_floats(); System.arraycopy(inF, beginIndex, outF, 0, endIndex-beginIndex); dataSel.flt_values(outF); } else { double[] outD = new double[endIndex-beginIndex]; double[] inD = seis.get_as_doubles(); System.arraycopy(inD, beginIndex, outD, 0, endIndex-beginIndex); dataSel.dbl_values(outD); } // end of else TimeSeriesType dataType = seis.getDataType(); return new LocalSeismogramImpl(seis, dataSel); }
|
public LocalSeismogramImpl apply(LocalSeismogramImpl seis) { if ( begin.after(seis.getEndTime()) || end.before(seis.getBeginTime())) { return null; } // end of if () TimeInterval sampPeriod = seis.getSampling().getPeriod(); QuantityImpl beginShift = begin.subtract(seis.getBeginTime()); beginShift = beginShift.divideBy(sampPeriod); beginShift = beginShift.convertTo(secPerSec); //should be dimensonless int beginIndex = (int)Math.ceil(beginShift.value); if (beginIndex < 0) { beginIndex = 0; } // end of if (beginIndex < 0) if (beginIndex >= seis.getNumPoints()) { beginIndex = seis.getNumPoints()-1; } QuantityImpl endShift = seis.getEndTime().subtract(end); endShift = endShift.divideBy(sampPeriod); endShift = endShift.convertTo(secPerSec); //should be dimensonless int endIndex = seis.getNumPoints() - (int)Math.floor(endShift.value); if (endIndex < 0) { endIndex = 0; } if (endIndex > seis.getNumPoints()) { endIndex = seis.getNumPoints(); } logger.debug("cut is "+beginIndex+" to "+endIndex+" "+seis.getEndTime()+" "+endShift); TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); if (seis.can_convert_to_short()) { short[] outS = new short[endIndex-beginIndex]; short[] inS = seis.get_as_shorts(); System.arraycopy(inS, beginIndex, outS, 0, endIndex-beginIndex); dataSel.sht_values(outS); } else if (seis.can_convert_to_long()) { int[] outI = new int[endIndex-beginIndex]; int[] inI = seis.get_as_longs(); System.arraycopy(inI, beginIndex, outI, 0, endIndex-beginIndex); dataSel.int_values(outI); } else if (seis.can_convert_to_float()) { float[] outF = new float[endIndex-beginIndex]; float[] inF = seis.get_as_floats(); System.arraycopy(inF, beginIndex, outF, 0, endIndex-beginIndex); outSeis = new LocalSeismogramImpl(seis, outF); } else { double[] outD = new double[endIndex-beginIndex]; double[] inD = seis.get_as_doubles(); System.arraycopy(inD, beginIndex, outD, 0, endIndex-beginIndex); dataSel.dbl_values(outD); } // end of else TimeSeriesType dataType = seis.getDataType(); return new LocalSeismogramImpl(seis, dataSel); }
| 1,118,604
|
public LocalSeismogramImpl apply(LocalSeismogramImpl seis) { if ( begin.after(seis.getEndTime()) || end.before(seis.getBeginTime())) { return null; } // end of if () TimeInterval sampPeriod = seis.getSampling().getPeriod(); QuantityImpl beginShift = begin.subtract(seis.getBeginTime()); beginShift = beginShift.divideBy(sampPeriod); beginShift = beginShift.convertTo(secPerSec); //should be dimensonless int beginIndex = (int)Math.ceil(beginShift.value); if (beginIndex < 0) { beginIndex = 0; } // end of if (beginIndex < 0) if (beginIndex >= seis.getNumPoints()) { beginIndex = seis.getNumPoints()-1; } QuantityImpl endShift = seis.getEndTime().subtract(end); endShift = endShift.divideBy(sampPeriod); endShift = endShift.convertTo(secPerSec); //should be dimensonless int endIndex = seis.getNumPoints() - (int)Math.floor(endShift.value); if (endIndex < 0) { endIndex = 0; } if (endIndex > seis.getNumPoints()) { endIndex = seis.getNumPoints(); } logger.debug("cut is "+beginIndex+" to "+endIndex+" "+seis.getEndTime()+" "+endShift); TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); if (seis.can_convert_to_short()) { short[] outS = new short[endIndex-beginIndex]; short[] inS = seis.get_as_shorts(); System.arraycopy(inS, beginIndex, outS, 0, endIndex-beginIndex); dataSel.sht_values(outS); } else if (seis.can_convert_to_long()) { int[] outI = new int[endIndex-beginIndex]; int[] inI = seis.get_as_longs(); System.arraycopy(inI, beginIndex, outI, 0, endIndex-beginIndex); dataSel.int_values(outI); } else if (seis.can_convert_to_float()) { float[] outF = new float[endIndex-beginIndex]; float[] inF = seis.get_as_floats(); System.arraycopy(inF, beginIndex, outF, 0, endIndex-beginIndex); dataSel.flt_values(outF); } else { double[] outD = new double[endIndex-beginIndex]; double[] inD = seis.get_as_doubles(); System.arraycopy(inD, beginIndex, outD, 0, endIndex-beginIndex); dataSel.dbl_values(outD); } // end of else TimeSeriesType dataType = seis.getDataType(); return new LocalSeismogramImpl(seis, dataSel); }
|
public LocalSeismogramImpl apply(LocalSeismogramImpl seis) { if ( begin.after(seis.getEndTime()) || end.before(seis.getBeginTime())) { return null; } // end of if () TimeInterval sampPeriod = seis.getSampling().getPeriod(); QuantityImpl beginShift = begin.subtract(seis.getBeginTime()); beginShift = beginShift.divideBy(sampPeriod); beginShift = beginShift.convertTo(secPerSec); //should be dimensonless int beginIndex = (int)Math.ceil(beginShift.value); if (beginIndex < 0) { beginIndex = 0; } // end of if (beginIndex < 0) if (beginIndex >= seis.getNumPoints()) { beginIndex = seis.getNumPoints()-1; } QuantityImpl endShift = seis.getEndTime().subtract(end); endShift = endShift.divideBy(sampPeriod); endShift = endShift.convertTo(secPerSec); //should be dimensonless int endIndex = seis.getNumPoints() - (int)Math.floor(endShift.value); if (endIndex < 0) { endIndex = 0; } if (endIndex > seis.getNumPoints()) { endIndex = seis.getNumPoints(); } logger.debug("cut is "+beginIndex+" to "+endIndex+" "+seis.getEndTime()+" "+endShift); TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); if (seis.can_convert_to_short()) { short[] outS = new short[endIndex-beginIndex]; short[] inS = seis.get_as_shorts(); System.arraycopy(inS, beginIndex, outS, 0, endIndex-beginIndex); dataSel.sht_values(outS); } else if (seis.can_convert_to_long()) { int[] outI = new int[endIndex-beginIndex]; int[] inI = seis.get_as_longs(); System.arraycopy(inI, beginIndex, outI, 0, endIndex-beginIndex); dataSel.int_values(outI); } else if (seis.can_convert_to_float()) { float[] outF = new float[endIndex-beginIndex]; float[] inF = seis.get_as_floats(); System.arraycopy(inF, beginIndex, outF, 0, endIndex-beginIndex); dataSel.flt_values(outF); } else { double[] outD = new double[endIndex-beginIndex]; double[] inD = seis.get_as_doubles(); System.arraycopy(inD, beginIndex, outD, 0, endIndex-beginIndex); dataSel.dbl_values(outD); } // end of else TimeSeriesType dataType = seis.getDataType(); return new LocalSeismogramImpl(seis, dataSel); }
| 1,118,605
|
public LocalSeismogramImpl apply(LocalSeismogramImpl seis) { if ( begin.after(seis.getEndTime()) || end.before(seis.getBeginTime())) { return null; } // end of if () TimeInterval sampPeriod = seis.getSampling().getPeriod(); QuantityImpl beginShift = begin.subtract(seis.getBeginTime()); beginShift = beginShift.divideBy(sampPeriod); beginShift = beginShift.convertTo(secPerSec); //should be dimensonless int beginIndex = (int)Math.ceil(beginShift.value); if (beginIndex < 0) { beginIndex = 0; } // end of if (beginIndex < 0) if (beginIndex >= seis.getNumPoints()) { beginIndex = seis.getNumPoints()-1; } QuantityImpl endShift = seis.getEndTime().subtract(end); endShift = endShift.divideBy(sampPeriod); endShift = endShift.convertTo(secPerSec); //should be dimensonless int endIndex = seis.getNumPoints() - (int)Math.floor(endShift.value); if (endIndex < 0) { endIndex = 0; } if (endIndex > seis.getNumPoints()) { endIndex = seis.getNumPoints(); } logger.debug("cut is "+beginIndex+" to "+endIndex+" "+seis.getEndTime()+" "+endShift); TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); if (seis.can_convert_to_short()) { short[] outS = new short[endIndex-beginIndex]; short[] inS = seis.get_as_shorts(); System.arraycopy(inS, beginIndex, outS, 0, endIndex-beginIndex); dataSel.sht_values(outS); } else if (seis.can_convert_to_long()) { int[] outI = new int[endIndex-beginIndex]; int[] inI = seis.get_as_longs(); System.arraycopy(inI, beginIndex, outI, 0, endIndex-beginIndex); dataSel.int_values(outI); } else if (seis.can_convert_to_float()) { float[] outF = new float[endIndex-beginIndex]; float[] inF = seis.get_as_floats(); System.arraycopy(inF, beginIndex, outF, 0, endIndex-beginIndex); dataSel.flt_values(outF); } else { double[] outD = new double[endIndex-beginIndex]; double[] inD = seis.get_as_doubles(); System.arraycopy(inD, beginIndex, outD, 0, endIndex-beginIndex); dataSel.dbl_values(outD); } // end of else TimeSeriesType dataType = seis.getDataType(); return new LocalSeismogramImpl(seis, dataSel); }
|
public LocalSeismogramImpl apply(LocalSeismogramImpl seis) { if ( begin.after(seis.getEndTime()) || end.before(seis.getBeginTime())) { return null; } // end of if () TimeInterval sampPeriod = seis.getSampling().getPeriod(); QuantityImpl beginShift = begin.subtract(seis.getBeginTime()); beginShift = beginShift.divideBy(sampPeriod); beginShift = beginShift.convertTo(secPerSec); //should be dimensonless int beginIndex = (int)Math.ceil(beginShift.value); if (beginIndex < 0) { beginIndex = 0; } // end of if (beginIndex < 0) if (beginIndex >= seis.getNumPoints()) { beginIndex = seis.getNumPoints()-1; } QuantityImpl endShift = seis.getEndTime().subtract(end); endShift = endShift.divideBy(sampPeriod); endShift = endShift.convertTo(secPerSec); //should be dimensonless int endIndex = seis.getNumPoints() - (int)Math.floor(endShift.value); if (endIndex < 0) { endIndex = 0; } if (endIndex > seis.getNumPoints()) { endIndex = seis.getNumPoints(); } logger.debug("cut is "+beginIndex+" to "+endIndex+" "+seis.getEndTime()+" "+endShift); TimeSeriesDataSel dataSel = new TimeSeriesDataSel(); if (seis.can_convert_to_short()) { short[] outS = new short[endIndex-beginIndex]; short[] inS = seis.get_as_shorts(); System.arraycopy(inS, beginIndex, outS, 0, endIndex-beginIndex); dataSel.sht_values(outS); } else if (seis.can_convert_to_long()) { int[] outI = new int[endIndex-beginIndex]; int[] inI = seis.get_as_longs(); System.arraycopy(inI, beginIndex, outI, 0, endIndex-beginIndex); dataSel.int_values(outI); } else if (seis.can_convert_to_float()) { float[] outF = new float[endIndex-beginIndex]; float[] inF = seis.get_as_floats(); System.arraycopy(inF, beginIndex, outF, 0, endIndex-beginIndex); dataSel.flt_values(outF); } else { double[] outD = new double[endIndex-beginIndex]; double[] inD = seis.get_as_doubles(); System.arraycopy(inD, beginIndex, outD, 0, endIndex-beginIndex); dataSel.dbl_values(outD); } // end of else TimeSeriesType dataType = seis.getDataType(); return outSeis; }
| 1,118,606
|
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access */ if (!form.getAuthorisedUser()) { return "noAccess"; } /** Set the objects to null so we get new ones. */ form.initFields(); form.assignAddingLocation(false); return "continue"; }
|
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access */ if (!form.getAuthorisedUser()) { return "noAccess"; } /** Set the objects to null so we get new ones. */ initFields(form); form.assignAddingLocation(false); return "continue"; }
| 1,118,607
|
public void addParameter(Element param) { config.appendChild(param); }
|
public void addParameter(Element param) { config.appendChild(param); }
| 1,118,608
|
public Element getParamter(String 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) { 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 { return sl.retrieve(); } catch (Exception e) { logger.error("can't get paramterRef", e); } // end of try-catch } } //can't find that name??? return null; }
|
public Object getParamter(String name) { if (parameterCache.containsKey(name)) { return parameterCache.get(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) { 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 { return sl.retrieve(); } catch (Exception e) { logger.error("can't get paramterRef", e); } // end of try-catch } } //can't find that name??? return null; }
| 1,118,609
|
public Element getParamter(String 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) { 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 { return sl.retrieve(); } catch (Exception e) { logger.error("can't get paramterRef", e); } // end of try-catch } } //can't find that name??? return null; }
|
public Element getParamter(String 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) { 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; }
| 1,118,610
|
void loadSacFile(File sacFile) throws IOException, FissuresException { if (excludes.contains(sacFile.getName())) { return; } // end of if (excludes.contains(sacFile.getName())) if (paramRefs.containsValue(sacFile.getName())) { return; } // end of if (excludes.contains(sacFile.getName())) SacTimeSeries sac = new SacTimeSeries(); sac.read(sacFile.getCanonicalPath()); AuditInfo[] audit = new AuditInfo[1]; audit[0] = new AuditInfo(userName+" via SacDirToDataSet", "seismogram loaded from "+sacFile.getCanonicalPath()); URL seisURL = new URL(dirURL, sacFile.getName()); // System.out.println(" the seisURL is "+seisURL.toString()); // DataInputStream dis = new DataInputStream(new BufferedInputStream(seisURL.openStream())); // SacTimeSeries sac = new SacTimeSeries(); //sac.read(dis); edu.iris.Fissures.seismogramDC.LocalSeismogramImpl seis = SacToFissures.getSeismogram(sac); System.out.println("The PATH is "+sacFile.getParent()); edu.sc.seis.fissuresUtil.cache.CacheEvent event = SacToFissures.getEvent(sac); if (event != null && dataset.getParameter(EVENT) == null) { String eventName = event.get_attributes().name; String eName = eventName.replace(' ', '_'); // add event File outFile = new File(sacFile.getParent(), eName); OutputStream fos = new BufferedOutputStream(new FileOutputStream(outFile)); AuditInfo[] eventAudit = new AuditInfo[1]; eventAudit[0] = new AuditInfo(System.getProperty("user.name"), "event loaded from sac file."); XMLParameter.write(fos, event); fos.close(); dataset.addParameterRef( new URL("file:"+eName), EVENT, event,eventAudit); edu.sc.seis.fissuresUtil.cache.CacheEvent cacheEvent = (edu.sc.seis.fissuresUtil.cache.CacheEvent)((XMLDataSet)dataset).getParameter(EVENT); if(cacheEvent == null){ System.out.println("CACHE EVENT IS NULL"); System.exit(0); } else System.out.println("CACHE EVENT IS NOT NULL"); } // end of if (event != null) Channel channel = SacToFissures.getChannel(sac); String channelParamName = CHANNEL+ChannelIdUtil.toString(seis.channel_id); if (channel != null && dataset.getParameter(channelParamName) == null) { File outFile = new File(sacFile.getParent(), ChannelIdUtil.toString(seis.channel_id)); BufferedOutputStream fos = new BufferedOutputStream(new FileOutputStream(outFile)); // add event AuditInfo[] chanAudit = new AuditInfo[1]; chanAudit[0] = new AuditInfo(System.getProperty("user.name"), "channel loaded from sac file."); XMLParameter.write(fos, channel); fos.close(); dataset.addParameterRef(new URL("file:"+ChannelIdUtil.toString(seis.channel_id)), channelParamName, channel, chanAudit); } String seisName = sacFile.getName(); if (seisName.endsWith(".SAC")) { seisName = seisName.substring(0,seisName.length()-4); } // end of if (seisName.endsWith(".SAC")) seis.setName(seisName); dataset.addSeismogramRef(seis, seisURL, seisName, new Property[0], new ParameterRef[0], audit); }
|
void loadSacFile(File sacFile) throws IOException, FissuresException { if (excludes.contains(sacFile.getName())) { return; } // end of if (excludes.contains(sacFile.getName())) if (paramRefs.containsValue(sacFile.getName())) { return; } // end of if (excludes.contains(sacFile.getName())) SacTimeSeries sac = new SacTimeSeries(); sac.read(sacFile.getCanonicalPath()); AuditInfo[] audit = new AuditInfo[1]; audit[0] = new AuditInfo(userName+" via SacDirToDataSet", "seismogram loaded from "+sacFile.getCanonicalPath()); URL seisURL = new URL(dirURL, sacFile.getName()); // System.out.println(" the seisURL is "+seisURL.toString()); // DataInputStream dis = new DataInputStream(new BufferedInputStream(seisURL.openStream())); // SacTimeSeries sac = new SacTimeSeries(); //sac.read(dis); edu.iris.Fissures.seismogramDC.LocalSeismogramImpl seis = SacToFissures.getSeismogram(sac); System.out.println("The PATH is "+sacFile.getParent()); edu.sc.seis.fissuresUtil.cache.CacheEvent event = SacToFissures.getEvent(sac); if (event != null && dataset.getParameter(EVENT) == null) { String eventName = event.get_attributes().name; String eName = eventName.replace(' ', '_'); // add event File outFile = new File(sacFile.getParent(), eName); OutputStream fos = new BufferedOutputStream(new FileOutputStream(outFile)); AuditInfo[] eventAudit = new AuditInfo[1]; eventAudit[0] = new AuditInfo(System.getProperty("user.name"), "event loaded from sac file."); XMLParameter.write(fos, event); fos.close(); dataset.addParameterRef( new URL("file:"+eName), EVENT, event,eventAudit); edu.sc.seis.fissuresUtil.cache.CacheEvent cacheEvent = (edu.sc.seis.fissuresUtil.cache.CacheEvent)((XMLDataSet)dataset).getParameter(EVENT); if(cacheEvent == null){ System.out.println("CACHE EVENT IS NULL"); System.exit(0); } else System.out.println("CACHE EVENT IS NOT NULL"); } // end of if (event != null) Channel channel = SacToFissures.getChannel(sac); String channelParamName = CHANNEL+ChannelIdUtil.toString(seis.channel_id); if (channel != null && dataset.getParameter(channelParamName) == null) { String chanFileName = ChannelIdUtil.toString(seis.channel_id); chanFileName = chanFileName.replace(' ', '_'); File outFile = new File(sacFile.getParent(), chanFileName); BufferedOutputStream fos = new BufferedOutputStream(new FileOutputStream(outFile)); // add event AuditInfo[] chanAudit = new AuditInfo[1]; chanAudit[0] = new AuditInfo(System.getProperty("user.name"), "channel loaded from sac file."); XMLParameter.write(fos, channel); fos.close(); dataset.addParameterRef(new URL("file:"+ChannelIdUtil.toString(seis.channel_id)), channelParamName, channel, chanAudit); } String seisName = sacFile.getName(); if (seisName.endsWith(".SAC")) { seisName = seisName.substring(0,seisName.length()-4); } // end of if (seisName.endsWith(".SAC")) seis.setName(seisName); dataset.addSeismogramRef(seis, seisURL, seisName, new Property[0], new ParameterRef[0], audit); }
| 1,118,611
|
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { CalSvcI svc = form.getCalSvcI(); String name = request.getParameter("name"); if (name == null) { form.getErr().emit("org.bedework.client.missingfield", "name"); return "error"; } BwView view = svc.findView(name); if (view == null) { form.getErr().emit("org.bedework.client.notfound", name); return "notFound"; } form.setView(view); form.setSubscriptions(svc.getSubscriptions()); return "success"; }
|
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { CalSvcI svc = form.getCalSvcI(); String name = request.getParameter("name"); if (name == null) { form.getErr().emit("org.bedework.client.error.missingfield", "name"); return "error"; } BwView view = svc.findView(name); if (view == null) { form.getErr().emit("org.bedework.client.notfound", name); return "notFound"; } form.setView(view); form.setSubscriptions(svc.getSubscriptions()); return "success"; }
| 1,118,615
|
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { CalSvcI svc = form.getCalSvcI(); String name = request.getParameter("name"); if (name == null) { form.getErr().emit("org.bedework.client.missingfield", "name"); return "error"; } BwView view = svc.findView(name); if (view == null) { form.getErr().emit("org.bedework.client.notfound", name); return "notFound"; } form.setView(view); form.setSubscriptions(svc.getSubscriptions()); return "success"; }
|
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { CalSvcI svc = form.getCalSvcI(); String name = request.getParameter("name"); if (name == null) { form.getErr().emit("org.bedework.client.missingfield", "name"); return "error"; } BwView view = svc.findView(name); if (view == null) { form.getErr().emit("org.bedework.client.error.notfound", name); return "notFound"; } form.setView(view); form.setSubscriptions(svc.getSubscriptions()); return "success"; }
| 1,118,616
|
protected String isoDateTimeFld() throws Exception { if (fldval == null) { throw new Exception("No value for " + tagName); } /** Value should be of form yyyy-MM-dd hh:mm:ss.0 or yyyy-MM-dd hh:mm:ss, convert to yyyyMMddThhmmss */ if ((fldval.length() < 21) || (fldval.charAt(4) != '-') || (fldval.charAt(7) != '-') || (fldval.charAt(10) != ' ') || (fldval.charAt(13) != ':') || (fldval.charAt(16) != ':')) { throw new Exception("Bad value " + fldval + " for " + tagName); } String dtval = fldval.substring(0, 4) + fldval.substring(5, 7) + fldval.substring(8, 10) + "T" + fldval.substring(11, 13) + fldval.substring(14, 16) + fldval.substring(17, 19); return dtval; }
|
protected String isoDateTimeFld() throws Exception { if (fldval == null) { throw new Exception("No value for " + tagName); } /** Value should be of form yyyy-MM-dd hh:mm:ss.0 or yyyy-MM-dd hh:mm:ss, convert to yyyyMMddThhmmss */ if ((fldval.length() < 21) || (fldval.charAt(4) != '-') || (fldval.charAt(7) != '-') || (fldval.charAt(10) != ' ') || (fldval.charAt(13) != ':') || (fldval.charAt(16) != ':')) { throw new Exception("Bad value " + fldval + " for " + tagName); } String dtval = fldval.substring(0, 4) + fldval.substring(5, 7) + fldval.substring(8, 10) + "T" + fldval.substring(11, 13) + fldval.substring(14, 16) + fldval.substring(17, 19) + "Z"; return dtval; }
| 1,118,617
|
public ParticleMotionDisplay(DataSetSeismogram datasetSeismogram, Registrar registrar, boolean advancedOption) { this.registrar = registrar; particleDisplayPanel = new JLayeredPane(); OverlayLayout overlayLayout = new OverlayLayout(particleDisplayPanel); radioPanel = new JPanel(); this.setLayout(new BorderLayout()); particleDisplayPanel.setLayout(overlayLayout); radioPanel.setLayout(new GridLayout(1, 0)); view = new ParticleMotionView(this); view.setSize(new java.awt.Dimension(300, 300)); particleDisplayPanel.add(view, PARTICLE_MOTION_LAYER); hAmpScaleMap = new AmpScaleMapper(50, 4, registrar); vAmpScaleMap = new AmpScaleMapper(50, 4, registrar); ScaleBorder scaleBorder = new ScaleBorder(); scaleBorder.setBottomScaleMapper(hAmpScaleMap); scaleBorder.setLeftScaleMapper(vAmpScaleMap); hTitleBorder = new BottomTitleBorder("X - axis Title"); vTitleBorder = new LeftTitleBorder("Y - axis Title"); Border titleBorder = BorderFactory.createCompoundBorder(hTitleBorder, vTitleBorder); Border bevelBorder = BorderFactory.createRaisedBevelBorder(); Border bevelTitleBorder = BorderFactory.createCompoundBorder(bevelBorder, titleBorder); Border lowBevelBorder = BorderFactory.createLoweredBevelBorder(); Border scaleBevelBorder = BorderFactory.createCompoundBorder(scaleBorder, lowBevelBorder); particleDisplayPanel.setBorder(BorderFactory.createCompoundBorder(bevelTitleBorder, scaleBevelBorder)); add(particleDisplayPanel, BorderLayout.CENTER); radioPanel.setVisible(false); add(radioPanel, BorderLayout.SOUTH); if(registrar != null) { registrar.addListener((AmpListener)this); registrar.addListener((TimeListener)this); } addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { resize(); } public void componentShown(ComponentEvent e) { resize(); } }); ParticleMotionDisplayThread t = new ParticleMotionDisplayThread(datasetSeismogram, registrar, advancedOption, true, this); t.execute(); initialized = t.getCompletion(); }
|
public ParticleMotionDisplay(DataSetSeismogram datasetSeismogram, Registrar registrar, boolean advancedOption) { particleDisplayPanel = new JLayeredPane(); OverlayLayout overlayLayout = new OverlayLayout(particleDisplayPanel); radioPanel = new JPanel(); this.setLayout(new BorderLayout()); particleDisplayPanel.setLayout(overlayLayout); radioPanel.setLayout(new GridLayout(1, 0)); view = new ParticleMotionView(this); view.setSize(new java.awt.Dimension(300, 300)); particleDisplayPanel.add(view, PARTICLE_MOTION_LAYER); hAmpScaleMap = new AmpScaleMapper(50, 4, registrar); vAmpScaleMap = new AmpScaleMapper(50, 4, registrar); ScaleBorder scaleBorder = new ScaleBorder(); scaleBorder.setBottomScaleMapper(hAmpScaleMap); scaleBorder.setLeftScaleMapper(vAmpScaleMap); hTitleBorder = new BottomTitleBorder("X - axis Title"); vTitleBorder = new LeftTitleBorder("Y - axis Title"); Border titleBorder = BorderFactory.createCompoundBorder(hTitleBorder, vTitleBorder); Border bevelBorder = BorderFactory.createRaisedBevelBorder(); Border bevelTitleBorder = BorderFactory.createCompoundBorder(bevelBorder, titleBorder); Border lowBevelBorder = BorderFactory.createLoweredBevelBorder(); Border scaleBevelBorder = BorderFactory.createCompoundBorder(scaleBorder, lowBevelBorder); particleDisplayPanel.setBorder(BorderFactory.createCompoundBorder(bevelTitleBorder, scaleBevelBorder)); add(particleDisplayPanel, BorderLayout.CENTER); radioPanel.setVisible(false); add(radioPanel, BorderLayout.SOUTH); if(registrar != null) { registrar.addListener((AmpListener)this); registrar.addListener((TimeListener)this); } addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { resize(); } public void componentShown(ComponentEvent e) { resize(); } }); ParticleMotionDisplayThread t = new ParticleMotionDisplayThread(datasetSeismogram, registrar, advancedOption, true, this); t.execute(); initialized = t.getCompletion(); }
| 1,118,618
|
public ParticleMotionDisplay(DataSetSeismogram datasetSeismogram, Registrar registrar, boolean advancedOption) { this.registrar = registrar; particleDisplayPanel = new JLayeredPane(); OverlayLayout overlayLayout = new OverlayLayout(particleDisplayPanel); radioPanel = new JPanel(); this.setLayout(new BorderLayout()); particleDisplayPanel.setLayout(overlayLayout); radioPanel.setLayout(new GridLayout(1, 0)); view = new ParticleMotionView(this); view.setSize(new java.awt.Dimension(300, 300)); particleDisplayPanel.add(view, PARTICLE_MOTION_LAYER); hAmpScaleMap = new AmpScaleMapper(50, 4, registrar); vAmpScaleMap = new AmpScaleMapper(50, 4, registrar); ScaleBorder scaleBorder = new ScaleBorder(); scaleBorder.setBottomScaleMapper(hAmpScaleMap); scaleBorder.setLeftScaleMapper(vAmpScaleMap); hTitleBorder = new BottomTitleBorder("X - axis Title"); vTitleBorder = new LeftTitleBorder("Y - axis Title"); Border titleBorder = BorderFactory.createCompoundBorder(hTitleBorder, vTitleBorder); Border bevelBorder = BorderFactory.createRaisedBevelBorder(); Border bevelTitleBorder = BorderFactory.createCompoundBorder(bevelBorder, titleBorder); Border lowBevelBorder = BorderFactory.createLoweredBevelBorder(); Border scaleBevelBorder = BorderFactory.createCompoundBorder(scaleBorder, lowBevelBorder); particleDisplayPanel.setBorder(BorderFactory.createCompoundBorder(bevelTitleBorder, scaleBevelBorder)); add(particleDisplayPanel, BorderLayout.CENTER); radioPanel.setVisible(false); add(radioPanel, BorderLayout.SOUTH); if(registrar != null) { registrar.addListener((AmpListener)this); registrar.addListener((TimeListener)this); } addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { resize(); } public void componentShown(ComponentEvent e) { resize(); } }); ParticleMotionDisplayThread t = new ParticleMotionDisplayThread(datasetSeismogram, registrar, advancedOption, true, this); t.execute(); initialized = t.getCompletion(); }
|
public ParticleMotionDisplay(DataSetSeismogram datasetSeismogram, Registrar registrar, boolean advancedOption) { this.registrar = registrar; particleDisplayPanel = new JLayeredPane(); OverlayLayout overlayLayout = new OverlayLayout(particleDisplayPanel); radioPanel = new JPanel(); this.setLayout(new BorderLayout()); particleDisplayPanel.setLayout(overlayLayout); radioPanel.setLayout(new GridLayout(1, 0)); view = new ParticleMotionView(this); view.setSize(new java.awt.Dimension(300, 300)); particleDisplayPanel.add(view, PARTICLE_MOTION_LAYER); hAmpScaleMap = new AmpScaleMapper(50, 4, registrar); vAmpScaleMap = new AmpScaleMapper(50, 4, registrar); ScaleBorder scaleBorder = new ScaleBorder(); scaleBorder.setBottomScaleMapper(hAmpScaleMap); scaleBorder.setLeftScaleMapper(vAmpScaleMap); hTitleBorder = new BottomTitleBorder("X - axis Title"); vTitleBorder = new LeftTitleBorder("Y - axis Title"); Border titleBorder = BorderFactory.createCompoundBorder(hTitleBorder, vTitleBorder); Border bevelBorder = BorderFactory.createRaisedBevelBorder(); Border bevelTitleBorder = BorderFactory.createCompoundBorder(bevelBorder, titleBorder); Border lowBevelBorder = BorderFactory.createLoweredBevelBorder(); Border scaleBevelBorder = BorderFactory.createCompoundBorder(scaleBorder, lowBevelBorder); particleDisplayPanel.setBorder(BorderFactory.createCompoundBorder(bevelTitleBorder, scaleBevelBorder)); add(particleDisplayPanel, BorderLayout.CENTER); radioPanel.setVisible(false); add(radioPanel, BorderLayout.SOUTH); if(registrar != null) { registrar.addListener((AmpListener)this); registrar.addListener((TimeListener)this); } addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { resize(); } public void componentShown(ComponentEvent e) { resize(); } }); ParticleMotionDisplayThread t = new ParticleMotionDisplayThread(datasetSeismogram, registrar, advancedOption, true, this); t.execute(); initialized = t.getCompletion(); }
| 1,118,619
|
public synchronized void addParticleMotionDisplay(DataSetSeismogram datasetSeismogram, Registrar registrar) { this.registrar = registrar; boolean buttonPanel = this.displayButtonPanel; displayButtonPanel = false; ParticleMotionDisplayThread t = new ParticleMotionDisplayThread(datasetSeismogram, registrar, false, buttonPanel, this); t.execute(); }
|
public synchronized void addParticleMotionDisplay(DataSetSeismogram datasetSeismogram, Registrar registrar) { this.registrar = registrar; boolean buttonPanel = this.displayButtonPanel; displayButtonPanel = false; ParticleMotionDisplayThread t = new ParticleMotionDisplayThread(datasetSeismogram, registrar, false, buttonPanel, this); t.execute(); }
| 1,118,621
|
public synchronized void addParticleMotionDisplay(DataSetSeismogram datasetSeismogram, Registrar registrar) { this.registrar = registrar; boolean buttonPanel = this.displayButtonPanel; displayButtonPanel = false; ParticleMotionDisplayThread t = new ParticleMotionDisplayThread(datasetSeismogram, registrar, false, buttonPanel, this); t.execute(); }
|
public synchronized void addParticleMotionDisplay(DataSetSeismogram datasetSeismogram, Registrar registrar) { this.registrar = registrar; boolean buttonPanel = this.displayButtonPanel; displayButtonPanel = false; ParticleMotionDisplayThread t = new ParticleMotionDisplayThread(datasetSeismogram, registrar, false, buttonPanel, this); t.execute(); }
| 1,118,622
|
protected AbstractDefaultQueryPersonAttributeDao getAbstractDefaultQueryPersonAttributeDao() { final String queryAttr = "uid"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(uid={0})"); impl.setQueryAttributes(queryAttrList); return impl; }
|
protected AbstractDefaultQueryPersonAttributeDao getAbstractDefaultQueryPersonAttributeDao() { final String queryAttr = "uid"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setContextSource(this.contextSource); impl.setQuery("(uid={0})"); impl.setQueryAttributes(queryAttrList); return impl; }
| 1,118,623
|
protected void setUp() throws Exception { super.setUp(); Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap://mrfrumble.its.yale.edu:389/o=yale.edu"); this.ldapContext = new InitialLdapContext(env, null); }
|
protected void setUp() throws Exception { super.setUp(); Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory"); env.put(Context.PROVIDER_URL, "ldap://mrfrumble.its.yale.edu:389/o=yale.edu"); this.ldapContext = new InitialLdapContext(env, null); }
| 1,118,624
|
protected void tearDown() throws Exception { super.tearDown(); this.ldapContext = null; }
|
protected void tearDown() throws Exception { super.tearDown(); this.contextSource = null; }
| 1,118,625
|
public void testDefaultAttrMap() { final String queryAttr = "uid"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", null); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(uid={0})"); impl.setQueryAttributes(queryAttrList); Map queryMap = new HashMap(); queryMap.put(queryAttr, "awp9"); Map attribs = impl.getUserAttributes(queryMap); assertEquals("andrew.petro@yale.edu", attribs.get("mail")); }
|
public void testDefaultAttrMap() { final String queryAttr = "uid"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", null); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setContextSource(this.contextSource); impl.setQuery("(uid={0})"); impl.setQueryAttributes(queryAttrList); Map queryMap = new HashMap(); queryMap.put(queryAttr, "awp9"); Map attribs = impl.getUserAttributes(queryMap); assertEquals("andrew.petro@yale.edu", attribs.get("mail")); }
| 1,118,626
|
public void testInsufficientAttrQuery() { final String queryAttr1 = "uid"; final String queryAttr2 = "alias"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr1); queryAttrList.add(queryAttr2); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(&(uid={0})(alias={1}))"); impl.setQueryAttributes(queryAttrList); Map queryMap = new HashMap(); queryMap.put(queryAttr1, "awp9"); queryMap.put("email", "edalquist@unicon.net"); Map attribs = impl.getUserAttributes(queryMap); assertNull(attribs); }
|
public void testInsufficientAttrQuery() { final String queryAttr1 = "uid"; final String queryAttr2 = "alias"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr1); queryAttrList.add(queryAttr2); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setContextSource(this.contextSource); impl.setQuery("(&(uid={0})(alias={1}))"); impl.setQueryAttributes(queryAttrList); Map queryMap = new HashMap(); queryMap.put(queryAttr1, "awp9"); queryMap.put("email", "edalquist@unicon.net"); Map attribs = impl.getUserAttributes(queryMap); assertNull(attribs); }
| 1,118,627
|
public void testInvalidAttrMap() { final String queryAttr = "uid"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("email", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(uid={0})"); impl.setQueryAttributes(queryAttrList); Map queryMap = new HashMap(); queryMap.put(queryAttr, "awp9"); Map attribs = impl.getUserAttributes(queryMap); assertNull(attribs.get("email")); }
|
public void testInvalidAttrMap() { final String queryAttr = "uid"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("email", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setContextSource(this.contextSource); impl.setQuery("(uid={0})"); impl.setQueryAttributes(queryAttrList); Map queryMap = new HashMap(); queryMap.put(queryAttr, "awp9"); Map attribs = impl.getUserAttributes(queryMap); assertNull(attribs.get("email")); }
| 1,118,628
|
public void testMultiAttrQuery() { final String queryAttr1 = "uid"; final String queryAttr2 = "alias"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr1); queryAttrList.add(queryAttr2); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(&(uid={0})(alias={1}))"); impl.setQueryAttributes(queryAttrList); Map queryMap = new HashMap(); queryMap.put(queryAttr1, "awp9"); queryMap.put(queryAttr2, "andrew.petro"); queryMap.put("email", "edalquist@unicon.net"); Map attribs = impl.getUserAttributes(queryMap); assertEquals("andrew.petro@yale.edu", attribs.get("email")); }
|
public void testMultiAttrQuery() { final String queryAttr1 = "uid"; final String queryAttr2 = "alias"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr1); queryAttrList.add(queryAttr2); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setContextSource(this.contextSource); impl.setQuery("(&(uid={0})(alias={1}))"); impl.setQueryAttributes(queryAttrList); Map queryMap = new HashMap(); queryMap.put(queryAttr1, "awp9"); queryMap.put(queryAttr2, "andrew.petro"); queryMap.put("email", "edalquist@unicon.net"); Map attribs = impl.getUserAttributes(queryMap); assertEquals("andrew.petro@yale.edu", attribs.get("email")); }
| 1,118,629
|
public void testNotFoundQuery() { final String queryAttr = "uid"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(uid={0})"); impl.setQueryAttributes(queryAttrList); Map queryMap = new HashMap(); queryMap.put(queryAttr, "unknown"); Map attribs = impl.getUserAttributes(queryMap); assertNull(attribs); }
|
public void testNotFoundQuery() { final String queryAttr = "uid"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setContextSource(this.contextSource); impl.setQuery("(uid={0})"); impl.setQueryAttributes(queryAttrList); Map queryMap = new HashMap(); queryMap.put(queryAttr, "unknown"); Map attribs = impl.getUserAttributes(queryMap); assertNull(attribs); }
| 1,118,630
|
public void testNullContext() { LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); impl.setLdapContext(ldapContext); try { impl.getUserAttributes(Collections.singletonMap("dummy", "seed")); fail("IllegalStateException should have been thrown with no query configured"); } catch (IllegalStateException ise) { //expected } }
|
public void testNullContext() { LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); impl.setContextSource(this.contextSource); try { impl.getUserAttributes(Collections.singletonMap("dummy", "seed")); fail("IllegalStateException should have been thrown with no query configured"); } catch (IllegalStateException ise) { //expected } }
| 1,118,631
|
public void testProperties() { LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); assertEquals("", impl.getBaseDN()); impl.setBaseDN("BaseDN"); assertEquals("BaseDN", impl.getBaseDN()); impl.setBaseDN(null); assertEquals("", impl.getBaseDN()); assertEquals(Collections.EMPTY_MAP, impl.getLdapAttributesToPortalAttributes()); Map attrMap = new HashMap(); attrMap.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(attrMap); Map expectedAttrMap = new HashMap(attrMap); expectedAttrMap.put("mail", Collections.singleton("email")); assertEquals(expectedAttrMap, impl.getLdapAttributesToPortalAttributes()); assertNull(impl.getLdapContext()); impl.setLdapContext(ldapContext); assertEquals(ldapContext, impl.getLdapContext()); impl.setLdapAttributesToPortalAttributes(null); assertEquals(Collections.EMPTY_SET, impl.getPossibleUserAttributeNames()); impl.setLdapAttributesToPortalAttributes(attrMap); assertEquals(Collections.singleton("email"), impl.getPossibleUserAttributeNames()); assertNull(impl.getQuery()); impl.setQuery("QueryString"); assertEquals("QueryString", impl.getQuery()); assertEquals(Collections.EMPTY_LIST, impl.getQueryAttributes()); impl.setQueryAttributes(Collections.singletonList("QAttr")); assertEquals(Collections.singletonList("QAttr"), impl.getQueryAttributes()); assertEquals(0, impl.getTimeLimit()); impl.setTimeLimit(1337); assertEquals(1337, impl.getTimeLimit()); }
|
public void testProperties() { LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); assertEquals("", impl.getBaseDN()); impl.setBaseDN("BaseDN"); assertEquals("BaseDN", impl.getBaseDN()); impl.setBaseDN(null); assertEquals("", impl.getBaseDN()); assertEquals(Collections.EMPTY_MAP, impl.getLdapAttributesToPortalAttributes()); Map attrMap = new HashMap(); attrMap.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(attrMap); Map expectedAttrMap = new HashMap(attrMap); expectedAttrMap.put("mail", Collections.singleton("email")); assertEquals(expectedAttrMap, impl.getLdapAttributesToPortalAttributes()); assertNull(impl.getLdapContext()); impl.setLdapContext(ldapContext); assertEquals(ldapContext, impl.getLdapContext()); impl.setLdapAttributesToPortalAttributes(null); assertEquals(Collections.EMPTY_SET, impl.getPossibleUserAttributeNames()); impl.setLdapAttributesToPortalAttributes(attrMap); assertEquals(Collections.singleton("email"), impl.getPossibleUserAttributeNames()); assertNull(impl.getQuery()); impl.setQuery("QueryString"); assertEquals("QueryString", impl.getQuery()); assertEquals(Collections.EMPTY_LIST, impl.getQueryAttributes()); impl.setQueryAttributes(Collections.singletonList("QAttr")); assertEquals(Collections.singletonList("QAttr"), impl.getQueryAttributes()); assertEquals(0, impl.getTimeLimit()); impl.setTimeLimit(1337); assertEquals(1337, impl.getTimeLimit()); }
| 1,118,632
|
public void testSingleAttrQuery() { final String queryAttr = "uid"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(uid={0})"); impl.setQueryAttributes(queryAttrList); Map queryMap = new HashMap(); queryMap.put(queryAttr, "awp9"); Map attribs = impl.getUserAttributes(queryMap); assertEquals("andrew.petro@yale.edu", attribs.get("email")); }
|
public void testSingleAttrQuery() { final String queryAttr = "uid"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setContextSource(this.contextSource); impl.setQuery("(uid={0})"); impl.setQueryAttributes(queryAttrList); Map queryMap = new HashMap(); queryMap.put(queryAttr, "awp9"); Map attribs = impl.getUserAttributes(queryMap); assertEquals("andrew.petro@yale.edu", attribs.get("email")); }
| 1,118,633
|
public void testToString() { final String queryAttr1 = "uid"; final String queryAttr2 = "alias"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr1); queryAttrList.add(queryAttr2); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(&(uid={0})(alias={1}))"); impl.setQueryAttributes(queryAttrList); StringBuffer expected = new StringBuffer(); expected.append(impl.getClass().getName()); expected.append("@"); expected.append(Integer.toHexString(impl.hashCode())); expected.append("[ldapContext="); expected.append(ldapContext.getClass().getName()); expected.append("@"); expected.append(Integer.toHexString(ldapContext.hashCode())); expected.append(", timeLimit=0, baseDN=, query=(&(uid={0})(alias={1})), queryAttributes=[uid, alias], ldapAttributesToPortalAttributes={mail=[email]}]"); String result = impl.toString(); assertEquals(expected.toString(), result); }
|
public void testToString() { final String queryAttr1 = "uid"; final String queryAttr2 = "alias"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr1); queryAttrList.add(queryAttr2); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setContextSource(this.contextSource); impl.setQuery("(&(uid={0})(alias={1}))"); impl.setQueryAttributes(queryAttrList); StringBuffer expected = new StringBuffer(); expected.append(impl.getClass().getName()); expected.append("@"); expected.append(Integer.toHexString(impl.hashCode())); expected.append("[ldapContext="); expected.append(ldapContext.getClass().getName()); expected.append("@"); expected.append(Integer.toHexString(ldapContext.hashCode())); expected.append(", timeLimit=0, baseDN=, query=(&(uid={0})(alias={1})), queryAttributes=[uid, alias], ldapAttributesToPortalAttributes={mail=[email]}]"); String result = impl.toString(); assertEquals(expected.toString(), result); }
| 1,118,634
|
public void testToString() { final String queryAttr1 = "uid"; final String queryAttr2 = "alias"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr1); queryAttrList.add(queryAttr2); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(&(uid={0})(alias={1}))"); impl.setQueryAttributes(queryAttrList); StringBuffer expected = new StringBuffer(); expected.append(impl.getClass().getName()); expected.append("@"); expected.append(Integer.toHexString(impl.hashCode())); expected.append("[ldapContext="); expected.append(ldapContext.getClass().getName()); expected.append("@"); expected.append(Integer.toHexString(ldapContext.hashCode())); expected.append(", timeLimit=0, baseDN=, query=(&(uid={0})(alias={1})), queryAttributes=[uid, alias], ldapAttributesToPortalAttributes={mail=[email]}]"); String result = impl.toString(); assertEquals(expected.toString(), result); }
|
public void testToString() { final String queryAttr1 = "uid"; final String queryAttr2 = "alias"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr1); queryAttrList.add(queryAttr2); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(&(uid={0})(alias={1}))"); impl.setQueryAttributes(queryAttrList); StringBuffer expected = new StringBuffer(); expected.append(impl.getClass().getName()); expected.append("@"); expected.append(Integer.toHexString(impl.hashCode())); expected.append("[ldapContext="); expected.append(ldapContext.getClass().getName()); expected.append("@"); expected.append(Integer.toHexString(ldapContext.hashCode())); expected.append(", timeLimit=0, baseDN=, query=(&(uid={0})(alias={1})), queryAttributes=[uid, alias], ldapAttributesToPortalAttributes={mail=[email]}]"); String result = impl.toString(); assertEquals(expected.toString(), result); }
| 1,118,635
|
public void testToString() { final String queryAttr1 = "uid"; final String queryAttr2 = "alias"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr1); queryAttrList.add(queryAttr2); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(&(uid={0})(alias={1}))"); impl.setQueryAttributes(queryAttrList); StringBuffer expected = new StringBuffer(); expected.append(impl.getClass().getName()); expected.append("@"); expected.append(Integer.toHexString(impl.hashCode())); expected.append("[ldapContext="); expected.append(ldapContext.getClass().getName()); expected.append("@"); expected.append(Integer.toHexString(ldapContext.hashCode())); expected.append(", timeLimit=0, baseDN=, query=(&(uid={0})(alias={1})), queryAttributes=[uid, alias], ldapAttributesToPortalAttributes={mail=[email]}]"); String result = impl.toString(); assertEquals(expected.toString(), result); }
|
public void testToString() { final String queryAttr1 = "uid"; final String queryAttr2 = "alias"; final List queryAttrList = new LinkedList(); queryAttrList.add(queryAttr1); queryAttrList.add(queryAttr2); LdapPersonAttributeDaoImpl impl = new LdapPersonAttributeDaoImpl(); Map ldapAttribsToPortalAttribs = new HashMap(); ldapAttribsToPortalAttribs.put("mail", "email"); impl.setLdapAttributesToPortalAttributes(ldapAttribsToPortalAttribs); impl.setLdapContext(ldapContext); impl.setQuery("(&(uid={0})(alias={1}))"); impl.setQueryAttributes(queryAttrList); StringBuffer expected = new StringBuffer(); expected.append(impl.getClass().getName()); expected.append("@"); expected.append(Integer.toHexString(impl.hashCode())); expected.append("[ldapContext="); expected.append(ldapContext.getClass().getName()); expected.append("@"); expected.append(Integer.toHexString(contextSource.hashCode())); expected.append(", timeLimit=0, baseDN=, query=(&(uid={0})(alias={1})), queryAttributes=[uid, alias], ldapAttributesToPortalAttributes={mail=[email]}]"); String result = impl.toString(); assertEquals(expected.toString(), result); }
| 1,118,636
|
public void removeParent(BasicSeismogramDisplay disowner){ parents.remove(disowner); if(parents.isEmpty()){ Iterator e = displays.iterator(); while(e.hasNext()){ ((BasicSeismogramDisplay)e.next()).remove(); } } }
|
public void removeParent(BasicSeismogramDisplay disowner){ parents.remove(disowner); if(parents.isEmpty()){ Iterator e = displays.iterator(); while(e.hasNext()){ ((BasicSeismogramDisplay)e.next()).remove(); } } }
| 1,118,637
|
private void setInterval(TimeInterval newInterval){ double currentInterval = latestTime.getTime().getInterval().getValue(); System.out.println(newInterval); double scale = newInterval.getValue()/currentInterval; internalRegistrar.shaleTime(0, scale); }
|
private void setInterval(TimeInterval newInterval){ double currentInterval = latestTime.getTime().getInterval().getValue(); double scale = newInterval.getValue()/currentInterval; internalRegistrar.shaleTime(0, scale); }
| 1,118,638
|
public void setIsUnderline(boolean value){ this.setAttribute(ATTRIBUTE_IS_UNDERLINE, Boolean.toString(value)); }
|
public void setIsUnderline(boolean value){ this.setAttribute(ATTRIBUTE_IS_UNDERLINE, String.valueOf(value)); }
| 1,118,639
|
public int getMaxDescriptionLength() { return BwEvent.maxDescriptionLength; }
|
public int getMaxDescriptionLength() { try { return fetchSvci().getSyspars().getMaxPublicDescriptionLength(); } catch (Throwable t) { err.emit(t); return 0; } }
| 1,118,640
|
public JavaClosure(ATObject scope, JavaMethod meth) { super(meth, null); scope_ = scope; }
|
public JavaClosure(ATObject scope, JavaMethod meth) { super(meth, null); scope_ = scope; }
| 1,118,641
|
public String getDefaultPersonalAccess() { return defaultPersonalAccess; }
|
public static String getDefaultPersonalAccess() { return defaultPersonalAccess; }
| 1,118,642
|
public String getDefaultPublicAccess() { return defaultPublicAccess; }
|
public static String getDefaultPublicAccess() { return defaultPublicAccess; }
| 1,118,643
|
public CurrentAccess evaluateAccess(AccessPrincipal who, String owner, Privilege[] how, char[] acl, PrivilegeSet filter) throws AccessException { boolean authenticated = !who.getUnauthenticated(); boolean isOwner = false; CurrentAccess ca = new CurrentAccess(); ca.desiredAccess = how; ca.acl = this; decode(acl); if (authenticated) { isOwner = who.getAccount().equals(owner); } StringBuffer debugsb = null; if (debug) { debugsb = new StringBuffer("Check access for '"); debugsb.append(new String(acl)); debugsb.append("' with authenticated = "); debugsb.append(authenticated); debugsb.append(" isOwner = "); debugsb.append(isOwner); } getPrivileges: { if (!authenticated) { ca.privileges = Ace.findMergedPrivilege(this, null, Ace.whoTypeUnauthenticated); break getPrivileges; } if (isOwner) { ca.privileges = Ace.findMergedPrivilege(this, null, Ace.whoTypeOwner); if (ca.privileges == null) { ca.privileges = PrivilegeSet.makeDefaultOwnerPrivileges(); } break getPrivileges; } // Not owner - look for user ca.privileges = Ace.findMergedPrivilege(this, who.getAccount(), Ace.whoTypeUser); if (ca.privileges != null) { if (debug) { debugsb.append("... For user got: " + ca.privileges); } break getPrivileges; } // No specific user access - look for group access if (who.getGroupNames() != null) { Iterator it = who.getGroupNames().iterator(); while (it.hasNext()) { String group = (String)it.next(); if (debug) { debugsb.append("...Try access for group " + group); } PrivilegeSet privs = Ace.findMergedPrivilege(this, group, Ace.whoTypeGroup); if (privs != null) { ca.privileges = PrivilegeSet.mergePrivileges(ca.privileges, privs, false); } } } if (ca.privileges != null) { if (debug) { debugsb.append("...For groups got: " + ca.privileges); } break getPrivileges; } // "other" access set? ca.privileges = Ace.findMergedPrivilege(this, null, Ace.whoTypeOther); if (ca.privileges != null) { if (debug) { debugsb.append("...For other got: " + ca.privileges); } break getPrivileges; } } // getPrivileges if (ca.privileges == null) { if (debug) { debugMsg(debugsb.toString() + "...Check access denied (noprivs)"); } return ca; } ca.privileges.setUnspecified(isOwner); if (filter != null) { ca.privileges.filterPrivileges(filter); } if (how.length == 0) { // Means any access will do ca.accessAllowed = ca.privileges.getAnyAllowed(); return ca; } for (int i = 0; i < how.length; i++) { char priv = ca.privileges.getPrivilege(how[i].getIndex()); if ((priv != allowed) && (priv != allowedInherited)) { if (debug) { debugMsg(debugsb.toString() + "...Check access denied (!allowed)"); } return ca; } } if (debug) { debugMsg(debugsb.toString() + "...Check access allowed"); } ca.accessAllowed = true; return ca; }
|
public CurrentAccess evaluateAccess(AccessPrincipal who, String owner, Privilege[] how, char[] acl, PrivilegeSet filter) throws AccessException { boolean authenticated = !who.getUnauthenticated(); boolean isOwner = false; CurrentAccess ca = new CurrentAccess(); ca.desiredAccess = how; ca.acl = this; decode(acl); if (authenticated) { isOwner = who.getAccount().equals(owner); } StringBuffer debugsb = null; if (debug) { debugsb = new StringBuffer("Check access for '"); debugsb.append(new String(acl)); debugsb.append("' with authenticated = "); debugsb.append(authenticated); debugsb.append(" isOwner = "); debugsb.append(isOwner); } getPrivileges: { if (!authenticated) { ca.privileges = Ace.findMergedPrivilege(this, null, Ace.whoTypeUnauthenticated); break getPrivileges; } if (isOwner) { ca.privileges = Ace.findMergedPrivilege(this, null, Ace.whoTypeOwner); if (ca.privileges == null) { ca.privileges = PrivilegeSet.makeDefaultOwnerPrivileges(); } break getPrivileges; } // Not owner - look for user ca.privileges = Ace.findMergedPrivilege(this, who.getAccount(), Ace.whoTypeUser); if (ca.privileges != null) { if (debug) { debugsb.append("... For user got: " + ca.privileges); } break getPrivileges; } // No specific user access - look for group access if (who.getGroupNames() != null) { Iterator it = who.getGroupNames().iterator(); while (it.hasNext()) { String group = (String)it.next(); if (debug) { debugsb.append("...Try access for group " + group); } PrivilegeSet privs = Ace.findMergedPrivilege(this, group, Ace.whoTypeGroup); if (privs != null) { ca.privileges = PrivilegeSet.mergePrivileges(ca.privileges, privs, false); } } } if (ca.privileges != null) { if (debug) { debugsb.append("...For groups got: " + ca.privileges); } break getPrivileges; } // "other" access set? ca.privileges = Ace.findMergedPrivilege(this, null, Ace.whoTypeOther); if (ca.privileges != null) { if (debug) { debugsb.append("...For other got: " + ca.privileges); } break getPrivileges; } } // getPrivileges if (ca.privileges == null) { if (debug) { debugMsg(debugsb.toString() + "...Check access denied (noprivs)"); } return ca; } ca.privileges.setUnspecified(isOwner); if (filter != null) { ca.privileges.filterPrivileges(filter); } if (how.length == 0) { // Means any access will do ca.accessAllowed = ca.privileges.getAnyAllowed(); return ca; } for (int i = 0; i < how.length; i++) { char priv = ca.privileges.getPrivilege(how[i].getIndex()); if ((priv != allowed) && (priv != allowedInherited)) { if (debug) { debugsb.append("...Check access denied (!allowed) "); debugsb.append(ca.privileges); debugMsg(debugsb.toString()); } return ca; } } if (debug) { debugMsg(debugsb.toString() + "...Check access allowed"); } ca.accessAllowed = true; return ca; }
| 1,118,644
|
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access */ if (!form.getUserAuth().isSuperUser()) { return "noAccess"; } CalSvcI svci = form.getCalSvcI(); /** We are just updating from the current form values. */ BwAuthUser au = validateAuthUser(form); if (au == null) { return "retry"; } if (debug) { debugMsg("Update authUser " + au); } svci.getUserAuth().updateUser(au); form.getMsg().emit("org.bedework.pubevents.message.authuser.updated"); return "continue"; }
|
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access */ if (!form.getUserAuth().isSuperUser()) { return "noAccess"; } CalSvcI svci = form.getCalSvcI(); /** We are just updating from the current form values. */ BwAuthUser au = validateAuthUser(form); if (au == null) { return "retry"; } if (debug) { debugMsg("Update authUser " + au); } svci.getUserAuth().updateUser(au); form.getMsg().emit("org.bedework.client.message.authuser.updated"); return "continue"; }
| 1,118,647
|
public void dump(Logger log, String indent) { StringBuffer sb = new StringBuffer(indent); sb.append("<prop-filter name=\""); sb.append(name); sb.append("\">\n"); log.debug(sb.toString()); if (isDefined) { log.debug(indent + " " + "<is-defined/>\n"); } else if (timeRange != null) { timeRange.dump(log, indent + " "); } else { match.dump(log, indent + " "); } if (paramFilters != null) { Iterator it = paramFilters.iterator(); while (it.hasNext()) { ParamFilter pf = (ParamFilter)it.next(); pf.dump(log, indent + " "); } } log.debug(indent + "<prop-filter/>"); }
|
public void dump(Logger log, String indent) { StringBuffer sb = new StringBuffer(indent); sb.append("<prop-filter name=\""); sb.append(name); sb.append("\">\n"); log.debug(sb.toString()); if (isDefined) { log.debug(indent + " " + "<is-defined/>\n"); } else if (timeRange != null) { timeRange.dump(log, indent + " "); } else { match.dump(log, indent + " "); } if (paramFilters != null) { Iterator it = paramFilters.iterator(); while (it.hasNext()) { ParamFilter pf = (ParamFilter)it.next(); pf.dump(log, indent + " "); } } log.debug(indent + "<prop-filter/>"); }
| 1,118,652
|
public boolean filter(Component c) throws WebdavException { try { PropertyList pl = c.getProperties(); if (pl == null) { return false; } Property prop = pl.getProperty(getName()); if (prop == null) { return false; } if (getIsDefined()) { return true; } TextMatch match = getMatch(); if (match != null) { return match.matches(prop.getValue()); } TimeRange tr = getTimeRange(); if (tr == null) { // invalid state? return true; } return tr.matches(prop); } catch (Throwable t) { throw new WebdavException(t); } }
|
public boolean filter(Component c) throws WebdavException { try { PropertyList pl = c.getProperties(); if (pl == null) { return false; } Property prop = pl.getProperty(getName()); if (prop == null) { return false; } if (getIsDefined()) { return true; } TextMatch match = getMatch(); if (match != null) { return match.matches(prop.getValue()); } TimeRange tr = getTimeRange(); if (tr == null) { // invalid state? return true; } return tr.matches(prop); } catch (Throwable t) { throw new WebdavException(t); } }
| 1,118,653
|
public void dump(Logger log, String indent) { StringBuffer sb = new StringBuffer(indent); sb.append("<param-filter name=\""); sb.append(name); sb.append(">\n"); log.debug(sb.toString()); if (isDefined) { log.debug(indent + " " + "<is-defined/>\n"); } else { match.dump(log, indent + " "); } log.debug(indent + "<param-filter/>"); }
|
public void dump(Logger log, String indent) { StringBuffer sb = new StringBuffer(indent); sb.append("<param-filter name=\""); sb.append(name); sb.append(">\n"); log.debug(sb.toString()); if (isDefined) { log.debug(indent + " " + "<is-defined/>\n"); } else { match.dump(log, indent + " "); } log.debug(indent + "<param-filter/>"); }
| 1,118,654
|
public static void createSequence(String tableName, Connection conn, Object tableObj, SQLLoader statements) throws SQLException { try { Field field = tableObj.getClass().getField(tableName+"Seq"); String key = tableName + "Seq.create"; if(field != null ) { if (statements.has(key)) { String sql = statements.get(key); field.setAccessible(true); field.set(tableObj, new JDBCSequence(conn, tableName+"Seq", statements.get(tableName+"Seq.create"), statements.get(tableName+"Seq.nextVal"))); } else { throw new IllegalArgumentException(tableName+"Seq.create is not defined, unable to create sequence"); } } } catch(NoSuchFieldException e) { // no field following the naming convention, so skip } catch(IllegalArgumentException e) { GlobalExceptionHandler.handle("Thought this couldn't happen since I checked the object type.", e); } catch(IllegalAccessException e) { GlobalExceptionHandler.handle("Thought this couldn't happen since I called setAccessible. Looks like I was wrong", e); } }
|
public static void createSequence(String tableName, Connection conn, Object tableObj, SQLLoader statements) throws SQLException { try { Field field = tableObj.getClass().getDeclaredField(tableName+"Seq"); String key = tableName + "Seq.create"; if(field != null ) { if (statements.has(key)) { String sql = statements.get(key); field.setAccessible(true); field.set(tableObj, new JDBCSequence(conn, tableName+"Seq", statements.get(tableName+"Seq.create"), statements.get(tableName+"Seq.nextVal"))); } else { throw new IllegalArgumentException(tableName+"Seq.create is not defined, unable to create sequence"); } } } catch(NoSuchFieldException e) { // no field following the naming convention, so skip } catch(IllegalArgumentException e) { GlobalExceptionHandler.handle("Thought this couldn't happen since I checked the object type.", e); } catch(IllegalAccessException e) { GlobalExceptionHandler.handle("Thought this couldn't happen since I called setAccessible. Looks like I was wrong", e); } }
| 1,118,655
|
public org.omg.CORBA.Object resolve(String dns, String interfacename, String objectname) throws NotFound,CannotProceed, InvalidName, org.omg.CORBA.ORBPackage.InvalidName { dns = appendKindNames(dns); if(interfacename != null && interfacename.length() != 0) dns = dns + "/" + interfacename + ".interface"; if(objectname != null && objectname.length() != 0) { objectname = objectname;// + getVersion(); dns = dns + "/" + objectname + ".object"+getVersion(); } logger.info("the final dns resolved is "+dns); try { return getNameService().resolve(getNameService().to_name(dns)); } catch(NotFound nfe) { logger.info("NOT FOUND Exception caught while resolving dns name context and the name not found is "+nfe.rest_of_name[0].id); throw nfe; } catch(InvalidName ine) { logger.info("INVALID NAME Exception caught while resolving dns name context"); throw ine; } catch(CannotProceed cpe) { logger.info("CANNOT PROCEED Exception caught while resolving dns name context"); throw cpe; } }
|
public org.omg.CORBA.Object resolve(String dns, String interfacename, String objectname) throws NotFound,CannotProceed, InvalidName, org.omg.CORBA.ORBPackage.InvalidName { dns = appendKindNames(dns); if(interfacename != null && interfacename.length() != 0) dns = dns + "/" + interfacename + ".interface"; if(objectname != null && objectname.length() != 0) { objectname = objectname;// + getVersion(); dns = dns + "/" + objectname + ".object"+getVersion(); } logger.info("the final dns resolved is "+dns); try { NameComponent[] names = getNameService().to_name(dns); return getNameService().resolve(names); } catch(NotFound nfe) { logger.info("NOT FOUND Exception caught while resolving dns name context and the name not found is "+nfe.rest_of_name[0].id); throw nfe; } catch(InvalidName ine) { logger.info("INVALID NAME Exception caught while resolving dns name context"); throw ine; } catch(CannotProceed cpe) { logger.info("CANNOT PROCEED Exception caught while resolving dns name context"); throw cpe; } }
| 1,118,657
|
public org.omg.CORBA.Object resolve(String dns, String interfacename, String objectname) throws NotFound,CannotProceed, InvalidName, org.omg.CORBA.ORBPackage.InvalidName { dns = appendKindNames(dns); if(interfacename != null && interfacename.length() != 0) dns = dns + "/" + interfacename + ".interface"; if(objectname != null && objectname.length() != 0) { objectname = objectname;// + getVersion(); dns = dns + "/" + objectname + ".object"+getVersion(); } logger.info("the final dns resolved is "+dns); try { return getNameService().resolve(getNameService().to_name(dns)); } catch(NotFound nfe) { logger.info("NOT FOUND Exception caught while resolving dns name context and the name not found is "+nfe.rest_of_name[0].id); throw nfe; } catch(InvalidName ine) { logger.info("INVALID NAME Exception caught while resolving dns name context"); throw ine; } catch(CannotProceed cpe) { logger.info("CANNOT PROCEED Exception caught while resolving dns name context"); throw cpe; } }
|
public org.omg.CORBA.Object resolve(String dns, String interfacename, String objectname) throws NotFound,CannotProceed, InvalidName, org.omg.CORBA.ORBPackage.InvalidName { dns = appendKindNames(dns); if(interfacename != null && interfacename.length() != 0) dns = dns + "/" + interfacename + ".interface"; if(objectname != null && objectname.length() != 0) { objectname = objectname;// + getVersion(); dns = dns + "/" + objectname + ".object"+getVersion(); } logger.info("the final dns resolved is "+dns); try { return getNameService().resolve(getNameService().to_name(dns)); } catch(NotFound nfe) { logger.info("NOT FOUND Exception caught while resolving name context and the name not found is "+nfe.rest_of_name[0].id); throw nfe; } catch(InvalidName ine) { logger.info("INVALID NAME Exception caught while resolving dns name context"); throw ine; } catch(CannotProceed cpe) { logger.info("CANNOT PROCEED Exception caught while resolving dns name context"); throw cpe; } }
| 1,118,658
|
public org.omg.CORBA.Object resolve(String dns, String interfacename, String objectname) throws NotFound,CannotProceed, InvalidName, org.omg.CORBA.ORBPackage.InvalidName { dns = appendKindNames(dns); if(interfacename != null && interfacename.length() != 0) dns = dns + "/" + interfacename + ".interface"; if(objectname != null && objectname.length() != 0) { objectname = objectname;// + getVersion(); dns = dns + "/" + objectname + ".object"+getVersion(); } logger.info("the final dns resolved is "+dns); try { return getNameService().resolve(getNameService().to_name(dns)); } catch(NotFound nfe) { logger.info("NOT FOUND Exception caught while resolving dns name context and the name not found is "+nfe.rest_of_name[0].id); throw nfe; } catch(InvalidName ine) { logger.info("INVALID NAME Exception caught while resolving dns name context"); throw ine; } catch(CannotProceed cpe) { logger.info("CANNOT PROCEED Exception caught while resolving dns name context"); throw cpe; } }
|
public org.omg.CORBA.Object resolve(String dns, String interfacename, String objectname) throws NotFound,CannotProceed, InvalidName, org.omg.CORBA.ORBPackage.InvalidName { dns = appendKindNames(dns); if(interfacename != null && interfacename.length() != 0) dns = dns + "/" + interfacename + ".interface"; if(objectname != null && objectname.length() != 0) { objectname = objectname;// + getVersion(); dns = dns + "/" + objectname + ".object"+getVersion(); } logger.info("the final dns resolved is "+dns); try { return getNameService().resolve(getNameService().to_name(dns)); } catch(NotFound nfe) { logger.info("NOT FOUND Exception caught while resolving dns name context and the name not found is "+nfe.rest_of_name[0].id); throw nfe; } catch(InvalidName ine) { logger.info("INVALID NAME Exception caught while resolving name context", ine); throw ine; } catch(CannotProceed cpe) { logger.info("CANNOT PROCEED Exception caught while resolving dns name context"); throw cpe; } }
| 1,118,659
|
public List getAllObjects(String interfaceName, FissBranch startingBranch) { List leaves = new ArrayList(); NamingContext namingContext = startingBranch.namingContext; BindingListHolder bindings = new BindingListHolder(); BindingIteratorHolder bindingIteratorHolder = new BindingIteratorHolder(); namingContext.list(0, bindings, bindingIteratorHolder); BindingIterator bindingIterator = bindingIteratorHolder.value; BindingHolder bindingHolder = new BindingHolder(); while(bindingIterator != null && bindingIterator.next_one(bindingHolder)) { Binding binding = bindingHolder.value; if(binding.binding_type == BindingType.ncontext) { if((binding.binding_name[0].kind.equals(INTERFACE) && binding.binding_name[0].id.equals(interfaceName)) || binding.binding_name[0].kind.equals(DNS)) { String newPath; if(binding.binding_name[0].kind.equals(DNS)) { newPath = startingBranch.path + binding.binding_name[0].id + "/"; } else { newPath = startingBranch.path; } NamingContext newNC = null; try { newNC = NamingContextHelper.narrow(namingContext.resolve(binding.binding_name)); } catch(UserException e) { throw new RuntimeException("This should not happen as the naming context should have come from the server. This probably indicates a programming error.", e); } leaves.addAll(getAllObjects(interfaceName, new FissBranch(newNC, newPath))); } } else if(binding.binding_name[0].kind.equals(OBJECT)) { Object o = null; if(interfaceName.equals(NETWORKDC)) { o = new NSNetworkDC(startingBranch.trimFissuresPath(), binding.binding_name[0].id, this); } else if(interfaceName.equals(EVENTDC)) { o = new NSEventDC(startingBranch.trimFissuresPath(), binding.binding_name[0].id, this); } else if(interfaceName.equals(SEISDC)) { o = new NSSeismogramDC(startingBranch.trimFissuresPath(), binding.binding_name[0].id, this); } else if(interfaceName.equals(PLOTTABLEDC)) { o = new NSPlottableDC(startingBranch.trimFissuresPath(), binding.binding_name[0].id, this); } else { try { o = startingBranch.namingContext.resolve(binding.binding_name); } catch(UserException e) { throw new RuntimeException("This should not happen as the naming context should have come from the server. This probably indicates a programming error.", e); } } leaves.add(o); } } return leaves; }
|
public List getAllObjects(String interfaceName, FissBranch startingBranch) { List leaves = new ArrayList(); NamingContext namingContext = startingBranch.namingContext; BindingListHolder bindings = new BindingListHolder(); BindingIteratorHolder bindingIteratorHolder = new BindingIteratorHolder(); namingContext.list(0, bindings, bindingIteratorHolder); BindingIterator bindingIterator = bindingIteratorHolder.value; BindingHolder bindingHolder = new BindingHolder(); while(bindingIterator != null && bindingIterator.next_one(bindingHolder)) { Binding binding = bindingHolder.value; if(binding.binding_type == BindingType.ncontext) { if((binding.binding_name[0].kind.equals(INTERFACE) && binding.binding_name[0].id.equals(interfaceName)) || binding.binding_name[0].kind.equals(DNS)) { String newPath; if(binding.binding_name[0].kind.equals(DNS)) { newPath = startingBranch.path + binding.binding_name[0].id + "/"; } else { newPath = startingBranch.path; } NamingContext newNC = null; try { newNC = NamingContextHelper.narrow(namingContext.resolve(binding.binding_name)); } catch(UserException e) { throw new RuntimeException("This should not happen as the naming context should have come from the server. This probably indicates a programming error.", e); } leaves.addAll(getAllObjects(interfaceName, new FissBranch(newNC, newPath))); } } else if(binding.binding_name[0].kind.equals(OBJECT)) { Object o = null; if(interfaceName.equals(NETWORKDC)) { o = new NSNetworkDC(startingBranch.trimFissuresPath(), binding.binding_name[0].id, this); } else if(interfaceName.equals(EVENTDC)) { o = new NSEventDC(startingBranch.trimFissuresPath(), binding.binding_name[0].id, this); } else if(interfaceName.equals(SEISDC)) { o = new NSSeismogramDC(startingBranch.trimFissuresPath(), binding.binding_name[0].id, this); } else if(interfaceName.equals(PLOTTABLEDC)) { o = new NSPlottableDC(startingBranch.trimFissuresPath(), binding.binding_name[0].id, this); } else { try { o = startingBranch.namingContext.resolve(binding.binding_name); } catch(UserException e) { throw new RuntimeException("This should not happen as the naming context should have come from the server. This probably indicates a programming error.", e); } } leaves.add(o); } } return leaves; }
| 1,118,660
|
public void readNextPacket(DataInput in, boolean processData, TimeRange fileTimeWindow) throws IOException, RT130FormatException, RT130BadPacketException { Calendar beginTime = Calendar.getInstance(); MicroSecondDate beginDate = new MicroSecondDate(fileTimeWindow.start_time); beginTime.setTime(beginDate); Calendar endTime = Calendar.getInstance(); MicroSecondDate endDate = new MicroSecondDate(fileTimeWindow.end_time); endTime.setTime(endDate); // Packet Type packetType = new String(this.readBytes(in, 2)); // logger.debug("Packet Type: " + packetType); if(!(packetType.equals("AD") || packetType.equals("CD") || packetType.equals("DS") || packetType.equals("DT") || packetType.equals("EH") || packetType.equals("ET") || packetType.equals("OM") || packetType.equals("SC") || packetType.equals("SH") || packetType.equals("FD"))) { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } // Experiment Number experimentNumber = BCDRead.toInt(this.readBytes(in, 1)); // System.out.println("Experiement Number: " + experimentNumber); // Year year = BCDRead.toInt(this.readBytes(in, 1)); if((year + 2000) < beginTime.get(Calendar.YEAR) || (year + 2000) > endTime.get(Calendar.YEAR) + 1) { logger.warn(" The file contained a packet with an invalid year. \n" + "The year parsed is: " + (year + 2000) + "\n The year " + beginTime.get(Calendar.YEAR) + " was parsed from the file structure, and will be used instead."); year = beginTime.get(Calendar.YEAR) - 2000; } // logger.debug("Year: " + year); // Unit ID Number unitIdNumber = HexRead.toString(this.readBytes(in, 2)); // System.out.println("Unit ID Number: " + unitIdNumber); // Time String timeString = BCDRead.toString(this.readBytes(in, 6)); // logger.debug("Time: " + timeString); time = this.stringToMicroSecondDate(timeString, year); if(packetType.equals("DT") && (time.before(beginDate) || time.after(endDate))) { logger.error(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); throw new RT130BadPacketException(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); } begin_time_of_first_packet = time; // logger.debug("Micro Second Date Time: " + time.toString()); // Byte Count byteCount = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Byte Count: " + byteCount); // Packet Sequence packetSequence = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Packet Sequence: " + packetSequence); if(packetType.equals("AD")) { this.aDPP = new AuxiliaryDataParameterPacket(in); } else if(packetType.equals("CD")) { this.cPP = new CalibrationParameterPacket(in); } else if(packetType.equals("DS")) { this.dSPP = new DataStreamParameterPacket(in); } else if(packetType.equals("DT")) { this.dP = new DataPacket(in, processData); if(processData) { encoded_data = new EncodedData[1]; encoded_data[0] = new EncodedData((short)10, this.dP.dataFrames, this.dP.numberOfSamples, false); } else { encoded_data = new EncodedData[0]; } channel_number = this.dP.channelNumber; } else if(packetType.equals("EH")) { this.eHP = new EventHeaderPacket(in); begin_time_of_seismogram = time; end_time_of_last_packet = time; String stringSampleRate = this.eHP.sampleRate.trim(); if(stringSampleRate != null && !stringSampleRate.equals("")) { sample_rate = Integer.valueOf(stringSampleRate).intValue(); } } else if(packetType.equals("ET")) { this.eTP = new EventTrailerPacket(in); sample_rate = Integer.valueOf(this.eTP.sampleRate.trim()) .intValue(); } else if(packetType.equals("OM")) { this.oMPP = new OperatingModeParameterPacket(in); } else if(packetType.equals("SC")) { this.sCPP = new StationChannelParameterPacket(in); } else if(packetType.equals("SH")) { this.sOHP = new StateOfHealthPacket(in); } else if(packetType.equals("FD")) { // Just skip FD packet. Using DataStreamParameterPacket is good for // that. new DataStreamParameterPacket(in); } else { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } }
|
public void readNextPacket(DataInput in, boolean processData, TimeRange fileTimeWindow) throws IOException, RT130FormatException, RT130BadPacketException { Calendar beginTime = Calendar.getInstance(); MicroSecondDate beginDate = new MicroSecondDate(fileTimeWindow.start_time); beginTime.setTime(beginDate); Calendar endTime = Calendar.getInstance(); MicroSecondDate endDate = new MicroSecondDate(fileTimeWindow.end_time); endTime.setTime(endDate); // Packet Type packetType = new String(this.readBytes(in, 2)); // logger.debug("Packet Type: " + packetType); if(!(packetType.equals("AD") || packetType.equals("CD") || packetType.equals("DS") || packetType.equals("DT") || packetType.equals("EH") || packetType.equals("ET") || packetType.equals("OM") || packetType.equals("SC") || packetType.equals("SH") || packetType.equals("FD"))) { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } // Experiment Number experimentNumber = BCDRead.toInt(this.readBytes(in, 1)); // System.out.println("Experiement Number: " + experimentNumber); // Year year = BCDRead.toInt(this.readBytes(in, 1)); if((year + 2000) < beginTime.get(Calendar.YEAR) || (year + 2000) > endTime.get(Calendar.YEAR) + 1) { logger.warn(" The file contained a packet with an invalid year. \n" + "The year parsed is: " + (year + 2000) + "\n The year " + beginTime.get(Calendar.YEAR) + " was parsed from the file structure, and will be used instead."); year = beginTime.get(Calendar.YEAR) - 2000; } // logger.debug("Year: " + year); // Unit ID Number unitIdNumber = HexRead.toString(this.readBytes(in, 2)); // System.out.println("Unit ID Number: " + unitIdNumber); // Time String timeString = BCDRead.toString(this.readBytes(in, 6)); // logger.debug("Time: " + timeString); time = this.stringToMicroSecondDate(timeString, year); if(packetType.equals("DT") && (time.before(beginDate) || time.after(endDate))) { logger.error(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); throw new RT130BadPacketException(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); } begin_time_of_first_packet = time; // logger.debug("Micro Second Date Time: " + time.toString()); // Byte Count byteCount = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Byte Count: " + byteCount); // Packet Sequence packetSequence = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Packet Sequence: " + packetSequence); if(packetType.equals("AD")) { this.aDPP = new AuxiliaryDataParameterPacket(in); } else if(packetType.equals("CD")) { this.cPP = new CalibrationParameterPacket(in); } else if(packetType.equals("DS")) { this.dSPP = new DataStreamParameterPacket(in); } else if(packetType.equals("DT")) { this.dP = new DataPacket(in, processData); if(processData) { encoded_data = new EncodedData[1]; encoded_data[0] = new EncodedData((short)10, this.dP.dataFrames, this.dP.numberOfSamples, false); } else { encoded_data = new EncodedData[0]; } channel_number = this.dP.channelNumber; } else if(packetType.equals("EH")) { this.eHP = new EventHeaderPacket(in); begin_time_of_seismogram = time; end_time_of_last_packet = time; String stringSampleRate = this.eHP.sampleRate.trim(); if(stringSampleRate != null && !stringSampleRate.equals("")) { sample_rate = Integer.valueOf(stringSampleRate).intValue(); } } else if(packetType.equals("ET")) { this.eTP = new EventTrailerPacket(in); sample_rate = Integer.valueOf(this.eTP.sampleRate.trim()) .intValue(); } else if(packetType.equals("OM")) { this.oMPP = new OperatingModeParameterPacket(in); } else if(packetType.equals("SC")) { this.sCPP = new StationChannelParameterPacket(in); } else if(packetType.equals("SH")) { this.sOHP = new StateOfHealthPacket(in); } else if(packetType.equals("FD")) { // Just skip FD packet. Using DataStreamParameterPacket is good for // that. new DataStreamParameterPacket(in); } else { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } }
| 1,118,661
|
public void readNextPacket(DataInput in, boolean processData, TimeRange fileTimeWindow) throws IOException, RT130FormatException, RT130BadPacketException { Calendar beginTime = Calendar.getInstance(); MicroSecondDate beginDate = new MicroSecondDate(fileTimeWindow.start_time); beginTime.setTime(beginDate); Calendar endTime = Calendar.getInstance(); MicroSecondDate endDate = new MicroSecondDate(fileTimeWindow.end_time); endTime.setTime(endDate); // Packet Type packetType = new String(this.readBytes(in, 2)); // logger.debug("Packet Type: " + packetType); if(!(packetType.equals("AD") || packetType.equals("CD") || packetType.equals("DS") || packetType.equals("DT") || packetType.equals("EH") || packetType.equals("ET") || packetType.equals("OM") || packetType.equals("SC") || packetType.equals("SH") || packetType.equals("FD"))) { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } // Experiment Number experimentNumber = BCDRead.toInt(this.readBytes(in, 1)); // System.out.println("Experiement Number: " + experimentNumber); // Year year = BCDRead.toInt(this.readBytes(in, 1)); if((year + 2000) < beginTime.get(Calendar.YEAR) || (year + 2000) > endTime.get(Calendar.YEAR) + 1) { logger.warn(" The file contained a packet with an invalid year. \n" + "The year parsed is: " + (year + 2000) + "\n The year " + beginTime.get(Calendar.YEAR) + " was parsed from the file structure, and will be used instead."); year = beginTime.get(Calendar.YEAR) - 2000; } // logger.debug("Year: " + year); // Unit ID Number unitIdNumber = HexRead.toString(this.readBytes(in, 2)); // System.out.println("Unit ID Number: " + unitIdNumber); // Time String timeString = BCDRead.toString(this.readBytes(in, 6)); // logger.debug("Time: " + timeString); time = this.stringToMicroSecondDate(timeString, year); if(packetType.equals("DT") && (time.before(beginDate) || time.after(endDate))) { logger.error(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); throw new RT130BadPacketException(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); } begin_time_of_first_packet = time; // logger.debug("Micro Second Date Time: " + time.toString()); // Byte Count byteCount = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Byte Count: " + byteCount); // Packet Sequence packetSequence = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Packet Sequence: " + packetSequence); if(packetType.equals("AD")) { this.aDPP = new AuxiliaryDataParameterPacket(in); } else if(packetType.equals("CD")) { this.cPP = new CalibrationParameterPacket(in); } else if(packetType.equals("DS")) { this.dSPP = new DataStreamParameterPacket(in); } else if(packetType.equals("DT")) { this.dP = new DataPacket(in, processData); if(processData) { encoded_data = new EncodedData[1]; encoded_data[0] = new EncodedData((short)10, this.dP.dataFrames, this.dP.numberOfSamples, false); } else { encoded_data = new EncodedData[0]; } channel_number = this.dP.channelNumber; } else if(packetType.equals("EH")) { this.eHP = new EventHeaderPacket(in); begin_time_of_seismogram = time; end_time_of_last_packet = time; String stringSampleRate = this.eHP.sampleRate.trim(); if(stringSampleRate != null && !stringSampleRate.equals("")) { sample_rate = Integer.valueOf(stringSampleRate).intValue(); } } else if(packetType.equals("ET")) { this.eTP = new EventTrailerPacket(in); sample_rate = Integer.valueOf(this.eTP.sampleRate.trim()) .intValue(); } else if(packetType.equals("OM")) { this.oMPP = new OperatingModeParameterPacket(in); } else if(packetType.equals("SC")) { this.sCPP = new StationChannelParameterPacket(in); } else if(packetType.equals("SH")) { this.sOHP = new StateOfHealthPacket(in); } else if(packetType.equals("FD")) { // Just skip FD packet. Using DataStreamParameterPacket is good for // that. new DataStreamParameterPacket(in); } else { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } }
|
public void readNextPacket(DataInput in, boolean processData, TimeRange fileTimeWindow) throws IOException, RT130FormatException, RT130BadPacketException { Calendar beginTime = Calendar.getInstance(); MicroSecondDate beginDate = new MicroSecondDate(fileTimeWindow.getBeginTime()); beginTime.setTime(beginDate); Calendar endTime = Calendar.getInstance(); MicroSecondDate endDate = new MicroSecondDate(fileTimeWindow.end_time); endTime.setTime(endDate); // Packet Type packetType = new String(this.readBytes(in, 2)); // logger.debug("Packet Type: " + packetType); if(!(packetType.equals("AD") || packetType.equals("CD") || packetType.equals("DS") || packetType.equals("DT") || packetType.equals("EH") || packetType.equals("ET") || packetType.equals("OM") || packetType.equals("SC") || packetType.equals("SH") || packetType.equals("FD"))) { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } // Experiment Number experimentNumber = BCDRead.toInt(this.readBytes(in, 1)); // System.out.println("Experiement Number: " + experimentNumber); // Year year = BCDRead.toInt(this.readBytes(in, 1)); if((year + 2000) < beginTime.get(Calendar.YEAR) || (year + 2000) > endTime.get(Calendar.YEAR) + 1) { logger.warn(" The file contained a packet with an invalid year. \n" + "The year parsed is: " + (year + 2000) + "\n The year " + beginTime.get(Calendar.YEAR) + " was parsed from the file structure, and will be used instead."); year = beginTime.get(Calendar.YEAR) - 2000; } // logger.debug("Year: " + year); // Unit ID Number unitIdNumber = HexRead.toString(this.readBytes(in, 2)); // System.out.println("Unit ID Number: " + unitIdNumber); // Time String timeString = BCDRead.toString(this.readBytes(in, 6)); // logger.debug("Time: " + timeString); time = this.stringToMicroSecondDate(timeString, year); if(packetType.equals("DT") && (time.before(beginDate) || time.after(endDate))) { logger.error(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); throw new RT130BadPacketException(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); } begin_time_of_first_packet = time; // logger.debug("Micro Second Date Time: " + time.toString()); // Byte Count byteCount = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Byte Count: " + byteCount); // Packet Sequence packetSequence = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Packet Sequence: " + packetSequence); if(packetType.equals("AD")) { this.aDPP = new AuxiliaryDataParameterPacket(in); } else if(packetType.equals("CD")) { this.cPP = new CalibrationParameterPacket(in); } else if(packetType.equals("DS")) { this.dSPP = new DataStreamParameterPacket(in); } else if(packetType.equals("DT")) { this.dP = new DataPacket(in, processData); if(processData) { encoded_data = new EncodedData[1]; encoded_data[0] = new EncodedData((short)10, this.dP.dataFrames, this.dP.numberOfSamples, false); } else { encoded_data = new EncodedData[0]; } channel_number = this.dP.channelNumber; } else if(packetType.equals("EH")) { this.eHP = new EventHeaderPacket(in); begin_time_of_seismogram = time; end_time_of_last_packet = time; String stringSampleRate = this.eHP.sampleRate.trim(); if(stringSampleRate != null && !stringSampleRate.equals("")) { sample_rate = Integer.valueOf(stringSampleRate).intValue(); } } else if(packetType.equals("ET")) { this.eTP = new EventTrailerPacket(in); sample_rate = Integer.valueOf(this.eTP.sampleRate.trim()) .intValue(); } else if(packetType.equals("OM")) { this.oMPP = new OperatingModeParameterPacket(in); } else if(packetType.equals("SC")) { this.sCPP = new StationChannelParameterPacket(in); } else if(packetType.equals("SH")) { this.sOHP = new StateOfHealthPacket(in); } else if(packetType.equals("FD")) { // Just skip FD packet. Using DataStreamParameterPacket is good for // that. new DataStreamParameterPacket(in); } else { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } }
| 1,118,662
|
public void readNextPacket(DataInput in, boolean processData, TimeRange fileTimeWindow) throws IOException, RT130FormatException, RT130BadPacketException { Calendar beginTime = Calendar.getInstance(); MicroSecondDate beginDate = new MicroSecondDate(fileTimeWindow.start_time); beginTime.setTime(beginDate); Calendar endTime = Calendar.getInstance(); MicroSecondDate endDate = new MicroSecondDate(fileTimeWindow.end_time); endTime.setTime(endDate); // Packet Type packetType = new String(this.readBytes(in, 2)); // logger.debug("Packet Type: " + packetType); if(!(packetType.equals("AD") || packetType.equals("CD") || packetType.equals("DS") || packetType.equals("DT") || packetType.equals("EH") || packetType.equals("ET") || packetType.equals("OM") || packetType.equals("SC") || packetType.equals("SH") || packetType.equals("FD"))) { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } // Experiment Number experimentNumber = BCDRead.toInt(this.readBytes(in, 1)); // System.out.println("Experiement Number: " + experimentNumber); // Year year = BCDRead.toInt(this.readBytes(in, 1)); if((year + 2000) < beginTime.get(Calendar.YEAR) || (year + 2000) > endTime.get(Calendar.YEAR) + 1) { logger.warn(" The file contained a packet with an invalid year. \n" + "The year parsed is: " + (year + 2000) + "\n The year " + beginTime.get(Calendar.YEAR) + " was parsed from the file structure, and will be used instead."); year = beginTime.get(Calendar.YEAR) - 2000; } // logger.debug("Year: " + year); // Unit ID Number unitIdNumber = HexRead.toString(this.readBytes(in, 2)); // System.out.println("Unit ID Number: " + unitIdNumber); // Time String timeString = BCDRead.toString(this.readBytes(in, 6)); // logger.debug("Time: " + timeString); time = this.stringToMicroSecondDate(timeString, year); if(packetType.equals("DT") && (time.before(beginDate) || time.after(endDate))) { logger.error(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); throw new RT130BadPacketException(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); } begin_time_of_first_packet = time; // logger.debug("Micro Second Date Time: " + time.toString()); // Byte Count byteCount = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Byte Count: " + byteCount); // Packet Sequence packetSequence = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Packet Sequence: " + packetSequence); if(packetType.equals("AD")) { this.aDPP = new AuxiliaryDataParameterPacket(in); } else if(packetType.equals("CD")) { this.cPP = new CalibrationParameterPacket(in); } else if(packetType.equals("DS")) { this.dSPP = new DataStreamParameterPacket(in); } else if(packetType.equals("DT")) { this.dP = new DataPacket(in, processData); if(processData) { encoded_data = new EncodedData[1]; encoded_data[0] = new EncodedData((short)10, this.dP.dataFrames, this.dP.numberOfSamples, false); } else { encoded_data = new EncodedData[0]; } channel_number = this.dP.channelNumber; } else if(packetType.equals("EH")) { this.eHP = new EventHeaderPacket(in); begin_time_of_seismogram = time; end_time_of_last_packet = time; String stringSampleRate = this.eHP.sampleRate.trim(); if(stringSampleRate != null && !stringSampleRate.equals("")) { sample_rate = Integer.valueOf(stringSampleRate).intValue(); } } else if(packetType.equals("ET")) { this.eTP = new EventTrailerPacket(in); sample_rate = Integer.valueOf(this.eTP.sampleRate.trim()) .intValue(); } else if(packetType.equals("OM")) { this.oMPP = new OperatingModeParameterPacket(in); } else if(packetType.equals("SC")) { this.sCPP = new StationChannelParameterPacket(in); } else if(packetType.equals("SH")) { this.sOHP = new StateOfHealthPacket(in); } else if(packetType.equals("FD")) { // Just skip FD packet. Using DataStreamParameterPacket is good for // that. new DataStreamParameterPacket(in); } else { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } }
|
public void readNextPacket(DataInput in, boolean processData, TimeRange fileTimeWindow) throws IOException, RT130FormatException, RT130BadPacketException { Calendar beginTime = Calendar.getInstance(); MicroSecondDate beginDate = new MicroSecondDate(fileTimeWindow.start_time); beginTime.setTime(beginDate); Calendar endTime = Calendar.getInstance(); MicroSecondDate endDate = new MicroSecondDate(fileTimeWindow.getEndTime()); endTime.setTime(endDate); // Packet Type packetType = new String(this.readBytes(in, 2)); // logger.debug("Packet Type: " + packetType); if(!(packetType.equals("AD") || packetType.equals("CD") || packetType.equals("DS") || packetType.equals("DT") || packetType.equals("EH") || packetType.equals("ET") || packetType.equals("OM") || packetType.equals("SC") || packetType.equals("SH") || packetType.equals("FD"))) { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } // Experiment Number experimentNumber = BCDRead.toInt(this.readBytes(in, 1)); // System.out.println("Experiement Number: " + experimentNumber); // Year year = BCDRead.toInt(this.readBytes(in, 1)); if((year + 2000) < beginTime.get(Calendar.YEAR) || (year + 2000) > endTime.get(Calendar.YEAR) + 1) { logger.warn(" The file contained a packet with an invalid year. \n" + "The year parsed is: " + (year + 2000) + "\n The year " + beginTime.get(Calendar.YEAR) + " was parsed from the file structure, and will be used instead."); year = beginTime.get(Calendar.YEAR) - 2000; } // logger.debug("Year: " + year); // Unit ID Number unitIdNumber = HexRead.toString(this.readBytes(in, 2)); // System.out.println("Unit ID Number: " + unitIdNumber); // Time String timeString = BCDRead.toString(this.readBytes(in, 6)); // logger.debug("Time: " + timeString); time = this.stringToMicroSecondDate(timeString, year); if(packetType.equals("DT") && (time.before(beginDate) || time.after(endDate))) { logger.error(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); throw new RT130BadPacketException(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); } begin_time_of_first_packet = time; // logger.debug("Micro Second Date Time: " + time.toString()); // Byte Count byteCount = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Byte Count: " + byteCount); // Packet Sequence packetSequence = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Packet Sequence: " + packetSequence); if(packetType.equals("AD")) { this.aDPP = new AuxiliaryDataParameterPacket(in); } else if(packetType.equals("CD")) { this.cPP = new CalibrationParameterPacket(in); } else if(packetType.equals("DS")) { this.dSPP = new DataStreamParameterPacket(in); } else if(packetType.equals("DT")) { this.dP = new DataPacket(in, processData); if(processData) { encoded_data = new EncodedData[1]; encoded_data[0] = new EncodedData((short)10, this.dP.dataFrames, this.dP.numberOfSamples, false); } else { encoded_data = new EncodedData[0]; } channel_number = this.dP.channelNumber; } else if(packetType.equals("EH")) { this.eHP = new EventHeaderPacket(in); begin_time_of_seismogram = time; end_time_of_last_packet = time; String stringSampleRate = this.eHP.sampleRate.trim(); if(stringSampleRate != null && !stringSampleRate.equals("")) { sample_rate = Integer.valueOf(stringSampleRate).intValue(); } } else if(packetType.equals("ET")) { this.eTP = new EventTrailerPacket(in); sample_rate = Integer.valueOf(this.eTP.sampleRate.trim()) .intValue(); } else if(packetType.equals("OM")) { this.oMPP = new OperatingModeParameterPacket(in); } else if(packetType.equals("SC")) { this.sCPP = new StationChannelParameterPacket(in); } else if(packetType.equals("SH")) { this.sOHP = new StateOfHealthPacket(in); } else if(packetType.equals("FD")) { // Just skip FD packet. Using DataStreamParameterPacket is good for // that. new DataStreamParameterPacket(in); } else { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } }
| 1,118,663
|
public void readNextPacket(DataInput in, boolean processData, TimeRange fileTimeWindow) throws IOException, RT130FormatException, RT130BadPacketException { Calendar beginTime = Calendar.getInstance(); MicroSecondDate beginDate = new MicroSecondDate(fileTimeWindow.start_time); beginTime.setTime(beginDate); Calendar endTime = Calendar.getInstance(); MicroSecondDate endDate = new MicroSecondDate(fileTimeWindow.end_time); endTime.setTime(endDate); // Packet Type packetType = new String(this.readBytes(in, 2)); // logger.debug("Packet Type: " + packetType); if(!(packetType.equals("AD") || packetType.equals("CD") || packetType.equals("DS") || packetType.equals("DT") || packetType.equals("EH") || packetType.equals("ET") || packetType.equals("OM") || packetType.equals("SC") || packetType.equals("SH") || packetType.equals("FD"))) { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } // Experiment Number experimentNumber = BCDRead.toInt(this.readBytes(in, 1)); // System.out.println("Experiement Number: " + experimentNumber); // Year year = BCDRead.toInt(this.readBytes(in, 1)); if((year + 2000) < beginTime.get(Calendar.YEAR) || (year + 2000) > endTime.get(Calendar.YEAR) + 1) { logger.warn(" The file contained a packet with an invalid year. \n" + "The year parsed is: " + (year + 2000) + "\n The year " + beginTime.get(Calendar.YEAR) + " was parsed from the file structure, and will be used instead."); year = beginTime.get(Calendar.YEAR) - 2000; } // logger.debug("Year: " + year); // Unit ID Number unitIdNumber = HexRead.toString(this.readBytes(in, 2)); // System.out.println("Unit ID Number: " + unitIdNumber); // Time String timeString = BCDRead.toString(this.readBytes(in, 6)); // logger.debug("Time: " + timeString); time = this.stringToMicroSecondDate(timeString, year); if(packetType.equals("DT") && (time.before(beginDate) || time.after(endDate))) { logger.error(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); throw new RT130BadPacketException(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); } begin_time_of_first_packet = time; // logger.debug("Micro Second Date Time: " + time.toString()); // Byte Count byteCount = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Byte Count: " + byteCount); // Packet Sequence packetSequence = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Packet Sequence: " + packetSequence); if(packetType.equals("AD")) { this.aDPP = new AuxiliaryDataParameterPacket(in); } else if(packetType.equals("CD")) { this.cPP = new CalibrationParameterPacket(in); } else if(packetType.equals("DS")) { this.dSPP = new DataStreamParameterPacket(in); } else if(packetType.equals("DT")) { this.dP = new DataPacket(in, processData); if(processData) { encoded_data = new EncodedData[1]; encoded_data[0] = new EncodedData((short)10, this.dP.dataFrames, this.dP.numberOfSamples, false); } else { encoded_data = new EncodedData[0]; } channel_number = this.dP.channelNumber; } else if(packetType.equals("EH")) { this.eHP = new EventHeaderPacket(in); begin_time_of_seismogram = time; end_time_of_last_packet = time; String stringSampleRate = this.eHP.sampleRate.trim(); if(stringSampleRate != null && !stringSampleRate.equals("")) { sample_rate = Integer.valueOf(stringSampleRate).intValue(); } } else if(packetType.equals("ET")) { this.eTP = new EventTrailerPacket(in); sample_rate = Integer.valueOf(this.eTP.sampleRate.trim()) .intValue(); } else if(packetType.equals("OM")) { this.oMPP = new OperatingModeParameterPacket(in); } else if(packetType.equals("SC")) { this.sCPP = new StationChannelParameterPacket(in); } else if(packetType.equals("SH")) { this.sOHP = new StateOfHealthPacket(in); } else if(packetType.equals("FD")) { // Just skip FD packet. Using DataStreamParameterPacket is good for // that. new DataStreamParameterPacket(in); } else { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } }
|
public void readNextPacket(DataInput in, boolean processData, TimeRange fileTimeWindow) throws IOException, RT130FormatException, RT130BadPacketException { Calendar beginTime = Calendar.getInstance(); MicroSecondDate beginDate = new MicroSecondDate(fileTimeWindow.start_time); beginTime.setTime(beginDate); Calendar endTime = Calendar.getInstance(); MicroSecondDate endDate = new MicroSecondDate(fileTimeWindow.end_time); endTime.setTime(endDate); // Packet Type packetType = new String(this.readBytes(in, 2)); // logger.debug("Packet Type: " + packetType); if(!(packetType.equals("AD") || packetType.equals("CD") || packetType.equals("DS") || packetType.equals("DT") || packetType.equals("EH") || packetType.equals("ET") || packetType.equals("OM") || packetType.equals("SC") || packetType.equals("SH") || packetType.equals("FD"))) { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } // Experiment Number experimentNumber = BCDRead.toInt(this.readBytes(in, 1)); // System.out.println("Experiement Number: " + experimentNumber); // Year year = BCDRead.toInt(this.readBytes(in, 1)); if((year + 2000) < beginTime.get(Calendar.YEAR) || (year + 2000) > endTime.get(Calendar.YEAR) + 1) { logger.warn(" The file contained a packet with an invalid year. \n" + "The year parsed is: " + (year + 2000) + "\n The year " + beginTime.get(Calendar.YEAR) + " was parsed from the file structure, and will be used instead."); year = beginTime.get(Calendar.YEAR) - 2000; } // logger.debug("Year: " + year); // Unit ID Number unitIdNumber = HexRead.toString(this.readBytes(in, 2)); // System.out.println("Unit ID Number: " + unitIdNumber); // Time String timeString = BCDRead.toString(this.readBytes(in, 6)); // logger.debug("Time: " + timeString); time = this.stringToMicroSecondDate(timeString, year); if(packetType.equals("DT") && (time.before(beginDate) || time.after(endDate))) { logger.error(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); throw new RT130BadPacketException(" The file contained a Data Packet with an invalid time. " + "\n The time parsed is: " + time.toString() + "\n The time should be after: " + beginDate.toString() + "\n The time should be before: " + endDate.toString() + "\n The file will not be read."); } begin_time_of_first_packet = time; // logger.debug("Micro Second Date Time: " + time.toString()); // Byte Count byteCount = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Byte Count: " + byteCount); // Packet Sequence packetSequence = BCDRead.toInt(this.readBytes(in, 2)); // System.out.println("Packet Sequence: " + packetSequence); if(packetType.equals("AD")) { this.aDPP = new AuxiliaryDataParameterPacket(in); } else if(packetType.equals("CD")) { this.cPP = new CalibrationParameterPacket(in); } else if(packetType.equals("DS")) { this.dSPP = new DataStreamParameterPacket(in); } else if(packetType.equals("DT")) { this.dP = new DataPacket(in, processData); if(processData) { encoded_data = new EncodedData[1]; encoded_data[0] = new EncodedData((short)10, this.dP.dataFrames, this.dP.numberOfSamples, false); } else { encoded_data = new EncodedData[0]; } channel_number = this.dP.channelNumber; } else if(packetType.equals("EH")) { this.eHP = new EventHeaderPacket(in); begin_time_of_seismogram = time; end_time_of_last_packet = time; String stringSampleRate = this.eHP.sampleRate.trim(); if(stringSampleRate != null && !stringSampleRate.equals("")) { sample_rate = Integer.valueOf(stringSampleRate).intValue(); } } else if(packetType.equals("ET")) { this.eTP = new EventTrailerPacket(in); sample_rate = Integer.valueOf(this.eTP.sampleRate.trim()) .intValue(); } else if(packetType.equals("OM")) { this.oMPP = new OperatingModeParameterPacket(in); } else if(packetType.equals("SC")) { this.sCPP = new StationChannelParameterPacket(in); } else if(packetType.equals("SH")) { this.sOHP = new StateOfHealthPacket(in); } else if(packetType.equals("FD")) { // Just skip FD packet. Using DataStreamParameterPacket is good for // that. new DataStreamParameterPacket(in); } else { logger.error(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); throw new RT130FormatException(" The first two bytes of the Packet Header were not formatted " + "correctly, and do not refer to a valid Packet Type. \n" + " First two bytes parse to: " + packetType); } }
| 1,118,664
|
public RT130BadPacketException(String s) { super(s); }
|
public RT130BadPacketException(String s) { super(s); }
| 1,118,665
|
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access */ if (!form.getAuthorisedUser()) { return "noAccess"; } BwSponsor sp = form.getSponsor(); int delResult = form.getCalSvcI().deleteSponsor(sp); if (delResult == 2) { form.getMsg().emit("org.bedework.client.message.sponsor.referenced"); return "inUse"; } if (delResult == 1) { form.getErr().emit("org.bedework.client.error.nosuchsponsor", sp); return "notFound"; } form.getMsg().emit("org.bedework.client.message.sponsor.deleted"); return "continue"; }
|
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access */ if (!form.getAuthorisedUser()) { return "noAccess"; } BwSponsor sp = form.getSponsor(); int delResult = form.getCalSvcI().deleteSponsor(sp); if (delResult == 2) { form.getErr().emit("org.bedework.client.error.sponsor.referenced"); return "inUse"; } if (delResult == 1) { form.getErr().emit("org.bedework.client.error.nosuchsponsor", sp); return "notFound"; } form.getMsg().emit("org.bedework.client.message.sponsor.deleted"); return "continue"; }
| 1,118,666
|
public OMEvent(EventAccessOperations eao) throws NoPreferredOrigin{ super(2); Origin prefOrigin = eao.get_preferred_origin(); float lat = prefOrigin.my_location.latitude; float lon = prefOrigin.my_location.longitude; float mag = prefOrigin.magnitudes[0].value; double scale = 2.2; int lilDiameter = (int)Math.pow(scale, 3.0); OMCircle lilCircle = new OMCircle(lat, lon, lilDiameter, lilDiameter); if (mag <= 3.0){ bigCircle = new OMCircle(lat, lon, lilDiameter, lilDiameter); } else{ mag = (float)(Math.pow(scale, (double)mag)); bigCircle = new OMCircle(lat, lon, (int)Math.floor(mag), (int)Math.floor(mag)); } event = new CacheEvent(eao); Color color = getDepthColor((QuantityImpl)prefOrigin.my_location.depth); lilCircle.setLinePaint(Color.BLACK); lilCircle.setFillPaint(color); bigCircle.setStroke(DisplayUtils.THREE_PIXEL_STROKE); bigCircle.setLinePaint(color); add(bigCircle); add(lilCircle); generate(getProjection()); }
|
public OMEvent(EventAccessOperations eao) throws NoPreferredOrigin{ super(2); Origin prefOrigin = eao.get_preferred_origin(); float lat = prefOrigin.my_location.latitude; float lon = prefOrigin.my_location.longitude; float mag = prefOrigin.magnitudes[0].value; double scale = 1.8; int lilDiameter = (int)Math.pow(scale, 3.0); OMCircle lilCircle = new OMCircle(lat, lon, lilDiameter, lilDiameter); if (mag <= 3.0){ bigCircle = new OMCircle(lat, lon, lilDiameter, lilDiameter); } else{ mag = (float)(Math.pow(scale, (double)mag)); bigCircle = new OMCircle(lat, lon, (int)Math.floor(mag), (int)Math.floor(mag)); } event = new CacheEvent(eao); Color color = getDepthColor((QuantityImpl)prefOrigin.my_location.depth); lilCircle.setLinePaint(Color.BLACK); lilCircle.setFillPaint(color); bigCircle.setStroke(DisplayUtils.THREE_PIXEL_STROKE); bigCircle.setLinePaint(color); add(bigCircle); add(lilCircle); generate(getProjection()); }
| 1,118,667
|
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { CalSvcI svc = form.fetchSvci(); BwPreferences prefs; /* Refetch the prefs */ if (getReqPar(request, "user") != null) { /* Fetch a given users preferences */ if (!form.getCurUserSuperUser()) { return "noAccess"; // First line of defence } BwUser user = findUser(request, form); if (user == null) { return "notFound"; } prefs = svc.getUserPrefs(user); } else { prefs = svc.getUserPrefs(); } String str = getReqPar(request, "preferredView"); if (str != null) { if (svc.findView(str) == null) { form.getErr().emit("org.bedework.client.error.viewnotfound", str); return "notFound"; } prefs.setPreferredView(str); } str = getReqPar(request, "viewPeriod"); if (str != null) { prefs.setPreferredViewPeriod(form.validViewPeriod(str)); } str = getReqPar(request, "skin"); if (str != null) { prefs.setSkinName(str); } str = getReqPar(request, "skinStyle"); if (str != null) { prefs.setSkinStyle(str); } str = getReqPar(request, "email"); if (str != null) { prefs.setEmail(str); } str = getReqPar(request, "newCalPath"); if (str != null) { BwCalendar cal = svc.getCalendar(str); if (cal == null) { form.getErr().emit("org.bedework.client.error.nosuchcalendar", str); return "notFound"; } prefs.setDefaultCalendar(cal); } int mode = getIntReqPar(request, "userMode", -1); if (mode != -1) { if ((mode < 0) || (mode > BwPreferences.maxMode)) { form.getErr().emit("org.bedework.client.error.badPref", "userMode"); return "badPref"; } prefs.setUserMode(mode); } str = getReqPar(request, "workDays"); if (str != null) { // XXX validate prefs.setWorkDays(str); } int minutes = getIntReqPar(request, "workDayStart", -1); if (minutes != -1) { if ((minutes < 0) || (minutes > 24 * 60 - 1)) { form.getErr().emit("org.bedework.client.error.badPref", "workDayStart"); return "badPref"; } prefs.setWorkdayStart(minutes); } minutes = getIntReqPar(request, "workDayEnd", -1); if (minutes != -1) { if ((minutes < 0) || (minutes > 24 * 60 - 1)) { form.getErr().emit("org.bedework.client.error.badPref", "workDayEnd"); return "badPref"; } prefs.setWorkdayEnd(minutes); } if (prefs.getWorkdayStart() > prefs.getWorkdayEnd()) { form.getErr().emit("org.bedework.client.error.badPref", "workDayStart > workDayEnd"); return "badPref"; } str = getReqPar(request, "preferredEndType"); if (str != null) { if ("duration".equals(str) || "date".equals(str)) { prefs.setPreferredEndType(str); } else { form.getErr().emit("org.bedework.client.error.badPref", "preferredEndType"); return "badPref"; } } svc.updateUserPrefs(prefs); form.setUserPreferences(prefs); form.getMsg().emit("org.bedework.client.message.prefs.updated"); return "success"; }
|
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase form) throws Throwable { CalSvcI svc = form.fetchSvci(); BwPreferences prefs; /* Refetch the prefs */ if (getPublicAdmin(form) && (getReqPar(request, "user") != null)) { /* Fetch a given users preferences */ if (!form.getCurUserSuperUser()) { return "noAccess"; // First line of defence } BwUser user = findUser(request, form); if (user == null) { return "notFound"; } prefs = svc.getUserPrefs(user); } else { prefs = svc.getUserPrefs(); } String str = getReqPar(request, "preferredView"); if (str != null) { if (svc.findView(str) == null) { form.getErr().emit("org.bedework.client.error.viewnotfound", str); return "notFound"; } prefs.setPreferredView(str); } str = getReqPar(request, "viewPeriod"); if (str != null) { prefs.setPreferredViewPeriod(form.validViewPeriod(str)); } str = getReqPar(request, "skin"); if (str != null) { prefs.setSkinName(str); } str = getReqPar(request, "skinStyle"); if (str != null) { prefs.setSkinStyle(str); } str = getReqPar(request, "email"); if (str != null) { prefs.setEmail(str); } str = getReqPar(request, "newCalPath"); if (str != null) { BwCalendar cal = svc.getCalendar(str); if (cal == null) { form.getErr().emit("org.bedework.client.error.nosuchcalendar", str); return "notFound"; } prefs.setDefaultCalendar(cal); } int mode = getIntReqPar(request, "userMode", -1); if (mode != -1) { if ((mode < 0) || (mode > BwPreferences.maxMode)) { form.getErr().emit("org.bedework.client.error.badPref", "userMode"); return "badPref"; } prefs.setUserMode(mode); } str = getReqPar(request, "workDays"); if (str != null) { // XXX validate prefs.setWorkDays(str); } int minutes = getIntReqPar(request, "workDayStart", -1); if (minutes != -1) { if ((minutes < 0) || (minutes > 24 * 60 - 1)) { form.getErr().emit("org.bedework.client.error.badPref", "workDayStart"); return "badPref"; } prefs.setWorkdayStart(minutes); } minutes = getIntReqPar(request, "workDayEnd", -1); if (minutes != -1) { if ((minutes < 0) || (minutes > 24 * 60 - 1)) { form.getErr().emit("org.bedework.client.error.badPref", "workDayEnd"); return "badPref"; } prefs.setWorkdayEnd(minutes); } if (prefs.getWorkdayStart() > prefs.getWorkdayEnd()) { form.getErr().emit("org.bedework.client.error.badPref", "workDayStart > workDayEnd"); return "badPref"; } str = getReqPar(request, "preferredEndType"); if (str != null) { if ("duration".equals(str) || "date".equals(str)) { prefs.setPreferredEndType(str); } else { form.getErr().emit("org.bedework.client.error.badPref", "preferredEndType"); return "badPref"; } } svc.updateUserPrefs(prefs); form.setUserPreferences(prefs); form.getMsg().emit("org.bedework.client.message.prefs.updated"); return "success"; }
| 1,118,670
|
public void addParent(BasicSeismogramDisplay newParent){ parents.add(newParent); }
|
public void addParent(BasicSeismogramDisplay newParent){ if(!parents.contains(newParent)) parents.add(newParent); }
| 1,118,671
|
public void merge(char[] val) throws AccessException { setEncoded(val); if (empty()) { return; } while (hasMore()) { Ace ace = new Ace(); ace.decode(this, true); ace.setInherited(true); if (aces == null) { aces = new TreeSet(); aces.add(ace); } else if (!aces.contains(ace)) { aces.add(ace); } } }
|
public void merge(char[] val) throws AccessException { EncodedAcl ea = new EncodedAcl(); ea.setEncoded(val); if (empty()) { return; } while (hasMore()) { Ace ace = new Ace(); ace.decode(this, true); ace.setInherited(true); if (aces == null) { aces = new TreeSet(); aces.add(ace); } else if (!aces.contains(ace)) { aces.add(ace); } } }
| 1,118,672
|
public void merge(char[] val) throws AccessException { setEncoded(val); if (empty()) { return; } while (hasMore()) { Ace ace = new Ace(); ace.decode(this, true); ace.setInherited(true); if (aces == null) { aces = new TreeSet(); aces.add(ace); } else if (!aces.contains(ace)) { aces.add(ace); } } }
|
public void merge(char[] val) throws AccessException { setEncoded(val); if (ea.empty()) { return; } while (hasMore()) { Ace ace = new Ace(); ace.decode(this, true); ace.setInherited(true); if (aces == null) { aces = new TreeSet(); aces.add(ace); } else if (!aces.contains(ace)) { aces.add(ace); } } }
| 1,118,673
|
public void merge(char[] val) throws AccessException { setEncoded(val); if (empty()) { return; } while (hasMore()) { Ace ace = new Ace(); ace.decode(this, true); ace.setInherited(true); if (aces == null) { aces = new TreeSet(); aces.add(ace); } else if (!aces.contains(ace)) { aces.add(ace); } } }
|
public void merge(char[] val) throws AccessException { setEncoded(val); if (empty()) { return; } while (ea.hasMore()) { Ace ace = new Ace(); ace.decode(this, true); ace.setInherited(true); if (aces == null) { aces = new TreeSet(); aces.add(ace); } else if (!aces.contains(ace)) { aces.add(ace); } } }
| 1,118,674
|
public void merge(char[] val) throws AccessException { setEncoded(val); if (empty()) { return; } while (hasMore()) { Ace ace = new Ace(); ace.decode(this, true); ace.setInherited(true); if (aces == null) { aces = new TreeSet(); aces.add(ace); } else if (!aces.contains(ace)) { aces.add(ace); } } }
|
public void merge(char[] val) throws AccessException { setEncoded(val); if (empty()) { return; } while (hasMore()) { Ace ace = new Ace(); ace.decode(ea, true); ace.setInherited(true); if (aces == null) { aces = new TreeSet(); aces.add(ace); } else if (!aces.contains(ace)) { aces.add(ace); } } }
| 1,118,675
|
public ActionForward execute(ActionMapping mapping, ActionForm frm, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ErrorEmitSvlt err = null; MessageEmitSvlt msg = null; String forward = "success"; UtilActionForm form = (UtilActionForm)frm; try { messages = getResources(request); /* Explicitly set logging on/off with an init parameter. Basing debugging off the state of log4j turns out to be too inflexible - for example, we have many applications with exactly the same code, basing logging on class names doesn't work. */ String debugVal = servlet.getServletConfig().getServletContext().getInitParameter("debug"); debug = !"0".equals(debugVal); checkDebug(request, form); isPortlet = isPortletRequest(request); noActionErrors = JspUtil.getProperty(messages, "edu.rpi.sss.util.action.noactionerrors", "no").equals("yes"); err = getErrorObj(request, messages); msg = getMessageObj(request, messages); /** Log the request - virtual domains can make it difficult to * distinguish applications. */ logRequest(request); if (debug) { debugOut("entry"); debugOut("================================"); debugOut("isPortlet=" + isPortlet); Enumeration en = servlet.getInitParameterNames(); while (en.hasMoreElements()) { debugOut("attr name=" + en.nextElement()); } debugOut("================================"); dumpRequest(request); } if (!form.getInitialised()) { // Do one time settings form.setNocache( JspUtil.getProperty(messages, "edu.rpi.sss.util.action.nocache", "no").equals("yes")); form.setInitialised(true); } form.setLog(getLogger()); form.setDebug(debug); form.setMres(messages); form.setBrowserType(JspUtil.getBrowserType(request)); form.assignCurrentUser(request.getRemoteUser()); form.setUrl(JspUtil.getUrl(request)); form.setSchemeHostPort(JspUtil.getURLshp(request)); form.setContext(JspUtil.getContext(request)); form.setUrlPrefix(JspUtil.getURLPrefix(request)); form.setActionPath(mapping.getPath()); form.setErr(err); form.setMsg(msg); form.assignSessionId(getSessionId(request)); checkNocache(request, response, form); String defaultContentType = JspUtil.getProperty(messages, "edu.rpi.sss.util.action.contenttype", "text/html"); /** Set up presentation values from request */ doPresentation(request, form); String contentName = getContentName(form); if (contentName != null) { /* Indicate we have a file attachment with the given name */ response.setHeader("Content-Disposition", "Attachment; Filename=\"" + contentName + "\""); } // Debugging action to test session serialization if (debug) { checkSerialize(request); } String appRoot = form.getPresentationState().getAppRoot(); if (appRoot != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("edu.rpi.sss.util.action.approot", appRoot); } /* ---------------------------------------------------------------- Everything is set up and ready to go. Execute something ---------------------------------------------------------------- */ forward = checkLogOut(request, form); if (forward != null) { // Disable xslt filters response.setContentType("text/html"); } else { response.setContentType(defaultContentType); forward = checkVarReq(request, form); if (forward == null) { forward = checkForwardto(request); } if (forward == null) { forward = performAction(request, response, form, messages); } } if (forward == null) { getLogger().warn("Forward = null"); err.emit("edu.rpi.sss.util.nullforward"); forward = "error"; } if (err == null) { getLogger().warn("No errors object"); } else if (err.messagesEmitted()) { if (noActionErrors) { } else { ActionErrors aes = ((ErrorEmitSvlt)err).getErrors(); saveErrors(request, aes); } if (debug) { getLogger().debug(((ErrorEmitSvlt)err).getMsgList().size() + " errors emitted"); } } else if (debug) { getLogger().debug("No errors emitted"); } if (msg == null) { getLogger().warn("No messages object"); } else if (msg.messagesEmitted()) { ActionMessages ams = ((MessageEmitSvlt)msg).getMessages(); saveMessages(request, ams); if (debug) { getLogger().debug(ams.size() + " messages emitted"); } } else if (debug) { getLogger().debug("No messages emitted"); } if (debug) { getLogger().debug("exit to " + forward); } } catch (Throwable t) { if (debug) { getLogger().debug("Action exception: ", t); } err.emit(t); forward = "error"; } return (mapping.findForward(forward)); }
|
public ActionForward execute(ActionMapping mapping, ActionForm frm, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ErrorEmitSvlt err = null; MessageEmitSvlt msg = null; String forward = "success"; UtilActionForm form = (UtilActionForm)frm; try { messages = getResources(request); /* Explicitly set logging on/off with an init parameter. Basing debugging off the state of log4j turns out to be too inflexible - for example, we have many applications with exactly the same code, basing logging on class names doesn't work. */ String debugVal = servlet.getServletConfig().getServletContext().getInitParameter("debug"); debug = !"0".equals(debugVal); checkDebug(request, form); isPortlet = isPortletRequest(request); noActionErrors = JspUtil.getProperty(messages, "edu.rpi.sss.util.action.noactionerrors", "no").equals("yes"); err = getErrorObj(request, messages); msg = getMessageObj(request, messages); /** Log the request - virtual domains can make it difficult to * distinguish applications. */ logRequest(request); if (debug) { debugOut("entry"); debugOut("================================"); debugOut("isPortlet=" + isPortlet); Enumeration en = servlet.getInitParameterNames(); while (en.hasMoreElements()) { debugOut("attr name=" + en.nextElement()); } debugOut("================================"); dumpRequest(request); } if (!form.getInitialised()) { // Do one time settings form.setNocache( JspUtil.getProperty(messages, "edu.rpi.sss.util.action.nocache", "no").equals("yes")); form.setInitialised(true); } form.setLog(getLogger()); form.setDebug(debug); form.setMres(messages); form.setBrowserType(JspUtil.getBrowserType(request)); form.assignCurrentUser(request.getRemoteUser()); form.setUrl(JspUtil.getUrl(request)); form.setSchemeHostPort(JspUtil.getURLshp(request)); form.setContext(JspUtil.getContext(request)); form.setUrlPrefix(JspUtil.getURLPrefix(request)); form.setActionPath(mapping.getPath()); form.setErr(err); form.setMsg(msg); form.assignSessionId(getSessionId(request)); checkNocache(request, response, form); String defaultContentType = JspUtil.getProperty(messages, "edu.rpi.sss.util.action.contenttype", "text/html"); /** Set up presentation values from request */ doPresentation(request, form); String contentName = getContentName(form); if (contentName != null) { /* Indicate we have a file attachment with the given name */ response.setHeader("Content-Disposition", "Attachment; Filename=\"" + contentName + "\""); } // Debugging action to test session serialization if (debug) { checkSerialize(request); } String appRoot = form.getPresentationState().getAppRoot(); if (appRoot != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("edu.rpi.sss.util.action.approot", appRoot); } /* ---------------------------------------------------------------- Everything is set up and ready to go. Execute something ---------------------------------------------------------------- */ if (!isPortlet) { forward = checkLogOut(request, form); } else { forward = null; } if (forward != null) { // Disable xslt filters response.setContentType("text/html"); } else { response.setContentType(defaultContentType); forward = checkVarReq(request, form); if (forward == null) { forward = checkForwardto(request); } if (forward == null) { forward = performAction(request, response, form, messages); } } if (forward == null) { getLogger().warn("Forward = null"); err.emit("edu.rpi.sss.util.nullforward"); forward = "error"; } if (err == null) { getLogger().warn("No errors object"); } else if (err.messagesEmitted()) { if (noActionErrors) { } else { ActionErrors aes = ((ErrorEmitSvlt)err).getErrors(); saveErrors(request, aes); } if (debug) { getLogger().debug(((ErrorEmitSvlt)err).getMsgList().size() + " errors emitted"); } } else if (debug) { getLogger().debug("No errors emitted"); } if (msg == null) { getLogger().warn("No messages object"); } else if (msg.messagesEmitted()) { ActionMessages ams = ((MessageEmitSvlt)msg).getMessages(); saveMessages(request, ams); if (debug) { getLogger().debug(ams.size() + " messages emitted"); } } else if (debug) { getLogger().debug("No messages emitted"); } if (debug) { getLogger().debug("exit to " + forward); } } catch (Throwable t) { if (debug) { getLogger().debug("Action exception: ", t); } err.emit(t); forward = "error"; } return (mapping.findForward(forward)); }
| 1,118,676
|
public ActionForward execute(ActionMapping mapping, ActionForm frm, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ErrorEmitSvlt err = null; MessageEmitSvlt msg = null; String forward = "success"; UtilActionForm form = (UtilActionForm)frm; try { messages = getResources(request); /* Explicitly set logging on/off with an init parameter. Basing debugging off the state of log4j turns out to be too inflexible - for example, we have many applications with exactly the same code, basing logging on class names doesn't work. */ String debugVal = servlet.getServletConfig().getServletContext().getInitParameter("debug"); debug = !"0".equals(debugVal); checkDebug(request, form); isPortlet = isPortletRequest(request); noActionErrors = JspUtil.getProperty(messages, "edu.rpi.sss.util.action.noactionerrors", "no").equals("yes"); err = getErrorObj(request, messages); msg = getMessageObj(request, messages); /** Log the request - virtual domains can make it difficult to * distinguish applications. */ logRequest(request); if (debug) { debugOut("entry"); debugOut("================================"); debugOut("isPortlet=" + isPortlet); Enumeration en = servlet.getInitParameterNames(); while (en.hasMoreElements()) { debugOut("attr name=" + en.nextElement()); } debugOut("================================"); dumpRequest(request); } if (!form.getInitialised()) { // Do one time settings form.setNocache( JspUtil.getProperty(messages, "edu.rpi.sss.util.action.nocache", "no").equals("yes")); form.setInitialised(true); } form.setLog(getLogger()); form.setDebug(debug); form.setMres(messages); form.setBrowserType(JspUtil.getBrowserType(request)); form.assignCurrentUser(request.getRemoteUser()); form.setUrl(JspUtil.getUrl(request)); form.setSchemeHostPort(JspUtil.getURLshp(request)); form.setContext(JspUtil.getContext(request)); form.setUrlPrefix(JspUtil.getURLPrefix(request)); form.setActionPath(mapping.getPath()); form.setErr(err); form.setMsg(msg); form.assignSessionId(getSessionId(request)); checkNocache(request, response, form); String defaultContentType = JspUtil.getProperty(messages, "edu.rpi.sss.util.action.contenttype", "text/html"); /** Set up presentation values from request */ doPresentation(request, form); String contentName = getContentName(form); if (contentName != null) { /* Indicate we have a file attachment with the given name */ response.setHeader("Content-Disposition", "Attachment; Filename=\"" + contentName + "\""); } // Debugging action to test session serialization if (debug) { checkSerialize(request); } String appRoot = form.getPresentationState().getAppRoot(); if (appRoot != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("edu.rpi.sss.util.action.approot", appRoot); } /* ---------------------------------------------------------------- Everything is set up and ready to go. Execute something ---------------------------------------------------------------- */ forward = checkLogOut(request, form); if (forward != null) { // Disable xslt filters response.setContentType("text/html"); } else { response.setContentType(defaultContentType); forward = checkVarReq(request, form); if (forward == null) { forward = checkForwardto(request); } if (forward == null) { forward = performAction(request, response, form, messages); } } if (forward == null) { getLogger().warn("Forward = null"); err.emit("edu.rpi.sss.util.nullforward"); forward = "error"; } if (err == null) { getLogger().warn("No errors object"); } else if (err.messagesEmitted()) { if (noActionErrors) { } else { ActionErrors aes = ((ErrorEmitSvlt)err).getErrors(); saveErrors(request, aes); } if (debug) { getLogger().debug(((ErrorEmitSvlt)err).getMsgList().size() + " errors emitted"); } } else if (debug) { getLogger().debug("No errors emitted"); } if (msg == null) { getLogger().warn("No messages object"); } else if (msg.messagesEmitted()) { ActionMessages ams = ((MessageEmitSvlt)msg).getMessages(); saveMessages(request, ams); if (debug) { getLogger().debug(ams.size() + " messages emitted"); } } else if (debug) { getLogger().debug("No messages emitted"); } if (debug) { getLogger().debug("exit to " + forward); } } catch (Throwable t) { if (debug) { getLogger().debug("Action exception: ", t); } err.emit(t); forward = "error"; } return (mapping.findForward(forward)); }
|
public ActionForward execute(ActionMapping mapping, ActionForm frm, HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { ErrorEmitSvlt err = null; MessageEmitSvlt msg = null; String forward = "success"; UtilActionForm form = (UtilActionForm)frm; try { messages = getResources(request); /* Explicitly set logging on/off with an init parameter. Basing debugging off the state of log4j turns out to be too inflexible - for example, we have many applications with exactly the same code, basing logging on class names doesn't work. */ String debugVal = servlet.getServletConfig().getServletContext().getInitParameter("debug"); debug = !"0".equals(debugVal); checkDebug(request, form); isPortlet = isPortletRequest(request); noActionErrors = JspUtil.getProperty(messages, "edu.rpi.sss.util.action.noactionerrors", "no").equals("yes"); err = getErrorObj(request, messages); msg = getMessageObj(request, messages); /** Log the request - virtual domains can make it difficult to * distinguish applications. */ logRequest(request); if (debug) { debugOut("entry"); debugOut("================================"); debugOut("isPortlet=" + isPortlet); Enumeration en = servlet.getInitParameterNames(); while (en.hasMoreElements()) { debugOut("attr name=" + en.nextElement()); } debugOut("================================"); dumpRequest(request); } if (!form.getInitialised()) { // Do one time settings form.setNocache( JspUtil.getProperty(messages, "edu.rpi.sss.util.action.nocache", "no").equals("yes")); form.setInitialised(true); } form.setLog(getLogger()); form.setDebug(debug); form.setMres(messages); form.setBrowserType(JspUtil.getBrowserType(request)); form.assignCurrentUser(request.getRemoteUser()); form.setUrl(JspUtil.getUrl(request)); form.setSchemeHostPort(JspUtil.getURLshp(request)); form.setContext(JspUtil.getContext(request)); form.setUrlPrefix(JspUtil.getURLPrefix(request)); form.setActionPath(mapping.getPath()); form.setErr(err); form.setMsg(msg); form.assignSessionId(getSessionId(request)); checkNocache(request, response, form); String defaultContentType = JspUtil.getProperty(messages, "edu.rpi.sss.util.action.contenttype", "text/html"); /** Set up presentation values from request */ doPresentation(request, form); String contentName = getContentName(form); if (contentName != null) { /* Indicate we have a file attachment with the given name */ response.setHeader("Content-Disposition", "Attachment; Filename=\"" + contentName + "\""); } // Debugging action to test session serialization if (debug) { checkSerialize(request); } String appRoot = form.getPresentationState().getAppRoot(); if (appRoot != null) { // Embed in request for pages that cannot access the form (loggedOut) request.setAttribute("edu.rpi.sss.util.action.approot", appRoot); } /* ---------------------------------------------------------------- Everything is set up and ready to go. Execute something ---------------------------------------------------------------- */ forward = checkLogOut(request, form); if (forward != null) { // Disable xslt filters response.setContentType("text/html"); } else { if (!isPortlet) { response.setContentType(defaultContentType); } forward = checkVarReq(request, form); if (forward == null) { forward = checkForwardto(request); } if (forward == null) { forward = performAction(request, response, form, messages); } } if (forward == null) { getLogger().warn("Forward = null"); err.emit("edu.rpi.sss.util.nullforward"); forward = "error"; } if (err == null) { getLogger().warn("No errors object"); } else if (err.messagesEmitted()) { if (noActionErrors) { } else { ActionErrors aes = ((ErrorEmitSvlt)err).getErrors(); saveErrors(request, aes); } if (debug) { getLogger().debug(((ErrorEmitSvlt)err).getMsgList().size() + " errors emitted"); } } else if (debug) { getLogger().debug("No errors emitted"); } if (msg == null) { getLogger().warn("No messages object"); } else if (msg.messagesEmitted()) { ActionMessages ams = ((MessageEmitSvlt)msg).getMessages(); saveMessages(request, ams); if (debug) { getLogger().debug(ams.size() + " messages emitted"); } } else if (debug) { getLogger().debug("No messages emitted"); } if (debug) { getLogger().debug("exit to " + forward); } } catch (Throwable t) { if (debug) { getLogger().debug("Action exception: ", t); } err.emit(t); forward = "error"; } return (mapping.findForward(forward)); }
| 1,118,677
|
public static BwLog getLogger() { BwLog logger = null; try { logger = (BwLog)CalEnv.getGlobalObject("loggerclass", BwLog.class); } catch (Throwable t) { logger = new BwLogImpl(); } return logger; }
|
public static BwLog getLogger() { BwLog logger = null; try { logger = (BwLog)CalEnvFactory.getEnv(null, false).getGlobalObject("loggerclass", BwLog.class); } catch (Throwable t) { logger = new BwLogImpl(); } return logger; }
| 1,118,678
|
public void addSeismogram(LocalSeismogram seis){ if(beginTime == null) this.beginTime = ((LocalSeismogramImpl)seis).getBeginTime(); if(displayInterval == null) this.displayInterval = new TimeInterval(((LocalSeismogramImpl)seis).getBeginTime(), ((LocalSeismogramImpl)seis).getEndTime()); seismos.put(seis, ((LocalSeismogramImpl)seis).getBeginTime()); this.updateTimeSyncListeners(); }
|
public void addSeismogram(LocalSeismogram seis){ if(beginTime == null){ this.beginTime = ((LocalSeismogramImpl)seis).getBeginTime(); if(displayInterval == null) this.displayInterval = new TimeInterval(((LocalSeismogramImpl)seis).getBeginTime(), ((LocalSeismogramImpl)seis).getEndTime()); seismos.put(seis, ((LocalSeismogramImpl)seis).getBeginTime()); this.updateTimeSyncListeners(); }
| 1,118,679
|
public void addSeismogram(LocalSeismogram seis){ if(beginTime == null) this.beginTime = ((LocalSeismogramImpl)seis).getBeginTime(); if(displayInterval == null) this.displayInterval = new TimeInterval(((LocalSeismogramImpl)seis).getBeginTime(), ((LocalSeismogramImpl)seis).getEndTime()); seismos.put(seis, ((LocalSeismogramImpl)seis).getBeginTime()); this.updateTimeSyncListeners(); }
|
public void addSeismogram(LocalSeismogram seis){ if(beginTime == null) this.beginTime = ((LocalSeismogramImpl)seis).getBeginTime(); if(displayInterval == null) this.displayInterval = new TimeInterval(((LocalSeismogramImpl)seis).getBeginTime(), ((LocalSeismogramImpl)seis).getEndTime()); this.updateTimeSyncListeners(); }
| 1,118,680
|
public abstract MicroSecondTimeRange getTimeRange();
|
public abstract MicroSecondTimeRange getTimeRange(DataSetSeismogram seis);
| 1,118,681
|
public void eqSelectionChanged(EQSelectionEvent eqSelectionEvent) { OMEvent selected = null; List deselected = new ArrayList(); synchronized(circles){ Iterator it = circles.iterator(); while (it.hasNext()){ OMEvent current = (OMEvent)it.next(); try{ if (current.getEvent().get_preferred_origin().equals(eqSelectionEvent.getEvents()[0].get_preferred_origin())){ selected = current; }else{ deselected.add(current); } } catch(NoPreferredOrigin e){} } } if(selected != null){ selected.select(); synchronized(circles){ circles.moveIndexedToTop(circles.indexOf(selected)); } } Iterator it = deselected.iterator(); while(it.hasNext()){ ((OMEvent)it.next()).deselect(); } }
|
public void eqSelectionChanged(EQSelectionEvent eqSelectionEvent) { OMEvent selected = null; List deselected = new ArrayList(); synchronized(circles){ Iterator it = circles.iterator(); while (it.hasNext()){ OMEvent current = (OMEvent)it.next(); try{ if (DisplayUtils.originIsEqual(current.getEvent(), eqSelectionEvent.getEvents()[0])){ selected = current; }else{ deselected.add(current); } } catch(NoPreferredOrigin e){} } } if(selected != null){ selected.select(); synchronized(circles){ circles.moveIndexedToTop(circles.indexOf(selected)); } } Iterator it = deselected.iterator(); while(it.hasNext()){ ((OMEvent)it.next()).deselect(); } }
| 1,118,682
|
public void eqSelectionChanged(EQSelectionEvent eqSelectionEvent) { OMEvent selected = null; List deselected = new ArrayList(); synchronized(circles){ Iterator it = circles.iterator(); while (it.hasNext()){ OMEvent current = (OMEvent)it.next(); try{ if (current.getEvent().get_preferred_origin().equals(eqSelectionEvent.getEvents()[0].get_preferred_origin())){ selected = current; }else{ deselected.add(current); } } catch(NoPreferredOrigin e){} } } if(selected != null){ selected.select(); synchronized(circles){ circles.moveIndexedToTop(circles.indexOf(selected)); } } Iterator it = deselected.iterator(); while(it.hasNext()){ ((OMEvent)it.next()).deselect(); } }
|
public void eqSelectionChanged(EQSelectionEvent eqSelectionEvent) { OMEvent selected = null; List deselected = new ArrayList(); synchronized(circles){ Iterator it = circles.iterator(); while (it.hasNext()){ OMEvent current = (OMEvent)it.next(); try{ if (current.getEvent().get_preferred_origin().equals(eqSelectionEvent.getEvents()[0].get_preferred_origin())){ selected = current; }else{ deselected.add(current); } } catch(NoPreferredOrigin e){ e.printStackTrace(); } } } if(selected != null){ selected.select(); synchronized(circles){ circles.moveIndexedToTop(circles.indexOf(selected)); } } Iterator it = deselected.iterator(); while(it.hasNext()){ ((OMEvent)it.next()).deselect(); } }
| 1,118,683
|
public boolean mouseMoved(MouseEvent e){ synchronized(circles){ Iterator it = circles.iterator(); while(it.hasNext()){ OMEvent current = (OMEvent)it.next(); try{ if(current.getBigCircle().contains(e.getX(), e.getY())){ EventAccessOperations event = current.getEvent(); StringBuffer buf = new StringBuffer(); //Get geographic name of origin ParseRegions regions = new ParseRegions(); String location = regions.getGeographicRegionName(event.get_attributes().region.number); //Get Date and format it accordingly MicroSecondDate msd = new MicroSecondDate(event.get_preferred_origin().origin_time); SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss z"); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); sdf.format(msd); //Get Magnitude float mag = event.get_preferred_origin().magnitudes[0].value; //get depth Quantity depth = event.get_preferred_origin().my_location.depth; buf.append("Event: "); buf.append(location + " | "); buf.append(sdf.format(msd) + " | "); buf.append("Mag " + mag + " | "); buf.append("Depth " + depth.value + " " + depth.the_units); fireRequestInfoLine(buf.toString()); return true; } } catch(Exception ex){} } } fireRequestInfoLine(" "); return false; }
|
public boolean mouseMoved(MouseEvent e){ synchronized(circles){ Iterator it = circles.iterator(); while(it.hasNext()){ OMEvent current = (OMEvent)it.next(); try{ if(current.getBigCircle().contains(e.getX(), e.getY())){ EventAccessOperations event = current.getEvent(); StringBuffer buf = new StringBuffer(); //Get geographic name of origin ParseRegions regions = new ParseRegions(); String location = regions.getGeographicRegionName(event.get_attributes().region.number); //Get Date and format it accordingly MicroSecondDate msd = new MicroSecondDate(event.get_preferred_origin().origin_time); SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss z"); sdf.setTimeZone(TimeZone.getTimeZone("GMT")); sdf.format(msd); //Get Magnitude float mag = event.get_preferred_origin().magnitudes[0].value; //get depth Quantity depth = event.get_preferred_origin().my_location.depth; buf.append("Event: "); buf.append(location + " | "); buf.append(sdf.format(msd) + " | "); buf.append("Mag " + mag + " | "); buf.append("Depth " + depth.value + " " + depth.the_units); fireRequestInfoLine(buf.toString()); return true; } } catch(Exception ex){} } } fireRequestInfoLine(" "); return false; }
| 1,118,684
|
public CalSvcTestWrapper(String user, int access, boolean publicEvents, boolean debug) throws Throwable { super(); //this.debug = debug; isPublic = publicEvents; this.user = user; String envPrefix; if (publicEvents) { envPrefix = webAdminAppPrefix; } else if (user == null) { envPrefix = webPublicAppPrefix; } else { envPrefix = webPersonalAppPrefix; } CalSvcIPars pars = new CalSvcIPars(user, access, user, envPrefix, publicEvents, false, // caldav null, // synch debug); init(pars); }
|
public CalSvcTestWrapper(String user, int access, boolean publicEvents, boolean debug) throws Throwable { super(); //this.debug = debug; isPublic = publicEvents; this.user = user; String envPrefix; if (publicEvents) { envPrefix = webAdminAppPrefix; } else if (user == null) { envPrefix = webPublicAppPrefix; } else { envPrefix = webPersonalAppPrefix; } CalSvcIPars pars = new CalSvcIPars(user, user, envPrefix, publicEvents, false, // caldav null, // synch debug); init(pars); }
| 1,118,685
|
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } int id = form.getLocationId(); if (id < 0) { // Do nothing return "doNothing"; } CalSvcI svci = form.getCalSvcI(); BwLocation loc = svci.getLocation(id); int delResult = svci.deleteLocation(loc); if (delResult == 2) { form.getErr().emit("org.bedework.error.location.referenced"); return "referenced"; } if (delResult == 1) { form.getErr().emit("org.bedework.error.nosuchlocation", id); return "doNothing"; } form.getMsg().emit("org.bedework.message.deleted.locations", 1); return "success"; }
|
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } int id = form.getLocationId(); if (id < 0) { // Do nothing return "doNothing"; } CalSvcI svci = form.getCalSvcI(); BwLocation loc = svci.getLocation(id); int delResult = svci.deleteLocation(loc); if (delResult == 2) { form.getErr().emit("org.bedework.client.error.location.referenced"); return "referenced"; } if (delResult == 1) { form.getErr().emit("org.bedework.error.nosuchlocation", id); return "doNothing"; } form.getMsg().emit("org.bedework.message.deleted.locations", 1); return "success"; }
| 1,118,686
|
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } int id = form.getLocationId(); if (id < 0) { // Do nothing return "doNothing"; } CalSvcI svci = form.getCalSvcI(); BwLocation loc = svci.getLocation(id); int delResult = svci.deleteLocation(loc); if (delResult == 2) { form.getErr().emit("org.bedework.error.location.referenced"); return "referenced"; } if (delResult == 1) { form.getErr().emit("org.bedework.error.nosuchlocation", id); return "doNothing"; } form.getMsg().emit("org.bedework.message.deleted.locations", 1); return "success"; }
|
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } int id = form.getLocationId(); if (id < 0) { // Do nothing return "doNothing"; } CalSvcI svci = form.getCalSvcI(); BwLocation loc = svci.getLocation(id); int delResult = svci.deleteLocation(loc); if (delResult == 2) { form.getErr().emit("org.bedework.error.location.referenced"); return "referenced"; } if (delResult == 1) { form.getErr().emit("org.bedework.client.error.nosuchlocation", id); return "doNothing"; } form.getMsg().emit("org.bedework.message.deleted.locations", 1); return "success"; }
| 1,118,687
|
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } int id = form.getLocationId(); if (id < 0) { // Do nothing return "doNothing"; } CalSvcI svci = form.getCalSvcI(); BwLocation loc = svci.getLocation(id); int delResult = svci.deleteLocation(loc); if (delResult == 2) { form.getErr().emit("org.bedework.error.location.referenced"); return "referenced"; } if (delResult == 1) { form.getErr().emit("org.bedework.error.nosuchlocation", id); return "doNothing"; } form.getMsg().emit("org.bedework.message.deleted.locations", 1); return "success"; }
|
public String doAction(HttpServletRequest request, BwActionForm form) throws Throwable { if (form.getGuest()) { return "doNothing"; } int id = form.getLocationId(); if (id < 0) { // Do nothing return "doNothing"; } CalSvcI svci = form.getCalSvcI(); BwLocation loc = svci.getLocation(id); int delResult = svci.deleteLocation(loc); if (delResult == 2) { form.getErr().emit("org.bedework.error.location.referenced"); return "referenced"; } if (delResult == 1) { form.getErr().emit("org.bedework.error.nosuchlocation", id); return "doNothing"; } form.getMsg().emit("org.bedework.client.message.deleted.locations", 1); return "success"; }
| 1,118,688
|
public void testGetCurrentUrlMalformedQueryString() throws Exception { request.setScheme("http"); request.setServerName("www.example.com"); request.setServerPort(80); request.setContextPath(""); request.setServletPath("/index.jsp"); request.setQueryString("param1=test1"); URL result = RequestHelper.getCurrentUrl(request); String ext = result.toExternalForm(); assertEquals("http://www.example.com/index.jsp?param1=test1", ext); }
|
public void testGetCurrentUrlMalformedQueryString() throws Exception { request.setScheme("http"); request.setServerName("www.example.com"); request.setServerPort(80); request.setContextPath(""); request.setServletPath("/index.jsp"); URL result = RequestHelper.getCurrentUrl(request); String ext = result.toExternalForm(); assertEquals("http://www.example.com/index.jsp?param1=test1", ext); }
| 1,118,689
|
public static PrivilegeSet fromEncoding(EncodedAcl acl) throws AccessException { char[] privStates = { unspecified, // privAll unspecified, // privRead unspecified, // privReadAcl unspecified, // privReadCurrentUserPrivilegeSet unspecified, // privReadFreeBusy unspecified, // privWrite unspecified, // privWriteAcl unspecified, // privWriteProperties unspecified, // privWriteContent unspecified, // privBind unspecified, // privUnbind unspecified, // privUnlock unspecified, // privNone }; while (acl.hasMore()) { char c = acl.getChar(); if ((c == ' ') || (c == inheritedFlag)) { break; } acl.back(); Privilege p = findPriv(privs[privAll], acl); if (p == null) { throw AccessException.badACL("unknown priv"); } // Set the states based on the priv we just found. setState(privStates, p, p.getDenial()); } return new PrivilegeSet(privStates); }
|
public static PrivilegeSet fromEncoding(EncodedAcl acl) throws AccessException { char[] privStates = { unspecified, // privAll unspecified, // privRead unspecified, // privReadAcl unspecified, // privReadCurrentUserPrivilegeSet unspecified, // privReadFreeBusy unspecified, // privWrite unspecified, // privWriteAcl unspecified, // privWriteProperties unspecified, // privWriteContent unspecified, // privBind unspecified, // privUnbind unspecified, // privUnlock unspecified, // privNone }; while (acl.hasMore()) { char c = acl.getChar(); if ((c == ' ') || (c == inheritedFlag)) { break; } acl.back(); Privilege p = Privilege.findPriv(privs[privAll], privs[privNone], acl); if (p == null) { throw AccessException.badACL("unknown priv"); } // Set the states based on the priv we just found. setState(privStates, p, p.getDenial()); } return new PrivilegeSet(privStates); }
| 1,118,691
|
public static PrivilegeSet fromEncoding(EncodedAcl acl) throws AccessException { char[] privStates = { unspecified, // privAll unspecified, // privRead unspecified, // privReadAcl unspecified, // privReadCurrentUserPrivilegeSet unspecified, // privReadFreeBusy unspecified, // privWrite unspecified, // privWriteAcl unspecified, // privWriteProperties unspecified, // privWriteContent unspecified, // privBind unspecified, // privUnbind unspecified, // privUnlock unspecified, // privNone }; while (acl.hasMore()) { char c = acl.getChar(); if ((c == ' ') || (c == inheritedFlag)) { break; } acl.back(); Privilege p = findPriv(privs[privAll], acl); if (p == null) { throw AccessException.badACL("unknown priv"); } // Set the states based on the priv we just found. setState(privStates, p, p.getDenial()); } return new PrivilegeSet(privStates); }
|
public static PrivilegeSet fromEncoding(EncodedAcl acl) throws AccessException { char[] privStates = { unspecified, // privAll unspecified, // privRead unspecified, // privReadAcl unspecified, // privReadCurrentUserPrivilegeSet unspecified, // privReadFreeBusy unspecified, // privWrite unspecified, // privWriteAcl unspecified, // privWriteProperties unspecified, // privWriteContent unspecified, // privBind unspecified, // privUnbind unspecified, // privUnlock unspecified, // privNone }; while (acl.hasMore()) { char c = acl.getChar(); if ((c == ' ') || (c == inheritedFlag)) { break; } acl.back(); Privilege p = findPriv(privs[privAll], acl); if (p == null) { throw AccessException.badACL("unknown priv " + acl.getErrorInfo()); } // Set the states based on the priv we just found. setState(privStates, p, p.getDenial()); } return new PrivilegeSet(privStates); }
| 1,118,692
|
public static Collection getPrivs(EncodedAcl acl) throws AccessException { ArrayList al = new ArrayList(); while (acl.hasMore()) { char c = acl.getChar(); if ((c == ' ') || (c == inheritedFlag)) { break; } acl.back(); Privilege p = findPriv(privs[privAll], acl); if (p == null) { throw AccessException.badACL("unknown priv"); } al.add(p); } return al; }
|
public static Collection getPrivs(EncodedAcl acl) throws AccessException { ArrayList al = new ArrayList(); while (acl.hasMore()) { char c = acl.getChar(); if ((c == ' ') || (c == inheritedFlag)) { break; } acl.back(); Privilege p = Privilege.findPriv(privs[privAll], privs[privNone], acl); if (p == null) { throw AccessException.badACL("unknown priv"); } al.add(p); } return al; }
| 1,118,694
|
int getMaxMonth() { return 12; }
|
int getMaxMonth() { return 12; }
| 1,118,695
|
public void testPutTwoDaysGetOne() throws SQLException, IOException { PlottableChunk secondDay = new PlottableChunk(data.getData(), 0, 2, 2000, PIXELS, CHAN_ID); plottDb.put(new PlottableChunk[] {data, secondDay}); MicroSecondDate halfPastFirstDay = START.add((TimeInterval)ONE_DAY.divideBy(2)); MicroSecondTimeRange halfFirstToHalfSecond = new MicroSecondTimeRange(halfPastFirstDay, ONE_DAY); PlottableChunk[] out = plottDb.get(halfFirstToHalfSecond, data.getChannel(), data.getPixelsPerDay()); int halfLength = data.getData().x_coor.length / 2; int[] x = new int[halfLength]; int[] y = new int[halfLength]; for(int i = 0; i < halfLength; i++) { x[i] = (i + halfLength) / 2; } System.arraycopy(data.getData().y_coor, halfLength, y, 0, halfLength); PlottableChunk secondHalfFirstDay = new PlottableChunk(new Plottable(x, y), halfLength, 1, 2000, PIXELS, CHAN_ID); assertEquals(secondHalfFirstDay, out[0]); }
|
public void testPutTwoDaysGetOne() throws SQLException, IOException { PlottableChunk secondDay = new PlottableChunk(data.getData(), 0, 2, 2000, PIXELS, CHAN_ID); plottDb.put(new PlottableChunk[] {data, secondDay}); MicroSecondDate halfPastFirstDay = START.add((TimeInterval)ONE_DAY.divideBy(2)); MicroSecondTimeRange halfFirstToHalfSecond = new MicroSecondTimeRange(halfPastFirstDay, ONE_DAY); PlottableChunk[] out = plottDb.get(halfFirstToHalfSecond, data.getChannel(), data.getPixelsPerDay()); int halfLength = data.getData().x_coor.length / 2; int[] x = new int[halfLength]; int[] y = new int[halfLength]; for(int i = 0; i < halfLength; i++) { x[i] = (i + halfLength) / 2; } System.arraycopy(data.getData().y_coor, halfLength, y, 0, halfLength); PlottableChunk secondHalfFirstDay = new PlottableChunk(new Plottable(x, y), halfLength, 1, 2000, PIXELS, CHAN_ID); assertEquals(secondHalfFirstDay, out[0]); }
| 1,118,696
|
public void testPutTwoDaysGetOne() throws SQLException, IOException { PlottableChunk secondDay = new PlottableChunk(data.getData(), 0, 2, 2000, PIXELS, CHAN_ID); plottDb.put(new PlottableChunk[] {data, secondDay}); MicroSecondDate halfPastFirstDay = START.add((TimeInterval)ONE_DAY.divideBy(2)); MicroSecondTimeRange halfFirstToHalfSecond = new MicroSecondTimeRange(halfPastFirstDay, ONE_DAY); PlottableChunk[] out = plottDb.get(halfFirstToHalfSecond, data.getChannel(), data.getPixelsPerDay()); int halfLength = data.getData().x_coor.length / 2; int[] x = new int[halfLength]; int[] y = new int[halfLength]; for(int i = 0; i < halfLength; i++) { x[i] = (i + halfLength) / 2; } System.arraycopy(data.getData().y_coor, halfLength, y, 0, halfLength); PlottableChunk secondHalfFirstDay = new PlottableChunk(new Plottable(x, y), halfLength, 1, 2000, PIXELS, CHAN_ID); assertEquals(secondHalfFirstDay, out[0]); }
|
public void testPutTwoDaysGetOne() throws SQLException, IOException { PlottableChunk secondDay = new PlottableChunk(data.getData(), 0, 2, 2000, PIXELS, CHAN_ID); plottDb.put(new PlottableChunk[] {data, secondDay}); MicroSecondDate halfPastFirstDay = START.add((TimeInterval)ONE_DAY.divideBy(2)); MicroSecondTimeRange halfFirstToHalfSecond = new MicroSecondTimeRange(halfPastFirstDay, ONE_DAY); PlottableChunk[] out = plottDb.get(halfFirstToHalfSecond, data.getChannel(), data.getPixelsPerDay()); int halfLength = data.getData().x_coor.length / 2; int[] x = new int[halfLength]; int[] y = new int[halfLength]; for(int i = 0; i < halfLength; i++) { x[i] = i / 2; } System.arraycopy(data.getData().y_coor, halfLength, y, 0, halfLength); PlottableChunk secondHalfFirstDay = new PlottableChunk(new Plottable(x, y), halfLength, 1, 2000, PIXELS, CHAN_ID); assertEquals(secondHalfFirstDay, out[0]); }
| 1,118,697
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.