Acquisition
Class FolderInputSystem

java.lang.Object
  extended by Acquisition.DaqSystem
      extended by Acquisition.FileInputSystem
          extended by Acquisition.FolderInputSystem
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, PamSettings

public class FolderInputSystem
extends FileInputSystem
implements PamSettings

Read multiple files in sequence. Options exist to either pause and restart analysis after each file, or to merge files into one long continuous sound stream.

Author:
Doug Gillespie

Nested Class Summary
(package private)  class FolderInputSystem.CheckFiles
           
(package private)  class FolderInputSystem.FindAudioFolder
           
(package private)  class FolderInputSystem.RestartTimer
           
 
Nested classes/interfaces inherited from class Acquisition.FileInputSystem
FileInputSystem.CollectorThread
 
Field Summary
private  java.util.ArrayList<java.io.File> allFiles
           
private  PamFileFilter audioFileFilter
           
(package private)  javax.swing.JPanel barBit
           
private  javax.swing.JButton checkFiles
           
private  int currentFile
           
(package private)  long currentFileStart
           
private  long eta
           
private  FolderInputParameters folderInputParameters
           
(package private)  javax.swing.JProgressBar folderProgress
           
private  javax.swing.JCheckBox mergeFiles
           
private  javax.swing.Timer newFileTimer
           
private  boolean running
           
private  javax.swing.JCheckBox subFolders
           
 
Fields inherited from class Acquisition.FileInputSystem
acquisitionControl, acquisitionDialog, audioFormat, audioStream, collectorThread, fileDate, fileDateMillis, fileDateText, fileInputParameters, fileLength, fileName, fileSamples, fileSelect, fileStartTime, nChannels, newDataUnits, readFileSamples, repeat, sampleRate, startTimeMS, statusPanel, theThread
 
Fields inherited from class Acquisition.DaqSystem
PARAMETER_FIXED, PARAMETER_UNKNOWN, STREAM_CLOSED, STREAM_ENDED, STREAM_OPEN, STREAM_PAUSED, STREAM_RUNNING
 
Constructor Summary
FolderInputSystem()
           
 
Method Summary
(package private)  void addFolderFiles(java.io.File folder)
           
private  void checkFileHeaders()
          Checks file length matched actual file data length and repairs if necessary.
protected  javax.swing.JPanel createDaqDialogPanel()
           
 void daqHasEnded()
          Called after DAQ has stopped - for whatever reason.
 boolean dialogGetParams()
          Called by AcquisitionDialog.GetParams so that parameters can be extracted from the dialog component.
 void dialogSetParams()
          Called by AcquisitionDialog.SetParams so that the dialog componenet can update it's fields
 PamFileFilter getAudioFileFilter()
           
 java.io.File getCurrentFile()
           
protected  java.lang.String getCurrentFolder()
           
 java.lang.String getDeviceName()
          Gets a name for the acquisition device (may just be a number but need to generalise).
 long getEta()
           
 FolderInputParameters getFolderInputParameters()
           
 java.io.Serializable getSettingsReference()
           
 long getSettingsVersion()
           
 java.awt.Component getStatusBarComponent()
           
 java.lang.String getSystemType()
           
 java.lang.String getUnitName()
           
 java.lang.String getUnitType()
           
 void interpretNewFile(java.lang.String newFile)
           
(package private)  int makeSelFileList()
           
(package private)  int makeSelFileList(java.io.File[] fileList)
           
(package private)  int makeSelFileList(java.lang.String fileOrFolder)
           
protected  boolean openNextFile()
           
 boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
           
 boolean runFileAnalysis()
           
protected  void selectFolder()
           
 void setAudioFileFilter(PamFileFilter audioFileFilter)
           
 void setFileDateText()
           
 void setFolderInputParameters(FolderInputParameters folderInputParameters)
           
private  void setFolderProgress()
           
 boolean startSystem(AcquisitionControl daqControl)
          Start the DaqSystem.
 
Methods inherited from class Acquisition.FileInputSystem
actionPerformed, addComponent, bytesToSamples, canPlayBack, getChannels, getDaqSpecificDialogComponent, getDataUnitSamples, getMaxChannels, getMaxSampleRate, getPeak2PeakVoltage, getSample, getSampleRate, getSystemName, isRealTime, prepareInputFile, prepareSystem, sayEta, sayEta, selectFile, setNewFile, setStreamStatus, stopSystem, systemHasStopped
 
Methods inherited from class Acquisition.DaqSystem
areSampleSettingsOk, getDaqSpecificChannelListPanel, getInputChannelMap, getPlaybackSystem, getStreamStatus, setSelected, showSampleSettingsDialog, supportsChannelLists
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

running

private boolean running

allFiles

private java.util.ArrayList<java.io.File> allFiles

currentFile

private int currentFile

audioFileFilter

private PamFileFilter audioFileFilter

newFileTimer

private javax.swing.Timer newFileTimer

subFolders

private javax.swing.JCheckBox subFolders

mergeFiles

private javax.swing.JCheckBox mergeFiles

checkFiles

private javax.swing.JButton checkFiles

eta

private long eta

folderInputParameters

private FolderInputParameters folderInputParameters

currentFileStart

long currentFileStart

barBit

javax.swing.JPanel barBit

folderProgress

javax.swing.JProgressBar folderProgress
Constructor Detail

FolderInputSystem

public FolderInputSystem()
Method Detail

runFileAnalysis

public boolean runFileAnalysis()
Overrides:
runFileAnalysis in class FileInputSystem

createDaqDialogPanel

protected javax.swing.JPanel createDaqDialogPanel()
Overrides:
createDaqDialogPanel in class FileInputSystem

checkFileHeaders

private void checkFileHeaders()
Checks file length matched actual file data length and repairs if necessary.


makeSelFileList

int makeSelFileList()

makeSelFileList

int makeSelFileList(java.lang.String fileOrFolder)

makeSelFileList

int makeSelFileList(java.io.File[] fileList)

addFolderFiles

void addFolderFiles(java.io.File folder)

selectFolder

protected void selectFolder()

getCurrentFolder

protected java.lang.String getCurrentFolder()

interpretNewFile

public void interpretNewFile(java.lang.String newFile)
Overrides:
interpretNewFile in class FileInputSystem

setFileDateText

public void setFileDateText()

getSystemType

public java.lang.String getSystemType()
Overrides:
getSystemType in class FileInputSystem
Returns:
The 'type' of data source for display in the Data Source dialog

Calling functions should be able to handle 'null'


getUnitName

public java.lang.String getUnitName()
Specified by:
getUnitName in interface PamSettings
Overrides:
getUnitName in class FileInputSystem
Returns:
A Name specific to this instance of the particular class, e.g. Sperm whale detector, Beaked whale detector, etc.

getUnitType

public java.lang.String getUnitType()
Specified by:
getUnitType in interface PamSettings
Overrides:
getUnitType in class FileInputSystem
Returns:
A Name specific to the type, e.g. Glick detector

getCurrentFile

public java.io.File getCurrentFile()
Overrides:
getCurrentFile in class FileInputSystem

openNextFile

protected boolean openNextFile()
Overrides:
openNextFile in class FileInputSystem

daqHasEnded

public void daqHasEnded()
Description copied from class: DaqSystem
Called after DAQ has stopped - for whatever reason. Nost DAQ systems will not need to do anything here, but they could potentially clean up memory The motivation for putting this here now is for the folder analysis system so that it can start analysing the next file.

Overrides:
daqHasEnded in class FileInputSystem

setFolderProgress

private void setFolderProgress()

getStatusBarComponent

public java.awt.Component getStatusBarComponent()
Overrides:
getStatusBarComponent in class FileInputSystem

getEta

public long getEta()
Overrides:
getEta in class FileInputSystem

getSettingsReference

public java.io.Serializable getSettingsReference()
Specified by:
getSettingsReference in interface PamSettings
Overrides:
getSettingsReference in class FileInputSystem
Returns:
The serialisable object that will be stored

getSettingsVersion

public long getSettingsVersion()
Specified by:
getSettingsVersion in interface PamSettings
Overrides:
getSettingsVersion in class FileInputSystem
Returns:
An integer version number for the settings

dialogGetParams

public boolean dialogGetParams()
Description copied from class: DaqSystem
Called by AcquisitionDialog.GetParams so that parameters can be extracted from the dialog component. The DaqSystem should also implement PamSettings and handle storage of parameters between runs.

Overrides:
dialogGetParams in class FileInputSystem
Returns:
true if the parameters and selections are OK. If false is returned the Acquisition dialog will not respond to its Ok button.

dialogSetParams

public void dialogSetParams()
Description copied from class: DaqSystem
Called by AcquisitionDialog.SetParams so that the dialog componenet can update it's fields

Overrides:
dialogSetParams in class FileInputSystem

restoreSettings

public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings)
Specified by:
restoreSettings in interface PamSettings
Overrides:
restoreSettings in class FileInputSystem
Returns:
true if successful The object performs final checks (if needed) and then casts the settings data pamcontrolledunitSettings.settings into the correct type and uses as required

getFolderInputParameters

public FolderInputParameters getFolderInputParameters()

setFolderInputParameters

public void setFolderInputParameters(FolderInputParameters folderInputParameters)

startSystem

public boolean startSystem(AcquisitionControl daqControl)
Description copied from class: DaqSystem
Start the DaqSystem. This is called immediately after PrepareSystem

Most things should be ready from the call to PrepareSystem. In StartSystem you will generally need to start a thread which will read in the data and place PamDataUnits in a buffer from where they are read by the main thred and passed on to other Pam modules for processing (see SoundCardSystem for an example)

Overrides:
startSystem in class FileInputSystem
Parameters:
daqControl - AcquisitionControl unit.
Returns:
true if OK, false otherwise

setAudioFileFilter

public void setAudioFileFilter(PamFileFilter audioFileFilter)
Parameters:
audioFileFilter - the audioFileFilter to set

getAudioFileFilter

public PamFileFilter getAudioFileFilter()
Returns:
the audioFileFilter

getDeviceName

public java.lang.String getDeviceName()
Description copied from class: DaqSystem
Gets a name for the acquisition device (may just be a number but need to generalise).

Overrides:
getDeviceName in class FileInputSystem
Returns: