rem
stringlengths 0
477k
| add
stringlengths 0
313k
| context
stringlengths 6
599k
|
---|---|---|
} else if( command == MenuBar.VIEW_AUTOSIZE_COLUMNS ) { | } else if( source == MenuBar.fileExportFIX ) { exportFile( source ); } else if( source == MenuBar.fileExportXML ) { exportFile( source ); } else if( source == MenuBar.fileExportCSV ) { exportFile( source ); } else if( source == MenuBar.viewExportFIX ) { exportFile( source ); } else if( source == MenuBar.viewExportXML ) { exportFile( source ); } else if( source == MenuBar.viewExportCSV ) { exportFile( source ); } else if( source == MenuBar.viewAutosizeColumns ) { | public void run() { Object command = e.getActionCommand(); if( command == MenuBar.FILE_OPEN ) { openFile(); } else if( command == MenuBar.VIEW_AUTOSIZE_COLUMNS ) { currentTable.autoSizeColumns( progressBar, 100 ); } else if( command == MenuBar.VIEW_AUTOSIZE_AND_HIDE_COLUMNS ) { currentTable.autoSizeColumns( progressBar, 1 ); } setEnabled( true ); menuBar.setEnabled( true ); } |
} else if( command == MenuBar.VIEW_AUTOSIZE_AND_HIDE_COLUMNS ) { | } else if( source == MenuBar.viewAutosizeAndHideColumns ) { | public void run() { Object command = e.getActionCommand(); if( command == MenuBar.FILE_OPEN ) { openFile(); } else if( command == MenuBar.VIEW_AUTOSIZE_COLUMNS ) { currentTable.autoSizeColumns( progressBar, 100 ); } else if( command == MenuBar.VIEW_AUTOSIZE_AND_HIDE_COLUMNS ) { currentTable.autoSizeColumns( progressBar, 1 ); } setEnabled( true ); menuBar.setEnabled( true ); } |
FileOpenDialog dialog = new FileOpenDialog( frame, dataDictionary ); | FileOpenDialog dialog = new FileOpenDialog( frame ); | private void openFile() { FileOpenDialog dialog = new FileOpenDialog( frame, dataDictionary ); dialog.setVisible( true ); final File file = dialog.getFile(); final Date startTime = dialog.getStartTime(); final Date endTime = dialog.getEndTime(); dialog.dispose(); boolean traceRunning = tracer.isRunning(); if( traceRunning ) tracer.stop(); if( file != null ) { try { LogFile logFile = new LogFile( file, dataDictionary ); ArrayList messages = logFile.parseMessages( progressBar, startTime, endTime ); //ArrayList invalidMessages = logFile.getInvalidMessages(); currentModel = new MessagesTableModel( dataDictionary, logFile ); currentTable = new MessagesTable( currentModel ); currentTable.addListSelectionListener( this ); currentTable.addMouseListener( this ); JScrollPane component = new JScrollPane( currentTable ); upperTabbedPane.add( file.getName(), component ); upperTabbedPane.setSelectedComponent( component ); currentModel.setMessages( messages, progressBar ); menuBar.reset(); menuBar.setFileOpen( true ); } catch( CancelException e ) { closeFile(); } catch( FileNotFoundException e ) { System.out.println(e); } catch (IOException e) { System.out.println(e); } } if( traceRunning ) tracer.start(); } |
fileExportMenu.setEnabled( value ); viewExportMenu.setEnabled( value ); fileClose.setEnabled( value ); | public void setFileOpen( boolean value ) { viewMenu.setEnabled( value ); filterMenu.setEnabled( value ); } |
|
public FileOpenDialog(JFrame owner, DataDictionary dataDictionary) throws HeadlessException { | public FileOpenDialog(JFrame owner) throws HeadlessException { | public FileOpenDialog(JFrame owner, DataDictionary dataDictionary) throws HeadlessException { super(owner, "File Open"); setResizable(false); getContentPane().setLayout( new GridBagLayout() ); GridBagConstraints constraints = new GridBagConstraints(); constraints.fill = GridBagConstraints.BOTH; constraints.weightx = 1.0; constraints.weighty = 20.0; constraints.gridwidth = GridBagConstraints.REMAINDER; getContentPane().add( fileChooser, constraints ); Dimension size = fileChooser.getPreferredSize(); size.setSize( size.getWidth() * 1.1, size.getHeight() * 1.25 ); setSize(size); constraints.weighty = 1.0; constraints.weightx = 1.0; constraints.gridwidth = 1; getContentPane().add( new JLabel(), constraints ); constraints.weightx = 1.0; constraints.gridwidth = 10; startTimeControl = new JSpinner(new SpinnerDateModel()); startTimeControl.setEditor(new JSpinner.DateEditor(startTimeControl, "HH:mm:ss MM/dd/yyyy")); startTimeControl.setValue(new Date()); getContentPane().add( startTimeControl, constraints ); constraints.weightx = 1.0; constraints.gridwidth = 1; label.setHorizontalAlignment(JLabel.CENTER); label.setVerticalAlignment(JLabel.CENTER); getContentPane().add( label, constraints ); constraints.weightx = 1.0; constraints.gridwidth = 10; endTimeControl = new JSpinner(new SpinnerDateModel()); endTimeControl.setEditor(new JSpinner.DateEditor(endTimeControl, "HH:mm:ss MM/dd/yyyy")); endTimeControl.setValue(new Date()); getContentPane().add( endTimeControl, constraints ); constraints.weightx = 1.0; constraints.gridwidth = 1; getContentPane().add( new JLabel(), constraints ); fileChooser.setCurrentDirectory( new File(path) ); fileChooser.addActionListener( this ); fileChooser.addPropertyChangeListener( this ); setSize( 640, 480 ); } |
public LogFile( File file, DataDictionary aDataDictionary ) throws FileNotFoundException { logFile = file; | public LogFile( String name, DataDictionary aDataDictionary ) throws FileNotFoundException { logFile = new File(name); | public LogFile( File file, DataDictionary aDataDictionary ) throws FileNotFoundException { logFile = file; dataDictionary = aDataDictionary; initialize(); } |
public ArrayList parseMessages( ProgressBarPanel progressBar, Date startTime, Date endTime ) throws IOException, CancelException { int startingPosition = findPositionByTime( progressBar, startTime, 0, true ); int endingPosition = (int)logFile.length(); if( endTime != null ) endingPosition = findPositionByTime( progressBar, endTime, startingPosition, false ); | public ArrayList parseMessages( ProgressBarPanel progressBar, int startingPosition, int endingPosition ) throws IOException, CancelException { initialize(); messages = new ArrayList(); invalidMessages = new ArrayList(); newMessages = new ArrayList(); newInvalidMessages = new ArrayList(); String line = null; lastPosition = endingPosition; if( progressBar != null ) progressBar.setTask( "Parsing FIX Messages", startingPosition, endingPosition, true ); | public ArrayList parseMessages( ProgressBarPanel progressBar, Date startTime, Date endTime ) throws IOException, CancelException { int startingPosition = findPositionByTime( progressBar, startTime, 0, true ); int endingPosition = (int)logFile.length(); if( endTime != null ) endingPosition = findPositionByTime( progressBar, endTime, startingPosition, false ); ArrayList messages = parseMessages( progressBar, startingPosition, endingPosition ); return trimMessages( messages, startTime, endTime ); } |
ArrayList messages = parseMessages( progressBar, startingPosition, endingPosition ); return trimMessages( messages, startTime, endTime ); | initialize(); bufferedLogFileReader.skip( startingPosition ); int bytesRead = 0; int totalBytesRead = 0; int totalBytes = endingPosition - startingPosition; while( (line = bufferedLogFileReader.readLine()) != null && totalBytesRead < totalBytes ) { bytesRead += line.length(); totalBytesRead += line.length(); if( bytesRead > 30000 ) { if( progressBar != null ) { if( !progressBar.increment( bytesRead ) ) { messages.clear(); invalidMessages.clear(); throw new CancelException(); } } bytesRead = 0; } Message message = parseLine( line, dataDictionary ); if( message == null ) continue; messages.add( message ); } if( progressBar != null ) progressBar.done(); messages.addAll( newMessages ); invalidMessages.addAll( newInvalidMessages ); return messages; | public ArrayList parseMessages( ProgressBarPanel progressBar, Date startTime, Date endTime ) throws IOException, CancelException { int startingPosition = findPositionByTime( progressBar, startTime, 0, true ); int endingPosition = (int)logFile.length(); if( endTime != null ) endingPosition = findPositionByTime( progressBar, endTime, startingPosition, false ); ArrayList messages = parseMessages( progressBar, startingPosition, endingPosition ); return trimMessages( messages, startTime, endTime ); } |
public MessagesTableModel( DataDictionary aDataDictionary, LogFile aLogFile ) { | public MessagesTableModel( DataDictionary aDataDictionary ) { | public MessagesTableModel( DataDictionary aDataDictionary, LogFile aLogFile ) { dataDictionary = aDataDictionary; logFile = aLogFile; messages = allMessages; } |
logFile = aLogFile; | public MessagesTableModel( DataDictionary aDataDictionary, LogFile aLogFile ) { dataDictionary = aDataDictionary; logFile = aLogFile; messages = allMessages; } |
|
addLabel( "QuickFIX Log Viewer v1.0.0" ); | addLabel( "QuickFIX Log Viewer v1.0.1" ); | AboutDialog(JFrame owner) { super(owner, "About"); setResizable( false ); setSize( 320, 100 ); setLayout( new GridBagLayout() ); constraints.fill = GridBagConstraints.CENTER; constraints.weightx = 1; constraints.gridx = 1; constraints.weighty = 1; constraints.gridy = 0; addLabel( "QuickFIX Log Viewer v1.0.0" ); addLabel( "Copyright 2004-2006 quickfixengine.org" ); addLabel( "www.quickfixengine.org"); addLabel( "[email protected]"); } |
ATSymbol restArgsName = pars[numMandatoryPars].asSplice().getExpression().asSymbol(); | ATSymbol restArgsName = pars[numMandatoryPars].asSplice().base_getExpression().asSymbol(); | private static final void bindArguments(String funnam, ATObject scope, ATTable parameters, ATTable arguments, BindClosure binder) throws NATException { if (parameters == NATTable.EMPTY) { if (arguments == NATTable.EMPTY) return; // no need to bind any arguments else throw new XArityMismatch(funnam, 0, arguments.base_getLength().asNativeNumber().javaValue); } ATObject[] pars = parameters.asNativeTable().elements_; ATObject[] args = arguments.asNativeTable().elements_; // check to see whether the last argument is a spliced parameters, which // indicates a variable parameter list if (pars[pars.length - 1].isSplice()) { int numMandatoryPars = (pars.length - 1); // if so, check whether at least all mandatory parameters are matched if (args.length < numMandatoryPars) throw new XArityMismatch(funnam, numMandatoryPars, args.length); // bind all parameters except for the last one for (int i = 0; i < numMandatoryPars; i++) { binder.bindParamToArg(scope, pars[i].asSymbol(), args[i]); } // bind the last parameter to the remaining arguments int numRemainingArgs = args.length - numMandatoryPars; ATObject[] restArgs = new ATObject[numRemainingArgs]; for (int i = 0; i < numRemainingArgs; i++) { restArgs[i] = args[i + numMandatoryPars]; } ATSymbol restArgsName = pars[numMandatoryPars].asSplice().getExpression().asSymbol(); binder.bindParamToArg(scope, restArgsName, new NATTable(restArgs)); } else { // regular parameter list: arguments and parameters have to match exactly if (pars.length != args.length) throw new XArityMismatch(funnam, pars.length, args.length); for (int i = 0; i < pars.length; i++) { binder.bindParamToArg(scope, pars[i].asSymbol(), args[i]); } } } |
ATObject[] tbl = els[i].asSplice().getExpression().meta_eval(ctx).asNativeTable().elements_; | ATObject[] tbl = els[i].asSplice().base_getExpression().meta_eval(ctx).asNativeTable().elements_; | public static final NATTable evaluateArguments(NATTable args, ATContext ctx) throws NATException { if (args == NATTable.EMPTY) return NATTable.EMPTY; ATObject[] els = args.elements_; LinkedList result = new LinkedList(); int siz = els.length; for (int i = 0; i < els.length; i++) { if (els[i].isSplice()) { ATObject[] tbl = els[i].asSplice().getExpression().meta_eval(ctx).asNativeTable().elements_; for (int j = 0; j < tbl.length; j++) { result.add(tbl[j]); } siz += (tbl.length - 1); // -1 because we replace one element by a table of elements } else { result.add(els[i].meta_eval(ctx)); } } return new NATTable((ATObject[]) result.toArray(new ATObject[siz])); } |
Channel channel = ((XMLDataSet)dataset).getChannel(channelId); | public static String getSeismogramName(ChannelId channelId, DataSet dataset, TimeRange timeRange) { Channel channel = ((XMLDataSet)dataset).getChannel(channelId); SeismogramAttr[] attrs = ((XMLDataSet)dataset).getSeismogramAttrs(); MicroSecondDate startDate = new MicroSecondDate(timeRange.start_time); MicroSecondDate endDate = new MicroSecondDate(timeRange.end_time); for(int counter = 0; counter < attrs.length; counter++) { if(ChannelIdUtil.toString(channelId).equals(ChannelIdUtil.toString(((SeismogramAttrImpl)attrs[counter]).getChannelID()))){ if(((((SeismogramAttrImpl)attrs[counter]).getBeginTime().equals(startDate) || ((SeismogramAttrImpl)attrs[counter]).getBeginTime().before(startDate))) && (((SeismogramAttrImpl)attrs[counter]).getEndTime().equals(endDate) || ((SeismogramAttrImpl)attrs[counter]).getEndTime().after(endDate))){ return ((SeismogramAttrImpl)attrs[counter]).getName(); } } } return null; } |
|
Channel channel = ((XMLDataSet)dataset).getChannel(channelId); | public static String[] getSeismogramNames(ChannelId channelId, DataSet dataset, TimeRange timeRange) { Channel channel = ((XMLDataSet)dataset).getChannel(channelId); SeismogramAttr[] attrs = ((XMLDataSet)dataset).getSeismogramAttrs(); MicroSecondDate startDate = new MicroSecondDate(timeRange.start_time); MicroSecondDate endDate = new MicroSecondDate(timeRange.end_time); ArrayList arrayList = new ArrayList(); for(int counter = 0; counter < attrs.length; counter++) { if(ChannelIdUtil.toString(channelId).equals(ChannelIdUtil.toString(((SeismogramAttrImpl)attrs[counter]).getChannelID()))){ if(((((SeismogramAttrImpl)attrs[counter]).getBeginTime().equals(startDate) || ((SeismogramAttrImpl)attrs[counter]).getBeginTime().before(startDate))) && (((SeismogramAttrImpl)attrs[counter]).getEndTime().equals(endDate) || ((SeismogramAttrImpl)attrs[counter]).getEndTime().after(endDate))){ arrayList.add(((SeismogramAttrImpl)attrs[counter]).getName()); } } } String[] rtnValues = new String[arrayList.size()]; rtnValues = (String[]) arrayList.toArray(rtnValues); return rtnValues; } |
|
return this; } else { for (IdeaView subView: subViews) { IdeaView hit = subView.getViewAt(p); if (hit != null) { return hit; } | hit = this; } for (IdeaView subView: subViews) { IdeaView hit2 = subView.getViewAt(p); if (hit2 != null) { hit = hit2; | public IdeaView getViewAt(Point2D p) { if (hits(p)) { return this; } else { for (IdeaView subView: subViews) { IdeaView hit = subView.getViewAt(p); if (hit != null) { return hit; } } } return null; } |
return null; | return hit; | public IdeaView getViewAt(Point2D p) { if (hits(p)) { return this; } else { for (IdeaView subView: subViews) { IdeaView hit = subView.getViewAt(p); if (hit != null) { return hit; } } } return null; } |
if (Math.abs(distance) <= thickness) { | if (Math.abs(distance) <= (thickness / 2)) { | private boolean hits(Point2D p) { if ((fromPoint == null) || (toPoint == null)) { return false; } double vx0 = fromPoint.getX(); double vy0 = fromPoint.getY(); double vx1 = toPoint.getX(); double vy1 = toPoint.getY(); double vx2 = p.getX(); double vy2 = p.getY(); double minX = Math.min(vx0, vx1) - thickness; double maxX = Math.max(vx0, vx1) + thickness; double minY = Math.min(vy0, vy1) - thickness; double maxY = Math.max(vy0, vy1) + thickness; if ((vx2 > maxX) || (vx2 < minX)) { return false; } if ((vy2 > maxY) || (vy2 < minY)) { return false; } // Calculate magnitude of the normal to the line-segment double magNormal = Math.sqrt( ((vx1 - vx0) * (vx1 - vx0)) + ((vy1 - vy0) * (vy1 - vy0)) ); // Calculate (signed) distance of the point from the line-segment double distance = ( ((vx2 - vx0) * (vy0 - vy1)) + ((vy2 - vy0) * (vx1 - vx0)) ) / magNormal; // Check if the if (Math.abs(distance) <= thickness) { return true; } return false; } |
System.out.println("Simple brutal removeTabAt owner="+owner); | public void removeTabAt(int index) { if (index < 0 || index >= getTabCount()) { return; } Component c = getComponentAt(index); Object owner = table.remove(c); if (owner != null && owner instanceof IModule) { ModuleFactory.disposeInstance((IModule)owner); // real removing done by listener (disposed()) } else if (owner != null && owner instanceof IPanel) { ((IPanel)owner).dispose(); super.removeTabAt(index); } else { System.out.println("Simple brutal removeTabAt owner="+owner); super.removeTabAt(index); } } |
|
public static void show(String msg, Throwable exc) { new ExceptionDialog(msg, exc); | public static void show(Exception exc) { new ExceptionDialog(exc); | public static void show(String msg, Throwable exc) { new ExceptionDialog(msg, exc); } |
assertEquals("foo_", Reflection.upSelector(AGSymbol.alloc("foo:"))); assertEquals("foo_bar_", Reflection.upSelector(AGSymbol.alloc("foo:bar:"))); assertEquals("_oppls_", Reflection.upSelector(AGSymbol.alloc("+"))); assertEquals("set_opnot_", Reflection.upSelector(AGSymbol.alloc("set!"))); assertEquals("foo__opltx_bar_", Reflection.upSelector(AGSymbol.alloc("foo:<bar:"))); assertEquals("_opbla_", Reflection.upSelector(AGSymbol.alloc(":opbla:"))); assertEquals("yes_opque_", Reflection.upSelector(AGSymbol.alloc("yes?"))); | assertEquals("foo_", Reflection.upSelector(AGSymbol.jAlloc("foo:"))); assertEquals("foo_bar_", Reflection.upSelector(AGSymbol.jAlloc("foo:bar:"))); assertEquals("_oppls_", Reflection.upSelector(AGSymbol.jAlloc("+"))); assertEquals("set_opnot_", Reflection.upSelector(AGSymbol.jAlloc("set!"))); assertEquals("foo__opltx_bar_", Reflection.upSelector(AGSymbol.jAlloc("foo:<bar:"))); assertEquals("_opbla_", Reflection.upSelector(AGSymbol.jAlloc(":opbla:"))); assertEquals("yes_opque_", Reflection.upSelector(AGSymbol.jAlloc("yes?"))); | public void testUpSelector() throws InterpreterException { assertEquals("foo_", Reflection.upSelector(AGSymbol.alloc("foo:"))); assertEquals("foo_bar_", Reflection.upSelector(AGSymbol.alloc("foo:bar:"))); assertEquals("_oppls_", Reflection.upSelector(AGSymbol.alloc("+"))); assertEquals("set_opnot_", Reflection.upSelector(AGSymbol.alloc("set!"))); assertEquals("foo__opltx_bar_", Reflection.upSelector(AGSymbol.alloc("foo:<bar:"))); assertEquals("_opbla_", Reflection.upSelector(AGSymbol.alloc(":opbla:"))); assertEquals("yes_opque_", Reflection.upSelector(AGSymbol.alloc("yes?"))); } |
_reportDescription.setLocale(iwc.getCurrentLocale()); | private void generateDataSource(IWContext iwc) throws XMLException, Exception { Locale currentLocale = iwc.getCurrentLocale(); if(_queryPK != null) { QueryService service = (QueryService)(IBOLookup.getServiceInstance(iwc,QueryService.class)); _dataSource = service.generateQueryResult(_queryPK, iwc); } else if (_methodInvokeDoc != null) { ReportDescription tmpReportDescriptionForCollectingData = new ReportDescription(); List mDescs = _methodInvokeDoc.getMethodDescriptions(); if (mDescs != null) { Iterator it = mDescs.iterator(); if (it.hasNext()) { MethodDescription mDesc = (MethodDescription) it.next(); ClassDescription mainClassDesc = mDesc.getClassDescription(); Class mainClass = mainClassDesc.getClassObject(); String type = mainClassDesc.getType(); String methodName = mDesc.getName(); MethodInput input = mDesc.getInput(); List parameters = null; if (input != null) { parameters = input.getClassDescriptions(); } Object[] prmVal = null; Class[] paramTypes = null; if (parameters != null) { prmVal = new Object[parameters.size()]; paramTypes = new Class[parameters.size()]; ListIterator iterator = parameters.listIterator(); while (iterator.hasNext()) { int index = iterator.nextIndex(); ClassDescription clDesc = (ClassDescription) iterator.next(); Class prmClassType = clDesc.getClassObject(); paramTypes[index] = prmClassType; String[] prmValues = iwc.getParameterValues(getParameterName(clDesc.getName())); String prm = null; Object obj = null; if (prmValues != null && prmValues.length > 0) { prm = prmValues[0]; } ClassHandler cHandler = clDesc.getClassHandler(); InputHandler iHandler = null; boolean isHidden = false; if (cHandler != null) { iHandler = cHandler.getHandler(); isHidden = iHandler instanceof HiddenInputHandler; } if (iHandler != null) { obj = iHandler.getResultingObject(prmValues, iwc); String displayNameOfValue = iHandler.getDisplayForResultingObject(obj, iwc); if (displayNameOfValue != null) { tmpReportDescriptionForCollectingData.put(clDesc.getName(), displayNameOfValue); } if (isHidden) { tmpReportDescriptionForCollectingData.remove(clDesc.getName()); } } else { //ONLY HANDLES ONE VALUE! obj = getParameterObject(iwc, prm, prmClassType); if (!isHidden) { tmpReportDescriptionForCollectingData.put(clDesc.getName(), prm); } } if (!isHidden) { tmpReportDescriptionForCollectingData.put(_prmLablePrefix + clDesc.getName(), clDesc.getLocalizedName(currentLocale) + ":"); } else { tmpReportDescriptionForCollectingData.remove(_prmLablePrefix + clDesc.getName()); } prmVal[index] = obj; } } Object forInvocationOfMethod = null; if (ClassDescription.VALUE_TYPE_IDO_SESSION_BEAN.equals(type)) { forInvocationOfMethod = IBOLookup.getSessionInstance(iwc, mainClass); } else if (ClassDescription.VALUE_TYPE_IDO_SERVICE_BEAN.equals(type)) { forInvocationOfMethod = IBOLookup.getServiceInstance(iwc, mainClass); } else if (ClassDescription.VALUE_TYPE_IDO_ENTITY_HOME.equals(type)) { forInvocationOfMethod = IDOLookup.getHome(mainClass); } else { //ClassDescription.VALUE_TYPE_CLASS.equals(type)) forInvocationOfMethod = mainClass.newInstance(); } MethodFinder mf = MethodFinder.getInstance(); Method method = mf.getMethodWithNameAndParameters(mainClass, methodName, paramTypes); try { _dataSource = (JRDataSource) method.invoke(forInvocationOfMethod, prmVal); } catch (InvocationTargetException e) { Throwable someException = e.getTargetException(); if (someException != null && someException instanceof Exception) { throw (Exception) someException; } else { throw e; } } if (_dataSource != null && _dataSource instanceof ReportableCollection) { _reportDescription = ((ReportableCollection) _dataSource).getReportDescription(); _reportDescription.merge(tmpReportDescriptionForCollectingData); } else { _reportDescription = tmpReportDescriptionForCollectingData; } } } } } |
|
public DynamicReportDesign(String name) { initializeDocument(name); createTitle(); createPageHeader(); createColumnHeader(); createDetail(); createColumnFooter(); createPageFooter(); createSummary(); } | public DynamicReportDesign() { } | public DynamicReportDesign(String name) { initializeDocument(name); createTitle(); createPageHeader(); createColumnHeader(); createDetail(); createColumnFooter(); createPageFooter(); createSummary(); } |
KortathjonustanAuthorisationEntriesHome authHome = (KortathjonustanAuthorisationEntriesHome) IDOLookup.getHome(KortathjonustanAuthorisationEntries.class); KortathjonustanAuthorisationEntries auth = authHome.create(); | public String doRefund(String cardnumber, String monthExpires, String yearExpires, String ccVerifyNumber, double amount, String currency, Object parentDataPK, String captureProperties) throws CreditCardAuthorizationException { IWTimestamp stamp = IWTimestamp.RightNow(); strCCNumber = cardnumber; strCCExpire = yearExpires + monthExpires; strCCVerify = ccVerifyNumber; setCurrencyAndAmount(currency, amount); strCurrentDate = getDateString(stamp); try { StringBuffer logText = new StringBuffer(); Hashtable capturePropertiesHash = parseResponse(captureProperties); Hashtable properties = doRefund(getAmountWithExponents(amount), capturePropertiesHash, parentDataPK); String authCode = properties.get(PROPERTY_APPROVAL_CODE).toString(); logText.append("\nRefund successful").append("\nAuthorization Code = " + authCode); logText.append("\nAction Code = " + properties.get(PROPERTY_ACTION_CODE).toString()); try { KortathjonustanAuthorisationEntriesHome authHome = (KortathjonustanAuthorisationEntriesHome) IDOLookup.getHome(KortathjonustanAuthorisationEntries.class); KortathjonustanAuthorisationEntries auth = authHome.create(); String tmpCardNum = CreditCardBusinessBean.encodeCreditCardNumber(cardnumber); auth.setAmount(Double.parseDouble(strAmount)); auth.setAuthorizationCode(authCode); auth.setBrandName(null); auth.setCardExpires(monthExpires+yearExpires); auth.setCardNumber(tmpCardNum); auth.setCurrency(currency); auth.setDate(stamp.getDate()); auth.setErrorNumber(properties.get(PROPERTY_ERROR_CODE).toString()); auth.setErrorText(properties.get(PROPERTY_ERROR_TEXT).toString()); auth.setTransactionType(KortathjonustanAuthorisationEntries.AUTHORIZATION_TYPE_REFUND); auth.setServerResponse(properties.get(PROPERTY_TOTAL_RESPONSE).toString()); if (parentDataPK != null) { try { auth.setParentID(((Integer) parentDataPK).intValue()); } catch (Exception e) { System.out.println("KortathjonustanCCCleint : could not set parentID : " + parentDataPK); } } auth.store(); logger.info(logText.toString()); } catch (Exception e) { System.err.println("Unable to save entry to database"); e.printStackTrace(); if (authCode != null) { return authCode; } else { throw new CreditCardAuthorizationException(e); } } return authCode; } catch (CreditCardAuthorizationException e) { StringBuffer logText = new StringBuffer(); logText.append("Authorization FAILED"); logText.append("\nError = " + e.getErrorMessage()); logText.append("\nNumber = " + e.getErrorNumber()); logText.append("\nDisplay error = " + e.getDisplayError()); logger.info(logText.toString()); throw e; } catch (NullPointerException n) { throw new CreditCardAuthorizationException(n); } } |
|
auth.setAmount(Double.parseDouble(strAmount)); auth.setAuthorizationCode(authCode); auth.setBrandName(null); auth.setCardExpires(monthExpires+yearExpires); auth.setCardNumber(tmpCardNum); auth.setCurrency(currency); auth.setDate(stamp.getDate()); auth.setErrorNumber(properties.get(PROPERTY_ERROR_CODE).toString()); auth.setErrorText(properties.get(PROPERTY_ERROR_TEXT).toString()); auth.setTransactionType(KortathjonustanAuthorisationEntries.AUTHORIZATION_TYPE_REFUND); auth.setServerResponse(properties.get(PROPERTY_TOTAL_RESPONSE).toString()); if (parentDataPK != null) { try { auth.setParentID(((Integer) parentDataPK).intValue()); } catch (Exception e) { System.out.println("KortathjonustanCCCleint : could not set parentID : " + parentDataPK); } } auth.store(); | storeAuthorizationEntry(tmpCardNum, parentDataPK, properties, KortathjonustanAuthorisationEntries.AUTHORIZATION_TYPE_REFUND); | public String doRefund(String cardnumber, String monthExpires, String yearExpires, String ccVerifyNumber, double amount, String currency, Object parentDataPK, String captureProperties) throws CreditCardAuthorizationException { IWTimestamp stamp = IWTimestamp.RightNow(); strCCNumber = cardnumber; strCCExpire = yearExpires + monthExpires; strCCVerify = ccVerifyNumber; setCurrencyAndAmount(currency, amount); strCurrentDate = getDateString(stamp); try { StringBuffer logText = new StringBuffer(); Hashtable capturePropertiesHash = parseResponse(captureProperties); Hashtable properties = doRefund(getAmountWithExponents(amount), capturePropertiesHash, parentDataPK); String authCode = properties.get(PROPERTY_APPROVAL_CODE).toString(); logText.append("\nRefund successful").append("\nAuthorization Code = " + authCode); logText.append("\nAction Code = " + properties.get(PROPERTY_ACTION_CODE).toString()); try { KortathjonustanAuthorisationEntriesHome authHome = (KortathjonustanAuthorisationEntriesHome) IDOLookup.getHome(KortathjonustanAuthorisationEntries.class); KortathjonustanAuthorisationEntries auth = authHome.create(); String tmpCardNum = CreditCardBusinessBean.encodeCreditCardNumber(cardnumber); auth.setAmount(Double.parseDouble(strAmount)); auth.setAuthorizationCode(authCode); auth.setBrandName(null); auth.setCardExpires(monthExpires+yearExpires); auth.setCardNumber(tmpCardNum); auth.setCurrency(currency); auth.setDate(stamp.getDate()); auth.setErrorNumber(properties.get(PROPERTY_ERROR_CODE).toString()); auth.setErrorText(properties.get(PROPERTY_ERROR_TEXT).toString()); auth.setTransactionType(KortathjonustanAuthorisationEntries.AUTHORIZATION_TYPE_REFUND); auth.setServerResponse(properties.get(PROPERTY_TOTAL_RESPONSE).toString()); if (parentDataPK != null) { try { auth.setParentID(((Integer) parentDataPK).intValue()); } catch (Exception e) { System.out.println("KortathjonustanCCCleint : could not set parentID : " + parentDataPK); } } auth.store(); logger.info(logText.toString()); } catch (Exception e) { System.err.println("Unable to save entry to database"); e.printStackTrace(); if (authCode != null) { return authCode; } else { throw new CreditCardAuthorizationException(e); } } return authCode; } catch (CreditCardAuthorizationException e) { StringBuffer logText = new StringBuffer(); logText.append("Authorization FAILED"); logText.append("\nError = " + e.getErrorMessage()); logText.append("\nNumber = " + e.getErrorNumber()); logText.append("\nDisplay error = " + e.getDisplayError()); logger.info(logText.toString()); throw e; } catch (NullPointerException n) { throw new CreditCardAuthorizationException(n); } } |
KortathjonustanAuthorisationEntriesHome authHome = (KortathjonustanAuthorisationEntriesHome) IDOLookup.getHome(KortathjonustanAuthorisationEntries.class); KortathjonustanAuthorisationEntries auth = authHome.create(); | public String doSale(String nameOnCard, String cardnumber, String monthExpires, String yearExpires, String ccVerifyNumber, double amount, String currency, String referenceNumber) throws CreditCardAuthorizationException { try { IWTimestamp stamp = IWTimestamp.RightNow(); strName = nameOnCard; strCCNumber = cardnumber; strCCExpire = yearExpires + monthExpires; strCCVerify = ccVerifyNumber; setCurrencyAndAmount(currency, amount); strCurrentDate = getDateString(stamp); strReferenceNumber = convertStringToNumbers(referenceNumber); StringBuffer logText = new StringBuffer(); //System.out.println("referenceNumber => " + strReferenceNumber); Hashtable returnedProperties = getFirstResponse(); String authCode = null; if (returnedProperties != null) { logText.append("Authorization successful"); Hashtable returnedCaptureProperties = finishTransaction(returnedProperties); if (returnedCaptureProperties != null && returnedCaptureProperties.get(PROPERTY_APPROVAL_CODE).toString() != null) { //System.out.println("Approval Code = // "+returnedCaptureProperties.get(PROPERTY_APPROVAL_CODE).toString()); authCode = returnedCaptureProperties.get(PROPERTY_APPROVAL_CODE).toString();//returnedCaptureProperties; logText.append("\nCapture successful").append("\nAuthorization Code = " + authCode); logText.append("\nAction Code = " + returnedCaptureProperties.get(PROPERTY_ACTION_CODE).toString()); try { KortathjonustanAuthorisationEntriesHome authHome = (KortathjonustanAuthorisationEntriesHome) IDOLookup.getHome(KortathjonustanAuthorisationEntries.class); KortathjonustanAuthorisationEntries auth = authHome.create(); String tmpCardNum = CreditCardBusinessBean.encodeCreditCardNumber(cardnumber); auth.setAmount(Double.parseDouble(strAmount)); auth.setAuthorizationCode(authCode); auth.setBrandName(returnedCaptureProperties.get(PROPERTY_CARD_BRAND_NAME).toString()); auth.setCardExpires(monthExpires+yearExpires); //auth.setCardExpires(strCCExpire); auth.setCardNumber(tmpCardNum); auth.setCurrency(currency); auth.setDate(stamp.getDate()); auth.setErrorNumber(returnedCaptureProperties.get(PROPERTY_ERROR_CODE).toString()); auth.setErrorText(returnedCaptureProperties.get(PROPERTY_ERROR_TEXT).toString()); auth.setTransactionType(KortathjonustanAuthorisationEntries.AUTHORIZATION_TYPE_SALE); auth.setServerResponse(returnedCaptureProperties.get(PROPERTY_TOTAL_RESPONSE).toString()); auth.store(); logger.info(logText.toString()); } catch (Exception e) { System.err.println("Unable to save entry to database"); throw new CreditCardAuthorizationException(e); } } } return authCode; } catch (CreditCardAuthorizationException e) { StringBuffer logText = new StringBuffer(); logText.append("Authorization FAILED"); logText.append("\nError = " + e.getErrorMessage()); logText.append("\nNumber = " + e.getErrorNumber()); logText.append("\nDisplay error = " + e.getDisplayError()); logger.info(logText.toString()); throw e; } } |
|
auth.setAmount(Double.parseDouble(strAmount)); auth.setAuthorizationCode(authCode); auth.setBrandName(returnedCaptureProperties.get(PROPERTY_CARD_BRAND_NAME).toString()); auth.setCardExpires(monthExpires+yearExpires); auth.setCardNumber(tmpCardNum); auth.setCurrency(currency); auth.setDate(stamp.getDate()); auth.setErrorNumber(returnedCaptureProperties.get(PROPERTY_ERROR_CODE).toString()); auth.setErrorText(returnedCaptureProperties.get(PROPERTY_ERROR_TEXT).toString()); auth.setTransactionType(KortathjonustanAuthorisationEntries.AUTHORIZATION_TYPE_SALE); auth.setServerResponse(returnedCaptureProperties.get(PROPERTY_TOTAL_RESPONSE).toString()); auth.store(); | this.storeAuthorizationEntry(tmpCardNum, null, returnedCaptureProperties, KortathjonustanAuthorisationEntries.AUTHORIZATION_TYPE_SALE); | public String doSale(String nameOnCard, String cardnumber, String monthExpires, String yearExpires, String ccVerifyNumber, double amount, String currency, String referenceNumber) throws CreditCardAuthorizationException { try { IWTimestamp stamp = IWTimestamp.RightNow(); strName = nameOnCard; strCCNumber = cardnumber; strCCExpire = yearExpires + monthExpires; strCCVerify = ccVerifyNumber; setCurrencyAndAmount(currency, amount); strCurrentDate = getDateString(stamp); strReferenceNumber = convertStringToNumbers(referenceNumber); StringBuffer logText = new StringBuffer(); //System.out.println("referenceNumber => " + strReferenceNumber); Hashtable returnedProperties = getFirstResponse(); String authCode = null; if (returnedProperties != null) { logText.append("Authorization successful"); Hashtable returnedCaptureProperties = finishTransaction(returnedProperties); if (returnedCaptureProperties != null && returnedCaptureProperties.get(PROPERTY_APPROVAL_CODE).toString() != null) { //System.out.println("Approval Code = // "+returnedCaptureProperties.get(PROPERTY_APPROVAL_CODE).toString()); authCode = returnedCaptureProperties.get(PROPERTY_APPROVAL_CODE).toString();//returnedCaptureProperties; logText.append("\nCapture successful").append("\nAuthorization Code = " + authCode); logText.append("\nAction Code = " + returnedCaptureProperties.get(PROPERTY_ACTION_CODE).toString()); try { KortathjonustanAuthorisationEntriesHome authHome = (KortathjonustanAuthorisationEntriesHome) IDOLookup.getHome(KortathjonustanAuthorisationEntries.class); KortathjonustanAuthorisationEntries auth = authHome.create(); String tmpCardNum = CreditCardBusinessBean.encodeCreditCardNumber(cardnumber); auth.setAmount(Double.parseDouble(strAmount)); auth.setAuthorizationCode(authCode); auth.setBrandName(returnedCaptureProperties.get(PROPERTY_CARD_BRAND_NAME).toString()); auth.setCardExpires(monthExpires+yearExpires); //auth.setCardExpires(strCCExpire); auth.setCardNumber(tmpCardNum); auth.setCurrency(currency); auth.setDate(stamp.getDate()); auth.setErrorNumber(returnedCaptureProperties.get(PROPERTY_ERROR_CODE).toString()); auth.setErrorText(returnedCaptureProperties.get(PROPERTY_ERROR_TEXT).toString()); auth.setTransactionType(KortathjonustanAuthorisationEntries.AUTHORIZATION_TYPE_SALE); auth.setServerResponse(returnedCaptureProperties.get(PROPERTY_TOTAL_RESPONSE).toString()); auth.store(); logger.info(logText.toString()); } catch (Exception e) { System.err.println("Unable to save entry to database"); throw new CreditCardAuthorizationException(e); } } } return authCode; } catch (CreditCardAuthorizationException e) { StringBuffer logText = new StringBuffer(); logText.append("Authorization FAILED"); logText.append("\nError = " + e.getErrorMessage()); logText.append("\nNumber = " + e.getErrorNumber()); logText.append("\nDisplay error = " + e.getDisplayError()); logger.info(logText.toString()); throw e; } } |
finishTransaction(parseResponse(properties)); | Hashtable returnedCaptureProperties = finishTransaction(parseResponse(properties)); try { this.storeAuthorizationEntry(null, null, returnedCaptureProperties, KortathjonustanAuthorisationEntries.AUTHORIZATION_TYPE_DELAYED_TRANSACTION); } catch (Exception e) { System.err.println("Unable to save entry to database"); e.printStackTrace(); throw new KortathjonustanAuthorizationException(e); } | public void finishTransaction(String properties) throws KortathjonustanAuthorizationException { finishTransaction(parseResponse(properties)); } |
if(displayButtonPanel) { if(!advancedOption) { particleMotionDisplay.formRadioSetPanel(channelGroup); } else { particleMotionDisplay.formCheckBoxPanel(channelGroup); } } | public void execute() { if(dataSetSeismogram.length == 1) { dataSetSeismogram = retrieve_seismograms(); } for(int counter = 0; counter < dataSetSeismogram.length; counter++) { for(int subcounter = counter+1; subcounter < dataSetSeismogram.length; subcounter++) { boolean horizPlane = isHorizontalPlane(dataSetSeismogram[counter].getSeismogram().getChannelID(), dataSetSeismogram[subcounter].getSeismogram().getChannelID(), dataSetSeismogram[counter].getDataSet()); if(horizPlane) { particleMotionDisplay.displayBackAzimuth(dataSetSeismogram[counter].getDataSet(), channelGroup[counter]); } particleMotionDisplay.getView().addParticleMotionDisplay(dataSetSeismogram[counter], dataSetSeismogram[subcounter], timeConfigRegistrar, hAmpConfigRegistrar, vAmpConfigRegistrar, null, getOrientationName(channelGroup[counter].channel_code)+"-"+ getOrientationName(channelGroup[subcounter].channel_code), horizPlane); particleMotionDisplay.updateTimeRange(); } } if(displayButtonPanel) { particleMotionDisplay.setInitialButton(); } } |
|
if(displayButtonPanel) { if(!advancedOption) { particleMotionDisplay.formRadioSetPanel(channelGroup); } else { particleMotionDisplay.formCheckBoxPanel(channelGroup); } } | public DataSetSeismogram[] retrieve_seismograms() { LocalSeismogramImpl seis = dataSetSeismogram[0].getSeismogram(); ChannelId[] channelIds = ((edu.sc.seis.fissuresUtil.xml.XMLDataSet)dataSetSeismogram[0].getDataSet()).getChannelIds(); ChannelGrouperImpl channelProxy = new ChannelGrouperImpl(); logger.debug("the original channel_code from the seismogram is "+seis.getChannelID().channel_code); channelGroup = channelProxy.retrieve_grouping(channelIds, seis.getChannelID()); logger.debug("THe length of the channel group is "+channelGroup.length); //decide whether to form the radioSetPanel or the checkBoxPanel. if(displayButtonPanel) { if(!advancedOption) { particleMotionDisplay.formRadioSetPanel(channelGroup); } else { particleMotionDisplay.formCheckBoxPanel(channelGroup); } } edu.iris.Fissures.Time startTime; edu.iris.Fissures.Time endTime; DataSetSeismogram[] seismograms = new DataSetSeismogram[3]; if(timeConfigRegistrar != null) { startTime = timeConfigRegistrar.getTimeRange().getBeginTime().getFissuresTime(); endTime = timeConfigRegistrar.getTimeRange().getEndTime().getFissuresTime(); } else { startTime = seis.getBeginTime().getFissuresTime(); endTime = seis.getEndTime().getFissuresTime(); } try { for(int counter = 0; counter < channelGroup.length; counter++) { seismograms[counter] = new DataSetSeismogram(dataSetSeismogram[0].getDataSet(). getSeismogram(DisplayUtils.getSeismogramName(channelGroup[counter], dataSetSeismogram[0].getDataSet(), new edu.iris.Fissures.TimeRange(seis.getBeginTime().getFissuresTime(), seis.getEndTime().getFissuresTime()))), dataSetSeismogram[0].getDataSet()); //ChannelIdUtil.toStringNoDates(channelGroup[counter])); timeConfigRegistrar.addSeismogram(seismograms[counter]); //hAmpRangeConfigRegistrar.addSeismogram(seismograms[counter]); } return seismograms; } catch(Exception e) { e.printStackTrace();//strack trace } return new DataSetSeismogram[0]; } |
|
graphics2D.setColor(Color.blue); | graphics2D.setColor(new Color(100, 160, 140)); | public synchronized void drawAzimuth(ParticleMotion particleMotion, Graphics2D graphics2D) { logger.debug("IN DRAW AZIMUTH"); if(!particleMotion.isHorizontalPlane()) return; Shape sector = getSectorShape(); graphics2D.setColor(Color.blue); graphics2D.fill(sector); graphics2D.draw(sector); graphics2D.setStroke(new BasicStroke(2.0f)); graphics2D.setColor(Color.green); Shape azimuth = getAzimuthPath(); graphics2D.draw(azimuth); graphics2D.setStroke(new BasicStroke(1.0f)); } |
}; | } | public Icon getGUIIcon() { return null; }; |
return null; | return modeCursor; | public Cursor getModeCursor() { return null; } |
public void mouseMoved(MouseEvent e) {} | public void mouseMoved(MouseEvent e) { if (!isPressed && currentCursor != modeCursor){ setCursor(modeCursor, e); } } | public void mouseMoved(MouseEvent e) {} |
public void mousePressed(MouseEvent e) {} | public void mousePressed(MouseEvent e) { isPressed = true; if (currentCursor != pressedCursor){ setCursor(pressedCursor, e); } } | public void mousePressed(MouseEvent e) {} |
public void mouseReleased(MouseEvent e) {} | public void mouseReleased(MouseEvent e) { isPressed = false; if (currentCursor != modeCursor){ setCursor(modeCursor, e); } } | public void mouseReleased(MouseEvent e) {} |
return seismos.size(); | int rtnValue = seismos.size(); seismos.put(name, seismo); return rtnValue; | public int sort(DataSetSeismogram seismo, String name){ names.add(name); return seismos.size(); } |
} catch(edu.sc.seis.anhinga.database.NotFound nfe) { | } catch(NotFound nfe) { | public void update_region(edu.iris.Fissures.FlinnEngdahlRegion region, edu.iris.Fissures.AuditInfo[] audit_info) { try { jdbcEventAccess.updateFlinnEngdahlRegion(eventid, region); } catch(SQLException sqle) { logger.error("Problem with SQL ", sqle); throw new org.omg.CORBA.INTERNAL(sqle.toString()); } catch(edu.sc.seis.anhinga.database.NotFound nfe) { logger.error(" The Event with id " + eventid + " is Not Found", nfe); throw new org.omg.CORBA.INTERNAL(nfe.toString()); } } |
public NATMirage(ATObject dynamicParent, ATObject lexicalParent, NATIntercessiveMirror mirror, boolean parentType) { super(dynamicParent, lexicalParent, parentType); | public NATMirage(NATIntercessiveMirror mirror) { | public NATMirage(ATObject dynamicParent, ATObject lexicalParent, NATIntercessiveMirror mirror, boolean parentType) { super(dynamicParent, lexicalParent, parentType); mirror_ = mirror; } |
for (int i = 0; i < selected.length; i++) { | for (int i = selected.length - 1; i >= 0; i--) { | public TablePanel() { super(new GridLayout(1, 0)); final JTable table = new JTable(model); table.getColumnModel().getColumn(0).setPreferredWidth(150); table.getColumnModel().getColumn(1).setPreferredWidth(150); table.getColumnModel().getColumn(2).setPreferredWidth(10); table.getColumnModel().getColumn(3).setPreferredWidth(150); table.getColumnModel().getColumn(4).setPreferredWidth(50); table.sizeColumnsToFit(-1); final JPopupMenu rightClickMenu = new JPopupMenu(); JMenuItem removeItem = new JMenuItem(Messages.getString("ModuleConfigurationPanel.REMOVE")); //$NON-NLS-1$ removeItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { int[] selected = table.getSelectedRows(); for (int i = 0; i < selected.length; i++) { Object source = table.getModel().getValueAt(selected[i], 0); String id = (String)table.getModel().getValueAt(selected[i], 1); ModuleConfiguration.remove(source); ModuleLoader.unload(id); } } }); rightClickMenu.add(removeItem); table.addMouseListener(new MouseListener() { public void mouseClicked(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { } public void mousePressed(MouseEvent e) { if (e.getClickCount() == 1 && e.getButton() == MouseEvent.BUTTON3 && table.getSelectedRow() != -1) { rightClickMenu.show(table, e.getX(), e.getY()); } } public void mouseReleased(MouseEvent e) { } }); JScrollPane scrollPane = new JScrollPane(table); add(scrollPane); } |
for (int i = 0; i < selected.length; i++) { | for (int i = selected.length - 1; i >= 0; i--) { | public void actionPerformed(ActionEvent e) { int[] selected = table.getSelectedRows(); for (int i = 0; i < selected.length; i++) { Object source = table.getModel().getValueAt(selected[i], 0); String id = (String)table.getModel().getValueAt(selected[i], 1); ModuleConfiguration.remove(source); ModuleLoader.unload(id); } } |
public static void addRightClickMenu(JTextComponent tc) { RightClickMenu menu = new RightClickMenu(tc); menu.addRightClickListener(); tc.add(menu); | public static void addRightClickMenu(JComponent c, JPopupMenu menu) { addRightClickListener(c, menu); c.add(menu); | public static void addRightClickMenu(JTextComponent tc) { RightClickMenu menu = new RightClickMenu(tc); menu.addRightClickListener(); tc.add(menu); } |
public static ModuleContainer load(String moduleClassName) throws ModuleLoaderException { | public static ModuleContainer load(File f) throws ModuleLoaderException { | public static ModuleContainer load(String moduleClassName) throws ModuleLoaderException { try { float version = 0.0f; Requirement[] requirements = new Requirement[0]; Class cls = Class.forName(moduleClassName); ModuleContainer module = new ModuleContainer(cls, version); module.setRequirements(requirements); module.setSource(moduleClassName); String id = module.getId(); if (!isLoaded(id)) { table.put(id, module); fireLoaded(module); return module; } else { return getLoadedModule(id); } } catch (ModuleLoaderException exc) { throw exc; } catch (Exception exc) { throw new ModuleLoaderException(exc); } } |
float version = 0.0f; Requirement[] requirements = new Requirement[0]; Class cls = Class.forName(moduleClassName); ModuleContainer module = new ModuleContainer(cls, version); module.setRequirements(requirements); module.setSource(moduleClassName); String id = module.getId(); if (!isLoaded(id)) { table.put(id, module); fireLoaded(module); return module; } else { return getLoadedModule(id); } } catch (ModuleLoaderException exc) { throw exc; | return load(f.toURL()); | public static ModuleContainer load(String moduleClassName) throws ModuleLoaderException { try { float version = 0.0f; Requirement[] requirements = new Requirement[0]; Class cls = Class.forName(moduleClassName); ModuleContainer module = new ModuleContainer(cls, version); module.setRequirements(requirements); module.setSource(moduleClassName); String id = module.getId(); if (!isLoaded(id)) { table.put(id, module); fireLoaded(module); return module; } else { return getLoadedModule(id); } } catch (ModuleLoaderException exc) { throw exc; } catch (Exception exc) { throw new ModuleLoaderException(exc); } } |
int offsetIntoRequestSamples = SimplePlotUtil.getPixel(y.length, | int offsetIntoRequestSamples = SimplePlotUtil.getPixel(y.length / 2, | public static int[] fill(MicroSecondTimeRange fullRange, int[] y, PlottableChunk chunk) { MicroSecondDate rowBeginTime = chunk.getBeginTime(); int offsetIntoRequestSamples = SimplePlotUtil.getPixel(y.length, fullRange, rowBeginTime); int[] dataY = chunk.getData().y_coor; int numSamples = dataY.length; int firstSampleForRequest = 0; if(offsetIntoRequestSamples < 0) { firstSampleForRequest = -1 * offsetIntoRequestSamples; } int lastSampleForRequest = numSamples; if(offsetIntoRequestSamples + numSamples > y.length) { lastSampleForRequest = y.length - offsetIntoRequestSamples; } for(int i = firstSampleForRequest; i < lastSampleForRequest; i++) { y[i + offsetIntoRequestSamples] = dataY[i]; } return y; } |
rowBeginTime); | rowBeginTime) * 2; | public static int[] fill(MicroSecondTimeRange fullRange, int[] y, PlottableChunk chunk) { MicroSecondDate rowBeginTime = chunk.getBeginTime(); int offsetIntoRequestSamples = SimplePlotUtil.getPixel(y.length, fullRange, rowBeginTime); int[] dataY = chunk.getData().y_coor; int numSamples = dataY.length; int firstSampleForRequest = 0; if(offsetIntoRequestSamples < 0) { firstSampleForRequest = -1 * offsetIntoRequestSamples; } int lastSampleForRequest = numSamples; if(offsetIntoRequestSamples + numSamples > y.length) { lastSampleForRequest = y.length - offsetIntoRequestSamples; } for(int i = firstSampleForRequest; i < lastSampleForRequest; i++) { y[i + offsetIntoRequestSamples] = dataY[i]; } return y; } |
logger.debug("rowBeginTime: " + rowBeginTime); | 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; ResultSet rs; synchronized(get) { get.setTimestamp(index++, requestRange.getEndTime().getTimestamp()); get.setTimestamp(index++, requestRange.getBeginTime() .getTimestamp()); get.setInt(index++, chanDbId); get.setInt(index++, pixelsPerDay); 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); logger.debug("rowBeginTime: " + rowBeginTime); int offsetIntoRequestPixels = SimplePlotUtil.getPixel(requestPixels, requestRange, rowBeginTime); logger.debug("offetIntoRequestPixels: " + offsetIntoRequestPixels); int numPixels = rs.getInt("pixel_count"); logger.debug("numPixels: " + numPixels); int firstPixelForRequest = 0; if(offsetIntoRequestPixels < 0) { // This db row has data starting before the request, start at // pertinent point firstPixelForRequest = -1 * offsetIntoRequestPixels; } logger.debug("firstPixelForRequest: " + firstPixelForRequest); 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; } logger.debug("lastPixleForRequest: " + lastPixelForRequest); int pixelsUsed = lastPixelForRequest - firstPixelForRequest; logger.debug("pixelsUsed: " + pixelsUsed); 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; x[i] = firstPixelForRequest + offsetIntoRequestPixels + i / 2; y[i] = dis.readInt(); } if(x.length > 0) { logger.debug("x[0]: " + x[0]); } else { logger.debug("ZERO LENGTH ARRAY!!!"); } 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("offetIntoRequestPixels: " + offsetIntoRequestPixels); | 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; ResultSet rs; synchronized(get) { get.setTimestamp(index++, requestRange.getEndTime().getTimestamp()); get.setTimestamp(index++, requestRange.getBeginTime() .getTimestamp()); get.setInt(index++, chanDbId); get.setInt(index++, pixelsPerDay); 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); logger.debug("rowBeginTime: " + rowBeginTime); int offsetIntoRequestPixels = SimplePlotUtil.getPixel(requestPixels, requestRange, rowBeginTime); logger.debug("offetIntoRequestPixels: " + offsetIntoRequestPixels); int numPixels = rs.getInt("pixel_count"); logger.debug("numPixels: " + numPixels); int firstPixelForRequest = 0; if(offsetIntoRequestPixels < 0) { // This db row has data starting before the request, start at // pertinent point firstPixelForRequest = -1 * offsetIntoRequestPixels; } logger.debug("firstPixelForRequest: " + firstPixelForRequest); 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; } logger.debug("lastPixleForRequest: " + lastPixelForRequest); int pixelsUsed = lastPixelForRequest - firstPixelForRequest; logger.debug("pixelsUsed: " + pixelsUsed); 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; x[i] = firstPixelForRequest + offsetIntoRequestPixels + i / 2; y[i] = dis.readInt(); } if(x.length > 0) { logger.debug("x[0]: " + x[0]); } else { logger.debug("ZERO LENGTH ARRAY!!!"); } 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("numPixels: " + numPixels); | 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; ResultSet rs; synchronized(get) { get.setTimestamp(index++, requestRange.getEndTime().getTimestamp()); get.setTimestamp(index++, requestRange.getBeginTime() .getTimestamp()); get.setInt(index++, chanDbId); get.setInt(index++, pixelsPerDay); 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); logger.debug("rowBeginTime: " + rowBeginTime); int offsetIntoRequestPixels = SimplePlotUtil.getPixel(requestPixels, requestRange, rowBeginTime); logger.debug("offetIntoRequestPixels: " + offsetIntoRequestPixels); int numPixels = rs.getInt("pixel_count"); logger.debug("numPixels: " + numPixels); int firstPixelForRequest = 0; if(offsetIntoRequestPixels < 0) { // This db row has data starting before the request, start at // pertinent point firstPixelForRequest = -1 * offsetIntoRequestPixels; } logger.debug("firstPixelForRequest: " + firstPixelForRequest); 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; } logger.debug("lastPixleForRequest: " + lastPixelForRequest); int pixelsUsed = lastPixelForRequest - firstPixelForRequest; logger.debug("pixelsUsed: " + pixelsUsed); 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; x[i] = firstPixelForRequest + offsetIntoRequestPixels + i / 2; y[i] = dis.readInt(); } if(x.length > 0) { logger.debug("x[0]: " + x[0]); } else { logger.debug("ZERO LENGTH ARRAY!!!"); } 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("firstPixelForRequest: " + firstPixelForRequest); | 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; ResultSet rs; synchronized(get) { get.setTimestamp(index++, requestRange.getEndTime().getTimestamp()); get.setTimestamp(index++, requestRange.getBeginTime() .getTimestamp()); get.setInt(index++, chanDbId); get.setInt(index++, pixelsPerDay); 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); logger.debug("rowBeginTime: " + rowBeginTime); int offsetIntoRequestPixels = SimplePlotUtil.getPixel(requestPixels, requestRange, rowBeginTime); logger.debug("offetIntoRequestPixels: " + offsetIntoRequestPixels); int numPixels = rs.getInt("pixel_count"); logger.debug("numPixels: " + numPixels); int firstPixelForRequest = 0; if(offsetIntoRequestPixels < 0) { // This db row has data starting before the request, start at // pertinent point firstPixelForRequest = -1 * offsetIntoRequestPixels; } logger.debug("firstPixelForRequest: " + firstPixelForRequest); 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; } logger.debug("lastPixleForRequest: " + lastPixelForRequest); int pixelsUsed = lastPixelForRequest - firstPixelForRequest; logger.debug("pixelsUsed: " + pixelsUsed); 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; x[i] = firstPixelForRequest + offsetIntoRequestPixels + i / 2; y[i] = dis.readInt(); } if(x.length > 0) { logger.debug("x[0]: " + x[0]); } else { logger.debug("ZERO LENGTH ARRAY!!!"); } 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("lastPixleForRequest: " + lastPixelForRequest); | 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; ResultSet rs; synchronized(get) { get.setTimestamp(index++, requestRange.getEndTime().getTimestamp()); get.setTimestamp(index++, requestRange.getBeginTime() .getTimestamp()); get.setInt(index++, chanDbId); get.setInt(index++, pixelsPerDay); 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); logger.debug("rowBeginTime: " + rowBeginTime); int offsetIntoRequestPixels = SimplePlotUtil.getPixel(requestPixels, requestRange, rowBeginTime); logger.debug("offetIntoRequestPixels: " + offsetIntoRequestPixels); int numPixels = rs.getInt("pixel_count"); logger.debug("numPixels: " + numPixels); int firstPixelForRequest = 0; if(offsetIntoRequestPixels < 0) { // This db row has data starting before the request, start at // pertinent point firstPixelForRequest = -1 * offsetIntoRequestPixels; } logger.debug("firstPixelForRequest: " + firstPixelForRequest); 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; } logger.debug("lastPixleForRequest: " + lastPixelForRequest); int pixelsUsed = lastPixelForRequest - firstPixelForRequest; logger.debug("pixelsUsed: " + pixelsUsed); 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; x[i] = firstPixelForRequest + offsetIntoRequestPixels + i / 2; y[i] = dis.readInt(); } if(x.length > 0) { logger.debug("x[0]: " + x[0]); } else { logger.debug("ZERO LENGTH ARRAY!!!"); } 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("pixelsUsed: " + pixelsUsed); | 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; ResultSet rs; synchronized(get) { get.setTimestamp(index++, requestRange.getEndTime().getTimestamp()); get.setTimestamp(index++, requestRange.getBeginTime() .getTimestamp()); get.setInt(index++, chanDbId); get.setInt(index++, pixelsPerDay); 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); logger.debug("rowBeginTime: " + rowBeginTime); int offsetIntoRequestPixels = SimplePlotUtil.getPixel(requestPixels, requestRange, rowBeginTime); logger.debug("offetIntoRequestPixels: " + offsetIntoRequestPixels); int numPixels = rs.getInt("pixel_count"); logger.debug("numPixels: " + numPixels); int firstPixelForRequest = 0; if(offsetIntoRequestPixels < 0) { // This db row has data starting before the request, start at // pertinent point firstPixelForRequest = -1 * offsetIntoRequestPixels; } logger.debug("firstPixelForRequest: " + firstPixelForRequest); 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; } logger.debug("lastPixleForRequest: " + lastPixelForRequest); int pixelsUsed = lastPixelForRequest - firstPixelForRequest; logger.debug("pixelsUsed: " + pixelsUsed); 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; x[i] = firstPixelForRequest + offsetIntoRequestPixels + i / 2; y[i] = dis.readInt(); } if(x.length > 0) { logger.debug("x[0]: " + x[0]); } else { logger.debug("ZERO LENGTH ARRAY!!!"); } 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()]); } |
|
MicroSecondTimeRange stuffInDB = RangeTool.getFullTime(chunks); logger.debug("stuffInDB timeRange: " + stuffInDB); MicroSecondDate startTime = PlottableChunk.stripToDay(stuffInDB.getBeginTime()); logger.debug("start time of chunks: " + startTime); MicroSecondDate strippedEnd = PlottableChunk.stripToDay(stuffInDB.getEndTime()); logger.debug("end time of chunks: " + strippedEnd); if(!strippedEnd.equals(stuffInDB.getEndTime())) { logger.debug("!strippedEnd.equals(stuffInDB.getEndTime())"); strippedEnd = strippedEnd.add(PlottableChunk.ONE_DAY); logger.debug("strippedEnd now: " + strippedEnd); } stuffInDB = new MicroSecondTimeRange(startTime, strippedEnd); | MicroSecondTimeRange stuffInDB = getDroppingRange(chunks); | public void put(PlottableChunk[] chunks) throws SQLException, IOException { MicroSecondTimeRange stuffInDB = RangeTool.getFullTime(chunks); logger.debug("stuffInDB timeRange: " + stuffInDB); MicroSecondDate startTime = PlottableChunk.stripToDay(stuffInDB.getBeginTime()); logger.debug("start time of chunks: " + startTime); MicroSecondDate strippedEnd = PlottableChunk.stripToDay(stuffInDB.getEndTime()); logger.debug("end time of chunks: " + strippedEnd); if(!strippedEnd.equals(stuffInDB.getEndTime())) { logger.debug("!strippedEnd.equals(stuffInDB.getEndTime())"); strippedEnd = strippedEnd.add(PlottableChunk.ONE_DAY); logger.debug("strippedEnd now: " + strippedEnd); } stuffInDB = new MicroSecondTimeRange(startTime, strippedEnd); PlottableChunk[] dbChunks = get(stuffInDB, chunks[0].getChannel(), chunks[0].getPixelsPerDay()); logger.debug("got " + dbChunks.length + " chunks from stuff that was already in the database"); 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"); for(int i = 0; i < everything.length; i++) { logger.debug(everything[i]); } everything = ReduceTool.merge(everything); logger.debug("Breaking " + everything.length + " remaining chunks after merge into seperate chunks based on day"); for(int i = 0; i < everything.length; i++) { logger.debug(everything[i]); } everything = breakIntoDays(everything); logger.debug("Adding " + everything.length + " chunks split on days"); for(int i = 0; i < everything.length; i++) { logger.debug(everything[i]); } 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]; synchronized(put) { try { 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(); } catch(SQLException ex) { logger.warn("problem with sql query: " + put); throw ex; } } } } |
for(int i = 0; i < everything.length; i++) { logger.debug(everything[i]); } | public void put(PlottableChunk[] chunks) throws SQLException, IOException { MicroSecondTimeRange stuffInDB = RangeTool.getFullTime(chunks); logger.debug("stuffInDB timeRange: " + stuffInDB); MicroSecondDate startTime = PlottableChunk.stripToDay(stuffInDB.getBeginTime()); logger.debug("start time of chunks: " + startTime); MicroSecondDate strippedEnd = PlottableChunk.stripToDay(stuffInDB.getEndTime()); logger.debug("end time of chunks: " + strippedEnd); if(!strippedEnd.equals(stuffInDB.getEndTime())) { logger.debug("!strippedEnd.equals(stuffInDB.getEndTime())"); strippedEnd = strippedEnd.add(PlottableChunk.ONE_DAY); logger.debug("strippedEnd now: " + strippedEnd); } stuffInDB = new MicroSecondTimeRange(startTime, strippedEnd); PlottableChunk[] dbChunks = get(stuffInDB, chunks[0].getChannel(), chunks[0].getPixelsPerDay()); logger.debug("got " + dbChunks.length + " chunks from stuff that was already in the database"); 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"); for(int i = 0; i < everything.length; i++) { logger.debug(everything[i]); } everything = ReduceTool.merge(everything); logger.debug("Breaking " + everything.length + " remaining chunks after merge into seperate chunks based on day"); for(int i = 0; i < everything.length; i++) { logger.debug(everything[i]); } everything = breakIntoDays(everything); logger.debug("Adding " + everything.length + " chunks split on days"); for(int i = 0; i < everything.length; i++) { logger.debug(everything[i]); } 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]; synchronized(put) { try { 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(); } catch(SQLException ex) { logger.warn("problem with sql query: " + put); throw ex; } } } } |
|
for(int i = 0; i < everything.length; i++) { logger.debug(everything[i]); } | logger.debug("Dropping data within time range of " + stuffInDB); | public void put(PlottableChunk[] chunks) throws SQLException, IOException { MicroSecondTimeRange stuffInDB = RangeTool.getFullTime(chunks); logger.debug("stuffInDB timeRange: " + stuffInDB); MicroSecondDate startTime = PlottableChunk.stripToDay(stuffInDB.getBeginTime()); logger.debug("start time of chunks: " + startTime); MicroSecondDate strippedEnd = PlottableChunk.stripToDay(stuffInDB.getEndTime()); logger.debug("end time of chunks: " + strippedEnd); if(!strippedEnd.equals(stuffInDB.getEndTime())) { logger.debug("!strippedEnd.equals(stuffInDB.getEndTime())"); strippedEnd = strippedEnd.add(PlottableChunk.ONE_DAY); logger.debug("strippedEnd now: " + strippedEnd); } stuffInDB = new MicroSecondTimeRange(startTime, strippedEnd); PlottableChunk[] dbChunks = get(stuffInDB, chunks[0].getChannel(), chunks[0].getPixelsPerDay()); logger.debug("got " + dbChunks.length + " chunks from stuff that was already in the database"); 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"); for(int i = 0; i < everything.length; i++) { logger.debug(everything[i]); } everything = ReduceTool.merge(everything); logger.debug("Breaking " + everything.length + " remaining chunks after merge into seperate chunks based on day"); for(int i = 0; i < everything.length; i++) { logger.debug(everything[i]); } everything = breakIntoDays(everything); logger.debug("Adding " + everything.length + " chunks split on days"); for(int i = 0; i < everything.length; i++) { logger.debug(everything[i]); } 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]; synchronized(put) { try { 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(); } catch(SQLException ex) { logger.warn("problem with sql query: " + put); throw ex; } } } } |
logger.debug("Adding chunk " + i + ": " + everything[i]); | logger.debug("putting chunk " + i + ": " + everything[i]); | public void put(PlottableChunk[] chunks) throws SQLException, IOException { MicroSecondTimeRange stuffInDB = RangeTool.getFullTime(chunks); logger.debug("stuffInDB timeRange: " + stuffInDB); MicroSecondDate startTime = PlottableChunk.stripToDay(stuffInDB.getBeginTime()); logger.debug("start time of chunks: " + startTime); MicroSecondDate strippedEnd = PlottableChunk.stripToDay(stuffInDB.getEndTime()); logger.debug("end time of chunks: " + strippedEnd); if(!strippedEnd.equals(stuffInDB.getEndTime())) { logger.debug("!strippedEnd.equals(stuffInDB.getEndTime())"); strippedEnd = strippedEnd.add(PlottableChunk.ONE_DAY); logger.debug("strippedEnd now: " + strippedEnd); } stuffInDB = new MicroSecondTimeRange(startTime, strippedEnd); PlottableChunk[] dbChunks = get(stuffInDB, chunks[0].getChannel(), chunks[0].getPixelsPerDay()); logger.debug("got " + dbChunks.length + " chunks from stuff that was already in the database"); 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"); for(int i = 0; i < everything.length; i++) { logger.debug(everything[i]); } everything = ReduceTool.merge(everything); logger.debug("Breaking " + everything.length + " remaining chunks after merge into seperate chunks based on day"); for(int i = 0; i < everything.length; i++) { logger.debug(everything[i]); } everything = breakIntoDays(everything); logger.debug("Adding " + everything.length + " chunks split on days"); for(int i = 0; i < everything.length; i++) { logger.debug(everything[i]); } 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]; synchronized(put) { try { 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(); } catch(SQLException ex) { logger.warn("problem with sql query: " + put); throw ex; } } } } |
logger.debug("problematic chunk: " + chunk); | public void put(PlottableChunk[] chunks) throws SQLException, IOException { MicroSecondTimeRange stuffInDB = RangeTool.getFullTime(chunks); logger.debug("stuffInDB timeRange: " + stuffInDB); MicroSecondDate startTime = PlottableChunk.stripToDay(stuffInDB.getBeginTime()); logger.debug("start time of chunks: " + startTime); MicroSecondDate strippedEnd = PlottableChunk.stripToDay(stuffInDB.getEndTime()); logger.debug("end time of chunks: " + strippedEnd); if(!strippedEnd.equals(stuffInDB.getEndTime())) { logger.debug("!strippedEnd.equals(stuffInDB.getEndTime())"); strippedEnd = strippedEnd.add(PlottableChunk.ONE_DAY); logger.debug("strippedEnd now: " + strippedEnd); } stuffInDB = new MicroSecondTimeRange(startTime, strippedEnd); PlottableChunk[] dbChunks = get(stuffInDB, chunks[0].getChannel(), chunks[0].getPixelsPerDay()); logger.debug("got " + dbChunks.length + " chunks from stuff that was already in the database"); 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"); for(int i = 0; i < everything.length; i++) { logger.debug(everything[i]); } everything = ReduceTool.merge(everything); logger.debug("Breaking " + everything.length + " remaining chunks after merge into seperate chunks based on day"); for(int i = 0; i < everything.length; i++) { logger.debug(everything[i]); } everything = breakIntoDays(everything); logger.debug("Adding " + everything.length + " chunks split on days"); for(int i = 0; i < everything.length; i++) { logger.debug(everything[i]); } 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]; synchronized(put) { try { 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(); } catch(SQLException ex) { logger.warn("problem with sql query: " + put); throw ex; } } } } |
|
ev.setRecurrence(getRecurrence()); | ev.setRecurrence((BwRecurrence)getRecurrence().clone()); | public void copyTo(BwEvent ev) { super.copyTo(ev); ev.setName(getName()); ev.setSummary(getSummary()); ev.setDescription(getDescription()); ev.setDtstart(getDtstart()); ev.setDtend(getDtend()); ev.setEndType(getEndType()); ev.setDuration(getDuration()); ev.setLink(getLink()); ev.setDeleted(getDeleted()); ev.setStatus(getStatus()); ev.setCost(getCost()); BwOrganizer org = getOrganizer(); if (org != null) { org = (BwOrganizer)org.clone(); } ev.setOrganizer(org); ev.setDtstamp(getDtstamp()); ev.setLastmod(getLastmod()); ev.setCreated(getCreated()); ev.setPriority(getPriority()); ev.setSequence(getSequence()); BwSponsor sp = getSponsor(); if (sp != null) { sp = (BwSponsor)sp.clone(); } ev.setSponsor(sp); BwLocation loc = getLocation(); if (loc != null) { loc = (BwLocation)loc.clone(); } ev.setLocation(loc); ev.setGuid(getGuid()); ev.setTransparency(getTransparency()); /* categories */ Iterator it = iterateCategories(); TreeSet cs = new TreeSet(); while (it.hasNext()) { BwCategory c = (BwCategory)it.next(); cs.add((BwCategory)c.clone()); } ev.setCategories(cs); ev.setAttendees(cloneAttendees()); ev.setRecurring(getRecurring()); /* This ought to be cloned but it brings with it a whole set of instances. Leave for the moment */ ev.setRecurrence(getRecurrence()); } |
val.setCalendar((BwCalendar)getCalendar()); | val.setCalendar((BwCalendar)getCalendar().clone()); | public void copyTo(BwShareableContainedDbentity val) { super.copyTo(val); val.setCalendar((BwCalendar)getCalendar()); } |
BwOrganizer nobj = new BwOrganizer(getId(), getCn(), | BwOrganizer nobj = new BwOrganizer((BwUser)getOwner().clone(), getPublick(), getCn(), | public Object clone() { BwOrganizer nobj = new BwOrganizer(getId(), getCn(), getDir(), getLanguage(), getSentBy(), getOrganizerUri()); nobj.setId(getId()); return nobj; } |
} else if (path.endsWith(".rdo")) { | } else if (path.endsWith(".do")) { | protected String calculateURL() throws JspException { String urlStr = super.calculateURL(); if (!PortletServlet.isPortletRequest(pageContext.getRequest())) { return urlStr; } try { URL url = new URL(urlStr); String path = url.getPath(); if (path.endsWith(".rdo")) { setRenderURL("true"); } else if (path.endsWith(".rdo")) { setActionURL("true"); } /* We want a context relative url */ urlStr = url.getFile(); //System.out.println("LLLLLLLLLLLLLLLLLLUrlStr = " + urlStr); /* Drop the context */ int pos = urlStr.indexOf('/'); if (pos > 0) { urlStr = urlStr.substring(pos); } urlStr = TagsSupport.getURL(pageContext, urlStr, urlType); /* remove embedded anchor because calendar xsl stylesheet * adds extra parameters later during transformation */ pos = urlStr.indexOf('#'); if (pos > -1) { urlStr = urlStr.substring(0, pos); } /* Remove bedework dummy request parameter - * it's an encoded form of ?b=de */ urlStr = urlStr.replaceAll(bedeworkDummyPar, ""); //Generate valid xml markup for transformationthrow new urlStr = urlStr.replaceAll("&", "&"); //System.out.println("LLLLLLLLLLLLLLLLLLLLLLLUrlStr = " + urlStr); } catch (MalformedURLException mue) { throw new JspException(mue); } return urlStr; } |
public static LocalSeismogramImpl toFissures(DataRecord seed) throws SeedFormatException { DataHeader header = seed.getHeader(); edu.iris.Fissures.Time time = new edu.iris.Fissures.Time(header.getISOStartTime(), -1); ChannelId channelId = new ChannelId(new NetworkId(header.getNetworkCode().trim(), time), header.getStationIdentifier().trim(), header.getLocationIdentifier().trim(), header.getChannelIdentifier().trim(), time); String seisId = channelId.network_id.network_code+":" +channelId.station_code+":" +channelId.site_code+":" +channelId.channel_code+":" +header.getISOStartTime(); Property[] props = new Property[1]; props[0] = new Property("Name", seisId); Blockette[] blocketts = seed.getBlockettes(100); int numPerSampling; TimeInterval timeInterval; if (blocketts.length != 0) { Blockette100 b100 = (Blockette100)blocketts[0]; float f = b100.getActualSampleRate(); numPerSampling = 1; timeInterval = new TimeInterval(1/f, UnitImpl.SECOND); } else { if (header.getSampleRateFactor() > 0) { numPerSampling = header.getSampleRateFactor(); timeInterval = new TimeInterval(1, UnitImpl.SECOND); if (header.getSampleRateMultiplier() > 0) { numPerSampling *= header.getSampleRateMultiplier(); } else { timeInterval = (TimeInterval)timeInterval.multiplyBy(-1 * header.getSampleRateMultiplier()); } } else { numPerSampling = 1; timeInterval = new TimeInterval(-1 * header.getSampleRateFactor(), UnitImpl.SECOND); if (header.getSampleRateMultiplier() > 0) { numPerSampling *= header.getSampleRateMultiplier(); } else { timeInterval = (TimeInterval)timeInterval.multiplyBy(-1 * header.getSampleRateMultiplier()); } } | public static LocalSeismogramImpl toFissures(DataRecord[] seed) throws SeedFormatException, FissuresException { LocalSeismogramImpl seis = toFissures(seed[0]); for (int i = 1; i < seed.length; i++) { append(seis, seed[i]); | public static LocalSeismogramImpl toFissures(DataRecord seed) throws SeedFormatException { DataHeader header = seed.getHeader(); edu.iris.Fissures.Time time = new edu.iris.Fissures.Time(header.getISOStartTime(), -1); // the network id isn't correct, but network start is not stored // in miniseed ChannelId channelId = new ChannelId(new NetworkId(header.getNetworkCode().trim(), time), header.getStationIdentifier().trim(), header.getLocationIdentifier().trim(), header.getChannelIdentifier().trim(), time); String seisId = channelId.network_id.network_code+":" +channelId.station_code+":" +channelId.site_code+":" +channelId.channel_code+":" +header.getISOStartTime(); Property[] props = new Property[1]; props[0] = new Property("Name", seisId); Blockette[] blocketts = seed.getBlockettes(100); int numPerSampling; TimeInterval timeInterval; if (blocketts.length != 0) { Blockette100 b100 = (Blockette100)blocketts[0]; float f = b100.getActualSampleRate(); numPerSampling = 1; timeInterval = new TimeInterval(1/f, UnitImpl.SECOND); } else { if (header.getSampleRateFactor() > 0) { numPerSampling = header.getSampleRateFactor(); timeInterval = new TimeInterval(1, UnitImpl.SECOND); if (header.getSampleRateMultiplier() > 0) { numPerSampling *= header.getSampleRateMultiplier(); } else { timeInterval = (TimeInterval)timeInterval.multiplyBy(-1 * header.getSampleRateMultiplier()); } } else { numPerSampling = 1; timeInterval = new TimeInterval(-1 * header.getSampleRateFactor(), UnitImpl.SECOND); if (header.getSampleRateMultiplier() > 0) { numPerSampling *= header.getSampleRateMultiplier(); } else { timeInterval = (TimeInterval)timeInterval.multiplyBy(-1 * header.getSampleRateMultiplier()); } } } SamplingImpl sampling = new SamplingImpl(numPerSampling, timeInterval); TimeSeriesDataSel bits = convertData(seed); return new LocalSeismogramImpl(seisId, props, time, header.getNumSamples(), sampling, UnitImpl.COUNT, channelId, new edu.iris.Fissures.IfParameterMgr.ParameterRef[0], new QuantityImpl[0], new SamplingImpl[0], bits); } |
SamplingImpl sampling = new SamplingImpl(numPerSampling, timeInterval); TimeSeriesDataSel bits = convertData(seed); return new LocalSeismogramImpl(seisId, props, time, header.getNumSamples(), sampling, UnitImpl.COUNT, channelId, new edu.iris.Fissures.IfParameterMgr.ParameterRef[0], new QuantityImpl[0], new SamplingImpl[0], bits); | return seis; | public static LocalSeismogramImpl toFissures(DataRecord seed) throws SeedFormatException { DataHeader header = seed.getHeader(); edu.iris.Fissures.Time time = new edu.iris.Fissures.Time(header.getISOStartTime(), -1); // the network id isn't correct, but network start is not stored // in miniseed ChannelId channelId = new ChannelId(new NetworkId(header.getNetworkCode().trim(), time), header.getStationIdentifier().trim(), header.getLocationIdentifier().trim(), header.getChannelIdentifier().trim(), time); String seisId = channelId.network_id.network_code+":" +channelId.station_code+":" +channelId.site_code+":" +channelId.channel_code+":" +header.getISOStartTime(); Property[] props = new Property[1]; props[0] = new Property("Name", seisId); Blockette[] blocketts = seed.getBlockettes(100); int numPerSampling; TimeInterval timeInterval; if (blocketts.length != 0) { Blockette100 b100 = (Blockette100)blocketts[0]; float f = b100.getActualSampleRate(); numPerSampling = 1; timeInterval = new TimeInterval(1/f, UnitImpl.SECOND); } else { if (header.getSampleRateFactor() > 0) { numPerSampling = header.getSampleRateFactor(); timeInterval = new TimeInterval(1, UnitImpl.SECOND); if (header.getSampleRateMultiplier() > 0) { numPerSampling *= header.getSampleRateMultiplier(); } else { timeInterval = (TimeInterval)timeInterval.multiplyBy(-1 * header.getSampleRateMultiplier()); } } else { numPerSampling = 1; timeInterval = new TimeInterval(-1 * header.getSampleRateFactor(), UnitImpl.SECOND); if (header.getSampleRateMultiplier() > 0) { numPerSampling *= header.getSampleRateMultiplier(); } else { timeInterval = (TimeInterval)timeInterval.multiplyBy(-1 * header.getSampleRateMultiplier()); } } } SamplingImpl sampling = new SamplingImpl(numPerSampling, timeInterval); TimeSeriesDataSel bits = convertData(seed); return new LocalSeismogramImpl(seisId, props, time, header.getNumSamples(), sampling, UnitImpl.COUNT, channelId, new edu.iris.Fissures.IfParameterMgr.ParameterRef[0], new QuantityImpl[0], new SamplingImpl[0], bits); } |
return (error == null); | return (error != null); | public boolean isError() { return (error == null); } |
public static SacTimeSeries getSAC(LocalSeismogramImpl seis, Channel channel, Origin origin) | public static SacTimeSeries getSAC(LocalSeismogramImpl seis) | public static SacTimeSeries getSAC(LocalSeismogramImpl seis, Channel channel, Origin origin) throws CodecException { SacTimeSeries sac = getSAC(seis); addChannel(sac, channel); addOrigin(sac, origin); return sac; } |
SacTimeSeries sac = getSAC(seis); addChannel(sac, channel); addOrigin(sac, origin); | SacTimeSeries sac = new SacTimeSeries(); float[] floatSamps; try { if (seis.can_convert_to_long()) { int[] idata = seis.get_as_longs(); floatSamps = new float[idata.length]; for (int i=0; i<idata.length; i++) { floatSamps[i] = idata[i]; } } else { floatSamps = seis.get_as_floats(); } } catch (FissuresException e) { if (e.getCause() instanceof CodecException) { throw (CodecException)e.getCause(); } else { throw new CodecException(e.the_error.error_description); } } sac.y = floatSamps; sac.npts = sac.y.length; sac.b = 0; SamplingImpl samp = (SamplingImpl)seis.sampling_info; QuantityImpl period = samp.getPeriod(); period = period.convertTo(UnitImpl.SECOND); float f = (float)period.get_value(); sac.e = sac.npts * f; sac.iftype = sac.ITIME; sac.leven = sac.TRUE; sac.delta = f; sac.idep = sac.IUNKN; UnitImpl yUnit = (UnitImpl)seis.y_unit; QuantityImpl min = (QuantityImpl)seis.getMinValue(); sac.depmin = (float)min.convertTo(yUnit).value; QuantityImpl max = (QuantityImpl)seis.getMaxValue(); sac.depmax = (float)max.convertTo(yUnit).value; QuantityImpl mean = (QuantityImpl)seis.getMeanValue(); sac.depmen = (float)mean.convertTo(yUnit).value; GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("GMT")); cal.setTime(new MicroSecondDate(seis.begin_time)); sac.nzyear = cal.get(Calendar.YEAR); sac.nzjday = cal.get(Calendar.DAY_OF_YEAR); sac.nzhour = cal.get(Calendar.HOUR_OF_DAY); sac.nzmin = cal.get(Calendar.MINUTE); sac.nzsec = cal.get(Calendar.SECOND); sac.nzmsec = cal.get(Calendar.MILLISECOND); sac.knetwk = seis.channel_id.network_id.network_code; sac.kstnm = seis.channel_id.station_code; if ( ! seis.channel_id.site_code.equals(" ")) { sac.kcmpnm = seis.channel_id.site_code+seis.channel_id.channel_code; } else { sac.kcmpnm = seis.channel_id.channel_code; } | public static SacTimeSeries getSAC(LocalSeismogramImpl seis, Channel channel, Origin origin) throws CodecException { SacTimeSeries sac = getSAC(seis); addChannel(sac, channel); addOrigin(sac, origin); return sac; } |
public void write(File file) throws FileNotFoundException, IOException { DataOutputStream dos = new DataOutputStream( new BufferedOutputStream( new FileOutputStream(file))); writeHeader(dos); writeData(dos); dos.close(); | public void write(String filename) throws FileNotFoundException, IOException { File f = new File(filename); write(f); | public void write(File file) throws FileNotFoundException, IOException { DataOutputStream dos = new DataOutputStream( new BufferedOutputStream( new FileOutputStream(file))); writeHeader(dos); writeData(dos); dos.close(); } |
this.debug = debug; | super(debug); | TimezonesImpl(boolean debug, BwUser user, RestoreIntf ri) throws CalFacadeException { this.debug = debug; this.user = user; this.ri = ri; // Force fetch of timezones //lookup("not-a-timezone"); } |
if ((tzinfo != null) && (tzinfo.vtz != null)) { return tzinfo.vtz; | if ((tzinfo != null) && (tzinfo.getVtz() != null)) { return tzinfo.getVtz(); | public VTimeZone findTimeZone(final String id, BwUser owner) throws CalFacadeException { if (debug) { trace("find timezone with id " + id + " for owner " + owner); } TimezoneInfo tzinfo = lookup(id); if ((tzinfo != null) && (tzinfo.vtz != null)) { return tzinfo.vtz; } /* Do we need to look up anything? VTimeZone vTimeZone = cal.getTimeZone(id, owner); if (vTimeZone == null) { return null; } tzinfo = new TimezoneInfo(); tzinfo.vtz = vTimeZone; tzinfo.tz = new TimeZone(vTimeZone); timezones.put(id, tzinfo); return vTimeZone; */ return null; } |
return tzinfo.tz; | return tzinfo.getTz(); | public TimeZone getTimeZone(final String id) throws CalFacadeException { TimezoneInfo tzinfo = lookup(id); /* Do we need to look up anything? if (tzinfo == null) { VTimeZone vTimeZone = cal.getTimeZone(id, null); if (vTimeZone == null) { return null; } tzinfo = new TimezoneInfo(); tzinfo.vtz = vTimeZone; tzinfo.tz = new TimeZone(vTimeZone); timezones.put(id, tzinfo); } */ return tzinfo.tz; } |
tzinfo = (TimezoneInfo)systemTimezones.get(id); | private TimezoneInfo lookup(String id) throws CalFacadeException { TimezoneInfo tzinfo; /* if (!systemTimezonesInitialised) { // First call (after reinit) synchronized (this) { if (!systemTimezonesInitialised) { Collection tzs = cal.getPublicTimeZones(); Iterator it = tzs.iterator(); while (it.hasNext()) { BwTimeZone btz = (BwTimeZone)it.next(); Calendar cal = IcalTranslator.getCalendar(btz.getVtimezone()); VTimeZone vtz = (VTimeZone)cal.getComponents().getComponent(Component.VTIMEZONE); if (vtz == null) { throw new CalFacadeException("Incorrectly stored timezone"); } tzinfo = new TimezoneInfo(); tzinfo.vtz = vtz; tzinfo.tz = new TimeZone(vtz); systemTimezones.put(btz.getTzid(), tzinfo); } systemTimezonesInitialised = true; } } } */ tzinfo = (TimezoneInfo)systemTimezones.get(id); if (tzinfo != null) { tzinfo.publick = true; } else { tzinfo = (TimezoneInfo)timezones.get(id); } return tzinfo; } |
|
if (tzinfo != null) { tzinfo.publick = true; } else { | private TimezoneInfo lookup(String id) throws CalFacadeException { TimezoneInfo tzinfo; /* if (!systemTimezonesInitialised) { // First call (after reinit) synchronized (this) { if (!systemTimezonesInitialised) { Collection tzs = cal.getPublicTimeZones(); Iterator it = tzs.iterator(); while (it.hasNext()) { BwTimeZone btz = (BwTimeZone)it.next(); Calendar cal = IcalTranslator.getCalendar(btz.getVtimezone()); VTimeZone vtz = (VTimeZone)cal.getComponents().getComponent(Component.VTIMEZONE); if (vtz == null) { throw new CalFacadeException("Incorrectly stored timezone"); } tzinfo = new TimezoneInfo(); tzinfo.vtz = vtz; tzinfo.tz = new TimeZone(vtz); systemTimezones.put(btz.getTzid(), tzinfo); } systemTimezonesInitialised = true; } } } */ tzinfo = (TimezoneInfo)systemTimezones.get(id); if (tzinfo != null) { tzinfo.publick = true; } else { tzinfo = (TimezoneInfo)timezones.get(id); } return tzinfo; } |
|
} | private TimezoneInfo lookup(String id) throws CalFacadeException { TimezoneInfo tzinfo; /* if (!systemTimezonesInitialised) { // First call (after reinit) synchronized (this) { if (!systemTimezonesInitialised) { Collection tzs = cal.getPublicTimeZones(); Iterator it = tzs.iterator(); while (it.hasNext()) { BwTimeZone btz = (BwTimeZone)it.next(); Calendar cal = IcalTranslator.getCalendar(btz.getVtimezone()); VTimeZone vtz = (VTimeZone)cal.getComponents().getComponent(Component.VTIMEZONE); if (vtz == null) { throw new CalFacadeException("Incorrectly stored timezone"); } tzinfo = new TimezoneInfo(); tzinfo.vtz = vtz; tzinfo.tz = new TimeZone(vtz); systemTimezones.put(btz.getTzid(), tzinfo); } systemTimezonesInitialised = true; } } } */ tzinfo = (TimezoneInfo)systemTimezones.get(id); if (tzinfo != null) { tzinfo.publick = true; } else { tzinfo = (TimezoneInfo)timezones.get(id); } return tzinfo; } |
|
systemTimezones = new HashMap(); | public void refreshTimezones() throws CalFacadeException { synchronized (this) { //systemTimezonesInitialised = false; systemTimezones = new HashMap(); } // force refresh now lookup("not-a-timezone"); } |
|
BwTimeZone tz = new BwTimeZone(); | BwTimeZone btz = new BwTimeZone(); | public void saveTimeZone(String tzid, VTimeZone vtz) throws CalFacadeException { /* For a user update the map to avoid a refetch. For system timezones we will force a refresh when we're done. */ BwTimeZone tz = new BwTimeZone(); tz.setTzid(tzid); tz.setPublick(publick); tz.setOwner(user); StringBuffer sb = new StringBuffer(); sb.append("BEGIN:VCALENDAR\n"); sb.append("PRODID:-//RPI//BEDEWORK//US\n"); sb.append("VERSION:2.0\n"); sb.append(vtz.toString()); sb.append("END:VCALENDAR\n"); tz.setVtimezone(sb.toString()); try { ri.restoreTimezone(tz); } catch (Throwable t) { throw new CalFacadeException(t); } TimezoneInfo tzinfo = (TimezoneInfo)timezones.get(tzid); if (tzinfo == null) { tzinfo = new TimezoneInfo(); } tzinfo.vtz = vtz; tzinfo.tz = new TimeZone(vtz); timezones.put(tzid, tzinfo); } |
tz.setTzid(tzid); tz.setPublick(publick); tz.setOwner(user); | btz.setTzid(tzid); btz.setPublick(publick); btz.setOwner(user); | public void saveTimeZone(String tzid, VTimeZone vtz) throws CalFacadeException { /* For a user update the map to avoid a refetch. For system timezones we will force a refresh when we're done. */ BwTimeZone tz = new BwTimeZone(); tz.setTzid(tzid); tz.setPublick(publick); tz.setOwner(user); StringBuffer sb = new StringBuffer(); sb.append("BEGIN:VCALENDAR\n"); sb.append("PRODID:-//RPI//BEDEWORK//US\n"); sb.append("VERSION:2.0\n"); sb.append(vtz.toString()); sb.append("END:VCALENDAR\n"); tz.setVtimezone(sb.toString()); try { ri.restoreTimezone(tz); } catch (Throwable t) { throw new CalFacadeException(t); } TimezoneInfo tzinfo = (TimezoneInfo)timezones.get(tzid); if (tzinfo == null) { tzinfo = new TimezoneInfo(); } tzinfo.vtz = vtz; tzinfo.tz = new TimeZone(vtz); timezones.put(tzid, tzinfo); } |
tz.setVtimezone(sb.toString()); | btz.setVtimezone(sb.toString()); | public void saveTimeZone(String tzid, VTimeZone vtz) throws CalFacadeException { /* For a user update the map to avoid a refetch. For system timezones we will force a refresh when we're done. */ BwTimeZone tz = new BwTimeZone(); tz.setTzid(tzid); tz.setPublick(publick); tz.setOwner(user); StringBuffer sb = new StringBuffer(); sb.append("BEGIN:VCALENDAR\n"); sb.append("PRODID:-//RPI//BEDEWORK//US\n"); sb.append("VERSION:2.0\n"); sb.append(vtz.toString()); sb.append("END:VCALENDAR\n"); tz.setVtimezone(sb.toString()); try { ri.restoreTimezone(tz); } catch (Throwable t) { throw new CalFacadeException(t); } TimezoneInfo tzinfo = (TimezoneInfo)timezones.get(tzid); if (tzinfo == null) { tzinfo = new TimezoneInfo(); } tzinfo.vtz = vtz; tzinfo.tz = new TimeZone(vtz); timezones.put(tzid, tzinfo); } |
ri.restoreTimezone(tz); | ri.restoreTimezone(btz); | public void saveTimeZone(String tzid, VTimeZone vtz) throws CalFacadeException { /* For a user update the map to avoid a refetch. For system timezones we will force a refresh when we're done. */ BwTimeZone tz = new BwTimeZone(); tz.setTzid(tzid); tz.setPublick(publick); tz.setOwner(user); StringBuffer sb = new StringBuffer(); sb.append("BEGIN:VCALENDAR\n"); sb.append("PRODID:-//RPI//BEDEWORK//US\n"); sb.append("VERSION:2.0\n"); sb.append(vtz.toString()); sb.append("END:VCALENDAR\n"); tz.setVtimezone(sb.toString()); try { ri.restoreTimezone(tz); } catch (Throwable t) { throw new CalFacadeException(t); } TimezoneInfo tzinfo = (TimezoneInfo)timezones.get(tzid); if (tzinfo == null) { tzinfo = new TimezoneInfo(); } tzinfo.vtz = vtz; tzinfo.tz = new TimeZone(vtz); timezones.put(tzid, tzinfo); } |
tzinfo = new TimezoneInfo(); | tzinfo = new TimezoneInfo(tz, vtz); timezones.put(tzid, tzinfo); } else { tzinfo.init(tz, vtz); | public void saveTimeZone(String tzid, VTimeZone vtz) throws CalFacadeException { /* For a user update the map to avoid a refetch. For system timezones we will force a refresh when we're done. */ BwTimeZone tz = new BwTimeZone(); tz.setTzid(tzid); tz.setPublick(publick); tz.setOwner(user); StringBuffer sb = new StringBuffer(); sb.append("BEGIN:VCALENDAR\n"); sb.append("PRODID:-//RPI//BEDEWORK//US\n"); sb.append("VERSION:2.0\n"); sb.append(vtz.toString()); sb.append("END:VCALENDAR\n"); tz.setVtimezone(sb.toString()); try { ri.restoreTimezone(tz); } catch (Throwable t) { throw new CalFacadeException(t); } TimezoneInfo tzinfo = (TimezoneInfo)timezones.get(tzid); if (tzinfo == null) { tzinfo = new TimezoneInfo(); } tzinfo.vtz = vtz; tzinfo.tz = new TimeZone(vtz); timezones.put(tzid, tzinfo); } |
tzinfo.vtz = vtz; tzinfo.tz = new TimeZone(vtz); timezones.put(tzid, tzinfo); | public void saveTimeZone(String tzid, VTimeZone vtz) throws CalFacadeException { /* For a user update the map to avoid a refetch. For system timezones we will force a refresh when we're done. */ BwTimeZone tz = new BwTimeZone(); tz.setTzid(tzid); tz.setPublick(publick); tz.setOwner(user); StringBuffer sb = new StringBuffer(); sb.append("BEGIN:VCALENDAR\n"); sb.append("PRODID:-//RPI//BEDEWORK//US\n"); sb.append("VERSION:2.0\n"); sb.append(vtz.toString()); sb.append("END:VCALENDAR\n"); tz.setVtimezone(sb.toString()); try { ri.restoreTimezone(tz); } catch (Throwable t) { throw new CalFacadeException(t); } TimezoneInfo tzinfo = (TimezoneInfo)timezones.get(tzid); if (tzinfo == null) { tzinfo = new TimezoneInfo(); } tzinfo.vtz = vtz; tzinfo.tz = new TimeZone(vtz); timezones.put(tzid, tzinfo); } |
|
public void write(IdeaDocument ideaDocument) throws Exception; | void write(IdeaDocument ideaDocument) throws Exception; | public void write(IdeaDocument ideaDocument) throws Exception; |
parameterCache.put(name, value); | public void addParameter(String name, Object value, AuditInfo[] audit) { parameterNameCache = null; // parameterCache.put(name, value); //if (value instanceof Element) { Element parameter = config.getOwnerDocument().createElement("parameter"); XMLParameter.insert(parameter, name, value); // Object cacheEvent = XMLParameter.getParameter(parameter);// if(cacheEvent instanceof edu.sc.seis.fissuresUtil.cache.CacheEvent) {// logger.debug("Instance of CaCHE EVENT -----------"); // } else {// logger.debug(" NOt an Instance of CACHE EVENT ------");// } config.appendChild(parameter); //} else { // logger.warn("Parameter is only stored in memory."); //} // end of else } |
|
seismogramCache.put(name, new SoftReference(seis)); | seismogramCache.put(name, seis); | public void addSeismogram(LocalSeismogramImpl seis, AuditInfo[] audit) { seismogramNameCache = null; // Note this does not set the xlink, as the seis has not been saved anywhere yet. Document doc = config.getOwnerDocument(); Element localSeismogram = doc.createElement("localSeismogram");//doc.createElement("SacSeismogram"); String name =seis.getProperty(seisNameKey); if (name == null || name.length() == 0) { name = seis.channel_id.network_id.network_code+"."+ seis.channel_id.station_code+"."+ seis.channel_id.channel_code; //edu.iris.Fissures.network.ChannelIdUtil.toStringNoDates(seis.channel_id); } name = getUniqueName(getSeismogramNames(), name); seis.setName(name); Element seismogramAttr = doc.createElement("seismogramAttr"); XMLSeismogramAttr.insert(seismogramAttr, (LocalSeismogram)seis); //localSeismogram.appendChild(seismogramAttr);// Element propertyElement = doc.createElement("property");// propertyElement.appendChild(XMLUtil.createTextElement(doc, "name",// "Name"));// propertyElement.appendChild(XMLUtil.createTextElement(doc, "value",// name)); ///seismogramAttr.appendChild(propertyElement); localSeismogram.appendChild(seismogramAttr); /*Property[] props = seis.getProperties(); //logger.debug("the length of the Properties of the seismogram are "+props.length); Element propE, propNameE, propValueE; for (int i=0; i<props.length; i++) { if (props[i] != null && props[i].name != seisNameKey) { propE = doc.createElement("property"); propNameE = doc.createElement("name"); propNameE.setNodeValue(props[i].name); propValueE = doc.createElement("value"); propValueE.setNodeValue(props[i].value); propE.appendChild(propNameE); propE.appendChild(propValueE); localSeismogram.appendChild(propE); } }*/ config.appendChild(localSeismogram); seismogramCache.put(name, new SoftReference(seis)); //logger.debug("added seis now "+getSeismogramNames().length+" seisnogram names."); seismogramNameCache = null; //xpath = new XPathAPI(); //xpath = new CachedXPathAPI(xpath); //logger.debug("2 added seis now "+getSeismogramNames().length+" seisnogram names."); } |
SoftReference softReference = (SoftReference)parameterCache.get(name); if(softReference.get() != null) return softReference.get(); else parameterCache.remove(name); | Object obj = parameterCache.get(name); if(obj instanceof SoftReference) { SoftReference softReference = (SoftReference)obj; if(softReference.get() != null) return softReference.get(); else parameterCache.remove(name); } else return obj; | public Object getParameter(String name) { System.out.println("IN THE METHOD GET PARAMETER ****************************************************"); if (parameterCache.containsKey(name)) { SoftReference softReference = (SoftReference)parameterCache.get(name); if(softReference.get() != null) return softReference.get(); else parameterCache.remove(name); } // end of if (parameterCache.containsKey(name)) NodeList nList = evalNodeList(config, "parameter[name/text()="+ dquote+name+dquote+"]"); if (nList != null && nList.getLength() != 0) { //logger.debug("getting the parameter "+name); Node n = nList.item(0); if (n instanceof Element) { Object r = XMLParameter.getParameter((Element)n); parameterCache.put(name, new SoftReference(r)); return r; } } else { logger.debug("THE NODE LIST IS NULL for parameter "+name); } System.out.println("GO AND GET THE PARAMETER REF"); // not a parameter, try parameterRef nList = evalNodeList(config, "parameterRef");//[text()="+dquote+name+dquote+"]"); if (nList != null && nList.getLength() != 0) { for(int counter = 0 ; counter < nList.getLength() ; counter++) { Node n = nList.item(counter); if (n instanceof Element) { if(!((Element)n).getAttribute("name").equals(name)) continue; SimpleXLink sl = new SimpleXLink(docBuilder, (Element)n, getBase()); try { Element e = sl.retrieve(); //parameterCache.put(name, e); Object obj = XMLParameter.getParameter(e); parameterCache.put(name, new SoftReference(obj)); return obj; } catch (Exception e) { logger.error("can't get paramterRef for "+name, e); } // end of try-catch } } } logger.warn("can't find paramter for "+name); //can't find that name??? return null; } |
if(!pushed){ synchronized(initiators){ | synchronized(initiators){ if(!finished){ | public boolean getData(SeisDataChangeListener listener, RequestFilter[] requestFilters){ for (int i = 0; i < requestFilters.length; i++){ boolean found = false; for (int j = 0; j < this.requestFilters.length && !found; j++){ if(requestFilters[i] == this.requestFilters[j]){ found = true; } } if(!found){ return false; } } if(!pushed){ synchronized(initiators){ initiators.add(listener); } return true; } LocalSeismogramImpl[] seis = (LocalSeismogramImpl[])seisRef.get(); if(seis != null){ a_client.pushData(seis, listener); a_client.finished(listener); return true; }else{ return false; } } |
return true; | public boolean getData(SeisDataChangeListener listener, RequestFilter[] requestFilters){ for (int i = 0; i < requestFilters.length; i++){ boolean found = false; for (int j = 0; j < this.requestFilters.length && !found; j++){ if(requestFilters[i] == this.requestFilters[j]){ found = true; } } if(!found){ return false; } } if(!pushed){ synchronized(initiators){ initiators.add(listener); } return true; } LocalSeismogramImpl[] seis = (LocalSeismogramImpl[])seisRef.get(); if(seis != null){ a_client.pushData(seis, listener); a_client.finished(listener); return true; }else{ return false; } } |
|
LocalSeismogramImpl[] seis = (LocalSeismogramImpl[])seisRef.get(); if(seis != null){ a_client.pushData(seis, listener); a_client.finished(listener); | if(!failed){ LocalSeismogramImpl[] seis = (LocalSeismogramImpl[])seisRef.get(); if(seis != null){ a_client.pushData(seis, listener); } | public boolean getData(SeisDataChangeListener listener, RequestFilter[] requestFilters){ for (int i = 0; i < requestFilters.length; i++){ boolean found = false; for (int j = 0; j < this.requestFilters.length && !found; j++){ if(requestFilters[i] == this.requestFilters[j]){ found = true; } } if(!found){ return false; } } if(!pushed){ synchronized(initiators){ initiators.add(listener); } return true; } LocalSeismogramImpl[] seis = (LocalSeismogramImpl[])seisRef.get(); if(seis != null){ a_client.pushData(seis, listener); a_client.finished(listener); return true; }else{ return false; } } |
pushed = true; | public void run() { List seismograms = new ArrayList(); for(int counter = 0; counter < requestFilters.length; counter++) { try { RequestFilter[] temp = { requestFilters[counter] }; LocalSeismogram[] seis = dbDataCenter.retrieve_seismograms(temp); LocalSeismogramImpl[] seisImpl = castToLocalSeismogramImplArray(seis); synchronized(initiators){ pushed = true; Iterator it = initiators.iterator(); while(it.hasNext()){ a_client.pushData(seisImpl, ((SeisDataChangeListener)it.next())); } } for (int i = 0; i < seisImpl.length; i++){ seismograms.add(seisImpl[i]); } } catch(FissuresException fe) { synchronized(initiators){ pushed = true; Iterator it = initiators.iterator(); while(it.hasNext()){ a_client.error(((SeisDataChangeListener)it.next()), fe); } continue; } } catch(org.omg.CORBA.SystemException fe) { synchronized(initiators){ pushed = true; Iterator it = initiators.iterator(); while(it.hasNext()){ a_client.error(((SeisDataChangeListener)it.next()), fe); } continue; } } } LocalSeismogramImpl[] seisArray = new LocalSeismogramImpl[seismograms.size()]; seisRef = new SoftReference(seismograms.toArray(seisArray)); synchronized(initiators){ Iterator it = initiators.iterator(); while(it.hasNext()){ a_client.finished(((SeisDataChangeListener)it.next())); } } } |
|
pushed = true; | failed = true; System.out.println("FISSURES FAILED"); | public void run() { List seismograms = new ArrayList(); for(int counter = 0; counter < requestFilters.length; counter++) { try { RequestFilter[] temp = { requestFilters[counter] }; LocalSeismogram[] seis = dbDataCenter.retrieve_seismograms(temp); LocalSeismogramImpl[] seisImpl = castToLocalSeismogramImplArray(seis); synchronized(initiators){ pushed = true; Iterator it = initiators.iterator(); while(it.hasNext()){ a_client.pushData(seisImpl, ((SeisDataChangeListener)it.next())); } } for (int i = 0; i < seisImpl.length; i++){ seismograms.add(seisImpl[i]); } } catch(FissuresException fe) { synchronized(initiators){ pushed = true; Iterator it = initiators.iterator(); while(it.hasNext()){ a_client.error(((SeisDataChangeListener)it.next()), fe); } continue; } } catch(org.omg.CORBA.SystemException fe) { synchronized(initiators){ pushed = true; Iterator it = initiators.iterator(); while(it.hasNext()){ a_client.error(((SeisDataChangeListener)it.next()), fe); } continue; } } } LocalSeismogramImpl[] seisArray = new LocalSeismogramImpl[seismograms.size()]; seisRef = new SoftReference(seismograms.toArray(seisArray)); synchronized(initiators){ Iterator it = initiators.iterator(); while(it.hasNext()){ a_client.finished(((SeisDataChangeListener)it.next())); } } } |
pushed = true; | failed = true; System.out.println("CORBA FAILED"); | public void run() { List seismograms = new ArrayList(); for(int counter = 0; counter < requestFilters.length; counter++) { try { RequestFilter[] temp = { requestFilters[counter] }; LocalSeismogram[] seis = dbDataCenter.retrieve_seismograms(temp); LocalSeismogramImpl[] seisImpl = castToLocalSeismogramImplArray(seis); synchronized(initiators){ pushed = true; Iterator it = initiators.iterator(); while(it.hasNext()){ a_client.pushData(seisImpl, ((SeisDataChangeListener)it.next())); } } for (int i = 0; i < seisImpl.length; i++){ seismograms.add(seisImpl[i]); } } catch(FissuresException fe) { synchronized(initiators){ pushed = true; Iterator it = initiators.iterator(); while(it.hasNext()){ a_client.error(((SeisDataChangeListener)it.next()), fe); } continue; } } catch(org.omg.CORBA.SystemException fe) { synchronized(initiators){ pushed = true; Iterator it = initiators.iterator(); while(it.hasNext()){ a_client.error(((SeisDataChangeListener)it.next()), fe); } continue; } } } LocalSeismogramImpl[] seisArray = new LocalSeismogramImpl[seismograms.size()]; seisRef = new SoftReference(seismograms.toArray(seisArray)); synchronized(initiators){ Iterator it = initiators.iterator(); while(it.hasNext()){ a_client.finished(((SeisDataChangeListener)it.next())); } } } |
LocalSeismogramImpl[] seisArray = new LocalSeismogramImpl[seismograms.size()]; seisRef = new SoftReference(seismograms.toArray(seisArray)); | public void run() { List seismograms = new ArrayList(); for(int counter = 0; counter < requestFilters.length; counter++) { try { RequestFilter[] temp = { requestFilters[counter] }; LocalSeismogram[] seis = dbDataCenter.retrieve_seismograms(temp); LocalSeismogramImpl[] seisImpl = castToLocalSeismogramImplArray(seis); synchronized(initiators){ pushed = true; Iterator it = initiators.iterator(); while(it.hasNext()){ a_client.pushData(seisImpl, ((SeisDataChangeListener)it.next())); } } for (int i = 0; i < seisImpl.length; i++){ seismograms.add(seisImpl[i]); } } catch(FissuresException fe) { synchronized(initiators){ pushed = true; Iterator it = initiators.iterator(); while(it.hasNext()){ a_client.error(((SeisDataChangeListener)it.next()), fe); } continue; } } catch(org.omg.CORBA.SystemException fe) { synchronized(initiators){ pushed = true; Iterator it = initiators.iterator(); while(it.hasNext()){ a_client.error(((SeisDataChangeListener)it.next()), fe); } continue; } } } LocalSeismogramImpl[] seisArray = new LocalSeismogramImpl[seismograms.size()]; seisRef = new SoftReference(seismograms.toArray(seisArray)); synchronized(initiators){ Iterator it = initiators.iterator(); while(it.hasNext()){ a_client.finished(((SeisDataChangeListener)it.next())); } } } |
|
job.decrementRetrievers(); | public void run() { List seismograms = new ArrayList(); for(int counter = 0; counter < requestFilters.length; counter++) { try { RequestFilter[] temp = { requestFilters[counter] }; LocalSeismogram[] seis = dbDataCenter.retrieve_seismograms(temp); LocalSeismogramImpl[] seisImpl = castToLocalSeismogramImplArray(seis); synchronized(initiators){ pushed = true; Iterator it = initiators.iterator(); while(it.hasNext()){ a_client.pushData(seisImpl, ((SeisDataChangeListener)it.next())); } } for (int i = 0; i < seisImpl.length; i++){ seismograms.add(seisImpl[i]); } } catch(FissuresException fe) { synchronized(initiators){ pushed = true; Iterator it = initiators.iterator(); while(it.hasNext()){ a_client.error(((SeisDataChangeListener)it.next()), fe); } continue; } } catch(org.omg.CORBA.SystemException fe) { synchronized(initiators){ pushed = true; Iterator it = initiators.iterator(); while(it.hasNext()){ a_client.error(((SeisDataChangeListener)it.next()), fe); } continue; } } } LocalSeismogramImpl[] seisArray = new LocalSeismogramImpl[seismograms.size()]; seisRef = new SoftReference(seismograms.toArray(seisArray)); synchronized(initiators){ Iterator it = initiators.iterator(); while(it.hasNext()){ a_client.finished(((SeisDataChangeListener)it.next())); } } } |
|
Thread th = new Thread(connChecker); | Thread th = new Thread(checkerThreadGroup, connChecker, "ConnChecker"+getThreadNum()); | public void runChecks() throws IOException { int sizeofCollection = ConnCheckerCollection.size(); Iterator collectionExe = ConnCheckerCollection.iterator(); while(collectionExe.hasNext()){ ConnChecker connChecker = (ConnChecker)collectionExe.next(); Thread th = new Thread(connChecker); th.start(); } } // close runChecks |
return BwEvent.statusConfirmed.equals(val) || BwEvent.statusTentative.equals(val) || BwEvent.statusCancelled.equals(val); | return (val == null) || BwEvent.statusConfirmed.equals(val) || BwEvent.statusTentative.equals(val) || BwEvent.statusCancelled.equals(val); | public static boolean checkStatus(String val) { return BwEvent.statusConfirmed.equals(val) || BwEvent.statusTentative.equals(val) || BwEvent.statusCancelled.equals(val); } |
return BwEvent.transparencyOpaque.equals(val) || BwEvent.transparencyTransparent.equals(val); | return (val == null) || BwEvent.transparencyOpaque.equals(val) || BwEvent.transparencyTransparent.equals(val); | public static boolean checkTransparency(String val) { return BwEvent.transparencyOpaque.equals(val) || BwEvent.transparencyTransparent.equals(val); } |
setProperty(key, value); | if (value != null) { setProperty(key, value); } | public void setString(String key, String value) { setProperty(key, value); } |
new SamplingImpl(numPts - 1, seis.getTimeInterval()), | new SamplingImpl(seis.getSampling().getNumPoints(), (TimeInterval)seis.getSampling().getTimeInterval().multiplyBy(factor)), | public LocalSeismogramImpl apply(LocalSeismogramImpl seis) throws Exception { LocalSeismogramImpl outSeis; TimeSeriesDataSel outData = new TimeSeriesDataSel(); int numPts = seis.num_points / factor; if(seis.can_convert_to_short()) { short[] inS = seis.get_as_shorts(); short[] outS = new short[numPts]; for(int i = 0; i < outS.length; i++) { outS[i] = inS[i * factor]; } outData.sht_values(outS); } else if(seis.can_convert_to_long()) { int[] outI = new int[numPts]; int[] inI = seis.get_as_longs(); for(int i = 0; i < outI.length; i++) { outI[i] = inI[i * factor]; } outData.int_values(outI); } else if(seis.can_convert_to_float()) { float[] outF = new float[numPts]; float[] inF = seis.get_as_floats(); for(int i = 0; i < outF.length; i++) { outF[i] = inF[i * factor]; } outData.flt_values(outF); } else { double[] outD = new double[numPts]; double[] inD = seis.get_as_doubles(); for(int i = 0; i < outD.length; i++) { outD[i] = inD[i * factor]; } outData.dbl_values(outD); } // end of else outSeis = new LocalSeismogramImpl(seis.get_id(), seis.properties, seis.begin_time, numPts, new SamplingImpl(numPts - 1, seis.getTimeInterval()), seis.y_unit, seis.channel_id, seis.parm_ids, seis.time_corrections, seis.sample_rate_history, outData); return outSeis; } |
AddStructuralFeatureValueAction container = (AddStructuralFeatureValueAction) (req.getContainer() instanceof View ? ((View) req.getContainer()).getElement() : req.getContainer()); if (container.getInsertAt() != null) { return super.getCreateCommand(req); } | protected Command getCreateCommand(CreateElementRequest req) { if (UMLElementTypes.InputPin_3003 == req.getElementType()) { AddStructuralFeatureValueAction container = (AddStructuralFeatureValueAction) (req.getContainer() instanceof View ? ((View) req.getContainer()).getElement() : req.getContainer()); if (container.getInsertAt() != null) { return super.getCreateCommand(req); } if (req.getContainmentFeature() == null) { req.setContainmentFeature(UMLPackage.eINSTANCE.getAddStructuralFeatureValueAction_InsertAt()); } return getMSLWrapper(new CreateInputPin_3003Command(req)); } if (UMLElementTypes.InputPin_3004 == req.getElementType()) { AddStructuralFeatureValueAction container = (AddStructuralFeatureValueAction) (req.getContainer() instanceof View ? ((View) req.getContainer()).getElement() : req.getContainer()); if (container.getValue() != null) { return super.getCreateCommand(req); } if (req.getContainmentFeature() == null) { req.setContainmentFeature(UMLPackage.eINSTANCE.getWriteStructuralFeatureAction_Value()); } return getMSLWrapper(new CreateInputPin_3004Command(req)); } if (UMLElementTypes.InputPin_3005 == req.getElementType()) { AddStructuralFeatureValueAction container = (AddStructuralFeatureValueAction) (req.getContainer() instanceof View ? ((View) req.getContainer()).getElement() : req.getContainer()); if (container.getObject() != null) { return super.getCreateCommand(req); } if (req.getContainmentFeature() == null) { req.setContainmentFeature(UMLPackage.eINSTANCE.getStructuralFeatureAction_Object()); } return getMSLWrapper(new CreateInputPin_3005Command(req)); } return super.getCreateCommand(req); } |
|
return getMSLWrapper(new CreateInputPin_3003Command(req)); | return getMSLWrapper(new InputPinCreateCommand(req)); | protected Command getCreateCommand(CreateElementRequest req) { if (UMLElementTypes.InputPin_3003 == req.getElementType()) { AddStructuralFeatureValueAction container = (AddStructuralFeatureValueAction) (req.getContainer() instanceof View ? ((View) req.getContainer()).getElement() : req.getContainer()); if (container.getInsertAt() != null) { return super.getCreateCommand(req); } if (req.getContainmentFeature() == null) { req.setContainmentFeature(UMLPackage.eINSTANCE.getAddStructuralFeatureValueAction_InsertAt()); } return getMSLWrapper(new CreateInputPin_3003Command(req)); } if (UMLElementTypes.InputPin_3004 == req.getElementType()) { AddStructuralFeatureValueAction container = (AddStructuralFeatureValueAction) (req.getContainer() instanceof View ? ((View) req.getContainer()).getElement() : req.getContainer()); if (container.getValue() != null) { return super.getCreateCommand(req); } if (req.getContainmentFeature() == null) { req.setContainmentFeature(UMLPackage.eINSTANCE.getWriteStructuralFeatureAction_Value()); } return getMSLWrapper(new CreateInputPin_3004Command(req)); } if (UMLElementTypes.InputPin_3005 == req.getElementType()) { AddStructuralFeatureValueAction container = (AddStructuralFeatureValueAction) (req.getContainer() instanceof View ? ((View) req.getContainer()).getElement() : req.getContainer()); if (container.getObject() != null) { return super.getCreateCommand(req); } if (req.getContainmentFeature() == null) { req.setContainmentFeature(UMLPackage.eINSTANCE.getStructuralFeatureAction_Object()); } return getMSLWrapper(new CreateInputPin_3005Command(req)); } return super.getCreateCommand(req); } |
AddStructuralFeatureValueAction container = (AddStructuralFeatureValueAction) (req.getContainer() instanceof View ? ((View) req.getContainer()).getElement() : req.getContainer()); if (container.getValue() != null) { return super.getCreateCommand(req); } | protected Command getCreateCommand(CreateElementRequest req) { if (UMLElementTypes.InputPin_3003 == req.getElementType()) { AddStructuralFeatureValueAction container = (AddStructuralFeatureValueAction) (req.getContainer() instanceof View ? ((View) req.getContainer()).getElement() : req.getContainer()); if (container.getInsertAt() != null) { return super.getCreateCommand(req); } if (req.getContainmentFeature() == null) { req.setContainmentFeature(UMLPackage.eINSTANCE.getAddStructuralFeatureValueAction_InsertAt()); } return getMSLWrapper(new CreateInputPin_3003Command(req)); } if (UMLElementTypes.InputPin_3004 == req.getElementType()) { AddStructuralFeatureValueAction container = (AddStructuralFeatureValueAction) (req.getContainer() instanceof View ? ((View) req.getContainer()).getElement() : req.getContainer()); if (container.getValue() != null) { return super.getCreateCommand(req); } if (req.getContainmentFeature() == null) { req.setContainmentFeature(UMLPackage.eINSTANCE.getWriteStructuralFeatureAction_Value()); } return getMSLWrapper(new CreateInputPin_3004Command(req)); } if (UMLElementTypes.InputPin_3005 == req.getElementType()) { AddStructuralFeatureValueAction container = (AddStructuralFeatureValueAction) (req.getContainer() instanceof View ? ((View) req.getContainer()).getElement() : req.getContainer()); if (container.getObject() != null) { return super.getCreateCommand(req); } if (req.getContainmentFeature() == null) { req.setContainmentFeature(UMLPackage.eINSTANCE.getStructuralFeatureAction_Object()); } return getMSLWrapper(new CreateInputPin_3005Command(req)); } return super.getCreateCommand(req); } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.