rem
stringlengths
0
477k
add
stringlengths
0
313k
context
stringlengths
6
599k
now,
public void testUnknownDasChannelCreation() { DASChannelCreator creator = new DASChannelCreator(NCReaderTest.net, new SamplingFinder() { public int find(String file, TimeRange fileTimeWindow) throws RT130FormatException, IOException { return 40; } }); MicroSecondDate now = new MicroSecondDate(); Channel[] chans = creator.create("1337", now, "1/00331133", new TimeRange()); assertEquals(3, chans.length); assertEquals("1337", chans[0].my_site.my_station.get_code()); // We assume that the channels are BH[ZNE] assertEquals("BHZ", chans[0].get_code()); Channel[] newChans = creator.create("1337", now.subtract(new TimeInterval(1, UnitImpl.MINUTE)), "1/00331133", new TimeRange()); // Dummy DAS channels just expand to fill whatever time is requsted of // that das for(int i = 0; i < newChans.length; i++) { assertEquals(chans[i], newChans[i]); } }
new TimeRange());
new MicroSecondTimeRange(now, now));
public void testUnknownDasChannelCreation() { DASChannelCreator creator = new DASChannelCreator(NCReaderTest.net, new SamplingFinder() { public int find(String file, TimeRange fileTimeWindow) throws RT130FormatException, IOException { return 40; } }); MicroSecondDate now = new MicroSecondDate(); Channel[] chans = creator.create("1337", now, "1/00331133", new TimeRange()); assertEquals(3, chans.length); assertEquals("1337", chans[0].my_site.my_station.get_code()); // We assume that the channels are BH[ZNE] assertEquals("BHZ", chans[0].get_code()); Channel[] newChans = creator.create("1337", now.subtract(new TimeInterval(1, UnitImpl.MINUTE)), "1/00331133", new TimeRange()); // Dummy DAS channels just expand to fill whatever time is requsted of // that das for(int i = 0; i < newChans.length; i++) { assertEquals(chans[i], newChans[i]); } }
now.subtract(new TimeInterval(1, UnitImpl.MINUTE)),
public void testUnknownDasChannelCreation() { DASChannelCreator creator = new DASChannelCreator(NCReaderTest.net, new SamplingFinder() { public int find(String file, TimeRange fileTimeWindow) throws RT130FormatException, IOException { return 40; } }); MicroSecondDate now = new MicroSecondDate(); Channel[] chans = creator.create("1337", now, "1/00331133", new TimeRange()); assertEquals(3, chans.length); assertEquals("1337", chans[0].my_site.my_station.get_code()); // We assume that the channels are BH[ZNE] assertEquals("BHZ", chans[0].get_code()); Channel[] newChans = creator.create("1337", now.subtract(new TimeInterval(1, UnitImpl.MINUTE)), "1/00331133", new TimeRange()); // Dummy DAS channels just expand to fill whatever time is requsted of // that das for(int i = 0; i < newChans.length; i++) { assertEquals(chans[i], newChans[i]); } }
new TimeRange());
new MicroSecondTimeRange(now.subtract(new TimeInterval(1, UnitImpl.MINUTE)), now));
public void testUnknownDasChannelCreation() { DASChannelCreator creator = new DASChannelCreator(NCReaderTest.net, new SamplingFinder() { public int find(String file, TimeRange fileTimeWindow) throws RT130FormatException, IOException { return 40; } }); MicroSecondDate now = new MicroSecondDate(); Channel[] chans = creator.create("1337", now, "1/00331133", new TimeRange()); assertEquals(3, chans.length); assertEquals("1337", chans[0].my_site.my_station.get_code()); // We assume that the channels are BH[ZNE] assertEquals("BHZ", chans[0].get_code()); Channel[] newChans = creator.create("1337", now.subtract(new TimeInterval(1, UnitImpl.MINUTE)), "1/00331133", new TimeRange()); // Dummy DAS channels just expand to fill whatever time is requsted of // that das for(int i = 0; i < newChans.length; i++) { assertEquals(chans[i], newChans[i]); } }
TimeRange fileTimeWindow)
MicroSecondTimeRange fileTimeWindow)
public int find(String file, TimeRange fileTimeWindow) throws RT130FormatException, IOException { return 40; }
return new Orientation[] {new Orientation(0, -90), new Orientation(0, 0), new Orientation(90, 0)};
return new Orientation[] {UP, NORTH, EAST};
public static Orientation[] parseOrientations(String orientationString) { Matcher m = orientation.matcher(orientationString); if(!m.matches()) { throw new IllegalArgumentException("The orientation string must be either 'default' or a channel orientation specification"); } if(m.group(1) != null) { return new Orientation[] {new Orientation(0, -90), new Orientation(0, 0), new Orientation(90, 0)}; } Orientation[] orientations = new Orientation[3]; for(int i = 0; i < orientations.length; i++) { orientations[i] = new Orientation(Integer.parseInt(m.group(3 + i * 2)), Integer.parseInt(m.group(2 + i * 2))); } return orientations; }
public DASChannelCreator(NetworkAttr net, List sites) { this.net = net; Iterator it = sites.iterator(); while(it.hasNext()) { add((Site)it.next()); }
public DASChannelCreator(Properties props) throws IOException { this(PopulationProperties.getNetworkAttr(props), new NCReader(props).getSites());
public DASChannelCreator(NetworkAttr net, List sites) { this.net = net; Iterator it = sites.iterator(); while(it.hasNext()) { add((Site)it.next()); } }
public int find(String file, TimeRange fileTimeWindow)
public int find(String file, MicroSecondTimeRange fileTimeWindow)
public int find(String file, TimeRange fileTimeWindow) throws RT130FormatException, IOException;
System.out.println("The name of the property is "+prop.name); System.out.println("The value of the property is "+prop.value);
public static Element createElement(Document doc, Property prop, String tagName) { //System.out.println("The name of the property is "+prop.name); //System.out.println("The value of the property is "+prop.value); Element element = doc.createElement(tagName); Text textNode = doc.createTextNode(prop.name); Element tempElement = doc.createElement("name"); tempElement.appendChild(textNode); element.appendChild(tempElement); textNode = doc.createTextNode(prop.value); tempElement = doc.createElement("value"); tempElement.appendChild(textNode); element.appendChild(tempElement); return element; }
System.out.println("While getting property name= "+name+" value= "+value);
public static Property getProperty(Element base) { String name = XMLUtil.getText(XMLUtil.getElement(base,"name")); String value = XMLUtil.getText(XMLUtil.getElement(base, "value")); return new Property(name, value); }
String name = XMLUtil.getText(XMLUtil.getElement(base,"name")); String value = XMLUtil.getText(XMLUtil.getElement(base, "value"));
String name = XMLUtil.getText(XMLUtil.getElement(element,"name")); String value = XMLUtil.getText(XMLUtil.getElement(element, "value"));
public static Property parse(Element element) { try { String name = XMLUtil.getText(XMLUtil.getElement(base,"name")); String value = XMLUtil.getText(XMLUtil.getElement(base, "value")); return new Property(name, value); } catch (Exception e) { return null; } // end of try-catch }
if(seisEnd <= seis.getNumPoints() && seisStart >= 0){
if(seisEnd <= seis.getNumPoints() && seisStart >= 0 && (startPixel != 0 && endPixel != 0)){
private void plotAll(Dimension size) throws CodecException{ if(seisEnd <= seis.getNumPoints() && seisStart >= 0){ if(seisStart != 0){ startPixel = 0; } if(seisEnd < seis.getNumPoints()){ endPixel = size.width; seisEnd++; } points = new int[seisEnd - seisStart][2]; samplesPerPixel = (seisEnd - seisStart - 1)/(double)(endPixel - startPixel); for(int i = 0; i < points.length; i++){ points[i][0] = (int)(i/samplesPerPixel) + startPixel; points[i][1] = (int)((seis.getValueAt(i + seisStart).getValue() - minAmp)/range * size.height); } } }
public Statistics(LocalSeismogramImpl seismo) throws FissuresException { if(seismo.can_convert_to_short()){ sSeries = seismo.get_as_shorts(); endIndex = sSeries.length; }else if(seismo.can_convert_to_long()){ iSeries = seismo.get_as_longs();
public Statistics(int[] iSeries) { this.iSeries = iSeries; beginIndex = 0;
public Statistics(LocalSeismogramImpl seismo) throws FissuresException { if(seismo.can_convert_to_short()){ sSeries = seismo.get_as_shorts(); endIndex = sSeries.length; }else if(seismo.can_convert_to_long()){ iSeries = seismo.get_as_longs(); endIndex = iSeries.length; }else if(seismo.can_convert_to_float()){ fSeries = seismo.get_as_floats(); endIndex = fSeries.length; }else{ dSeries = seismo.get_as_doubles(); endIndex = dSeries.length; } beginIndex = 0; }
}else if(seismo.can_convert_to_float()){ fSeries = seismo.get_as_floats(); endIndex = fSeries.length; }else{ dSeries = seismo.get_as_doubles(); endIndex = dSeries.length;
public Statistics(LocalSeismogramImpl seismo) throws FissuresException { if(seismo.can_convert_to_short()){ sSeries = seismo.get_as_shorts(); endIndex = sSeries.length; }else if(seismo.can_convert_to_long()){ iSeries = seismo.get_as_longs(); endIndex = iSeries.length; }else if(seismo.can_convert_to_float()){ fSeries = seismo.get_as_floats(); endIndex = fSeries.length; }else{ dSeries = seismo.get_as_doubles(); endIndex = dSeries.length; } beginIndex = 0; }
beginIndex = 0; }
public Statistics(LocalSeismogramImpl seismo) throws FissuresException { if(seismo.can_convert_to_short()){ sSeries = seismo.get_as_shorts(); endIndex = sSeries.length; }else if(seismo.can_convert_to_long()){ iSeries = seismo.get_as_longs(); endIndex = iSeries.length; }else if(seismo.can_convert_to_float()){ fSeries = seismo.get_as_floats(); endIndex = fSeries.length; }else{ dSeries = seismo.get_as_doubles(); endIndex = dSeries.length; } beginIndex = 0; }
unbindDead(unbindFrom.getAllEventDC()); unbindDead(unbindFrom.getAllSeismogramDC()); unbindDead(unbindFrom.getAllNetworkDC()); unbindDead(unbindFrom.getAllPlottableDC());
unbindDead(unbindFrom.getAllEventDC(), FissuresNamingService.EVENTDC); unbindDead(unbindFrom.getAllSeismogramDC(), FissuresNamingService.SEISDC); unbindDead(unbindFrom.getAllNetworkDC(), FissuresNamingService.NETWORKDC); unbindDead(unbindFrom.getAllPlottableDC(), FissuresNamingService.PLOTTABLEDC);
public static void main(String[] args) throws Exception { BasicConfigurator.configure(); Initializer.init(args); unbindFrom = Initializer.getNS(); unbindDead(unbindFrom.getAllEventDC()); unbindDead(unbindFrom.getAllSeismogramDC()); unbindDead(unbindFrom.getAllNetworkDC()); unbindDead(unbindFrom.getAllPlottableDC()); }
private static void unbindDead(ServerNameDNS[] servers) throws NotFound, CannotProceed, InvalidName {
private static void unbindDead(ServerNameDNS[] servers, String interfaceName) throws NotFound, CannotProceed, InvalidName {
private static void unbindDead(ServerNameDNS[] servers) throws NotFound, CannotProceed, InvalidName { for(int i = 0; i < servers.length; i++) { CorbaChecker checker = new CorbaChecker(servers[i].getCorbaObject(), servers[i].toString()); checker.run(); if(checker.getStatus().getStatus() == ConnStatus.FAILED) { unbindFrom.unbind(servers[i].getServerDNS(), servers[i].getServerName(), servers[i].getCorbaObject()); } } }
CorbaChecker checker = new CorbaChecker(servers[i].getCorbaObject(),
org.omg.CORBA.Object object; try { object = servers[i].getCorbaObject(); } catch(SystemException e) { logger.info(servers[i] + " threw " + e + " Unbinding"); unbindFrom.unbind(servers[i].getServerDNS(), interfaceName, servers[i].getServerName()); continue; } CorbaChecker checker = new CorbaChecker(object,
private static void unbindDead(ServerNameDNS[] servers) throws NotFound, CannotProceed, InvalidName { for(int i = 0; i < servers.length; i++) { CorbaChecker checker = new CorbaChecker(servers[i].getCorbaObject(), servers[i].toString()); checker.run(); if(checker.getStatus().getStatus() == ConnStatus.FAILED) { unbindFrom.unbind(servers[i].getServerDNS(), servers[i].getServerName(), servers[i].getCorbaObject()); } } }
servers[i].getServerName(), servers[i].getCorbaObject());
interfaceName, servers[i].getServerName());
private static void unbindDead(ServerNameDNS[] servers) throws NotFound, CannotProceed, InvalidName { for(int i = 0; i < servers.length; i++) { CorbaChecker checker = new CorbaChecker(servers[i].getCorbaObject(), servers[i].toString()); checker.run(); if(checker.getStatus().getStatus() == ConnStatus.FAILED) { unbindFrom.unbind(servers[i].getServerDNS(), servers[i].getServerName(), servers[i].getCorbaObject()); } } }
private LinkToolEntry(String title, String description, java.util.List relationshipTypes) {
private LinkToolEntry(String title, String description, List relationshipTypes) {
private LinkToolEntry(String title, String description, java.util.List relationshipTypes) { super(title, description, null, null); this.relationshipTypes = relationshipTypes; }
public org.eclipse.gef.Tool createTool() { org.eclipse.gef.Tool tool = new org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeConnectionTool(relationshipTypes);
public Tool createTool() { Tool tool = new UnspecifiedTypeConnectionTool(relationshipTypes);
public org.eclipse.gef.Tool createTool() { org.eclipse.gef.Tool tool = new org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeConnectionTool(relationshipTypes); tool.setProperties(getToolProperties()); return tool; }
private NodeToolEntry(String title, String description, java.util.List elementTypes) {
private NodeToolEntry(String title, String description, List elementTypes) {
private NodeToolEntry(String title, String description, java.util.List elementTypes) { super(title, description, null, null); this.elementTypes = elementTypes; }
public org.eclipse.gef.Tool createTool() { org.eclipse.gef.Tool tool = new org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCreationTool(elementTypes);
public Tool createTool() { Tool tool = new UnspecifiedTypeCreationTool(elementTypes);
public org.eclipse.gef.Tool createTool() { org.eclipse.gef.Tool tool = new org.eclipse.gmf.runtime.diagram.ui.tools.UnspecifiedTypeCreationTool(elementTypes); tool.setProperties(getToolProperties()); return tool; }
private org.eclipse.gef.palette.ToolEntry createConstraint4CreationTool() { java.util.Listtypes = new java.util.ArrayList(1); types.add(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Constraint_3008); NodeToolEntry entry = new NodeToolEntry( org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Constraint4CreationTool.title"), org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Constraint4CreationTool.desc"), types); entry.setSmallIcon(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.getImageDescriptor(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Constraint_3008));
private ToolEntry createConstraint4CreationTool() { Listtypes = new ArrayList(1); types.add(UMLElementTypes.Constraint_3008); NodeToolEntry entry = new NodeToolEntry(UMLDiagramEditorPlugin.getString("Constraint4CreationTool.title"), UMLDiagramEditorPlugin.getString("Constraint4CreationTool.desc"), types); entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Constraint_3008));
private org.eclipse.gef.palette.ToolEntry createConstraint4CreationTool() { java.util.List/*<IElementType>*/types = new java.util.ArrayList/*<IElementType>*/(1); types.add(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Constraint_3008); NodeToolEntry entry = new NodeToolEntry( org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Constraint4CreationTool.title"), org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Constraint4CreationTool.desc"), types); //$NON-NLS-1$ $NON-NLS-2$ entry.setSmallIcon(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.getImageDescriptor(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Constraint_3008)); entry.setLargeIcon(entry.getSmallIcon()); return entry; }
private org.eclipse.gef.palette.ToolEntry createEnumeration1CreationTool() { java.util.Listtypes = new java.util.ArrayList(1); types.add(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Enumeration_2003); NodeToolEntry entry = new NodeToolEntry( org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Enumeration1CreationTool.title"), org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Enumeration1CreationTool.desc"), types); entry.setSmallIcon(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.getImageDescriptor(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Enumeration_2003));
private ToolEntry createEnumeration1CreationTool() { Listtypes = new ArrayList(1); types.add(UMLElementTypes.Enumeration_2003); NodeToolEntry entry = new NodeToolEntry(UMLDiagramEditorPlugin.getString("Enumeration1CreationTool.title"), UMLDiagramEditorPlugin.getString("Enumeration1CreationTool.desc"), types); entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Enumeration_2003));
private org.eclipse.gef.palette.ToolEntry createEnumeration1CreationTool() { java.util.List/*<IElementType>*/types = new java.util.ArrayList/*<IElementType>*/(1); types.add(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Enumeration_2003); NodeToolEntry entry = new NodeToolEntry( org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Enumeration1CreationTool.title"), org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Enumeration1CreationTool.desc"), types); //$NON-NLS-1$ $NON-NLS-2$ entry.setSmallIcon(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.getImageDescriptor(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Enumeration_2003)); entry.setLargeIcon(entry.getSmallIcon()); return entry; }
private org.eclipse.gef.palette.ToolEntry createExtension4CreationTool() { java.util.Listtypes = new java.util.ArrayList(1); types.add(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Extension_4002); LinkToolEntry entry = new LinkToolEntry( org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Extension4CreationTool.title"), org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Extension4CreationTool.desc"), types); entry.setSmallIcon(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.getImageDescriptor(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Extension_4002));
private ToolEntry createExtension4CreationTool() { Listtypes = new ArrayList(1); types.add(UMLElementTypes.Extension_4002); LinkToolEntry entry = new LinkToolEntry(UMLDiagramEditorPlugin.getString("Extension4CreationTool.title"), UMLDiagramEditorPlugin.getString("Extension4CreationTool.desc"), types); entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Extension_4002));
private org.eclipse.gef.palette.ToolEntry createExtension4CreationTool() { java.util.List/*<IElementType>*/types = new java.util.ArrayList/*<IElementType>*/(1); types.add(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Extension_4002); LinkToolEntry entry = new LinkToolEntry( org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Extension4CreationTool.title"), org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Extension4CreationTool.desc"), types); //$NON-NLS-1$ $NON-NLS-2$ entry.setSmallIcon(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.getImageDescriptor(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Extension_4002)); entry.setLargeIcon(entry.getSmallIcon()); return entry; }
private org.eclipse.gef.palette.ToolEntry createGeneralization2CreationTool() { java.util.Listtypes = new java.util.ArrayList(1); types.add(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Generalization_4001); LinkToolEntry entry = new LinkToolEntry( org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Generalization2CreationTool.title"), org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Generalization2CreationTool.desc"), types); entry.setSmallIcon(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.getImageDescriptor(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Generalization_4001));
private ToolEntry createGeneralization2CreationTool() { Listtypes = new ArrayList(1); types.add(UMLElementTypes.Generalization_4001); LinkToolEntry entry = new LinkToolEntry(UMLDiagramEditorPlugin.getString("Generalization2CreationTool.title"), UMLDiagramEditorPlugin.getString("Generalization2CreationTool.desc"), types); entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Generalization_4001));
private org.eclipse.gef.palette.ToolEntry createGeneralization2CreationTool() { java.util.List/*<IElementType>*/types = new java.util.ArrayList/*<IElementType>*/(1); types.add(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Generalization_4001); LinkToolEntry entry = new LinkToolEntry( org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Generalization2CreationTool.title"), org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Generalization2CreationTool.desc"), types); //$NON-NLS-1$ $NON-NLS-2$ entry.setSmallIcon(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.getImageDescriptor(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Generalization_4001)); entry.setLargeIcon(entry.getSmallIcon()); return entry; }
private org.eclipse.gef.palette.ToolEntry createLiteral5CreationTool() { java.util.Listtypes = new java.util.ArrayList(1); types.add(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.EnumerationLiteral_3005); NodeToolEntry entry = new NodeToolEntry( org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Literal5CreationTool.title"), org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Literal5CreationTool.desc"), types); entry.setSmallIcon(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.getImageDescriptor(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.EnumerationLiteral_3005));
private ToolEntry createLiteral5CreationTool() { Listtypes = new ArrayList(1); types.add(UMLElementTypes.EnumerationLiteral_3005); NodeToolEntry entry = new NodeToolEntry(UMLDiagramEditorPlugin.getString("Literal5CreationTool.title"), UMLDiagramEditorPlugin.getString("Literal5CreationTool.desc"), types); entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.EnumerationLiteral_3005));
private org.eclipse.gef.palette.ToolEntry createLiteral5CreationTool() { java.util.List/*<IElementType>*/types = new java.util.ArrayList/*<IElementType>*/(1); types.add(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.EnumerationLiteral_3005); NodeToolEntry entry = new NodeToolEntry( org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Literal5CreationTool.title"), org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Literal5CreationTool.desc"), types); //$NON-NLS-1$ $NON-NLS-2$ entry.setSmallIcon(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.getImageDescriptor(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.EnumerationLiteral_3005)); entry.setLargeIcon(entry.getSmallIcon()); return entry; }
private org.eclipse.gef.palette.ToolEntry createMetaclass3CreationTool() { java.util.Listtypes = new java.util.ArrayList(1); types.add(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.ElementImport_2006); NodeToolEntry entry = new NodeToolEntry( org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Metaclass3CreationTool.title"), org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Metaclass3CreationTool.desc"), types); entry.setSmallIcon(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.getImageDescriptor(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.ElementImport_2006));
private ToolEntry createMetaclass3CreationTool() { Listtypes = new ArrayList(1); types.add(UMLElementTypes.ElementImport_2006); NodeToolEntry entry = new NodeToolEntry(UMLDiagramEditorPlugin.getString("Metaclass3CreationTool.title"), UMLDiagramEditorPlugin.getString("Metaclass3CreationTool.desc"), types); entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.ElementImport_2006));
private org.eclipse.gef.palette.ToolEntry createMetaclass3CreationTool() { java.util.List/*<IElementType>*/types = new java.util.ArrayList/*<IElementType>*/(1); types.add(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.ElementImport_2006); NodeToolEntry entry = new NodeToolEntry( org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Metaclass3CreationTool.title"), org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Metaclass3CreationTool.desc"), types); //$NON-NLS-1$ $NON-NLS-2$ entry.setSmallIcon(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.getImageDescriptor(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.ElementImport_2006)); entry.setLargeIcon(entry.getSmallIcon()); return entry; }
private org.eclipse.gef.palette.ToolEntry createProfile1CreationTool() { java.util.Listtypes = new java.util.ArrayList(1); types.add(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Profile_2002); NodeToolEntry entry = new NodeToolEntry( org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Profile1CreationTool.title"), org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Profile1CreationTool.desc"), types); entry.setSmallIcon(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.getImageDescriptor(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Profile_2002));
private ToolEntry createProfile1CreationTool() { Listtypes = new ArrayList(1); types.add(UMLElementTypes.Profile_2002); NodeToolEntry entry = new NodeToolEntry(UMLDiagramEditorPlugin.getString("Profile1CreationTool.title"), UMLDiagramEditorPlugin.getString("Profile1CreationTool.desc"), types); entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Profile_2002));
private org.eclipse.gef.palette.ToolEntry createProfile1CreationTool() { java.util.List/*<IElementType>*/types = new java.util.ArrayList/*<IElementType>*/(1); types.add(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Profile_2002); NodeToolEntry entry = new NodeToolEntry( org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Profile1CreationTool.title"), org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Profile1CreationTool.desc"), types); //$NON-NLS-1$ $NON-NLS-2$ entry.setSmallIcon(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.getImageDescriptor(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Profile_2002)); entry.setLargeIcon(entry.getSmallIcon()); return entry; }
private org.eclipse.gef.palette.PaletteContainer createProfiles1Group() { org.eclipse.gef.palette.PaletteGroup paletteContainer = new org.eclipse.gef.palette.PaletteGroup(org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Profiles1Group.title"));
private PaletteContainer createProfiles1Group() { PaletteGroup paletteContainer = new PaletteGroup(UMLDiagramEditorPlugin.getString("Profiles1Group.title"));
private org.eclipse.gef.palette.PaletteContainer createProfiles1Group() { org.eclipse.gef.palette.PaletteGroup paletteContainer = new org.eclipse.gef.palette.PaletteGroup(org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Profiles1Group.title")); //$NON-NLS-1$ paletteContainer.add(createProfile1CreationTool()); paletteContainer.add(createStereotype2CreationTool()); paletteContainer.add(createMetaclass3CreationTool()); paletteContainer.add(createExtension4CreationTool()); return paletteContainer; }
private org.eclipse.gef.palette.ToolEntry createProperty3CreationTool() { java.util.Listtypes = new java.util.ArrayList(1); types.add(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Property_3001); NodeToolEntry entry = new NodeToolEntry( org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Property3CreationTool.title"), org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Property3CreationTool.desc"), types); entry.setSmallIcon(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.getImageDescriptor(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Property_3001));
private ToolEntry createProperty3CreationTool() { Listtypes = new ArrayList(1); types.add(UMLElementTypes.Property_3001); NodeToolEntry entry = new NodeToolEntry(UMLDiagramEditorPlugin.getString("Property3CreationTool.title"), UMLDiagramEditorPlugin.getString("Property3CreationTool.desc"), types); entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Property_3001));
private org.eclipse.gef.palette.ToolEntry createProperty3CreationTool() { java.util.List/*<IElementType>*/types = new java.util.ArrayList/*<IElementType>*/(1); types.add(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Property_3001); NodeToolEntry entry = new NodeToolEntry( org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Property3CreationTool.title"), org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Property3CreationTool.desc"), types); //$NON-NLS-1$ $NON-NLS-2$ entry.setSmallIcon(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.getImageDescriptor(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Property_3001)); entry.setLargeIcon(entry.getSmallIcon()); return entry; }
private org.eclipse.gef.palette.ToolEntry createStereotype2CreationTool() { java.util.Listtypes = new java.util.ArrayList(2); types.add(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Stereotype_2001); types.add(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Stereotype_3003); NodeToolEntry entry = new NodeToolEntry( org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Stereotype2CreationTool.title"), org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Stereotype2CreationTool.desc"), types); entry.setSmallIcon(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.getImageDescriptor(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Stereotype_2001));
private ToolEntry createStereotype2CreationTool() { Listtypes = new ArrayList(2); types.add(UMLElementTypes.Stereotype_2001); types.add(UMLElementTypes.Stereotype_3003); NodeToolEntry entry = new NodeToolEntry(UMLDiagramEditorPlugin.getString("Stereotype2CreationTool.title"), UMLDiagramEditorPlugin.getString("Stereotype2CreationTool.desc"), types); entry.setSmallIcon(UMLElementTypes.getImageDescriptor(UMLElementTypes.Stereotype_2001));
private org.eclipse.gef.palette.ToolEntry createStereotype2CreationTool() { java.util.List/*<IElementType>*/types = new java.util.ArrayList/*<IElementType>*/(2); types.add(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Stereotype_2001); types.add(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Stereotype_3003); NodeToolEntry entry = new NodeToolEntry( org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Stereotype2CreationTool.title"), org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("Stereotype2CreationTool.desc"), types); //$NON-NLS-1$ $NON-NLS-2$ entry.setSmallIcon(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.getImageDescriptor(org.eclipse.uml2.diagram.profile.providers.UMLElementTypes.Stereotype_2001)); entry.setLargeIcon(entry.getSmallIcon()); return entry; }
private org.eclipse.gef.palette.PaletteContainer createUML2Group() { org.eclipse.gef.palette.PaletteGroup paletteContainer = new org.eclipse.gef.palette.PaletteGroup(org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("UML2Group.title"));
private PaletteContainer createUML2Group() { PaletteGroup paletteContainer = new PaletteGroup(UMLDiagramEditorPlugin.getString("UML2Group.title"));
private org.eclipse.gef.palette.PaletteContainer createUML2Group() { org.eclipse.gef.palette.PaletteGroup paletteContainer = new org.eclipse.gef.palette.PaletteGroup(org.eclipse.uml2.diagram.profile.part.UMLDiagramEditorPlugin.getString("UML2Group.title")); //$NON-NLS-1$ paletteContainer.add(createEnumeration1CreationTool()); paletteContainer.add(createGeneralization2CreationTool()); paletteContainer.add(createProperty3CreationTool()); paletteContainer.add(createConstraint4CreationTool()); paletteContainer.add(createLiteral5CreationTool()); return paletteContainer; }
public void fillPalette(org.eclipse.gef.palette.PaletteRoot paletteRoot) {
public void fillPalette(PaletteRoot paletteRoot) {
public void fillPalette(org.eclipse.gef.palette.PaletteRoot paletteRoot) { paletteRoot.add(createProfiles1Group()); paletteRoot.add(createUML2Group()); }
setupSharableEntity(val);
public boolean addLocation(BwLocation val) throws CalFacadeException { updateOK(val); setupSharableEntity(val); if (findLocation(val) != null) { return false; } if (debug) { trace("Add location " + val); } getCal().addLocation(val); return true; }
setupSharableEntity(val);
public boolean addSponsor(BwSponsor val) throws CalFacadeException { updateOK(val); setupSharableEntity(val); if (findSponsor(val) != null) { return false; } if (debug) { trace("Add sponsor " + val); } getCal().addSponsor(val); return true; }
if (isPublicAdmin() && !isSuper()) { throw new CalFacadeAccessException(); }
public void clearPublicTimezones() throws CalFacadeException { timezones.clearPublicTimezones(); }
pars.isSuperUser(),
Calintf getCal() throws CalFacadeException { if (cali != null) { return cali; } try { cali = (Calintf)CalEnv.getGlobalObject("calintfclass", Calintf.class); } catch (Throwable t) { throw new CalFacadeException(t); } try { cali.open(); // Just for the user interactions cali.beginTransaction(); boolean userCreated = cali.init(pars.getAuthUser(), pars.getUser(), pars.getPublicAdmin(), pars.isSuperUser(), getGroups(), pars.getSynchId(), debug); // Prepare for call below. publicUserAccount = cali.getSyspars().getPublicUser(); BwUser auth;// XXX if (isPublicAdmin() || isGuest()) { if (isGuest()) { auth = getPublicUser(); } else { auth = cali.getUser(pars.getAuthUser()); } if (debug) { trace("Got auth user object " + auth); } dbi = new CalSvcDb(this, auth); if (userCreated) { initUser(auth, cali); } if (debug) { trace("PublicAdmin: " + pars.getPublicAdmin() + " user: " + pars.getUser()); } if (pars.getPublicAdmin()) { /* We may be running as a different user. The preferences we want to see * are those of the user we are running as - i.e. the 'run.as' user for * not those of the authenticated user. */ dbi.close(); BwUser user = cali.getUser(pars.getUser()); dbi = new CalSvcDb(this, user); } return cali; } finally { cali.endTransaction(); cali.close(); } }
return pars.getPublicAdmin() && pars.isSuperUser();
return pars.getPublicAdmin() && superUser;
private boolean isSuper() throws CalFacadeException { return pars.getPublicAdmin() && pars.isSuperUser(); }
if (isPublicAdmin() && !isSuper()) { throw new CalFacadeAccessException(); }
public void saveTimeZone(String tzid, VTimeZone vtz) throws CalFacadeException { timezones.saveTimeZone(tzid, vtz); }
public VTimeZone findTimeZone(final String id, BwUser owner) throws CalFacadeException;
public abstract VTimeZone findTimeZone(final String id, BwUser owner) throws CalFacadeException;
public VTimeZone findTimeZone(final String id, BwUser owner) throws CalFacadeException;
throws CalFacadeException;
throws CalFacadeException { if (debug) { trace("register timezone with id " + id); } TimezoneInfo tzinfo = (TimezoneInfo)timezones.get(id); if (tzinfo == null) { tzinfo = new TimezoneInfo(timezone, null); timezones.put(id, tzinfo); } else { tzinfo.tz = timezone; } }
public void registerTimeZone(String id, TimeZone timezone) throws CalFacadeException;
public void saveTimeZone(String tzid, VTimeZone vtz)
public abstract void saveTimeZone(String tzid, VTimeZone vtz)
public void saveTimeZone(String tzid, VTimeZone vtz) throws CalFacadeException;
throw new CalFacadeException(CalFacadeException.duplicateSubscription);
throw new CalFacadeException(CalFacadeException.duplicateSubscription, val.toString());
public void addSubscription(BwSubscription val) throws CalFacadeException { Collection c = getSubscriptions(); if (c.contains(val)) { throw new CalFacadeException(CalFacadeException.duplicateSubscription); } c.add(val); }
public void clearPublicTimezones() throws CalFacadeException;
public abstract void clearPublicTimezones() throws CalFacadeException;
public void clearPublicTimezones() throws CalFacadeException;
public BwPreferences fetchPreferences(BwUser owner) throws CalFacadeException { HibSession sess = getSess(); sess.namedQuery("getOwnerPreferences"); sess.setEntity("owner", owner); sess.cacheableQuery(); return (BwPreferences)sess.getUnique();
public BwPreferences fetchPreferences() throws CalFacadeException { return fetchPreferences(user);
public BwPreferences fetchPreferences(BwUser owner) throws CalFacadeException { HibSession sess = getSess(); sess.namedQuery("getOwnerPreferences"); sess.setEntity("owner", owner); sess.cacheableQuery(); return (BwPreferences)sess.getUnique(); }
Object val) throws CalFacadeException;
Object val, boolean debug) throws CalFacadeException;
public void initialise(String userid, CallBack cb, Object val) throws CalFacadeException;
getRights(),
public Object clone() { CalSvcIPars pars = new CalSvcIPars(getAuthUser(), getRights(), getUser(), getEnvPrefix(), getPublicAdmin(), getCaldav(), getSynchId(), getDebug()); return pars; }
public void refreshTimezones() throws CalFacadeException;
public abstract void refreshTimezones() throws CalFacadeException;
public void refreshTimezones() throws CalFacadeException;
sub.setUnremoveable(getUnremoveable());
public void copyTo(BwSubscription sub) { super.copyTo(sub); sub.setName(getName()); sub.setUri(getUri()); sub.setInternalSubscription(getInternalSubscription()); sub.setDisplay(getDisplay()); sub.setAffectsFreeBusy(getAffectsFreeBusy()); sub.setEmailNotifications(getEmailNotifications()); }
short size = 40;
short size = 400;
protected void setUp() throws Exception { super.setUp(); short size = 40; intTestData = new int[size]; shortTestData = new short[size]; floatTestData = new float[size]; doubleTestData = new double[size]; for (short i=0; i<size; i++) { shortTestData[i] = i; intTestData[i] = i; floatTestData[i] = i; doubleTestData[i] = i; } // end of for (int i=0; i<intTestData.length; i++) rtrend = createInstance(); }
bumpSlope = 4.2367647f; bimpIntercept = 9.4117647f; bumps = new short[16]; bumps[0] = 7; bumps[1] = -12; bumps[2] = 46; bumps[3] = 30; bumps[4] = 17; bumps[5] = 33; bumps[6] = 27; bumps[7] = 39; bumps[8] = 51; bumps[9] = 48; bumps[10] = 51; bumps[11] = 60; bumps[12] = 59; bumps[13] = 70; bumps[14] = 78; bumps[15] = 55;
protected void setUp() throws Exception { super.setUp(); short size = 40; intTestData = new int[size]; shortTestData = new short[size]; floatTestData = new float[size]; doubleTestData = new double[size]; for (short i=0; i<size; i++) { shortTestData[i] = i; intTestData[i] = i; floatTestData[i] = i; doubleTestData[i] = i; } // end of for (int i=0; i<intTestData.length; i++) rtrend = createInstance(); }
assertEquals("double", 0, dOut[0], 0.000001);
for (int i = 0; i < dOut.length; i++) { assertEquals("double", 0, dOut[i], 0.000001); }
public void testApplyDouble() throws Exception { double[] dOut = rtrend.apply(doubleTestData); assertEquals("double", 0, dOut[0], 0.000001); }
assertEquals("float", 0, fOut[0], 0.0000001);
for (int i = 0; i < fOut.length; i++) { assertEquals("float", 0, fOut[i], 0.0000001); }
public void testApplyFloat() throws Exception { float[] fOut = rtrend.apply(floatTestData); assertEquals("float", 0, fOut[0], 0.0000001); }
assertEquals("int", 0, iOut[0]);
for (int i = 0; i < iOut.length; i++) { assertEquals("int", 0, iOut[i]); }
public void testApplyInt() throws Exception { int[] iOut = rtrend.apply(intTestData); assertEquals("int", 0, iOut[0]); }
assertEquals("short", 0, sOut[0]);
for (int i = 0; i < sOut.length; i++) { assertEquals("short", 0, sOut[i]); }
public void testApplyShort() throws Exception { short[] sOut = rtrend.apply(shortTestData); assertEquals("short", 0, sOut[0]); }
public short[] apply(short[] data) { short[] out = new short[data.length]; System.arraycopy(data, 0, out, 0, data.length); applyInPlace(out); return out;
public LocalSeismogramImpl apply(LocalSeismogramImpl seis) throws FissuresException { if (seis.can_convert_to_short()) { short[] sSeries = seis.get_as_shorts(); return new LocalSeismogramImpl(seis, apply(sSeries)); } else if (seis.can_convert_to_long()) { int[] iSeries = seis.get_as_longs(); return new LocalSeismogramImpl(seis, apply(iSeries)); } else if (seis.can_convert_to_float()) { float[] fSeries = seis.get_as_floats(); return new LocalSeismogramImpl(seis, apply(fSeries)); } else { double[] dSeries = seis.get_as_doubles(); return new LocalSeismogramImpl(seis, apply(dSeries)); }
public short[] apply(short[] data) { short[] out = new short[data.length]; System.arraycopy(data, 0, out, 0, data.length); applyInPlace(out); return out; }
x[i] = firstPixelForRequest + i / 2;
x[i] = firstPixelForRequest + offsetIntoRequestPixels + i/2;
public PlottableChunk[] get(MicroSecondTimeRange requestRange, ChannelId id, int pixelsPerDay) throws SQLException, IOException { int chanDbId; try { chanDbId = chanTable.getDBId(id); } catch(NotFound e) { logger.info("Channel " + ChannelIdUtil.toStringNoDates(id) + " not found"); return new PlottableChunk[0]; } int index = 1; get.setTimestamp(index++, requestRange.getEndTime().getTimestamp()); get.setTimestamp(index++, requestRange.getBeginTime().getTimestamp()); get.setInt(index++, chanDbId); get.setInt(index++, pixelsPerDay); ResultSet rs = get.executeQuery(); List chunks = new ArrayList(); int requestPixels = getPixels(pixelsPerDay, requestRange); logger.debug("Request made for " + requestPixels + " from " + requestRange + " at " + pixelsPerDay + "ppd"); while(rs.next()) { Timestamp ts = rs.getTimestamp("start_time"); MicroSecondDate rowBeginTime = new MicroSecondDate(ts); int offsetIntoRequestPixels = SimplePlotUtil.getPixel(requestPixels, requestRange, rowBeginTime); int numPixels = rs.getInt("pixel_count"); int firstPixelForRequest = 0; if(offsetIntoRequestPixels < 0) { //This db row has data starting before the request, start at // pertinent point firstPixelForRequest = -1 * offsetIntoRequestPixels; } int lastPixelForRequest = numPixels; if(offsetIntoRequestPixels + numPixels > requestPixels) { //This row has more data than was requested in it, only get // enough to fill the request lastPixelForRequest = requestPixels - offsetIntoRequestPixels; } int pixelsUsed = lastPixelForRequest - firstPixelForRequest; int[] x = new int[pixelsUsed * 2]; int[] y = new int[pixelsUsed * 2]; byte[] dataBytes = rs.getBytes("data"); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(dataBytes)); for(int i = 0; i < firstPixelForRequest; i++) { dis.readInt(); dis.readInt(); } for(int i = 0; i < pixelsUsed * 2; i++) { x[i] = firstPixelForRequest + i / 2; y[i] = dis.readInt(); } Plottable p = new Plottable(x, y); PlottableChunk pc = new PlottableChunk(p, PlottableChunk.getPixel(rowBeginTime, pixelsPerDay) + firstPixelForRequest, PlottableChunk.getJDay(rowBeginTime), PlottableChunk.getYear(rowBeginTime), pixelsPerDay, id); chunks.add(pc); logger.debug("Returning " + pc + " from chunk starting at " + rowBeginTime); } return (PlottableChunk[])chunks.toArray(new PlottableChunk[chunks.size()]); }
logger.debug("x[0]: " + x[0]);
public PlottableChunk[] get(MicroSecondTimeRange requestRange, ChannelId id, int pixelsPerDay) throws SQLException, IOException { int chanDbId; try { chanDbId = chanTable.getDBId(id); } catch(NotFound e) { logger.info("Channel " + ChannelIdUtil.toStringNoDates(id) + " not found"); return new PlottableChunk[0]; } int index = 1; get.setTimestamp(index++, requestRange.getEndTime().getTimestamp()); get.setTimestamp(index++, requestRange.getBeginTime().getTimestamp()); get.setInt(index++, chanDbId); get.setInt(index++, pixelsPerDay); ResultSet rs = get.executeQuery(); List chunks = new ArrayList(); int requestPixels = getPixels(pixelsPerDay, requestRange); logger.debug("Request made for " + requestPixels + " from " + requestRange + " at " + pixelsPerDay + "ppd"); while(rs.next()) { Timestamp ts = rs.getTimestamp("start_time"); MicroSecondDate rowBeginTime = new MicroSecondDate(ts); int offsetIntoRequestPixels = SimplePlotUtil.getPixel(requestPixels, requestRange, rowBeginTime); int numPixels = rs.getInt("pixel_count"); int firstPixelForRequest = 0; if(offsetIntoRequestPixels < 0) { //This db row has data starting before the request, start at // pertinent point firstPixelForRequest = -1 * offsetIntoRequestPixels; } int lastPixelForRequest = numPixels; if(offsetIntoRequestPixels + numPixels > requestPixels) { //This row has more data than was requested in it, only get // enough to fill the request lastPixelForRequest = requestPixels - offsetIntoRequestPixels; } int pixelsUsed = lastPixelForRequest - firstPixelForRequest; int[] x = new int[pixelsUsed * 2]; int[] y = new int[pixelsUsed * 2]; byte[] dataBytes = rs.getBytes("data"); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(dataBytes)); for(int i = 0; i < firstPixelForRequest; i++) { dis.readInt(); dis.readInt(); } for(int i = 0; i < pixelsUsed * 2; i++) { x[i] = firstPixelForRequest + i / 2; y[i] = dis.readInt(); } Plottable p = new Plottable(x, y); PlottableChunk pc = new PlottableChunk(p, PlottableChunk.getPixel(rowBeginTime, pixelsPerDay) + firstPixelForRequest, PlottableChunk.getJDay(rowBeginTime), PlottableChunk.getYear(rowBeginTime), pixelsPerDay, id); chunks.add(pc); logger.debug("Returning " + pc + " from chunk starting at " + rowBeginTime); } return (PlottableChunk[])chunks.toArray(new PlottableChunk[chunks.size()]); }
logger.debug("got " + dbChunks.length + " chunks from stuff that was already in the database");
public void put(PlottableChunk[] chunks) throws SQLException, IOException { MicroSecondTimeRange stuffInDB = RangeTool.getFullTime(chunks); MicroSecondDate startTime = PlottableChunk.stripToDay(stuffInDB.getBeginTime()); MicroSecondDate strippedEnd = PlottableChunk.stripToDay(stuffInDB.getEndTime()); if(!strippedEnd.equals(stuffInDB.getEndTime())) { strippedEnd = strippedEnd.add(PlottableChunk.ONE_DAY); } stuffInDB = new MicroSecondTimeRange(startTime, strippedEnd); PlottableChunk[] dbChunks = get(stuffInDB, chunks[0].getChannel(), chunks[0].getPixelsPerDay()); PlottableChunk[] everything = new PlottableChunk[chunks.length + dbChunks.length]; System.arraycopy(dbChunks, 0, everything, 0, dbChunks.length); System.arraycopy(chunks, 0, everything, dbChunks.length, chunks.length); logger.debug("Merging " + everything.length + " chunks"); everything = ReduceTool.merge(everything); logger.debug("Breaking " + everything.length + " remaining chunks after merge into seperate chunks based on day"); everything = breakIntoDays(everything); logger.debug("Adding " + everything.length + " chunks split on days"); int rowsDropped = drop(stuffInDB, chunks[0].getChannel(), chunks[0].getPixelsPerDay()); logger.debug("Dropped " + rowsDropped + " rows of stuff that new data covered"); for(int i = 0; i < everything.length; i++) { logger.debug("Adding chunk " + i + ": " + everything[i]); int stmtIndex = 1; PlottableChunk chunk = everything[i]; put.setInt(stmtIndex++, chanTable.put(chunk.getChannel())); put.setInt(stmtIndex++, chunk.getPixelsPerDay()); put.setTimestamp(stmtIndex++, chunk.getBeginTime().getTimestamp()); put.setTimestamp(stmtIndex++, chunk.getEndTime().getTimestamp()); int[] y = chunk.getData().y_coor; put.setInt(stmtIndex++, y.length / 2); ByteArrayOutputStream out = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(out); for(int k = 0; k < y.length; k++) { dos.writeInt(y[k]); } put.setBytes(stmtIndex++, out.toByteArray()); put.executeUpdate(); } }
public JDBCChannel(Connection conn) throws SQLException { this(conn, new JDBCQuantity(conn), new JDBCSite(conn), new JDBCTime(conn));
public JDBCChannel() throws SQLException { this(ConnMgr.createConnection());
public JDBCChannel(Connection conn) throws SQLException { this(conn, new JDBCQuantity(conn), new JDBCSite(conn), new JDBCTime(conn)); }
PlottableChunk[] dayChunks = new PlottableChunk[numDays];
if(getData().y_coor.length % getSamplesPerDay() == 0 && beginSample != 0) { numDays++; } List dayChunks = new ArrayList();
public PlottableChunk[] breakIntoDays() { int numDays = (int)Math.ceil(getData().y_coor.length / getSamplesPerDay()); PlottableChunk[] dayChunks = new PlottableChunk[numDays]; MicroSecondDate time = getBeginTime(); for(int i = 0; i < dayChunks.length; i++) { int copyStartPoint = i * getSamplesPerDay(); int newChunkStartPoint = 0; if(i == 0) { copyStartPoint = getBeginSample(); newChunkStartPoint = getBeginSample(); } int endOfDaySample = (i + 1) * getSamplesPerDay(); int copyEndPoint = endOfDaySample; if(endOfDaySample > getEndSample()) { copyEndPoint = getEndSample(); } int[] y = new int[copyEndPoint - copyStartPoint]; System.arraycopy(getData().y_coor, copyStartPoint, y, 0, y.length); Plottable p = new Plottable(null, y); dayChunks[i] = new PlottableChunk(p, newChunkStartPoint, getJDay(time), getYear(time), getSamplesPerDay(), getChannel()); time = time.add(ONE_DAY); } return dayChunks; }
for(int i = 0; i < dayChunks.length; i++) {
for(int i = 0; i < numDays; i++) {
public PlottableChunk[] breakIntoDays() { int numDays = (int)Math.ceil(getData().y_coor.length / getSamplesPerDay()); PlottableChunk[] dayChunks = new PlottableChunk[numDays]; MicroSecondDate time = getBeginTime(); for(int i = 0; i < dayChunks.length; i++) { int copyStartPoint = i * getSamplesPerDay(); int newChunkStartPoint = 0; if(i == 0) { copyStartPoint = getBeginSample(); newChunkStartPoint = getBeginSample(); } int endOfDaySample = (i + 1) * getSamplesPerDay(); int copyEndPoint = endOfDaySample; if(endOfDaySample > getEndSample()) { copyEndPoint = getEndSample(); } int[] y = new int[copyEndPoint - copyStartPoint]; System.arraycopy(getData().y_coor, copyStartPoint, y, 0, y.length); Plottable p = new Plottable(null, y); dayChunks[i] = new PlottableChunk(p, newChunkStartPoint, getJDay(time), getYear(time), getSamplesPerDay(), getChannel()); time = time.add(ONE_DAY); } return dayChunks; }
copyStartPoint = getBeginSample();
public PlottableChunk[] breakIntoDays() { int numDays = (int)Math.ceil(getData().y_coor.length / getSamplesPerDay()); PlottableChunk[] dayChunks = new PlottableChunk[numDays]; MicroSecondDate time = getBeginTime(); for(int i = 0; i < dayChunks.length; i++) { int copyStartPoint = i * getSamplesPerDay(); int newChunkStartPoint = 0; if(i == 0) { copyStartPoint = getBeginSample(); newChunkStartPoint = getBeginSample(); } int endOfDaySample = (i + 1) * getSamplesPerDay(); int copyEndPoint = endOfDaySample; if(endOfDaySample > getEndSample()) { copyEndPoint = getEndSample(); } int[] y = new int[copyEndPoint - copyStartPoint]; System.arraycopy(getData().y_coor, copyStartPoint, y, 0, y.length); Plottable p = new Plottable(null, y); dayChunks[i] = new PlottableChunk(p, newChunkStartPoint, getJDay(time), getYear(time), getSamplesPerDay(), getChannel()); time = time.add(ONE_DAY); } return dayChunks; }
int endOfDaySample = (i + 1) * getSamplesPerDay();
if(i != 0){ copyStartPoint -= getBeginSample(); } int endOfDaySample = (i + 1) * getSamplesPerDay() - getBeginSample();
public PlottableChunk[] breakIntoDays() { int numDays = (int)Math.ceil(getData().y_coor.length / getSamplesPerDay()); PlottableChunk[] dayChunks = new PlottableChunk[numDays]; MicroSecondDate time = getBeginTime(); for(int i = 0; i < dayChunks.length; i++) { int copyStartPoint = i * getSamplesPerDay(); int newChunkStartPoint = 0; if(i == 0) { copyStartPoint = getBeginSample(); newChunkStartPoint = getBeginSample(); } int endOfDaySample = (i + 1) * getSamplesPerDay(); int copyEndPoint = endOfDaySample; if(endOfDaySample > getEndSample()) { copyEndPoint = getEndSample(); } int[] y = new int[copyEndPoint - copyStartPoint]; System.arraycopy(getData().y_coor, copyStartPoint, y, 0, y.length); Plottable p = new Plottable(null, y); dayChunks[i] = new PlottableChunk(p, newChunkStartPoint, getJDay(time), getYear(time), getSamplesPerDay(), getChannel()); time = time.add(ONE_DAY); } return dayChunks; }
if(endOfDaySample > getEndSample()) { copyEndPoint = getEndSample();
if(endOfDaySample > getEndSample() - getBeginSample()) { copyEndPoint = getEndSample() - getBeginSample();
public PlottableChunk[] breakIntoDays() { int numDays = (int)Math.ceil(getData().y_coor.length / getSamplesPerDay()); PlottableChunk[] dayChunks = new PlottableChunk[numDays]; MicroSecondDate time = getBeginTime(); for(int i = 0; i < dayChunks.length; i++) { int copyStartPoint = i * getSamplesPerDay(); int newChunkStartPoint = 0; if(i == 0) { copyStartPoint = getBeginSample(); newChunkStartPoint = getBeginSample(); } int endOfDaySample = (i + 1) * getSamplesPerDay(); int copyEndPoint = endOfDaySample; if(endOfDaySample > getEndSample()) { copyEndPoint = getEndSample(); } int[] y = new int[copyEndPoint - copyStartPoint]; System.arraycopy(getData().y_coor, copyStartPoint, y, 0, y.length); Plottable p = new Plottable(null, y); dayChunks[i] = new PlottableChunk(p, newChunkStartPoint, getJDay(time), getYear(time), getSamplesPerDay(), getChannel()); time = time.add(ONE_DAY); } return dayChunks; }
dayChunks[i] = new PlottableChunk(p, newChunkStartPoint, getJDay(time), getYear(time), getSamplesPerDay(), getChannel());
dayChunks.add(new PlottableChunk(p, newChunkStartPoint, getJDay(time), getYear(time), getSamplesPerDay(), getChannel()));
public PlottableChunk[] breakIntoDays() { int numDays = (int)Math.ceil(getData().y_coor.length / getSamplesPerDay()); PlottableChunk[] dayChunks = new PlottableChunk[numDays]; MicroSecondDate time = getBeginTime(); for(int i = 0; i < dayChunks.length; i++) { int copyStartPoint = i * getSamplesPerDay(); int newChunkStartPoint = 0; if(i == 0) { copyStartPoint = getBeginSample(); newChunkStartPoint = getBeginSample(); } int endOfDaySample = (i + 1) * getSamplesPerDay(); int copyEndPoint = endOfDaySample; if(endOfDaySample > getEndSample()) { copyEndPoint = getEndSample(); } int[] y = new int[copyEndPoint - copyStartPoint]; System.arraycopy(getData().y_coor, copyStartPoint, y, 0, y.length); Plottable p = new Plottable(null, y); dayChunks[i] = new PlottableChunk(p, newChunkStartPoint, getJDay(time), getYear(time), getSamplesPerDay(), getChannel()); time = time.add(ONE_DAY); } return dayChunks; }
return dayChunks;
return (PlottableChunk[])dayChunks.toArray(new PlottableChunk[0]);
public PlottableChunk[] breakIntoDays() { int numDays = (int)Math.ceil(getData().y_coor.length / getSamplesPerDay()); PlottableChunk[] dayChunks = new PlottableChunk[numDays]; MicroSecondDate time = getBeginTime(); for(int i = 0; i < dayChunks.length; i++) { int copyStartPoint = i * getSamplesPerDay(); int newChunkStartPoint = 0; if(i == 0) { copyStartPoint = getBeginSample(); newChunkStartPoint = getBeginSample(); } int endOfDaySample = (i + 1) * getSamplesPerDay(); int copyEndPoint = endOfDaySample; if(endOfDaySample > getEndSample()) { copyEndPoint = getEndSample(); } int[] y = new int[copyEndPoint - copyStartPoint]; System.arraycopy(getData().y_coor, copyStartPoint, y, 0, y.length); Plottable p = new Plottable(null, y); dayChunks[i] = new PlottableChunk(p, newChunkStartPoint, getJDay(time), getYear(time), getSamplesPerDay(), getChannel()); time = time.add(ONE_DAY); } return dayChunks; }
+ beginId + " and chan_code = '" + id.channel_code
+ beginId + " and chan_code = '" + id.channel_code + "'"
public int getDBId(ChannelId id) throws SQLException, NotFound { int netDbId = netTable.getDBId(id.network_id); int[] possibleStaDbIds = stationTable.getDBIds(netDbId, id.station_code); int[] possibleSiteIds = siteTable.getDBIds(possibleStaDbIds, id.site_code); int beginId = time.put(id.begin_time); String query = "SELECT chan_id FROM channel WHERE chan_begin_id = " + beginId + " and chan_code = '" + id.channel_code + " and site_id IN ("; for(int i = 0; i < possibleSiteIds.length - 1; i++) { query += possibleSiteIds[i] + ", "; } query += possibleSiteIds[possibleSiteIds.length - 1] + ")"; Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(query); if(rs.next()) { return rs.getInt("chan_id"); } throw new NotFound("No such channel id in the db"); }
public PlottableChunk(Plottable data, int startSample, int jday, int year, int samplesPerDay, ChannelId channel) { this.data = data; this.beginSample = startSample; this.samplesPerDay = samplesPerDay; this.jday = jday; this.year = year; this.channel = channel;
public PlottableChunk(Plottable data, int startSample, PlottableChunk otherStuff) { this(data, startSample, otherStuff.getJDay(), otherStuff.getYear(), otherStuff.getSamplesPerDay(), otherStuff.getChannel());
public PlottableChunk(Plottable data, int startSample, int jday, int year, int samplesPerDay, ChannelId channel) { this.data = data; this.beginSample = startSample; this.samplesPerDay = samplesPerDay; this.jday = jday; this.year = year; this.channel = channel; }
public static PlottableChunk[] merge(PlottableChunk[] chunks) { return new PlottableChunkMerger().merge(chunks);
public static LocalSeismogramImpl[] merge(LocalSeismogramImpl[] seis) { return new LSMerger().merge(seis);
public static PlottableChunk[] merge(PlottableChunk[] chunks) { return new PlottableChunkMerger().merge(chunks); }
public int put(ChannelId id) throws SQLException {
public int put(Channel chan) throws SQLException {
public int put(ChannelId id) throws SQLException { int dbid; try { dbid = getDBId(id); } catch(NotFound notFound) { // no id found so ok to add the whole thing dbid = seq.next(); putId.setInt(1, dbid); insertId(id, putId, 2, siteTable, time); putId.executeUpdate(); } return dbid; }
dbid = getDBId(id);
dbid = getDBId(chan.get_id());
public int put(ChannelId id) throws SQLException { int dbid; try { dbid = getDBId(id); } catch(NotFound notFound) { // no id found so ok to add the whole thing dbid = seq.next(); putId.setInt(1, dbid); insertId(id, putId, 2, siteTable, time); putId.executeUpdate(); } return dbid; }
putId.setInt(1, dbid); insertId(id, putId, 2, siteTable, time); putId.executeUpdate();
putAll.setInt(1, dbid); insertAll(chan, putAll, 2, siteTable, quantityTable, time); putAll.executeUpdate();
public int put(ChannelId id) throws SQLException { int dbid; try { dbid = getDBId(id); } catch(NotFound notFound) { // no id found so ok to add the whole thing dbid = seq.next(); putId.setInt(1, dbid); insertId(id, putId, 2, siteTable, time); putId.executeUpdate(); } return dbid; }
this.getRootElement().setAttribute(ATTRIBUTE_IS_TITLE_NEW_PAGE,Boolean.toString(value));
this.getRootElement().setAttribute(ATTRIBUTE_IS_TITLE_NEW_PAGE,String.valueOf(value));
public void setIsTitleNewPage(boolean value){ this.getRootElement().setAttribute(ATTRIBUTE_IS_TITLE_NEW_PAGE,Boolean.toString(value)); }
setAttribute(ATTRIBUTE_IS_FOR_PROMPTING,Boolean.toString(value));
setAttribute(ATTRIBUTE_IS_FOR_PROMPTING,String.valueOf(value));
public void setIsForPrompting(boolean value){ setAttribute(ATTRIBUTE_IS_FOR_PROMPTING,Boolean.toString(value)); }
out.write(tmpBytes[1]); out.write(tmpBytes[2]); out.write(tmpBytes[3]);
protected static void writeLittleEndian(DataOutput out, int value) throws IOException { byte[] tmpBytes; tmpBytes = Utility.intToByteArray(value); out.write(tmpBytes[0]); out.write(tmpBytes[1]); out.write(tmpBytes[2]); out.write(tmpBytes[3]); }
int samp = (int)freq.getValue(); samp *= speedUp;
int samp = (int)(freq.getValue() * speedUp);
public static void writeWAV(LocalSeismogramImpl seis, int speedUp, DataOutput out) throws IOException { out.writeBytes("RIFF"); int size = 36 + 2*seis.getNumPoints(); writeLittleEndian(out, size); out.writeBytes("WAVE"); // write fmt subchunk out.writeBytes("fmt "); writeLittleEndian(out, 16); writeLittleEndian(out, (short)1); // linear quantization, PCM writeLittleEndian(out, (short)1); // mono, 1 channel SamplingImpl sampling = (SamplingImpl)seis.getSampling(); QuantityImpl freq = sampling.getFrequency(); freq = freq.convertTo(UnitImpl.HERTZ); int samp = (int)freq.getValue(); samp *= speedUp; writeLittleEndian(out, samp); // sample rate writeLittleEndian(out, samp*2); // byte rate, 2 bytes per sample writeLittleEndian(out, (short)2); // block align writeLittleEndian(out, (short)16); // bits per sample // write data subchunk out.writeBytes("data"); writeLittleEndian(out, seis.getNumPoints()*2); // subchunk2 size int[] data = seis.get_as_longs(); for ( int i=0; i<seis.getNumPoints(); i++) { writeLittleEndian(out, (short)data[i]); } // end of for () }
snapshot.update(seismos, timeConfig.getTimeRange());
public void returnSnapshot(){ taken = false; snapshot.update(seismos, timeConfig.getTimeRange()); }
Iterator e = seismos.keySet().iterator();
public void setTimeConfig(TimeRangeConfig newTimeConfig){ timeConfig.removeTimeSyncListener(this); Iterator e = seismos.keySet().iterator(); timeFinder = newTimeConfig.getTimeFinder(); newTimeConfig.addTimeSyncListener(this); while(e.hasNext()){ DataSetSeismogram current = (DataSetSeismogram)e.next(); timeConfig.removeSeismogram(current); this.addSeismogram(current); newTimeConfig.addSeismogram(current, ((MicroSecondTimeRange)seismos.get(current)).getBeginTime()); //seismos.put(current, newTimeConfig.getTimeRange(current));} seismos = newTimeConfig.getData(); timeConfig = newTimeConfig; updateTimeSyncListeners(); }
newTimeConfig.addTimeSyncListener(this);
/*Iterator e = seismos.keySet().iterator();
public void setTimeConfig(TimeRangeConfig newTimeConfig){ timeConfig.removeTimeSyncListener(this); Iterator e = seismos.keySet().iterator(); timeFinder = newTimeConfig.getTimeFinder(); newTimeConfig.addTimeSyncListener(this); while(e.hasNext()){ DataSetSeismogram current = (DataSetSeismogram)e.next(); timeConfig.removeSeismogram(current); this.addSeismogram(current); newTimeConfig.addSeismogram(current, ((MicroSecondTimeRange)seismos.get(current)).getBeginTime()); //seismos.put(current, newTimeConfig.getTimeRange(current));} seismos = newTimeConfig.getData(); timeConfig = newTimeConfig; updateTimeSyncListeners(); }
this.addSeismogram(current); newTimeConfig.addSeismogram(current, ((MicroSecondTimeRange)seismos.get(current)).getBeginTime());
public void setTimeConfig(TimeRangeConfig newTimeConfig){ timeConfig.removeTimeSyncListener(this); Iterator e = seismos.keySet().iterator(); timeFinder = newTimeConfig.getTimeFinder(); newTimeConfig.addTimeSyncListener(this); while(e.hasNext()){ DataSetSeismogram current = (DataSetSeismogram)e.next(); timeConfig.removeSeismogram(current); this.addSeismogram(current); newTimeConfig.addSeismogram(current, ((MicroSecondTimeRange)seismos.get(current)).getBeginTime()); //seismos.put(current, newTimeConfig.getTimeRange(current));} seismos = newTimeConfig.getData(); timeConfig = newTimeConfig; updateTimeSyncListeners(); }
}
}*/ newTimeConfig.setData(seismos); newTimeConfig.addTimeSyncListener(this);
public void setTimeConfig(TimeRangeConfig newTimeConfig){ timeConfig.removeTimeSyncListener(this); Iterator e = seismos.keySet().iterator(); timeFinder = newTimeConfig.getTimeFinder(); newTimeConfig.addTimeSyncListener(this); while(e.hasNext()){ DataSetSeismogram current = (DataSetSeismogram)e.next(); timeConfig.removeSeismogram(current); this.addSeismogram(current); newTimeConfig.addSeismogram(current, ((MicroSecondTimeRange)seismos.get(current)).getBeginTime()); //seismos.put(current, newTimeConfig.getTimeRange(current));} seismos = newTimeConfig.getData(); timeConfig = newTimeConfig; updateTimeSyncListeners(); }
public AmpConfigRegistrar(AmpRangeConfig ar){ this(ar, null);
public AmpConfigRegistrar(){ this(new RMeanAmpConfig());
public AmpConfigRegistrar(AmpRangeConfig ar){ this(ar, null); }
if(seismos.contains(name))
if(names.contains(name))
public boolean contains(String name){ if(seismos.contains(name)) return true; return false; }
public BasicSeismogramDisplay(LocalSeismogram seis, TimeRangeConfig tr, AmpRangeConfig ar, boolean timeBorder){ super(); this.setLayout(new OverlayLayout(this)); this.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { resize(); } public void componentShown(ComponentEvent e) { resize(); } }); setMinimumSize(new Dimension(100, 50)); tr.addTimeSyncListener(this); ar.addAmpSyncListener(this); this.timeConfig = tr; this.ampConfig = ar; this.addSeismogram(seis); scaleBorder = new ScaleBorder(); if(timeBorder) scaleBorder.setBottomScaleMapper(timeScaleMap); scaleBorder.setLeftScaleMapper(ampScaleMap); titleBorder = new LeftTitleBorder(""); setBorder(BorderFactory.createCompoundBorder( BorderFactory.createCompoundBorder( BorderFactory.createRaisedBevelBorder(), titleBorder), BorderFactory.createCompoundBorder( scaleBorder, BorderFactory.createLoweredBevelBorder()))); Dimension d = getSize(); int w = d.width * 5, h = d.height; overSize = new Dimension(w, h); this.add(new ImagePainter()); Insets current = this.getInsets(); setPreferredSize(new Dimension(200 + current.left, 100 + current.top + current.bottom));
public BasicSeismogramDisplay(LocalSeismogram seis, boolean timeBorder){ this(seis, new BoundedTimeConfig(), new RMeanAmpConfig(), timeBorder);
public BasicSeismogramDisplay(LocalSeismogram seis, TimeRangeConfig tr, AmpRangeConfig ar, boolean timeBorder){ super(); this.setLayout(new OverlayLayout(this)); this.addComponentListener(new ComponentAdapter() { public void componentResized(ComponentEvent e) { resize(); } public void componentShown(ComponentEvent e) { resize(); } }); setMinimumSize(new Dimension(100, 50)); tr.addTimeSyncListener(this); ar.addAmpSyncListener(this); this.timeConfig = tr; this.ampConfig = ar; this.addSeismogram(seis); scaleBorder = new ScaleBorder(); if(timeBorder) scaleBorder.setBottomScaleMapper(timeScaleMap); scaleBorder.setLeftScaleMapper(ampScaleMap); titleBorder = new LeftTitleBorder(""); setBorder(BorderFactory.createCompoundBorder( BorderFactory.createCompoundBorder( BorderFactory.createRaisedBevelBorder(), titleBorder), BorderFactory.createCompoundBorder( scaleBorder, BorderFactory.createLoweredBevelBorder()))); Dimension d = getSize(); int w = d.width * 5, h = d.height; overSize = new Dimension(w, h); this.add(new ImagePainter()); Insets current = this.getInsets(); setPreferredSize(new Dimension(200 + current.left, 100 + current.top + current.bottom)); }
seismos.add(name);
names.add(name);
public int sort(DataSetSeismogram seismo, String name){ seismos.add(name); return seismos.size(); }
public OffsetMeanAmpConfig(){ ampRange = new UnitRangeImpl(-500, 500, UnitImpl.COUNT);
public OffsetMeanAmpConfig(LocalSeismogram aSeis, MicroSecondTimeRange range){ LocalSeismogramImpl seis = (LocalSeismogramImpl)aSeis; int beginIndex = SeisPlotUtil.getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), range.getBeginTime()); if (beginIndex < 0) beginIndex = 0; if (beginIndex > seis.getNumPoints()) beginIndex = seis.getNumPoints(); int endIndex = SeisPlotUtil.getPixel(seis.getNumPoints(), seis.getBeginTime(), seis.getEndTime(), range.getEndTime()); if (endIndex < 0) endIndex = 0; if (endIndex > seis.getNumPoints()) endIndex = seis.getNumPoints(); if (endIndex == beginIndex) { ampRange = new UnitRangeImpl(-500, 500, UnitImpl.COUNT); } try { double min = seis.getMinValue(beginIndex, endIndex).getValue(); double max = seis.getMaxValue(beginIndex, endIndex).getValue(); double mean = seis.getMeanValue(beginIndex, endIndex).getValue(); double meanDiff = (Math.abs(mean - min) > Math.abs(mean - max) ? Math.abs(mean - min) : Math.abs(mean - max)); ampRange = new UnitRangeImpl(-meanDiff, meanDiff, seis.getAmplitudeRange().getUnit()); }catch (Exception e) { ampRange = new UnitRangeImpl(-500, 500, UnitImpl.COUNT); }
public OffsetMeanAmpConfig(){ ampRange = new UnitRangeImpl(-500, 500, UnitImpl.COUNT); }
public ParticleMotionDisplay (DataSetSeismogram hSeis, TimeConfigRegistrar timeConfigRegistrar, AmpConfigRegistrar hAmpConfigRegistrar, AmpConfigRegistrar vAmpConfigRegistrar, boolean advancedOption){ this(hSeis, timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, null, advancedOption);
public ParticleMotionDisplay(DataSetSeismogram hseis, TimeConfigRegistrar timeConfigRegistrar, AmpConfigRegistrar hAmpConfigRegistrar, AmpConfigRegistrar vAmpConfigRegistrar, Color color, boolean advancedOption) { JFrame displayFrame = new JFrame(); JPanel informationPanel = new JPanel(); String message = " Please Wait ....For the Particle Motion Window"; JLabel jLabel = new JLabel(message); JTextArea textArea = new JTextArea(); informationPanel.setLayout(new BorderLayout()); informationPanel.add(textArea, BorderLayout.CENTER); informationPanel.setSize(new java.awt.Dimension(500, 300)); displayFrame.getContentPane().add(informationPanel); displayFrame.setSize(new java.awt.Dimension(500, 300)); displayFrame.pack(); displayFrame.show(); try { Thread.sleep(5000); }catch(Exception e) {} createGUI(timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar); ParticleMotionDisplayThread t = new ParticleMotionDisplayThread(hseis, timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, advancedOption, true, this); t.execute(); displayFrame.dispose();
public ParticleMotionDisplay (DataSetSeismogram hSeis, TimeConfigRegistrar timeConfigRegistrar, AmpConfigRegistrar hAmpConfigRegistrar, AmpConfigRegistrar vAmpConfigRegistrar, boolean advancedOption){ this(hSeis, timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, null, advancedOption); //setting the advanced option to be false; }
}
} else { logger.debug("no found match parameter channelId "+paramNames[i]); }
public static ChannelId[] retrieveGrouping(DataSet dataset, ChannelId channelID) { String[] paramNames = dataset.getParameterNames(); LinkedList list = new LinkedList(); String origChannelIdStr = ChannelIdUtil.toString(channelID); origChannelIdStr = origChannelIdStr.substring(0, origChannelIdStr.indexOf(channelID.channel_code)+2); String chanGroupString = edu.sc.seis.fissuresUtil.xml.StdDataSetParamNames.CHANNEL + origChannelIdStr; for (int i=0; i<paramNames.length; i++) { if (paramNames[i].startsWith(chanGroupString)) { logger.debug("found match parameter channelId "+paramNames[i]); list.add(((edu.iris.Fissures.IfNetwork.Channel)dataset.getParameter(paramNames[i])).get_id()); } // end of if (paramNames[i].startsWith(origChannelIdStr)) } // end of for (int i=0; i<paramNames[i]; i++) ChannelId[] channelIds = (ChannelId[])list.toArray(new ChannelId[0]); ChannelGrouperImpl channelProxy = new ChannelGrouperImpl(); ChannelId[] channelGroup = channelProxy.retrieve_grouping(channelIds, channelID); return channelGroup; }
SoftReference softReference = (SoftReference)seismogramCache.get(name); LocalSeismogramImpl seis = (LocalSeismogramImpl)softReference.get(); if(seis != null) return seis; else seismogramCache.remove(name);
Object obj = seismogramCache.get(name); if(obj instanceof SoftReference) { SoftReference softReference = (SoftReference)obj; LocalSeismogramImpl seis = (LocalSeismogramImpl)softReference.get(); if(seis != null) { logger.debug("**********NO NULL WHILE GETTING FROM RHT CACHE"); return seis; } else { logger.debug("********** GARBAGE COLLECTED SO SEISMOGRAM NOT IN MEWMOERY"); seismogramCache.remove(name); } } else return (LocalSeismogramImpl)obj;
public LocalSeismogramImpl getSeismogram(String name) { if (seismogramCache.containsKey(name)) { logger.debug("getting the seismogram fromt the cache"); SoftReference softReference = (SoftReference)seismogramCache.get(name); LocalSeismogramImpl seis = (LocalSeismogramImpl)softReference.get(); if(seis != null) return seis; else seismogramCache.remove(name); } // end of if (seismogramCache.containsKey(name)) //logger.debug("The name of the data set is "+getName()); //logger.debug("The name of the seismogram is "+name); String urlString = "NONE"; NodeList nList = evalNodeList(config, "localSeismogram/seismogramAttr/property[name="+dquote+"Name"+dquote+ "]"+"[value="+dquote+name+dquote+"]"+"/../../data"); if(nList == null || (nList != null && nList.getLength() == 0)) { nList = getNoNameSeismogram(name); } if (nList != null && nList.getLength() != 0) { try { Node n = nList.item(0); if (n instanceof Element) { Element e = (Element)n; //logger.debug("**********************The name of the element is "+e.getTagName()); urlString = e.getAttribute("xlink:href"); if (urlString == null || urlString == "") { throw new MalformedURLException(name+" does not have an xlink:href attribute"); } // end of if (urlString == null || urlString == "") //logger.debug("IN GET SEISMOGRAM The base str is "+base.toString()); URL sacURL = new URL(base, urlString); //logger.debug("The sacUrl is "+sacURL.toString()); DataInputStream dis = new DataInputStream(new BufferedInputStream(sacURL.openStream())); SacTimeSeries sac = new SacTimeSeries(); sac.read(dis); LocalSeismogramImpl seis = SacToFissures.getSeismogram(sac); //get the Seismogram Attributes from the xml .. only the data must // must be obtained fromt the SAC. NodeList seisAttrNode = XMLUtil.evalNodeList(e, "../seismogramAttr"); if(seisAttrNode != null && seisAttrNode.getLength() != 0) { SeismogramAttr seisAttr = XMLSeismogramAttr.getSeismogramAttr((Element)seisAttrNode.item(0)); //logger.debug("The &&&&&&&&&&&&&&&&&&& chan_cdoe from dsml file is "+ // ((SeismogramAttrImpl)seisAttr).getChannelID().channel_code); seis.setAttributes(seisAttr); //logger.debug("The &&&&&&&&&&&&&&&&&&& chan_code after setting is "+ // seis.getChannelID().channel_code); } NodeList propList = evalNodeList(e, "property"); int numDSProps = 0; if (propList != null && propList.getLength() != 0) { numDSProps = nList.getLength(); } else { // no properties in dataset numDSProps = 0; } // end of else // Property[] props = seis.getProperties();// Property[] newProps = // new Property[1+props.length+numDSProps];// System.arraycopy(props, 0, newProps, 0, props.length);// for (int i=0; i<propList.getLength(); i++) {// Element propElement = (Element)propList.item(i);// newProps[props.length+i] = // new Property(xpath.eval(propElement, "name/text()").str(),// xpath.eval(propElement, "value/text()").str());// } // end of for// newProps[newProps.length-1] = new Property(seisNameKey,// name);// seis.setProperties(newProps); if (seis != null) { seismogramCache.put(name, new SoftReference(seis)); } // end of if (seis != null) return seis; } } catch (MalformedURLException e) { logger.error("Couldn't get seismogram "+name, e); logger.error(urlString); } catch (Exception e) { logger.error("Couldn't get seismogram "+name, e); logger.error(urlString); } // end of try-catch } return null; }
else logger.debug("****************************************THE SEISMOGRAM RETURNED IS NULL");
public LocalSeismogramImpl getSeismogram(String name) { if (seismogramCache.containsKey(name)) { logger.debug("getting the seismogram fromt the cache"); SoftReference softReference = (SoftReference)seismogramCache.get(name); LocalSeismogramImpl seis = (LocalSeismogramImpl)softReference.get(); if(seis != null) return seis; else seismogramCache.remove(name); } // end of if (seismogramCache.containsKey(name)) //logger.debug("The name of the data set is "+getName()); //logger.debug("The name of the seismogram is "+name); String urlString = "NONE"; NodeList nList = evalNodeList(config, "localSeismogram/seismogramAttr/property[name="+dquote+"Name"+dquote+ "]"+"[value="+dquote+name+dquote+"]"+"/../../data"); if(nList == null || (nList != null && nList.getLength() == 0)) { nList = getNoNameSeismogram(name); } if (nList != null && nList.getLength() != 0) { try { Node n = nList.item(0); if (n instanceof Element) { Element e = (Element)n; //logger.debug("**********************The name of the element is "+e.getTagName()); urlString = e.getAttribute("xlink:href"); if (urlString == null || urlString == "") { throw new MalformedURLException(name+" does not have an xlink:href attribute"); } // end of if (urlString == null || urlString == "") //logger.debug("IN GET SEISMOGRAM The base str is "+base.toString()); URL sacURL = new URL(base, urlString); //logger.debug("The sacUrl is "+sacURL.toString()); DataInputStream dis = new DataInputStream(new BufferedInputStream(sacURL.openStream())); SacTimeSeries sac = new SacTimeSeries(); sac.read(dis); LocalSeismogramImpl seis = SacToFissures.getSeismogram(sac); //get the Seismogram Attributes from the xml .. only the data must // must be obtained fromt the SAC. NodeList seisAttrNode = XMLUtil.evalNodeList(e, "../seismogramAttr"); if(seisAttrNode != null && seisAttrNode.getLength() != 0) { SeismogramAttr seisAttr = XMLSeismogramAttr.getSeismogramAttr((Element)seisAttrNode.item(0)); //logger.debug("The &&&&&&&&&&&&&&&&&&& chan_cdoe from dsml file is "+ // ((SeismogramAttrImpl)seisAttr).getChannelID().channel_code); seis.setAttributes(seisAttr); //logger.debug("The &&&&&&&&&&&&&&&&&&& chan_code after setting is "+ // seis.getChannelID().channel_code); } NodeList propList = evalNodeList(e, "property"); int numDSProps = 0; if (propList != null && propList.getLength() != 0) { numDSProps = nList.getLength(); } else { // no properties in dataset numDSProps = 0; } // end of else // Property[] props = seis.getProperties();// Property[] newProps = // new Property[1+props.length+numDSProps];// System.arraycopy(props, 0, newProps, 0, props.length);// for (int i=0; i<propList.getLength(); i++) {// Element propElement = (Element)propList.item(i);// newProps[props.length+i] = // new Property(xpath.eval(propElement, "name/text()").str(),// xpath.eval(propElement, "value/text()").str());// } // end of for// newProps[newProps.length-1] = new Property(seisNameKey,// name);// seis.setProperties(newProps); if (seis != null) { seismogramCache.put(name, new SoftReference(seis)); } // end of if (seis != null) return seis; } } catch (MalformedURLException e) { logger.error("Couldn't get seismogram "+name, e); logger.error(urlString); } catch (Exception e) { logger.error("Couldn't get seismogram "+name, e); logger.error(urlString); } // end of try-catch } return null; }
overSizedImage = null;
redo = true;
public void redraw(){ overSizedImage = null; repaint(); }
return seismos.remove(name);
seismos.remove(name); return names.remove(name);
public boolean remove(String name){ return seismos.remove(name); }
public CaldavCalNode(CaldavURI cdURI, CalSvcI svci, IcalTranslator trans, boolean debug) { super(cdURI, svci, trans, debug); this.name = cdURI.getCalName(); collection = true; allowsGet = false; if (!uri.endsWith("/")) { uri += "/"; } contentLang = "en"; contentLen = 0;
public CaldavCalNode(int status, boolean debug) { super(null, null, null, debug); setStatus(status);
public CaldavCalNode(CaldavURI cdURI, CalSvcI svci, IcalTranslator trans, boolean debug) { super(cdURI, svci, trans, debug); this.name = cdURI.getCalName(); collection = true; allowsGet = false; if (!uri.endsWith("/")) { uri += "/"; } contentLang = "en"; contentLen = 0; }
return new CaldavCalNode(getCDURI(), svci, trans, debug);
return new CaldavCalNode(getCDURI(), getSvci(), trans, debug);
public Object clone() { return new CaldavCalNode(getCDURI(), svci, trans, debug); }
Collection events = svci.getEvents(sub, CalFacadeDefs.retrieveRecurExpanded);
Collection events = getSvci().getEvents(sub, CalFacadeDefs.retrieveRecurExpanded);
public Collection getChildren() throws WebdavIntfException { /* For the moment we're going to do this the inefficient way. We really need to have calendar defs that can be expressed as a search allowing us to retrieve all the ids of objects within a calendar. */ try { BwCalendar cal = cdURI.getCal(); if (cal.hasChildren()) { if (debug) { debugMsg("POSSIBLE SEARCH: getChildren for cal " + cal.getId()); } return cal.getChildren(); } /* Othewise, return the events in this calendar */ if (debug) { debugMsg("SEARCH: getEvents in calendar " + cal.getId()); } BwSubscription sub = BwSubscription.makeSubscription(cal); Collection events = svci.getEvents(sub, CalFacadeDefs.retrieveRecurExpanded); if (events == null) { return new ArrayList(); } return events; } catch (Throwable t) { throw new WebdavIntfException(t); } }
form.getMsg().emit("org.bedework.client.message.location.referenced");
form.getErr().emit("org.bedework.client.error.location.referenced");
public String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable { /** Check access */ if (!form.getAuthorisedUser()) { return "noAccess"; } BwLocation loc = form.getLocation(); int delResult = form.getCalSvcI().deleteLocation(loc); if (delResult == 2) { form.getMsg().emit("org.bedework.client.message.location.referenced"); return "inUse"; } if (delResult == 1) { form.getErr().emit("org.bedework.client.error.nosuchlocation", loc.getId()); return "notFound"; } form.getMsg().emit("org.bedework.client.message.location.deleted"); return "continue"; }
public abstract String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable;
public String doAction(HttpServletRequest request, HttpServletResponse response, BwSession sess, BwActionFormBase frm) throws Throwable { PEActionForm form = (PEActionForm)frm; return doAction(request, sess, form); }
public abstract String doAction(HttpServletRequest request, BwSession sess, PEActionForm form) throws Throwable;