Package edu.wisc.ssec.mcidasv.control
Class MultiSpectralControl.CsvTask
- All Implemented Interfaces:
Runnable
,Future<String>
,RunnableFuture<String>
- Enclosing class:
MultiSpectralControl
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.SwingWorker
SwingWorker.StateValue
Nested classes/interfaces inherited from interface java.util.concurrent.Future
Future.State
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate double[][]
collectValues
(double[] wavelengths) Iterates through each channel/wavenumber and extracts the value of the existing ReadoutProbes at their current positions.Does the work of exporting and formatting CSV values from aMultiSpectralControl
in a background thread.protected void
done()
Called (on the event dispatch thread) whendoInBackground()
has completed.private String
Coordinates the collecting of probe data as well as creating a string representing the contents of the CSV file.private void
writeToPath
(String csvContents) Write the given string topath
.Methods inherited from class javax.swing.SwingWorker
addPropertyChangeListener, cancel, execute, firePropertyChange, get, get, getProgress, getPropertyChangeSupport, getState, isCancelled, isDone, process, publish, removePropertyChangeListener, run, setProgress
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.concurrent.Future
exceptionNow, resultNow, state
-
Field Details
-
path
-
-
Constructor Details
-
CsvTask
Creates a CSV exporting task that's meant to store its values in the file specified bypath
.- Parameters:
path
- File to write to. Cannot benull
.
-
-
Method Details
-
doInBackground
Does the work of exporting and formatting CSV values from aMultiSpectralControl
in a background thread.- Specified by:
doInBackground
in classSwingWorker<String,
Object> - Returns:
- String representing the contents to write to a CSV file. May be
null
.
-
done
Called (on the event dispatch thread) whendoInBackground()
has completed.- Overrides:
done
in classSwingWorker<String,
Object>
-
writeToPath
Write the given string topath
.- Parameters:
csvContents
- CSV file contents. Should not benull
.
-
collectValues
Iterates through each channel/wavenumber and extracts the value of the existing ReadoutProbes at their current positions.Be warned, this can be slow when there are thousands of channels. Definitely do not run this method on the event dispatch thread.
- Parameters:
wavelengths
- Array containing all the channels/wavenumbers. Cannot benull
.- Returns:
- Two-dimensional array of doubles. First array represents the probes, second dimension is the value of a probe at each channel/wavenumber.
- Throws:
VisADException
- if there was a problemRemoteException
- if there was somehow an RMI problem
-
exportSpectra
Coordinates the collecting of probe data as well as creating a string representing the contents of the CSV file.- Returns:
- String value that can be written to a CSV file.
- Throws:
Exception
- if there was some problem
-