/** * @return */ public AcquisitionResult getCapturedData() { if ( this.dataSet == null ) { return null; } return this.dataSet.getCapturedData(); }
/** * Returns all channel labels. * * @return an array of all channel's label, never <code>null</code>. */ public Channel[] getAllChannels() { return getCurrentDataSet().getChannels(); }
/** * {@inheritDoc} */ public Cursor getCursor( final int aCursorIdx ) { final Cursor[] cursors = this.dataSet.getCursors(); if ( ( aCursorIdx < 0 ) || ( aCursorIdx > cursors.length ) ) { throw new IllegalArgumentException( "Invalid cursor index!" ); } return cursors[aCursorIdx]; }
final Channel[] channels = aDataSet.getChannels(); final AcquisitionResult capturedData = aDataSet.getCapturedData(); final long triggerPos = capturedData.getTriggerPosition(); final int sampleRate = capturedData.getSampleRate();
final AcquisitionResult capturedData = aDataSet.getCapturedData(); final Cursor[] cursors = aDataSet.getCursors(); final boolean cursorsEnabled = aDataSet.isCursorsEnabled();
/** * Creates a new DataSetImpl instance. * * @param aCapturedData * the captured data of this data set; * @param aOld * the old data set to template. */ public DataSetImpl( final AcquisitionResult aCapturedData, final DataSet aOld, final boolean aRetainAnnotations ) { this.propertyChangeSupport = new PropertyChangeSupport( this ); this.capturedData = aCapturedData; this.cursorsEnabled = aOld.isCursorsEnabled(); this.channels = createChannels( aCapturedData.getChannels(), aCapturedData.getEnabledChannels(), aRetainAnnotations, aOld.getChannels() ); this.cursors = createCursors( Ols.MAX_CURSORS, aOld.getCursors() ); }
final AcquisitionResult capturedData = dataSet.getCapturedData(); final Cursor cursor1 = dataSet.getCursor( 0 ); startOfDecode = capturedData.getSampleIndex( cursor1.getTimestamp() ) - 1; final Cursor cursor2 = dataSet.getCursor( 1 ); endOfDecode = capturedData.getSampleIndex( cursor2.getTimestamp() ) + 1;
/** * Returns whether or not the cursor-mode is enabled. * * @return <code>true</code> if cursor-mode is enabled, thereby making all * defined cursors visible, <code>false</code> otherwise. */ public boolean isCursorMode() { return ( this.dataSet != null ) && this.dataSet.isCursorsEnabled(); }
/** * {@inheritDoc} */ @Override public Cursor getCursor( final int aIndex ) { return this.dataSet.getCursor( aIndex ); }
/** * Returns the {@link Channel} with the given index. * * @param aChannelIdx * the index of the channel to return, >= 0. * @return a {@link Channel} instance, never <code>null</code>. */ private Channel getChannel( final int aChannelIdx ) { final DataSet currentDataSet = getCurrentDataSet(); if ( currentDataSet == null ) { return null; } return currentDataSet.getChannel( aChannelIdx ); }
/** * Writes down all variable definitions. * * @param aWriter * the print writer to write to, cannot be <code>null</code>; * @param aContainer * the data container to take the channel information from, cannot be * <code>null</code>. */ protected void writeVariableDefinitions( final PrintWriter aWriter, final DataSet aDataSet ) { final AcquisitionResult capturedData = aDataSet.getCapturedData(); final int channelMask = capturedData.getEnabledChannels(); final Channel[] channelLabels = aDataSet.getChannels(); for ( int i = 0; i < channelLabels.length; i++ ) { if ( ( channelMask & ( 1 << i ) ) == 0 ) { continue; } String label = channelLabels[i].getLabel(); if ( StringUtils.isEmpty( label ) ) { label = "channel" + i; } writeVariable( aWriter, i, label ); } }
/** * Provides direct access to the cursor with the given index. * * @param aCursorIdx * the index of the cursor, >= 0 && < {@link Ols#MAX_CURSORS}. * @return a cursor, never <code>null</code>. */ public final Cursor getCursor( final int aCursorIdx ) { final DataSet currentDataSet = getCurrentDataSet(); if ( currentDataSet == null ) { return null; } return currentDataSet.getCursor( aCursorIdx ); }
/** * {@inheritDoc} */ @Override public AcquisitionResult getData() { return this.dataSet.getCapturedData(); }
/** * {@inheritDoc} */ @Override public void export( final DataSet aDataSet, final JComponent aComponent, final OutputStream aStream ) throws IOException { final PrintStream stream = new PrintStream( aStream ); try { // Write header row... writeHeaderRow( stream, createHeaderRowValues( aDataSet ) ); final Channel[] channels = aDataSet.getChannels(); final AcquisitionResult capturedData = aDataSet.getCapturedData(); final int sampleRate = capturedData.getSampleRate(); final int[] values = capturedData.getValues(); final long[] timestamps = capturedData.getTimestamps(); final long triggerPos = capturedData.getTriggerPosition(); // Write data... for ( int i = 0; i < values.length; i++ ) { // Write data row... writeDataRow( stream, timestamps[i], triggerPos, sampleRate, values[i], channels ); } } finally { stream.flush(); } }
final Channel[] channels = aDataSet.getChannels();
/** * @return the cursorPositions */ private Cursor[] getCursors() { return getCurrentDataSet().getCursors(); } }
/** * Returns whether or not there's captured data to display. * * @return <code>true</code> if there's captured data, <code>false</code> * otherwise. */ public boolean hasCapturedData() { final DataSet currentDataSet = getCurrentDataSet(); return ( currentDataSet != null ) && ( currentDataSet.getCapturedData() != null ); }
/** * {@inheritDoc} */ @Override public void clearAnnotations() { for ( Channel channel : getCurrentDataSet().getChannels() ) { channel.clearAnnotations(); } repaintMainFrame(); }
/** * {@inheritDoc} */ public boolean isCursorDefined( final int aCursorIdx ) { Cursor[] cursors = this.dataSet.getCursors(); if ( ( aCursorIdx < 0 ) || ( aCursorIdx > cursors.length ) ) { throw new IllegalArgumentException( "Invalid cursor index!" ); } return cursors[aCursorIdx].isDefined(); }
/** * Returns the current acquisition results. * * @return the captured data, never <code>null</code>. */ private AcquisitionResult getAcquisitionData() { return getCurrentDataSet().getCapturedData(); }