From b420fd9f9de21e6cfd9fb7d40f0286ffe817fb8c Mon Sep 17 00:00:00 2001 From: Douglas Gillespie <50671166+douggillespie@users.noreply.github.com> Date: Tue, 27 Aug 2024 12:48:16 +0100 Subject: [PATCH] Major code cleanup Cleanup of imports, whitespace, etc. across all of PAMGuard. No other changes to code apart from this automatic cleanup. --- pom.xml | 2 +- src/AIS/AISBinaryDataSource.java | 1 - src/AIS/AISBugSearch.java | 2 +- src/AIS/AISControl.java | 6 + src/AIS/AISDataBlock.java | 14 +- src/AIS/AISDataUnit.java | 1 - src/AIS/AISGraphics.java | 10 +- src/AIS/AISLogger.java | 17 +- src/AIS/AISStaticData.java | 2 +- src/AIS/AISStringsTable.java | 6 +- src/AIS/ProcessAISData.java | 2 - src/Acquisition/AcquisitionCParameters.java | 8 +- src/Acquisition/AcquisitionControl.java | 218 ++-- src/Acquisition/AcquisitionDialog.java | 270 ++--- src/Acquisition/AcquisitionLogging.java | 92 +- src/Acquisition/AcquisitionParameters.java | 90 +- src/Acquisition/AcquisitionProcess.java | 347 +++---- src/Acquisition/AudioDataQueue.java | 30 +- src/Acquisition/ChannelListPanel.java | 34 +- src/Acquisition/CheckWavFileHeaders.java | 26 +- src/Acquisition/DAQChannelListManager.java | 6 +- src/Acquisition/DCFilter.java | 4 +- src/Acquisition/DCL5System.java | 6 +- src/Acquisition/DaqStatusBinaryStore.java | 21 +- src/Acquisition/DaqStatusDataBlock.java | 7 +- src/Acquisition/DaqStatusDataUnit.java | 49 +- src/Acquisition/DaqStatusModuleHeader.java | 2 +- src/Acquisition/DaqSystem.java | 144 ++- src/Acquisition/DaqSystemInterface.java | 10 +- src/Acquisition/DaqSystemXMLManager.java | 8 +- src/Acquisition/FileInputParameters.java | 26 +- src/Acquisition/FileInputSystem.java | 181 ++-- src/Acquisition/FolderInputParameters.java | 19 +- src/Acquisition/FolderInputSystem.java | 224 ++-- src/Acquisition/KETime.java | 26 +- src/Acquisition/RawDataBinaryDataSource.java | 37 +- src/Acquisition/RonaInputSystem.java | 67 +- src/Acquisition/SoundCardParameters.java | 9 +- src/Acquisition/SoundCardSystem.java | 158 +-- src/Acquisition/StandardChannelListPanel.java | 42 +- src/Acquisition/WavChunkData.java | 8 +- src/Acquisition/WavFileFuncs.java | 4 +- src/Acquisition/WavHeader.java | 20 +- src/Acquisition/icListenSystem.java | 970 +++++++++--------- src/AirgunDisplay/AirgunControl.java | 28 +- .../AirgunDimensionsDrawing.java | 4 +- src/AirgunDisplay/AirgunGraphics.java | 123 +-- src/AirgunDisplay/AirgunParameters.java | 34 +- src/AirgunDisplay/AirgunParametersDialog.java | 86 +- src/AirgunDisplay/AirgunProcess.java | 56 +- src/Array/ArrayDialog.java | 11 +- src/Array/ArrayManager.java | 37 +- src/Array/ArrayParameters.java | 1 - src/Array/ArraySidePanelControl.java | 8 +- src/Array/ChannelPanel.java | 5 + src/Array/EmptyLocatorSettings.java | 2 - src/Array/Hydrophone.java | 2 +- src/Array/HydrophoneDataBlock.java | 5 +- src/Array/HydrophoneDiagram.java | 4 +- src/Array/HydrophoneDialogPanel.java | 9 +- src/Array/HydrophoneElementDialog.java | 12 +- src/Array/HydrophoneLocator.java | 2 - src/Array/HydrophoneLocators.java | 1 - src/Array/HydrophoneProcess.java | 3 +- src/Array/HydrophoneSQLLogging.java | 4 +- src/Array/InstrumentIdentityPanel.java | 5 +- src/Array/MasterLocator.java | 19 +- src/Array/MovingHydrophoneLocator.java | 5 - src/Array/PamArray.java | 12 +- src/Array/Preamplifier.java | 2 +- src/Array/SimpleHydrophoneLocator.java | 5 - src/Array/StraightHydrophoneLocator.java | 8 - src/Array/Streamer.java | 6 +- src/Array/StreamerDataBlock.java | 1 + src/Array/StreamerDataUnit.java | 2 - src/Array/StreamerDialog.java | 27 +- src/Array/StreamerLogging.java | 6 - src/Array/StreamerOverlayGraphics.java | 6 +- src/Array/ThreadingHydrophoneLocator.java | 9 +- src/ArrayAccelerometer/ArrayAccelControl.java | 2 +- .../ArrayAccelDataUnit.java | 2 +- src/ArrayAccelerometer/ArrayAccelDialog.java | 32 +- src/ArrayAccelerometer/ArrayAccelPanel.java | 4 +- src/ArrayAccelerometer/ArrayAccelParams.java | 2 - src/ArrayAccelerometer/ArrayAccelProcess.java | 11 +- .../ArrayAccelSidePanel.java | 3 - src/Azigram/AzigramDataUnit.java | 2 - src/Azigram/AzigramParameters.java | 2 - src/Filters/FilterControl.java | 12 +- src/Filters/FilterDataSourceDialog.java | 1 + src/Filters/FilterDialog.java | 1 + src/Filters/FilterDialogPanel.java | 20 +- src/Filters/FilterMethod.java | 2 - src/Filters/FilterParameters_2.java | 3 - src/Filters/FilterParams.java | 5 - src/Filters/FilterSpeed.java | 2 +- src/Filters/IIRFilterMethod.java | 1 + src/Filters/IirfFilter.java | 3 + src/GPS/FormatGpsData.java | 4 +- src/GPS/GPSControl.java | 19 +- src/GPS/GPSDataBlock.java | 14 +- src/GPS/GPSDataMatcher.java | 1 - src/GPS/GPSOverlayGraphics.java | 9 +- src/GPS/GPSParametersDialog.java | 12 +- src/GPS/GpsData.java | 15 +- src/GPS/GpsLogger.java | 33 +- src/GPS/ImportGPSData.java | 15 +- src/GPS/ImportGPSDialog.java | 3 +- src/GPS/ProcessHeadingData.java | 11 +- src/GPS/ProcessNmeaData.java | 22 +- src/GPS/ShipDimensionsFields.java | 4 +- src/GPS/UpdateClockDialog.java | 20 +- src/IshmaelDetector/EnergySumControl.java | 5 +- .../EnergySumParamsDialog.java | 1 + src/IshmaelDetector/EnergySumProcess.java | 3 +- src/IshmaelDetector/IshAnchorGroup.java | 2 - src/IshmaelDetector/IshBinaryDataSource.java | 1 - src/IshmaelDetector/IshDetControl.java | 2 + src/IshmaelDetector/IshDetFnProcess.java | 4 +- src/IshmaelDetector/IshDetGraphics.java | 11 +- src/IshmaelDetector/IshDetParams.java | 2 +- src/IshmaelDetector/IshDetParamsDialog.java | 6 - src/IshmaelDetector/IshDetSave.java | 4 +- src/IshmaelDetector/IshDetWrapper.java | 1 - src/IshmaelDetector/IshLogger.java | 6 +- src/IshmaelDetector/MatchFiltControl.java | 3 + .../MatchFiltParamsDialog.java | 1 + src/IshmaelDetector/MatchFiltProcess.java | 2 +- src/IshmaelDetector/SgramCorrControl.java | 4 +- .../SgramCorrParamsDialog.java | 1 + src/IshmaelLocator/IshDetectionWrapper.java | 2 +- src/IshmaelLocator/IshLocControl.java | 6 +- src/IshmaelLocator/IshLocGraphics.java | 12 +- src/IshmaelLocator/IshLocHyperbProcess.java | 10 +- src/IshmaelLocator/IshLocPairProcess.java | 7 +- src/IshmaelLocator/IshLocParamsDialog.java | 5 +- src/IshmaelLocator/IshLocProcess.java | 22 +- src/IshmaelLocator/IshLocSqlLogging.java | 10 +- src/IshmaelLocator/LM.java | 4 +- src/JSSHTerminal/Esc.java | 3 +- src/JSSHTerminal/GraphicTerminal.java | 22 +- src/JSSHTerminal/JSchSession.java | 6 +- src/JSSHTerminal/MainPanel.java | 17 +- src/JSSHTerminal/MultiTerminal.java | 20 +- src/JSSHTerminal/SSHSession.java | 27 +- src/JSSHTerminal/TerminalEmulator.java | 28 +- src/JSSHTerminal/TerminalEvent.java | 29 +- src/JSSHTerminal/TextTerminal.java | 14 +- .../KernelSmoothingControl.java | 4 + .../KernelSmoothingDialog.java | 3 +- .../KernelSmoothingProcess.java | 3 +- src/Layout/DisplayPanel.java | 2 +- src/Layout/DisplayProviderList.java | 2 +- src/Layout/PamAxis.java | 8 +- src/Layout/PamFramePlots.java | 1 + src/Localiser/ModelControlPanel.java | 1 + src/Map/GebcoMapFile.java | 12 +- src/Map/GpsTextDisplay.java | 4 +- src/Map/MapCommentDialog.java | 5 +- src/Map/MapCommentOverlayGraphics.java | 4 +- src/Map/MapCommentSQLLogging.java | 4 +- src/Map/MapController.java | 11 +- src/Map/MapDetectionsDialog.java | 13 +- src/Map/MapDetectionsManager.java | 16 +- src/Map/MapDetectionsParameters.java | 3 +- src/Map/MapDisplayProvider.java | 2 - src/Map/MapPanel.java | 50 +- src/Map/MapParameters.java | 2 - src/Map/MapParametersDialog.java | 27 +- src/Map/MapRectProjector.java | 2 - src/Map/PamZoomOnMapPanel.java | 19 + src/Map/SimpleMap.java | 31 +- src/Map/TransformUtilities.java | 3 - src/Map/Vessel.java | 5 +- src/NMEA/AcquireNmeaData.java | 16 +- src/NMEA/ChannelAISData.java | 2 + src/NMEA/NMEAControl.java | 10 +- src/NMEA/NMEADataBlock.java | 2 +- src/NMEA/NMEAParametersDialog.java | 3 +- src/NMEA/NMEAStringSelector.java | 3 - src/NMEA/NMEAStringsTable.java | 8 +- src/PamController/DeserialisationWarning.java | 2 - src/PamController/DisplayScalingDialog.java | 1 - src/PamController/ModuleOrderDialog.java | 5 + src/PamController/OfflineDataStore.java | 6 +- src/PamController/OfflineFileDataStore.java | 1 - src/PamController/PSFXReadWriter.java | 3 +- src/PamController/PamConfiguration.java | 9 +- src/PamController/PamControlledUnit.java | 5 +- .../PamControlledUnitSettings.java | 5 +- src/PamController/PamController.java | 83 +- src/PamController/PamFolders.java | 10 +- src/PamController/PamSettingManager.java | 34 +- src/PamController/PamSettingsGroup.java | 3 +- src/PamController/PamViewParameters.java | 3 +- src/PamController/PamguardVersionInfo.java | 4 +- src/PamController/SettingsFileDialog.java | 5 +- src/PamController/StorageOptions.java | 6 +- src/PamController/StorageOptionsDialog.java | 17 +- src/PamController/XMLTest.java | 1 - src/PamDetection/AbstractLocalisation.java | 4 +- src/PamDetection/AcousticSQLLogging.java | 6 +- src/PamDetection/DetectionMatchModel.java | 1 + src/PamDetection/LocContents.java | 5 + src/PamModel/AboutPluginDisplay.java | 7 +- src/PamModel/CommonPluginInterface.java | 4 - src/PamModel/DependencyManager.java | 2 +- src/PamModel/ImportExport.java | 2 - src/PamModel/PamModel.java | 65 +- src/PamModel/PamModelSettings.java | 2 +- src/PamModel/PamModuleInfo.java | 11 +- src/PamModel/PamPluginInterface.java | 4 - src/PamModel/ThreadingDialog.java | 3 +- src/PamUtils/CheckStorageFolder.java | 4 +- src/PamUtils/DiskSpaceFormat.java | 5 +- src/PamUtils/FileFunctions.java | 16 +- src/PamUtils/FileList.java | 2 +- src/PamUtils/FolderZipper.java | 4 +- src/PamUtils/LatLong.java | 4 +- src/PamUtils/LatLongDialog.java | 2 +- src/PamUtils/LatLongDialogStrip.java | 17 +- src/PamUtils/LatLongEditableDialogStrip.java | 6 +- src/PamUtils/PamAudioFileFilter.java | 2 - src/PamUtils/PamCalendar.java | 2 - src/PamUtils/PamFileFilter.java | 2 +- src/PamUtils/PamSort.java | 6 +- src/PamUtils/PlatformInfo.java | 4 +- src/PamUtils/SelectFolder.java | 13 +- src/PamUtils/Splash.java | 7 +- src/PamUtils/SystemTiming.java | 12 +- src/PamUtils/TimedObservable.java | 3 +- src/PamUtils/TxtFileUtils.java | 4 +- src/PamUtils/XMLUtils.java | 2 +- src/PamUtils/ZipUtility.java | 1 - src/PamView/AnnotationsPopup.java | 2 +- src/PamView/BasicKeyItem.java | 7 +- src/PamView/ClipboardCopier.java | 2 + src/PamView/ColourComboBox.java | 15 +- src/PamView/ColourScheme.java | 5 +- src/PamView/DBTextArea.java | 3 + src/PamView/GeneralProjector.java | 13 +- src/PamView/GuiFrameManager.java | 14 +- src/PamView/HidingSidePanel.java | 2 - src/PamView/HoverData.java | 2 +- src/PamView/ImportLoadBar.java | 3 +- src/PamView/JFontChooser.java | 34 +- src/PamView/ObserverListPopup.java | 3 +- src/PamView/PamAWTUtils.java | 4 - src/PamView/PamColors.java | 12 +- src/PamView/PamControlledGUISwing.java | 3 +- src/PamView/PamDetectionOverlayGraphics.java | 24 +- src/PamView/PamGui.java | 80 +- src/PamView/PamList.java | 2 - src/PamView/PamLoadBar.java | 4 - src/PamView/PamObjectList.java | 16 +- src/PamView/PamObjectViewer.java | 39 +- src/PamView/PamOldSymbolManager.java | 13 +- src/PamView/PamPanelTiler.java | 4 + src/PamView/PamStatusBar.java | 3 - src/PamView/PamSymbol.java | 4 + src/PamView/PamSymbolDialog.java | 5 + src/PamView/PamSymbolSelector.java | 2 +- src/PamView/PamTable.java | 1 - src/PamView/PamView.java | 2 + src/PamView/PanelOverlayKeyItem.java | 3 + src/PamView/ScreenSize.java | 8 +- src/PamView/SymbolKeyItem.java | 3 + src/PamView/TextKeyItem.java | 3 + src/PamView/TopToolBar.java | 9 +- src/PamView/ViewTimesDialog.java | 1 + src/PamguardMVC/ChannelIterator.java | 3 - src/PamguardMVC/DataBlock2D.java | 1 + src/PamguardMVC/DataUnitFinder.java | 2 +- src/PamguardMVC/LastDataUnitStore.java | 1 - src/PamguardMVC/PamDataBlock.java | 64 +- src/PamguardMVC/PamDataUnit.java | 23 +- src/PamguardMVC/PamDataUnitIterator.java | 2 + src/PamguardMVC/PamInstantProcess.java | 1 - src/PamguardMVC/PamObservable.java | 20 +- src/PamguardMVC/PamProcess.java | 14 +- src/PamguardMVC/PamRawDataBlock.java | 10 +- src/PamguardMVC/RawDataDisplay.java | 18 +- src/PamguardMVC/RawDataTransforms.java | 3 +- src/PamguardMVC/SequenceIterator.java | 3 - src/PamguardMVC/ThreadedObserver.java | 5 +- .../RWEBinaryDataSource.java | 2 - src/RightWhaleEdgeDetector/RWEControl.java | 2 - src/RightWhaleEdgeDetector/RWEDataBlock.java | 1 - src/RightWhaleEdgeDetector/RWEDialog.java | 8 +- .../RWEOverlayGraphics.java | 3 - src/RightWhaleEdgeDetector/RWEProcess.java | 22 +- src/RightWhaleEdgeDetector/RWESQLLogging.java | 1 - src/SoundRecorder/PamAudioFileStorage.java | 15 +- src/SoundRecorder/RecorderButton.java | 2 +- src/SoundRecorder/RecorderControl.java | 17 +- src/SoundRecorder/RecorderLogger.java | 10 +- src/SoundRecorder/RecorderProcess.java | 3 - src/SoundRecorder/RecorderSettings.java | 9 +- src/SoundRecorder/RecorderSettingsDialog.java | 13 +- src/SoundRecorder/RecorderSidePanel.java | 11 +- src/SoundRecorder/RecorderTabPanel.java | 21 +- src/SoundRecorder/WavFileStorage.java | 7 +- src/Spectrogram/ColourRangeSlider.java | 6 +- src/Spectrogram/ColourRangeSliderUI.java | 6 +- src/Spectrogram/ScalePanel.java | 1 + src/Spectrogram/SpectrogramDisplay.java | 97 +- .../SpectrogramDisplayComponent.java | 1 - src/Spectrogram/SpectrogramHidingPanel.java | 19 +- src/Spectrogram/SpectrogramMarkConverter.java | 3 - src/Spectrogram/SpectrogramMarkObserver.java | 1 - src/Spectrogram/SpectrogramMarkObservers.java | 2 +- src/Spectrogram/SpectrogramMarkProcess.java | 6 +- src/Spectrogram/SpectrogramParameters.java | 3 +- src/Spectrogram/SpectrogramParamsDialog.java | 20 +- src/Spectrogram/SpectrogramZoomer.java | 1 + src/Stats/LinFit.java | 14 +- src/Stats/LogRegWeka.java | 1 - src/UserInput/UserInputDataUnit.java | 4 - src/UserInput/UserInputLogger.java | 11 +- src/UserInput/UserInputOverlayGraphics.java | 3 - src/UserInput/UserInputPanel.java | 12 +- src/UserInput/UserInputProcess.java | 4 +- src/UserInput/UserInputSidePanel.java | 11 +- src/alarm/AlarmControl.java | 25 +- src/alarm/AlarmDataSource.java | 4 - src/alarm/AlarmDialog.java | 23 +- src/alarm/AlarmDisplayTable.java | 9 +- src/alarm/AlarmLogging.java | 2 +- src/alarm/AlarmOfflineTask.java | 2 - src/alarm/AlarmParameters.java | 2 +- src/alarm/AlarmProcess.java | 5 +- src/alarm/AlarmSidePanel.java | 2 +- src/amplifier/AmpControl.java | 4 + .../AnalogArraySensorDataBlock.java | 1 - src/analogarraysensor/ArraySensorControl.java | 2 - src/analogarraysensor/ArraySensorProcess.java | 3 +- src/analoginput/AnalogDevicesManager.java | 4 - src/analoginput/AnalogRangeData.java | 4 +- src/angleMeasurement/AngleCalibration.java | 3 +- .../AngleCalibrationDialog.java | 11 +- src/angleMeasurement/AngleControl.java | 3 + src/angleMeasurement/AngleDataBlock.java | 2 +- .../AngleLoggingDialogPanel.java | 5 +- src/angleMeasurement/AngleMeasurement.java | 6 +- src/angleMeasurement/AngleProcess.java | 1 + src/angleMeasurement/AngleSidePanel.java | 3 + src/angleMeasurement/FluxgateWorldAngles.java | 7 +- src/angleMeasurement/FluxgateWorldDialog.java | 9 +- src/angleVetoes/AngleVetoDialog.java | 1 + src/angleVetoes/AngleVetoDisplay.java | 8 +- src/angleVetoes/AngleVetoes.java | 9 +- src/angleVetoes/AngleVetoesDialog.java | 6 + src/annotation/AnnotationList.java | 1 - src/annotation/DataAnnotationType.java | 5 +- src/annotationMark/MarkAnnotationDialog.java | 15 +- src/annotationMark/MarkDataBlock.java | 3 - src/annotationMark/MarkModule.java | 2 +- src/annotationMark/MarkOverlayDraw.java | 9 +- src/annotationMark/MarkProcess.java | 3 - src/asiojni/ASIOFilePlaybackSystem.java | 3 - src/asiojni/ASIOPlaybackSystem.java | 6 +- src/asiojni/ASIOSoundSystem.java | 14 +- src/asiojni/AsioDriverInfos.java | 2 +- src/asiojni/AsioJniInterface.java | 2 +- src/asiojni/NewAsioSoundSystem.java | 15 +- src/autecPhones/AutecDataUnit.java | 2 +- src/autecPhones/AutecGraphics.java | 8 +- src/autecPhones/AutecPhonesControl.java | 3 +- src/backupmanager/BackupInformation.java | 1 - src/backupmanager/BackupManager.java | 5 +- src/backupmanager/BackupProgress.java | 2 +- src/backupmanager/FileLocation.java | 4 +- src/beamformer/BeamAlgorithmParams.java | 1 + src/beamformer/BeamFormerBaseProcess.java | 7 +- src/beamformer/BeamFormerParams.java | 1 + .../BearingLocaliserControl.java | 7 +- src/binaryFileStorage/BinaryDataSource.java | 7 +- src/binaryFileStorage/BinaryInputStream.java | 1 - .../BinaryMapMakeProgress.java | 2 + .../BinaryMapMakingDialog.java | 2 +- .../BinaryOfflineDataMap.java | 5 +- .../BinaryOfflineDataMapPoint.java | 4 - src/binaryFileStorage/BinaryOutputStream.java | 15 +- .../BinaryStorageDialogPanel.java | 7 +- src/binaryFileStorage/BinaryStore.java | 66 +- src/binaryFileStorage/BinaryStoreDeleter.java | 8 +- src/binaryFileStorage/BinaryStoreProcess.java | 2 +- .../BinaryStoreSettings.java | 2 +- .../BinaryStoreStatusFuncs.java | 6 +- src/binaryFileStorage/DataMapSerialiser.java | 6 +- src/binaryFileStorage/ModuleFooter.java | 2 - src/cepstrum/CepstrumControl.java | 4 +- src/classifier/AbstractWekaClassifier.java | 7 +- src/classifier/Classifier.java | 2 +- src/classifier/WekaOptionsDialog.java | 2 +- src/clickDetector/BTAmplitudeSelector.java | 7 +- src/clickDetector/BTDisplayParameters.java | 3 - src/clickDetector/BasicClickIdParameters.java | 2 +- src/clickDetector/ClickAlarm.java | 4 +- src/clickDetector/ClickAlarmManager.java | 9 +- src/clickDetector/ClickBTDisplay.java | 89 +- src/clickDetector/ClickBinaryDataSource.java | 10 +- .../ClickBinaryModuleFooter.java | 4 +- src/clickDetector/ClickControl.java | 28 +- src/clickDetector/ClickDataBlock.java | 42 +- src/clickDetector/ClickDetection.java | 21 +- src/clickDetector/ClickDetector.java | 53 +- src/clickDetector/ClickDisplayManager.java | 22 +- .../ClickDisplayManagerParameters.java | 2 - .../ClickDisplayManagerParameters2.java | 7 +- src/clickDetector/ClickGroupDataBlock.java | 1 - src/clickDetector/ClickGroupLogging.java | 9 +- src/clickDetector/ClickLocalisation.java | 2 +- src/clickDetector/ClickLogger.java | 9 +- src/clickDetector/ClickMapDrawing.java | 11 +- src/clickDetector/ClickParameters.java | 15 +- src/clickDetector/ClickRecorderTrigger.java | 3 - src/clickDetector/ClickSidePanel.java | 17 +- src/clickDetector/ClickSpectrogramPlugin.java | 10 +- src/clickDetector/ClickSpectrum.java | 42 +- src/clickDetector/ClickSpectrumDialog.java | 8 +- .../ClickSpectrumTemplateDialog.java | 13 +- .../ClickSpectrumTemplateEditDialog.java | 18 +- src/clickDetector/ClickTabPanel.java | 10 +- src/clickDetector/ClickTabPanelControl.java | 11 +- src/clickDetector/ClickToolBar.java | 1 + src/clickDetector/ClickTrainDetector.java | 17 +- src/clickDetector/ClickTrainLogger.java | 8 +- src/clickDetector/ClickTrigger.java | 8 +- src/clickDetector/ClickWaveform.java | 17 +- .../ConcatenatedSpectrogram.java | 5 +- src/clickDetector/IDI_Display.java | 66 +- src/clickDetector/IDI_DisplayDialog.java | 30 +- .../NewClickOverlayGraphics.java | 6 +- src/clickDetector/NoiseDataBlock.java | 1 - src/clickDetector/OldClickClass.java | 2 +- src/clickDetector/RainbowFile.java | 23 +- src/clickDetector/TrackedClickDataBlock.java | 1 - .../TrackedClickGroupLogging.java | 4 +- src/clickDetector/TriggerLevelDataUnit.java | 1 - src/clickDetector/WignerPlot.java | 5 +- src/clickDetector/WignerPlotdialog.java | 4 +- src/clickDetector/WindowsBuffer.java | 6 + src/clickDetector/WindowsFile.java | 10 + .../CTClassificationProcess.java | 1 + src/clickTrainDetector/CTDataUnit.java | 2 - .../CTLocalisationProcess.java | 3 - src/clickTrainDetector/ClickTrainControl.java | 2 +- .../ClickTrainDataBlock.java | 2 - src/clickTrainDetector/ClickTrainProcess.java | 1 - src/clickTrainDetector/IDIInfo.java | 4 +- src/clickTrainDetector/TempCTDataUnit.java | 2 - src/clipgenerator/ClipBinaryDataSource.java | 1 - src/clipgenerator/ClipControl.java | 19 +- src/clipgenerator/ClipDataBlock.java | 2 +- src/clipgenerator/ClipDataUnit.java | 18 +- src/clipgenerator/ClipDialog.java | 5 +- src/clipgenerator/ClipDisplayDataBlock.java | 1 - src/clipgenerator/ClipDisplayDialog.java | 5 +- src/clipgenerator/ClipGenSetting.java | 2 +- src/clipgenerator/ClipGenSettingDialog.java | 1 - src/clipgenerator/ClipOverlayGraphics.java | 13 +- src/clipgenerator/ClipProcess.java | 31 +- src/clipgenerator/ClipSpectrogram.java | 1 - src/clipgenerator/ClipSpectrogramMark.java | 1 - src/cpod/CPODBinaryStore.java | 5 +- src/cpod/CPODClassification.java | 2 +- src/cpod/CPODClick.java | 1 - src/cpod/CPODClickTrainDataUnit.java | 1 + src/cpod/CPODControl.java | 19 +- src/cpod/CPODControl2.java | 1 + src/cpod/CPODDialog.java | 9 +- src/cpod/CPODImporter.java | 6 +- src/cpod/CPODLoader.java | 5 +- src/cpod/CPODMap.java | 11 +- src/cpod/CPODReader.java | 3 +- src/cpod/FPODReader.java | 1 - .../CBDetectionMatcher.java | 4 +- .../CBLocaliserControl.java | 8 +- .../CBLocaliserProcess.java | 1 - .../CBLocaliserSettngs.java | 1 - src/d3/D2TextTime.java | 5 +- src/d3/D3Control.java | 17 +- src/d3/D3DataBlock.java | 3 +- src/d3/D3SensorInfo.java | 4 +- src/d3/D3XMLFile.java | 6 +- src/dataGram/Datagram.java | 1 - src/dataGram/DatagramDialog.java | 6 +- src/dataGram/DatagramManager.java | 33 +- src/dataGram/DatagramProgress.java | 4 +- src/dataGram/DatagramProgressDialog.java | 2 +- src/dataMap/DataMapControl.java | 9 +- src/dataMap/DataStreamPanel.java | 28 +- src/dataMap/OfflineDataMap.java | 1 - src/dataMap/ScrollingDataPanel.java | 3 +- src/dataMap/SettingsStrip.java | 5 +- src/dataMap/SummaryPanel.java | 2 +- src/dataModelFX/DataModelConnectPane.java | 2 +- src/dataModelFX/DataModelModulePane.java | 2 +- src/dataModelFX/DataModelPaneFX.java | 31 +- src/dataModelFX/ModuleNodeParams.java | 1 + src/dataPlots/HidingControlPanel.java | 14 +- src/dataPlots/TDControl.java | 28 +- src/dataPlotsFX/SimpleSymbolChooserFX.java | 6 +- src/dataPlotsFX/TDControlAWT.java | 13 +- src/dataPlotsFX/TDControlFX.java | 28 +- src/dataPlotsFX/TDDisplayController.java | 14 +- src/dataPlotsFX/TDDisplayProviderFX.java | 1 - src/dataPlotsFX/TDGraphParametersFX.java | 6 +- src/dataPlotsFX/TDManagedSymbolChooserFX.java | 1 - src/dataPlotsFX/TDSymbolChooserFX.java | 3 +- src/dbht/DbHtControl.java | 11 +- src/dbht/DbHtDataBlock.java | 7 +- src/dbht/DbHtDataSource.java | 1 - src/dbht/DbHtDialog.java | 2 +- src/dbht/DbHtDisplayDialog.java | 2 +- src/dbht/DbHtDisplayPanel.java | 15 +- src/dbht/DbHtProcess.java | 3 +- src/decimator/DecimatorControl.java | 19 +- src/decimator/DecimatorParamsDialog.java | 4 +- src/decimator/DecimatorProcess.java | 7 +- src/decimator/DecimatorWorker.java | 3 - src/depthReadout/DepthControl.java | 5 + src/depthReadout/DepthDataBlock.java | 2 - src/depthReadout/DepthDialog.java | 1 + src/depthReadout/DepthProcess.java | 2 +- src/depthReadout/DepthSidePanel.java | 9 +- src/depthReadout/MccDepthParameters.java | 1 - src/depthReadout/MccDepthSystem.java | 10 +- src/depthReadout/MccDialog.java | 21 +- .../DetectionDisplayControl.java | 1 - .../DetectionDisplayControl2.java | 3 +- .../DetectionGroupDisplay.java | 2 - .../DetectionGroupDisplayFX.java | 7 +- src/detectionPlotFX/DetectionPlotParams.java | 1 - .../DetectionGroupControl.java | 4 +- .../DetectionGroupDataUnit.java | 1 - .../DetectionGroupProcess.java | 9 +- .../DetectionGroupSummary.java | 1 - .../EventBuilderFunctions.java | 5 - src/difar/BScan.java | 14 +- src/difar/BuoyCalibration.java | 3 - src/difar/DIFARCrossingInfo.java | 5 +- src/difar/DIFARTargetMotionInformation.java | 4 +- src/difar/DemuxWorkerMessage.java | 3 - src/difar/DifarBinaryDataSource.java | 5 - src/difar/DifarControl.java | 71 +- src/difar/DifarDataBlock.java | 15 +- src/difar/DifarDataUnit.java | 17 +- src/difar/DifarLocalisation.java | 2 +- src/difar/DifarParameters.java | 18 +- src/difar/DifarProcess.java | 51 +- src/difar/DifarSqlLogging.java | 1 - src/difar/SonobuoyManager.java | 11 +- src/effort/EffortProvider.java | 7 +- src/effortmonitor/EffortControl.java | 24 +- src/effortmonitor/EffortDataBlock.java | 3 - src/effortmonitor/EffortParams.java | 4 +- src/envelopeTracer/EnvelopeControl.java | 1 - src/eventCounter/DataCounter.java | 1 - src/export/ExportOptions.java | 1 + src/export/PamDataUnitExporter.java | 1 - src/export/PamExporterManager.java | 4 +- src/fftFilter/FFTFilter.java | 4 +- src/fftFilter/FFTFilterParams.java | 5 +- src/fftManager/FFT.java | 6 +- src/fftManager/FFTParameters.java | 3 +- src/fftManager/FFTParametersDialog.java | 12 +- src/fftManager/FFTPluginPanelProvider.java | 14 + src/fftManager/FFTPluginParamsDialog.java | 5 +- src/fftManager/FastFFT.java | 4 +- src/fftManager/FileFFTTest.java | 4 +- src/fftManager/PamFFTControl.java | 23 +- src/fftManager/PamFFTProcess.java | 3 +- src/fileOfflineData/OfflineFileControl.java | 10 +- src/fileOfflineData/OfflineFileList.java | 2 +- src/fileOfflineData/OfflineFileMapPoint.java | 2 - .../OfflineFileProgressDialog.java | 2 - src/generalDatabase/BaseAccessSystem.java | 4 - src/generalDatabase/BufferedSQLLogging.java | 2 - src/generalDatabase/DBCommitter.java | 2 +- src/generalDatabase/DBControl.java | 46 +- src/generalDatabase/DBControlSettings.java | 2 +- src/generalDatabase/DBControlUnit.java | 20 +- src/generalDatabase/DBDialog.java | 5 +- src/generalDatabase/DBMapMakingDialog.java | 2 +- src/generalDatabase/DBOfflineDataMap.java | 2 +- .../DBOfflineDataMapPoint.java | 2 +- src/generalDatabase/DBProcess.java | 68 +- src/generalDatabase/DBSidePanel.java | 4 +- src/generalDatabase/DBSpeedTest.java | 6 +- src/generalDatabase/DBSystem.java | 6 +- src/generalDatabase/DBTest.java | 7 +- src/generalDatabase/DatabaseSpeedDialog.java | 21 +- src/generalDatabase/EmptyTableDefinition.java | 8 +- src/generalDatabase/LogModules.java | 1 - src/generalDatabase/LogSettings.java | 9 +- src/generalDatabase/LogXMLSettings.java | 4 +- src/generalDatabase/MSAccessDialogPanel.java | 16 +- src/generalDatabase/MSAccessSystem.java | 13 +- src/generalDatabase/MySQLDialogPanel.java | 11 +- src/generalDatabase/MySQLPaneFX.java | 24 +- src/generalDatabase/MySQLParameters.java | 2 +- src/generalDatabase/MySQLSystem.java | 2 + src/generalDatabase/PamDetectionLogging.java | 2 +- src/generalDatabase/PamTableDefinition.java | 3 +- src/generalDatabase/PamTableItem.java | 2 +- src/generalDatabase/SQLLogging.java | 29 +- src/generalDatabase/ServerBasedSystem.java | 32 +- src/generalDatabase/SuperDetLogging.java | 2 +- src/generalDatabase/TableUtilities.java | 2 +- src/geoMag/TSAGeoMag.java | 5 +- src/gpl/GPLDetectionBlock.java | 1 - src/gpl/GPLParameters.java | 3 +- src/gpl/GPLProcess.java | 4 +- src/gpl/GPLStateDataBlock.java | 1 - src/gpl/GPLStateDataSource.java | 3 +- src/gpl/GPL_Quiet.java | 1 - src/group3dlocaliser/Group3DDataBlock.java | 1 - .../Group3DLocaliserControl.java | 3 +- src/group3dlocaliser/Group3DParams.java | 1 - src/group3dlocaliser/Group3DProcess.java | 4 +- src/hfDaqCard/SmruDaqDialogPanel.java | 11 +- src/hfDaqCard/SmruDaqJNI.java | 19 +- src/hfDaqCard/SmruDaqSystem.java | 16 +- src/ipcomms/Consumer.java | 3 + src/ishmaelComms/Client.java | 24 +- src/ishmaelComms/IshmaelDataControl.java | 3 + src/ishmaelComms/IshmaelGraphics.java | 11 +- src/ishmaelComms/ProcessIshmaelData.java | 8 +- src/jsonStorage/JSONObjectDataSource.java | 2 +- src/landMarks/DatabaseImport.java | 6 +- src/landMarks/LandmarkControl.java | 4 + src/landMarks/LandmarkDataBlock.java | 2 - src/landMarks/LandmarkDialog.java | 1 - src/landMarks/LandmarkGraphics.java | 14 +- src/landMarks/LandmarksDialog.java | 24 +- src/levelMeter/LevelMeterControl.java | 4 +- src/levelMeter/LevelMeterDialog.java | 5 +- src/levelMeter/LevelMeterSidePanel.java | 11 +- .../AbstractCellEditor.java | 28 +- .../CheckRenderer.java | 18 +- .../ConfigurationDialogSettings.java | 2 +- .../LikelihoodDetectionParameters.java | 8 +- .../LikelihoodDetectionParametersDialog.java | 18 +- .../LikelihoodDetectionUnit.java | 26 +- .../LikelihoodFFTController.java | 2 +- .../LikelihoodFFTParameters.java | 4 +- .../NewBandNameDialog.java | 23 +- src/likelihoodDetectionModule/SignalBand.java | 2 - .../TargetConfiguration.java | 2 +- .../TargetConfigurationExporter.java | 6 +- .../TargetConfigurationImporter.java | 7 +- .../TargetConfigurationNameDialog.java | 23 +- src/likelihoodDetectionModule/TreeTable.java | 71 +- .../TreeTableModel.java | 50 +- .../TreeTableModelAdapter.java | 39 +- src/listening/ListeningDialog.java | 4 +- src/listening/ListeningEffortGraphics.java | 15 +- src/listening/ListeningProcess.java | 2 - src/listening/ThingHeardGraphics.java | 15 +- src/listening/ThingHeardTabPanelControl.java | 8 +- src/loc3d_Thode/CrossStationMatcher.java | 4 +- src/loc3d_Thode/GroupDetDataUnit.java | 2 - src/loc3d_Thode/StationQueue.java | 3 +- src/loc3d_Thode/TowedArray3DController.java | 6 + src/loc3d_Thode/TowedArray3DDataUnit.java | 4 - src/loc3d_Thode/TowedArray3DLocalization.java | 8 +- .../TowedArray3DParametersDialog.java | 2 - src/loc3d_Thode/TowedArray3DProcess.java | 21 +- src/loc3d_Thode/TowedArray3DSQLLogging.java | 13 +- src/localTime/LocalTime.java | 4 +- .../LocaliserDisplayControlAWT.java | 2 + src/loggerForms/FormDescription.java | 53 +- src/loggerForms/FormPlotOptionsPanel.java | 10 +- src/loggerForms/FormsAlertSidePanel.java | 1 - src/loggerForms/FormsBinaryIO.java | 2 - src/loggerForms/FormsControl.java | 28 +- src/loggerForms/FormsDataBlock.java | 4 - src/loggerForms/FormsDataDisplayTable.java | 12 +- src/loggerForms/FormsDataUnit.java | 1 - src/loggerForms/FormsHotKeyControl.java | 2 - src/loggerForms/FormsLogging.java | 14 +- src/loggerForms/FormsPlotOptionsDialog.java | 2 +- src/loggerForms/FormsTabPanel.java | 4 - src/loggerForms/FormsTableItem.java | 2 +- src/loggerForms/ItemDescription.java | 2 - src/loggerForms/ItemInformation.java | 11 +- src/loggerForms/LoggerForm.java | 39 +- src/loggerForms/LoggerFormGraphics.java | 45 +- src/loggerForms/LoggerFormPanel.java | 2 - src/loggerForms/LoggerSubTabbedPane.java | 1 + src/loggerForms/UDColName.java | 2 - src/ltsa/LtsaBinaryDataSource.java | 2 - src/ltsa/LtsaControl.java | 6 +- src/ltsa/LtsaDataBlock.java | 1 - src/ltsa/LtsaDialog.java | 2 +- src/ltsa/LtsaModuleHeader.java | 3 +- src/ltsa/LtsaProcess.java | 5 +- src/map3D/Map3DDisplayComponent.java | 2 - .../MapGroupAnnotationHandler.java | 1 - .../MapGroupLocaliserControl.java | 7 +- .../MapGroupOverlayDraw.java | 9 +- .../MapGroupOverlayManager.java | 2 - src/mapgrouplocaliser/MapGrouperDialog.java | 6 +- src/mapgrouplocaliser/MapGrouperSettings.java | 4 +- src/mapgrouplocaliser/MarkGroupDataBlock.java | 1 - src/mapgrouplocaliser/MarkGroupDataUnit.java | 1 - src/mapgrouplocaliser/MarkGroupProcess.java | 12 +- .../MarkGroupSQLLogging.java | 8 - .../ImportTemplateCSV.java | 3 +- .../MTClassifierControl.java | 2 + .../MTClassifierTest.java | 2 +- .../MTControlGUI.java | 10 +- src/matchedTemplateClassifer/MTProcess.java | 3 - .../MatchedTemplateParams.java | 2 +- src/mcc/MccJniInterface.java | 8 - src/mcc/MccPanel.java | 6 +- src/metadata/MetaDataContol.java | 1 - src/metadata/PamguardMetaData.java | 1 - src/meygenturbine/MeygenDataUnit.java | 1 - src/meygenturbine/MeygenGraphics.java | 4 +- src/meygenturbine/MeygenTurbine.java | 1 - src/modbustcp/ModbusTCP.java | 2 +- src/nidaqdev/NIChannelListPanel.java | 6 +- src/nidaqdev/NIDAQProcess.java | 31 +- src/nidaqdev/NIDaqParams.java | 1 - src/nidaqdev/NIFilePlayback.java | 2 +- src/nidaqdev/NIPlaybackSettingsPanel.java | 3 +- src/nidaqdev/Nidaq.java | 12 +- src/nmeaEmulator/NMEAFrontEnd.java | 13 +- src/nmeaEmulator/SerialOutput.java | 3 +- src/noiseBandMonitor/NoiseBandControl.java | 12 +- .../NoiseBandDatagramProvider.java | 2 +- src/noiseBandMonitor/NoiseBandDialog.java | 39 +- src/noiseBandMonitor/NoiseBandProcess.java | 14 +- src/noiseBandMonitor/NoiseBandSettings.java | 2 +- src/noiseMonitor/NoiseBinaryDataSource.java | 2 - src/noiseMonitor/NoiseControl.java | 7 +- src/noiseMonitor/NoiseDataBlock.java | 19 +- src/noiseMonitor/NoiseDialog.java | 10 +- src/noiseMonitor/NoiseDisplayDialog.java | 2 +- src/noiseMonitor/NoiseProcess.java | 8 +- src/noiseMonitor/NoiseSettings.java | 2 +- src/noiseMonitor/NoiseTabPanel.java | 39 +- src/noiseMonitor/ResolutionPanel.java | 3 +- src/noiseMonitor/UserBandDialog.java | 6 +- src/noiseOneBand/OneBandControl.java | 12 +- src/noiseOneBand/OneBandDataBlock.java | 8 +- src/noiseOneBand/OneBandDataSource.java | 1 - src/noiseOneBand/OneBandDialog.java | 21 +- src/noiseOneBand/OneBandDisplayDialog.java | 4 +- src/noiseOneBand/OneBandDisplayPanel.java | 14 +- src/noiseOneBand/OneBandParameters.java | 5 +- src/noiseOneBand/OneBandProcess.java | 7 +- src/noiseOneBand/OneBandPulseProcess.java | 6 +- src/offlineProcessing/DataCopyTask.java | 9 +- src/offlineProcessing/OLProcessDialog.java | 6 +- src/offlineProcessing/OfflineTask.java | 24 +- src/offlineProcessing/OfflineTaskGroup.java | 47 +- src/offlineProcessing/OfflineTaskManager.java | 4 +- src/offlineProcessing/TaskGroupParams.java | 2 +- src/pamMaths/HistogramDisplay.java | 3 +- src/pamMaths/PamVector.java | 2 +- src/pamMaths/WignerTransform.java | 4 +- src/pamScrollSystem/AbstractPamScroller.java | 2 + .../AbstractScrollManager.java | 4 +- src/pamScrollSystem/LoadOptionsDialog.java | 2 +- .../LoadQueueProgressData.java | 1 + src/pamScrollSystem/LoadingDataDialog.java | 6 +- src/pamScrollSystem/PamScrollSlider.java | 3 - src/pamScrollSystem/PamScroller.java | 8 +- src/pamScrollSystem/PamScrollerFX.java | 12 +- src/pamScrollSystem/RangeSpinner.java | 1 + .../ViewerScrollerManager.java | 10 +- src/pamViewFX/PAMGuiFXSettings.java | 2 - src/pamViewFX/PamControlledGUIFX.java | 4 + src/pamViewFX/PamGuiFX.java | 29 +- src/pamViewFX/PamGuiManagerFX.java | 74 +- src/pamViewFX/PamGuiTabFX.java | 6 +- src/pamViewFX/PamSettingsMenuPane.java | 32 +- src/pamViewFX/TabSelectionPane.java | 5 +- src/pamguard/Pamguard.java | 62 +- src/pamguard/PamguardFX.java | 33 +- src/patchPanel/PatchPanelControl.java | 4 + src/patchPanel/PatchPanelDialog.java | 6 +- src/performanceTests/GraphicsDotTest2.java | 1 + src/performanceTests/PerformanceDialog.java | 2 +- src/printscreen/PrintScreenControl.java | 9 +- .../FrequencyAttenutationModel.java | 3 +- src/propagation/PropagationModel.java | 2 +- src/propagation/SphericalPropagation.java | 4 - src/propagation/SurfaceEcho.java | 2 +- src/qa/QAControl.java | 2 +- src/qa/QASequenceDataUnit.java | 1 - src/qa/RandomTestManager.java | 7 +- .../QuickAnnotationModule.java | 6 +- .../QuickAnnotationOverlayDraw.java | 3 +- .../QuickAnnotationParameters.java | 5 +- .../QuickAnnotationParamsDialog.java | 11 +- .../QuickAnnotationSidePanel.java | 11 +- src/radardisplay/RadarDataInfo.java | 1 + src/radardisplay/RadarDisplay.java | 34 +- src/radardisplay/RadarParametersDialog.java | 24 +- src/radardisplay/RadarProjector.java | 6 +- src/ravendata/RavenDataBlock.java | 1 - src/ravendata/RavenDataRow.java | 2 +- src/ravendata/RavenDataUnit.java | 1 - src/ravendata/RavenFileReader.java | 3 +- src/ravendata/RavenProcess.java | 2 +- src/rawDeepLearningClassifier/DLControl.java | 6 +- .../DLControlGUI.java | 4 +- .../DLDownloadManager.java | 5 +- src/reportWriter/PamReportViewer.java | 12 - src/reportWriter/ReportChart.java | 1 - src/reportWriter/ReportFactory.java | 6 +- src/reportWriter/ReportWriterTest.java | 7 - src/rocca/AttTest.java | 2 + src/rocca/RoccaAxis.java | 4 +- src/rocca/RoccaClassifier.java | 11 +- src/rocca/RoccaClassifyThisClick.java | 2 - src/rocca/RoccaClassifyThisEvent.java | 5 - src/rocca/RoccaClickEventList.java | 29 +- src/rocca/RoccaClickTypeDialog.java | 34 +- src/rocca/RoccaContour.java | 7 +- src/rocca/RoccaContourDataBlock.java | 20 +- src/rocca/RoccaContourDataUnit.java | 1 - src/rocca/RoccaControl.java | 34 +- src/rocca/RoccaDataUnit.java | 1 - src/rocca/RoccaDetectionLogger.java | 7 +- src/rocca/RoccaFixParams.java | 5 +- src/rocca/RoccaGraphics.java | 1 + src/rocca/RoccaLoggingDataUnit.java | 3 +- src/rocca/RoccaParameters.java | 2 +- src/rocca/RoccaParametersDialog.java | 54 +- src/rocca/RoccaProcess.java | 46 +- src/rocca/RoccaSidePanel.java | 67 +- src/rocca/RoccaSightingDataUnit.java | 8 +- src/rocca/RoccaSpecPopUp.java | 152 +-- src/rocca/RoccaStatsLogger.java | 7 +- src/rocca/RoccaTrainClassifier.java | 1 - src/rocca/SpectrogramPanel.java | 6 +- src/rockBlock/RockBlockControl.java | 1 + src/rockBlock/RockBlockParams.java | 2 - src/rockBlock/RockBlockParamsDialog.java | 2 - src/rockBlock/RockBlockProcess2.java | 28 +- src/rockBlock/RockBlockSidePanel.java | 21 +- src/seismicVeto/VetoController.java | 4 + src/seismicVeto/VetoDataUnit.java | 1 - src/seismicVeto/VetoParameters.java | 2 +- src/seismicVeto/VetoParametersDialog.java | 2 +- src/seismicVeto/VetoPluginPanelProvider.java | 8 + src/seismicVeto/VetoProcess.java | 17 +- src/serialComms/SerialPortPanel.java | 14 +- src/signal/Hilbert.java | 1 - src/simulatedAcquisition/SimDialogPanel.java | 3 +- src/simulatedAcquisition/SimGraphics.java | 6 +- src/simulatedAcquisition/SimObject.java | 2 +- .../SimObjectDataUnit.java | 19 +- src/simulatedAcquisition/SimObjectDialog.java | 54 +- src/simulatedAcquisition/SimParameters.java | 1 - src/simulatedAcquisition/SimProcess.java | 26 +- .../SimSoundDataUnit.java | 2 +- .../SimSoundsLogging.java | 5 +- src/soundPlayback/FilePlayback.java | 21 +- src/soundPlayback/PlaybackControl.java | 9 +- src/soundPlayback/PlaybackProcess.java | 9 +- src/soundPlayback/SoundCardFilePlayback.java | 10 - src/soundPlayback/SoundCardPlayback.java | 1 + src/soundPlayback/SoundCardPlaybackBase.java | 5 +- src/soundtrap/DWVConverter.java | 18 +- src/soundtrap/DWVReader.java | 3 +- src/soundtrap/ImportBCLDialog.java | 15 +- src/soundtrap/STAcquisitionControl.java | 2 - src/soundtrap/STClickControl.java | 6 +- src/soundtrap/STGroupInfo.java | 8 - src/soundtrap/STToolsControl.java | 2 +- src/soundtrap/STToolsParams.java | 1 - src/soundtrap/STXMLFile.java | 7 +- .../SpecNoiseMethod.java | 5 +- .../SpectrogramNoiseControl.java | 1 + .../SpectrogramNoiseDialog.java | 4 +- .../SpectrogramNoiseDialogPanel.java | 4 +- .../SpectrogramNoiseProcess.java | 30 +- .../SpectrogramNoiseSettings.java | 2 +- .../AbstractTargetMotionInformation.java | 10 +- src/targetMotionModule/EventRotator.java | 6 +- .../TargetMotionControl.java | 27 +- .../TargetMotionLocaliser.java | 10 +- .../TargetMotionResult.java | 7 +- .../TargetMotionSQLLogging.java | 9 +- .../AbstractTimeDelayLocaliser.java | 6 +- src/targetMotionOld/EventRotator.java | 5 +- .../TargetMotionLocalisation.java | 2 +- .../TargetMotionLocaliser.java | 23 +- .../TargetMotionSQLLogging.java | 5 +- src/tethys/Collection.java | 2 +- src/tethys/TethysControl.java | 4 - src/tipOfTheDay/PamTipViewer.java | 4 + src/turbineops/TurbineOperationControl.java | 1 - src/userDisplay/UserDisplayControl.java | 32 +- src/userDisplay/UserDisplayParameters.java | 1 - .../UserDisplayTabPanelControl.java | 12 +- src/userDisplay/UserFramePlots.java | 7 + src/userDisplayFX/UserDisplayProcess.java | 1 - src/videoRangePanel/LocationManager.java | 8 +- src/videoRangePanel/RefractionMethod.java | 8 + src/videoRangePanel/VRControl.java | 34 +- src/videoRangePanel/VRMeasurement.java | 4 +- src/videoRangePanel/VRParameters.java | 2 - src/videoRangePanel/VRSQLLogging.java | 1 - src/videoRangePanel/VRSymbolManager.java | 4 +- src/videoRangePanel/VRTabPane.java | 1 - src/warnings/WarningSystem.java | 1 - src/wavFiles/WavFile.java | 3 +- src/wavFiles/WavFileReader.java | 4 +- src/wavFiles/WavHeader.java | 1 - .../ClassifierHistoryWindow.java | 16 +- src/whistleClassifier/ClassifierInfoArea.java | 2 +- .../FragmentClassifierParams.java | 7 +- src/whistleClassifier/TrainingDataSet.java | 3 - .../WhistleClassificationDialog.java | 16 +- .../WhistleClassificationParameters.java | 2 +- .../WhistleClassifierControl.java | 15 +- .../WhistleClassifierLogging.java | 6 +- .../WhistleClassifierProcess.java | 16 +- .../WhistleClassifierTabPanelControl.java | 6 +- src/whistleDetector/BetterPeakDetector.java | 3 +- src/whistleDetector/PeakDataUnit.java | 1 - src/whistleDetector/PeakDetector.java | 8 +- src/whistleDetector/PeakGraphics.java | 6 +- src/whistleDetector/WhistleControl.java | 6 +- src/whistleDetector/WhistleDetector.java | 7 +- src/whistleDetector/WhistleEventDetector.java | 4 +- src/whistleDetector/WhistleEventGraphics.java | 3 +- src/whistleDetector/WhistleEventLogger.java | 11 +- src/whistleDetector/WhistleGraphics.java | 1 + src/whistleDetector/WhistleLocaliser.java | 1 - src/whistleDetector/WhistleLogger.java | 12 +- .../WhistleParametersDialog.java | 5 +- src/whistleDetector/WhistleShape.java | 1 + src/whistleDetector/WhistleSidePanel.java | 9 +- .../AbstractWhistleDataUnit.java | 6 +- src/whistlesAndMoans/ConnectedRegion.java | 16 +- .../ConnectedRegionDataBlock.java | 10 +- .../FragmentingFragmenter.java | 4 +- src/whistlesAndMoans/SliceData.java | 3 +- src/whistlesAndMoans/StubRemover.java | 3 +- src/whistlesAndMoans/WMDatagramProvider.java | 2 +- .../WMRecordTriggerdialog.java | 9 +- src/whistlesAndMoans/WMRecorderTrigger.java | 4 - src/whistlesAndMoans/WhistleBearingInfo.java | 3 +- .../WhistleBinaryDataSource.java | 3 +- .../WhistleBinaryModuleHeader.java | 1 - src/whistlesAndMoans/WhistleDelays.java | 4 +- .../WhistleJSONDataSource.java | 2 +- .../WhistleLocationDataBlock.java | 1 - src/whistlesAndMoans/WhistleMoanControl.java | 23 +- .../WhistleToneConnectProcess.java | 32 +- src/whistlesAndMoans/WhistleToneDialog.java | 20 +- src/whistlesAndMoans/WhistleToneLogging.java | 2 - .../WhistleToneParameters.java | 3 +- src/zipUnpacker/ZipSettings.java | 2 - src/zipUnpacker/ZipUnpacker.java | 10 +- 964 files changed, 5890 insertions(+), 5952 deletions(-) diff --git a/pom.xml b/pom.xml index 43540c68..a9d058fe 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 org.pamguard Pamguard - 2.02.13 + 2.02.13a Pamguard Pamguard using Maven to control dependencies www.pamguard.org diff --git a/src/AIS/AISBinaryDataSource.java b/src/AIS/AISBinaryDataSource.java index 910ffdcc..4e069541 100644 --- a/src/AIS/AISBinaryDataSource.java +++ b/src/AIS/AISBinaryDataSource.java @@ -13,7 +13,6 @@ import binaryFileStorage.BinaryHeader; import binaryFileStorage.BinaryObjectData; import binaryFileStorage.ModuleFooter; import binaryFileStorage.ModuleHeader; -import binaryFileStorage.PackedBinaryObject; public class AISBinaryDataSource extends BinaryDataSource { diff --git a/src/AIS/AISBugSearch.java b/src/AIS/AISBugSearch.java index 7525ac28..0a31dc49 100644 --- a/src/AIS/AISBugSearch.java +++ b/src/AIS/AISBugSearch.java @@ -32,7 +32,7 @@ public class AISBugSearch { // first comma separates date and NMEA data int chPos = line.indexOf(","); String nmeaData = line.substring(chPos+1); - if (nmeaData.contains("AIVDM") == false) { + if (!nmeaData.contains("AIVDM")) { continue; } System.out.println(nmeaData); diff --git a/src/AIS/AISControl.java b/src/AIS/AISControl.java index ac3cad65..c8b4500f 100644 --- a/src/AIS/AISControl.java +++ b/src/AIS/AISControl.java @@ -44,6 +44,7 @@ public class AISControl extends PamControlledUnit implements PamSettings { super(); this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { AISStringsTable.show(aisControl); } @@ -55,6 +56,7 @@ public class AISControl extends PamControlledUnit implements PamSettings { super(); this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { AISParameters newParams = AISDisplayDialog.showDialog(parentFrame, aisParameters); @@ -70,6 +72,7 @@ public class AISControl extends PamControlledUnit implements PamSettings { super(); this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { AISParameters newParams = AISSettingsDialog.showDialog(parentFrame, aisParameters); if (newParams != null) { @@ -115,14 +118,17 @@ public class AISControl extends PamControlledUnit implements PamSettings { aisProcess.noteNewSettings(); } + @Override public Serializable getSettingsReference() { return aisParameters; } + @Override public long getSettingsVersion() { return AISParameters.serialVersionUID; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { this.aisParameters = ((AISParameters) pamControlledUnitSettings.getSettings()).clone(); diff --git a/src/AIS/AISDataBlock.java b/src/AIS/AISDataBlock.java index b7ccc6cd..956c5d7b 100644 --- a/src/AIS/AISDataBlock.java +++ b/src/AIS/AISDataBlock.java @@ -1,18 +1,16 @@ package AIS; -import generalDatabase.DBControlUnit; -import generalDatabase.SQLTypes; - import java.util.ListIterator; -import pamScrollSystem.ViewLoadObserver; -import nmeaEmulator.EmulatedData; -import nmeaEmulator.NMEAEmulator; import NMEA.AcquireNmeaData; import PamController.masterReference.MasterReferencePoint; import PamUtils.LatLong; import PamguardMVC.PamDataBlock; import PamguardMVC.PamProcess; +import generalDatabase.DBControlUnit; +import generalDatabase.SQLTypes; +import nmeaEmulator.EmulatedData; +import nmeaEmulator.NMEAEmulator; public class AISDataBlock extends PamDataBlock implements NMEAEmulator { @@ -76,7 +74,7 @@ public class AISDataBlock extends PamDataBlock implements NMEAEmula } private boolean wantData(AISDataUnit existingUnit, AISDataUnit newUnit) { - if (aisControl.aisParameters.limitRange == false) { + if (!aisControl.aisParameters.limitRange) { return true; } double range = 0; @@ -133,7 +131,7 @@ public class AISDataBlock extends PamDataBlock implements NMEAEmula @Override public EmulatedData getNextData() { SQLTypes sqlTypes = DBControlUnit.findConnection().getSqlTypes(); - if (getLogging().readNextEmulation(sqlTypes) == false) { + if (!getLogging().readNextEmulation(sqlTypes)) { return null; } // now all data should be in the loggers table definition. diff --git a/src/AIS/AISDataUnit.java b/src/AIS/AISDataUnit.java index 74f6b56d..de915d96 100644 --- a/src/AIS/AISDataUnit.java +++ b/src/AIS/AISDataUnit.java @@ -5,7 +5,6 @@ import java.util.ArrayList; import NMEA.NMEABitArray; import NMEA.NMEADataBlock; -import PamDetection.AbstractLocalisation; import PamDetection.LocContents; import PamUtils.PamCalendar; import PamguardMVC.PamDataUnit; diff --git a/src/AIS/AISGraphics.java b/src/AIS/AISGraphics.java index da43a0f4..1f868d8d 100644 --- a/src/AIS/AISGraphics.java +++ b/src/AIS/AISGraphics.java @@ -7,8 +7,6 @@ import java.awt.Point; import java.awt.Rectangle; import java.util.ArrayList; -import radardisplay.RadarProjector; - import GPS.GpsData; import GPS.GpsDataUnit; import Map.MapRectProjector; @@ -20,14 +18,14 @@ import PamUtils.Coordinate3d; import PamUtils.LatLong; import PamUtils.PamCalendar; import PamView.GeneralProjector; +import PamView.GeneralProjector.ParameterType; import PamView.PamDetectionOverlayGraphics; import PamView.PamKeyItem; import PamView.PamSymbol; import PamView.PamSymbolType; -import PamView.GeneralProjector.ParameterType; import PamView.symbol.SymbolData; import PamguardMVC.PamDataUnit; -import PamguardMVC.debug.Debug; +import radardisplay.RadarProjector; public class AISGraphics extends PamDetectionOverlayGraphics { @@ -73,12 +71,12 @@ public class AISGraphics extends PamDetectionOverlayGraphics { AISStaticData staticData = aisDataUnit.getStaticData(); AISPositionReport positionReport = aisDataUnit.getPositionReport(); - if (aisDataUnit.isComplete() == false) { + if (!aisDataUnit.isComplete()) { return null; } AbstractLocalisation localisation = pamDataUnit.getLocalisation(); - if (localisation == null || localisation.hasLocContent(LocContents.HAS_BEARING | LocContents.HAS_RANGE) == false) return null; + if (localisation == null || !localisation.hasLocContent(LocContents.HAS_BEARING | LocContents.HAS_RANGE)) return null; double bearing = localisation.getBearing(0) * 180 / Math.PI; double range = localisation.getRange(0); Coordinate3d c3d = generalProjector.getCoord3d(bearing, range, 0); diff --git a/src/AIS/AISLogger.java b/src/AIS/AISLogger.java index 01b9c4d2..bf384431 100644 --- a/src/AIS/AISLogger.java +++ b/src/AIS/AISLogger.java @@ -1,22 +1,19 @@ package AIS; -import generalDatabase.DBProcess; -import generalDatabase.PamConnection; -import generalDatabase.PamTableDefinition; -import generalDatabase.PamTableItem; -import generalDatabase.SQLLogging; -import generalDatabase.SQLTypes; - import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.sql.Types; -import javax.naming.ldap.HasControls; - import PamController.PamController; import PamView.dialog.warn.WarnOnce; import PamguardMVC.PamDataUnit; +import generalDatabase.DBProcess; +import generalDatabase.PamConnection; +import generalDatabase.PamTableDefinition; +import generalDatabase.PamTableItem; +import generalDatabase.SQLLogging; +import generalDatabase.SQLTypes; public class AISLogger extends SQLLogging { @@ -167,7 +164,7 @@ public class AISLogger extends SQLLogging { acallSign = (String) callSign.getValue(); ashipName = (String) shipName.getValue(); ashipType = (String) shipType.getValue(); - aetaMillis = sqlTypes.millisFromTimeStamp(eta.getValue()); + aetaMillis = SQLTypes.millisFromTimeStamp(eta.getValue()); // aetaMillis = (Long) eta.getValue(); adraught = (Double) draft.getValue(); adestination = (String) destination.getValue(); diff --git a/src/AIS/AISStaticData.java b/src/AIS/AISStaticData.java index cbf891dc..af9b8889 100644 --- a/src/AIS/AISStaticData.java +++ b/src/AIS/AISStaticData.java @@ -199,7 +199,7 @@ public class AISStaticData extends AISReport implements Serializable, ManagedPar } switch(stationType) { case BASESTATION: - return stationType.BASESTATION.toString(); + return StationType.BASESTATION.toString(); case A: case B: return getVesselTypeAndCargo(type); diff --git a/src/AIS/AISStringsTable.java b/src/AIS/AISStringsTable.java index 536cc5cc..2542e30f 100644 --- a/src/AIS/AISStringsTable.java +++ b/src/AIS/AISStringsTable.java @@ -109,12 +109,13 @@ public class AISStringsTable { class TimerListener implements ActionListener { boolean doneLayout; + @Override public void actionPerformed(ActionEvent ev) { // table. // nmeaTableData.fireTableRowsUpdated(0, 10); aisTableData.fireTableDataChanged(); - if (doneLayout == false && aisTableData.getRowCount() > 0) { + if (!doneLayout && aisTableData.getRowCount() > 0) { doneLayout = true; } } @@ -134,6 +135,7 @@ public class AISStringsTable { /* (non-Javadoc) * @see javax.swing.table.TableModel#getColumnCount() */ + @Override public int getColumnCount() { return tableColumns.length; } @@ -141,6 +143,7 @@ public class AISStringsTable { /* (non-Javadoc) * @see javax.swing.table.TableModel#getRowCount() */ + @Override public int getRowCount() { if (aisDataBlock == null) return 0; //System.out.println(aisDataBlock.getUnitsCount() + " rows in AIS data"); @@ -150,6 +153,7 @@ public class AISStringsTable { /* (non-Javadoc) * @see javax.swing.table.TableModel#getValueAt(int, int) */ + @Override public Object getValueAt(int rowIndex, int columnIndex) { AISDataUnit aisDataUnit = aisDataBlock.getDataUnit(rowIndex, PamDataBlock.REFERENCE_CURRENT); diff --git a/src/AIS/ProcessAISData.java b/src/AIS/ProcessAISData.java index 717dc1db..4c4c73cc 100644 --- a/src/AIS/ProcessAISData.java +++ b/src/AIS/ProcessAISData.java @@ -3,7 +3,6 @@ package AIS; import NMEA.NMEADataBlock; import NMEA.NMEADataUnit; import PamController.PamController; -import PamDetection.AbstractLocalisation; import PamDetection.LocContents; import PamUtils.PamCalendar; import PamView.symbol.StandardSymbolManager; @@ -11,7 +10,6 @@ import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; -import autecPhones.AutecGraphics; /** * Process NMEA data to extract AIS information diff --git a/src/Acquisition/AcquisitionCParameters.java b/src/Acquisition/AcquisitionCParameters.java index c50d23a0..2ccf4397 100644 --- a/src/Acquisition/AcquisitionCParameters.java +++ b/src/Acquisition/AcquisitionCParameters.java @@ -2,7 +2,7 @@ package Acquisition; /** * Very simplified version of the Acquisition parameters - * to be passed over the JNI to the C backend. + * to be passed over the JNI to the C backend. * @author Doug * */ @@ -12,7 +12,7 @@ public class AcquisitionCParameters { public static final int SOUNDCARD = 1; public static final int WAVFILE = 2; public static final int DAQCARD = 3; - + public int deviceType; public int deviceNumber; public int sampleRate; @@ -23,7 +23,7 @@ public class AcquisitionCParameters { public String spareString2 = null; public int[] channelList = new int[MAXCHAN]; public String soundFile; - + public int setDaqType(String daqType) { deviceType = -1; if (daqType.equalsIgnoreCase("Sound Card")) { @@ -37,5 +37,5 @@ public class AcquisitionCParameters { } return deviceType; } - + } diff --git a/src/Acquisition/AcquisitionControl.java b/src/Acquisition/AcquisitionControl.java index 952aabcd..63ef8903 100644 --- a/src/Acquisition/AcquisitionControl.java +++ b/src/Acquisition/AcquisitionControl.java @@ -1,19 +1,19 @@ /* PAMGUARD - Passive Acoustic Monitoring GUARDianship. - * To assist in the Detection Classification and Localisation + * To assist in the Detection Classification and Localisation * of marine mammals (cetaceans). - * - * Copyright (C) 2006 - * + * + * Copyright (C) 2006 + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 3 * of the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -21,10 +21,6 @@ package Acquisition; -import hfDaqCard.SmruDaqSystem; -//import mcc.mccacquisition.MCCDaqSystem; -import mcc.mccacquisition.MCCDaqSystem; - import java.awt.Component; import java.awt.Frame; import java.awt.Window; @@ -38,20 +34,6 @@ import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.SwingConstants; -import org.pamguard.x3.sud.Chunk; -import org.pamguard.x3.sud.SudFileListener; - -import dataGram.DatagramManager; -import dataMap.OfflineDataMapPoint; -import dataMap.filemaps.OfflineFileServer; -import dataPlotsFX.data.TDDataProviderRegisterFX; -import dataPlotsFX.rawDataPlotFX.RawSoundProviderFX; -import pamScrollSystem.ViewLoadObserver; -import simulatedAcquisition.SimProcess; -//import xarraydaq.XArrayDaq; -import asiojni.ASIOSoundSystem; -import asiojni.NewAsioSoundSystem; -import nidaqdev.NIDAQProcess; import Acquisition.filedate.FileDate; import Acquisition.filedate.StandardFileDate; import Acquisition.filetypes.SoundFileTypes; @@ -74,8 +56,6 @@ import PamController.PamGUIManager; import PamController.PamSettingManager; import PamController.PamSettings; import PamController.RawInputControlledUnit; -import PamController.fileprocessing.StoreStatus; -import PamModel.PamModel; import PamModel.SMRUEnable; import PamUtils.FrequencyFormat; import PamUtils.PamCalendar; @@ -91,6 +71,20 @@ import PamguardMVC.PamDataBlock; import PamguardMVC.PamProcess; import PamguardMVC.PamRawDataBlock; import PamguardMVC.dataOffline.OfflineDataLoadInfo; +//import xarraydaq.XArrayDaq; +import asiojni.ASIOSoundSystem; +import asiojni.NewAsioSoundSystem; +import dataGram.DatagramManager; +import dataMap.OfflineDataMapPoint; +import dataMap.filemaps.OfflineFileServer; +import dataPlotsFX.data.TDDataProviderRegisterFX; +import dataPlotsFX.rawDataPlotFX.RawSoundProviderFX; +import hfDaqCard.SmruDaqSystem; +//import mcc.mccacquisition.MCCDaqSystem; +import mcc.mccacquisition.MCCDaqSystem; +import nidaqdev.NIDAQProcess; +import pamScrollSystem.ViewLoadObserver; +import simulatedAcquisition.SimProcess; /** * Main data acquisition control to get audio data from sound cards, @@ -98,9 +92,9 @@ import PamguardMVC.dataOffline.OfflineDataLoadInfo; *

* Uses a plug in architecture to allow new types to be added. This * is done through RegisterDaqType(). - * + * * @author Doug Gillespie - * + * * @see Acquisition.DaqSystem * */ @@ -133,26 +127,26 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet protected FolderInputSystem folderSystem; private DCL5System dclSystem; - + protected FileDate fileDate; - + /** - * The JavaFX GUI for the sound acquisition module. + * The JavaFX GUI for the sound acquisition module. */ private AquisitionGUIFX aquisitionGUIFX; - + private SUDNotificationManager sudNotificationManager; - + protected SoundFileTypes soundFileTypes; - + /** * Main control unit for audio data acquisition. *

* It is possible to instantiate several instances of this, preferably * with different names to simultaneously acquire sound from a number of - * sources such as multiple sound cards, fast ADC boards, etc. + * sources such as multiple sound cards, fast ADC boards, etc. *

- * Each different acquisition device must implement the DaqSystem interface + * Each different acquisition device must implement the DaqSystem interface * and register with each AcquisitionControl. * @param name name of the Acquisition control that will appear in menus. These should be * different for each instance of AcquistionControl since the names are used by PamProcesses @@ -164,13 +158,13 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet super(unitType, name); acquisitionControl = this; - + fileDate = new StandardFileDate(this); pamController = PamController.getInstance(); - + soundFileTypes = new SoundFileTypes(this); - + registerDaqSystem(new SoundCardSystem(this)); if (PlatformInfo.calculateOS() == OSType.WINDOWS) { long tic = System.currentTimeMillis(); @@ -178,13 +172,13 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet registerDaqSystem(new ASIOSoundSystem(this)); toc = System.currentTimeMillis(); if (toc-tic>1000) { - System.out.printf("Registering ASIOSoundSystem took %3.1fs\n", (double)(toc-tic)/1000.); + System.out.printf("Registering ASIOSoundSystem took %3.1fs\n", (toc-tic)/1000.); } tic = System.currentTimeMillis(); registerDaqSystem(new NewAsioSoundSystem(this)); toc = System.currentTimeMillis(); if (toc-tic>1000) { - System.out.printf("Registering NewAsioSoundSystem took %3.1fs\n", (double)(toc-tic)/1000.); + System.out.printf("Registering NewAsioSoundSystem took %3.1fs\n", (toc-tic)/1000.); } } registerDaqSystem(new FileInputSystem(this)); @@ -200,7 +194,7 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet registerDaqSystem(new MCCDaqSystem(this)); // registerDaqSystem(new RonaInputSystem(this)); } - + // load the DAQ Systems found in the plugins folder loadExternalDaqSystems(); @@ -231,7 +225,7 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet } } setSelectedSystem(); - + TDDataProviderRegisterFX.getInstance().registerDataInfo(new RawSoundProviderFX(this)); } @@ -242,22 +236,22 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet acquisitionControl = this; } - + /** * Overloaded constructor - used by the STAcquisitionControl class as a way to call * the PamController.PamControlledUnit constructor without all of the AcquisitionControl * code above - * + * * @param type the type of unit * @param name the name of the unit */ public AcquisitionControl(String type, String name) { super(type, name); } - + private PamPanel systemPanel; - + protected Component getStatusBarComponent() { PamPanel p = new PamPanel(); p.add(statusBarText = new PamLabel()); @@ -275,7 +269,7 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet */ public void registerDaqSystem(DaqSystem daqSystem){ if (systemList == null) { - systemList = new ArrayList(); + systemList = new ArrayList<>(); } systemList.add(daqSystem); //daqSystem.getItemsList(); @@ -283,7 +277,7 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet } public static ArrayList getControllers() { - ArrayList daqControllers = new ArrayList(); + ArrayList daqControllers = new ArrayList<>(); PamControlledUnit pcu; for (int i = 0; i < PamController.getInstance().getNumControlledUnits(); i++) { pcu = PamController.getInstance().getControlledUnit(i); @@ -315,7 +309,7 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet /** * Finds a reference to a given DAQ system based on it's type (e.g. sound card, file, etc. * @param systemType - * @return reference to a DaqSystem object + * @return reference to a DaqSystem object */ public DaqSystem findDaqSystem(String systemType) { @@ -323,8 +317,8 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet if (systemType == null) systemType = acquisitionParameters.daqSystemType; - for (int i = 0; i < systemList.size(); i++) { - if (systemList.get(i).getSystemType().equals(systemType)) return systemList.get(i); + for (DaqSystem element : systemList) { + if (element.getSystemType().equals(systemType)) return element; } return null; @@ -347,6 +341,7 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { AcquisitionParameters newParameters = AcquisitionDialog.showDialog(parentFrame, acquisitionControl, acquisitionParameters); if (newParameters != null) { @@ -378,28 +373,28 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet } lastSelSystem = selSystem; } - - + + /** - * Check array channels have corresponding hydrophones in the array manager. Does - * not open a dialog to warn or fix. - * @return check array channel. False if array manager + * Check array channels have corresponding hydrophones in the array manager. Does + * not open a dialog to warn or fix. + * @return check array channel. False if array manager */ public boolean checkArrayChannels() { int error = arrayChannelsOK(); if (error == ARRAY_ERROR_OK) { return true; } - else return false; - } + else return false; + } /** - * Run a check to see that all read out channels are connected to - * a hydrophone and if not, do something about it. - * @return true if OK, or problem resolved. + * Run a check to see that all read out channels are connected to + * a hydrophone and if not, do something about it. + * @return true if OK, or problem resolved. */ - public boolean checkArrayChannels(Frame parentFrame) { + public boolean checkArrayChannels(Frame parentFrame) { int error = arrayChannelsOK(); if (error == ARRAY_ERROR_OK) { @@ -526,14 +521,17 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet * (non-Javadoc) * @see PamController.PamSettings#GetSettingsReference() */ + @Override public Serializable getSettingsReference() { return acquisitionParameters; } + @Override public long getSettingsVersion() { return AcquisitionParameters.serialVersionUID; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { // if (PamSettingManager.getInstance().isSettingsUnit(this, pamControlledUnitSettings)) { @@ -568,11 +566,11 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet // converts a list of ADC channels to a list of hydrophones public int ChannelsToHydrophones(int channels) { int[] hydrophoneList = getHydrophoneList(); - if (hydrophoneList == null) return channels; // they are the same by default - //In viewer mode sometimes the number of channels in sound aquisition can be lost i.e. - //there are 0 channels. This causes bugs so if occurs return standard list. - if (acquisitionParameters.nChannels==0) return channels; - + // they are the same by default + //In viewer mode sometimes the number of channels in sound aquisition can be lost i.e. + //there are 0 channels. This causes bugs so if occurs return standard list. + if ((hydrophoneList == null) || (acquisitionParameters.nChannels==0)) return channels; + int hydrophones = 0; int channelListIndex; for (int i = 0; i < PamConstants.MAX_CHANNELS; i++) { @@ -585,8 +583,8 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet } /** - * Return a list of which channels are connected to which hydrophones in - * the currentarray. + * Return a list of which channels are connected to which hydrophones in + * the currentarray. * @return List of hydrophone numbers. */ public int[] getHydrophoneList() { @@ -601,15 +599,15 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet acquisitionParameters.setHydrophoneList(hydrophoneList); } /** - * - * finds the ADC channel for a given hydrophone. + * + * finds the ADC channel for a given hydrophone. * Will return -1 if no ADC channel uses this hydrophone - * + * * @param hydrophoneId Number of a hydrophone in a PamArray * @return the ADC channel for the given hydrophone */ public int findHydrophoneChannel(int hydrophoneId) { - // finds the ADC channel for a given hydrophone. + // finds the ADC channel for a given hydrophone. // will return -1 if no ADC channel uses this hydrophone // if no list, assume 1-1 mapping int channelList[] = acquisitionControl.acquisitionParameters.getHardwareChannelList(); @@ -664,7 +662,7 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet /** * Getter for acquisition parameters. - * @return data acquisition parameters. + * @return data acquisition parameters. */ public AcquisitionParameters getAcquisitionParameters() { return acquisitionParameters; @@ -679,6 +677,7 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet /** * @return the offlineFileServer */ + @Override public OfflineFileServer getOfflineFileServer() { return offlineFileServer; } @@ -759,15 +758,15 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet public FileDate getFileDate() { return fileDate; } - + /** * Load any classes that were found in the plugins folder and implement the DaqSystemInterface interface */ public void loadExternalDaqSystems() { - - // get a list of plugins - List daqList = ((PamModel) PamController.getInstance().getModelInterface()).getDaqList(); - + + // get a list of plugins + List daqList = PamController.getInstance().getModelInterface().getDaqList(); + // if there are no plugins, return if (daqList.isEmpty()) { return; @@ -776,7 +775,7 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet registerDaqSystem(dsi.createDAQControl(this)); } } - + /** * Get the available DAQ systems * @return @@ -784,16 +783,16 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet public ArrayList getSystemList() { return this.systemList; } - + /** - * Set the acquisition parameters. - * @param params - the acquisition params to set. + * Set the acquisition parameters. + * @param params - the acquisition params to set. */ public void setAquisitionParams(AcquisitionParameters params) { this.acquisitionParameters=params; - + } - + @Override public PamControlledUnitGUI getGUI(int flag) { if (flag==PamGUIManager.FX) { @@ -805,18 +804,18 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet //TODO swing return null; } - + /** - * Get a summary of the daq settings for the QA module. - * @return summary of DAQ settings. + * Get a summary of the daq settings for the QA module. + * @return summary of DAQ settings. */ public String getDaqSummary() { DaqSystem daqSys = findDaqSystem(null); if (daqSys == null) { return String.format("%s - currently unavailable", acquisitionParameters.daqSystemType); } - String str = String.format("%s - %s, %3.1fVp-p", - acquisitionParameters.daqSystemType, daqSys.getDeviceName(), + String str = String.format("%s - %s, %3.1fVp-p", + acquisitionParameters.daqSystemType, daqSys.getDeviceName(), acquisitionParameters.voltsPeak2Peak); Preamplifier preamp = acquisitionParameters.getPreamplifier(); if (preamp != null) { @@ -825,11 +824,11 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet str += ", Sample Rate " + FrequencyFormat.formatFrequency(acquisitionParameters.sampleRate, true); return str; } - + @Override public String tellModule(String command) { /** - * Get timing summary and return as a string. + * Get timing summary and return as a string. */ switch (command) { case "gettimeinfo": @@ -837,35 +836,35 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet } return super.tellModule(command); } - - + + /** * Get a summary of time information as to what's going on in the DAQ * @return time summary */ private String getTimeInfoString() { /* - * + * sprintf(returned,"%s:%lld,%lld,%ld,%lld",getModuleName(),calendar->getRawStartTime(), calendar->getMillisecondTime(),(int)daqProcess->getSampleRate(),acquiredSamples); */ - return String.format("%s:%d,%d,%d,%d", getUnitName(), PamCalendar.getSessionStartTime(), PamCalendar.getTimeInMillis(), + return String.format("%s:%d,%d,%d,%d", getUnitName(), PamCalendar.getSessionStartTime(), PamCalendar.getTimeInMillis(), (int) acquisitionProcess.getSampleRate(), acquisitionProcess.getTotalSamples(0)); } - + @Override public void pamHasStopped() { acquisitionProcess.pamHasStopped(); } - + @Override public String getModuleSummary(boolean clear) { return getDaqProcess().getRawDataBlock().getSummaryString(clear); } - + /** - * Get the SUD processing notification manager. - * @return SUD processing notification manager. + * Get the SUD processing notification manager. + * @return SUD processing notification manager. */ public SUDNotificationManager getSUDNotificationManager() { if (sudNotificationManager == null) { @@ -873,8 +872,8 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet } return sudNotificationManager; } - - + + @Override public int getRawInputType() { DaqSystem system = acquisitionProcess.getRunningSystem(); @@ -889,17 +888,18 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet public InputStoreInfo getStoreInfo(boolean detail) { return getDaqProcess().getStoreInfo(detail); } - + @Override public boolean setAnalysisStartTime(long startTime) { return getDaqProcess().setAnalysisStartTime(startTime); } - + /** - * Very specific command handler for batch status which will only work - * with the folderinputSystem. + * Very specific command handler for batch status which will only work + * with the folderinputSystem. * @return */ + @Override public String getBatchStatus() { DaqSystem runningSystem = getAcquisitionProcess().getRunningSystem(); if (runningSystem instanceof FolderInputSystem) { @@ -909,5 +909,5 @@ public class AcquisitionControl extends RawInputControlledUnit implements PamSet return null; } } - + } diff --git a/src/Acquisition/AcquisitionDialog.java b/src/Acquisition/AcquisitionDialog.java index cb739bb2..a0cd6ec4 100644 --- a/src/Acquisition/AcquisitionDialog.java +++ b/src/Acquisition/AcquisitionDialog.java @@ -30,87 +30,87 @@ import dataMap.filemaps.OfflineFileDialogPanel; import dataMap.filemaps.OfflineFileParameters; /** - * Main dialog for acquisition control. Takes plug in panels from + * Main dialog for acquisition control. Takes plug in panels from * the various sound systems to give more device specific controls where - * necessary. - * + * necessary. + * * @author Doug Gillespie * */ public class AcquisitionDialog extends PamDialog { private static AcquisitionParameters acquisitionParameters; - + private static AcquisitionDialog singleInstance; - + private static AcquisitionControl acquisitionControl; - + private OfflineFileDialogPanel offlineDAQDialogPanel; - + private PPSDialogPanel ppsDialogPanel; private DaqSystem currentDaqSystem; - + private JComboBox deviceType; - + private JPanel mainPanel; - + private JComponent deviceSpecificPanel; - + private JTextField sampleRate, nChannels, vPeak2Peak; - - private JTextField preampGain; + + private JTextField preampGain; // bandwidth0, bandwidth1; private JCheckBox subtractDC; - + private JTextField dcTimeconstant; - + // public int channelList[] = new int[PamConstants.MAX_CHANNELS]; // // private JLabel panelChannelLabel[] = new JLabel[PamConstants.MAX_CHANNELS]; // private JComboBox panelChannelList[] = new JComboBox[PamConstants.MAX_CHANNELS]; - + private ChannelListPanel standardChannelListPanel = new StandardChannelListPanel(); private ChannelListPanel currentChannelListPanel; private JPanel channelListPanelArea = new JPanel(); //private static AcquisitionParameters acquisitionParameters; //Xiao Yan Deng - + /** - * Main dialog for data acquisition control - *

- * When shown, the dialog contains three main panels. - *

The top one shows - * a list of available DaqSystems (e.g. sound cards, NI cards, etc. + * Main dialog for data acquisition control + *

+ * When shown, the dialog contains three main panels. + *

The top one shows + * a list of available DaqSystems (e.g. sound cards, NI cards, etc. * >p> * The middle panel selected based on the type of DaqSytem and is implemented differently * within each DaqSystem. For instance, the sound card DaqSystem displays a list - * of available sound cards. The file system displays a list of recent files, + * of available sound cards. The file system displays a list of recent files, * systems for other ADC cards mght display a channel selector and gain settings - * specific for a particular device. + * specific for a particular device. *

- * The bottom panel shows the number of channels, sample rate, and device sensitivity. + * The bottom panel shows the number of channels, sample rate, and device sensitivity. * The selected DaqSystem is queried to see if these are fixed, unknown or user entered - * and enables the controls accordingly. If they are set by the DaqSystem, the + * and enables the controls accordingly. If they are set by the DaqSystem, the * DaqSystem should set them explicity using setSampleRate(), setChannels, and - * setVPeak2Peak + * setVPeak2Peak * */ private AcquisitionDialog (Frame parentFrame) { super(parentFrame, "Audio Data Acquisition", false); - + mainPanel = new JPanel(); - + mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.add(DeviceTypePanel()); mainPanel.add(SamplingPanel()); mainPanel.add(CalibrationPanel()); - - nChannels.addActionListener(new NumChannels()); + + nChannels.addActionListener(new NumChannels()); setHelpPoint("sound_processing.AcquisitionHelp.docs.AcquisitionConfiguration"); - + if (PamController.getInstance().getRunMode() == PamController.RUN_PAMVIEW) { JTabbedPane tabbedPane = new JTabbedPane(); offlineDAQDialogPanel = new OfflineFileDialogPanel(acquisitionControl, this); @@ -131,45 +131,45 @@ public class AcquisitionDialog extends PamDialog { setParams(); //Xiao Yan Deng sortChannelLists(); // Xiao Yan Deng } - + /** - * Clear the static instance so that the dialog is - * totally rebuilt next time it's launched. + * Clear the static instance so that the dialog is + * totally rebuilt next time it's launched. */ static public void clearInstance() { singleInstance = null; } /** - * Shows the data acquisition dialog. + * Shows the data acquisition dialog. * @param daqControl the calling AcquisitionControl * @param oldParams current parameters from the AcquisitionControl * @return new parameters selected in the dialog * @see AcquisitionControl */ static public AcquisitionParameters showDialog(Frame parentFrame, AcquisitionControl daqControl, AcquisitionParameters oldParams) { - + acquisitionParameters = oldParams.clone(); - + acquisitionControl = daqControl; // singleInstance = null; - + if (singleInstance == null || singleInstance.getOwner() != parentFrame) { singleInstance = new AcquisitionDialog(parentFrame); } - + singleInstance.setParams(); - + singleInstance.sortChannelLists(); - + singleInstance.setVisible(true); - + singleInstance.sortChannelLists(); // Xiao Yan Deng - + return acquisitionParameters; } - + private void setParams() { - + // fill in the different device types. deviceType.removeAllItems(); int ind = 0; @@ -180,23 +180,23 @@ public class AcquisitionDialog extends PamDialog { } } deviceType.setSelectedIndex(ind); - + newDeviceType(); - + setSampleRate(acquisitionParameters.sampleRate); - + setChannels(acquisitionParameters.nChannels); - + setVPeak2Peak(acquisitionParameters.voltsPeak2Peak); - + // preampGain.setText(String.format("%.1f", acquisitionParameters.preamplifier.getGain())); setPreampGain(acquisitionParameters.preamplifier.getGain()); // bandwidth0.setText(String.format("%.1f", acquisitionParameters.preamplifier.getBandwidth()[0])); // bandwidth1.setText(String.format("%.1f", acquisitionParameters.preamplifier.getBandwidth()[1])); subtractDC.setSelected(acquisitionParameters.subtractDC); dcTimeconstant.setText(String.format("%3.1f", acquisitionParameters.dcTimeConstant)); - - + + if (currentDaqSystem != null) currentDaqSystem.dialogSetParams(); if (currentChannelListPanel != null) { @@ -206,24 +206,24 @@ public class AcquisitionDialog extends PamDialog { if (offlineDAQDialogPanel != null) { offlineDAQDialogPanel.setParams(); } - + if (ppsDialogPanel != null) { ppsDialogPanel.setParams(acquisitionParameters.getPpsParameters()); } - + enableControls(); } /** * Called by the specific DaqSystem to set sample rate when it is set by - * the DaqSystem (for instance FileInputSystem will set sample rate to the - * sample rate of data in the current file. + * the DaqSystem (for instance FileInputSystem will set sample rate to the + * sample rate of data in the current file. * @param sampleRate Current sample rate */ public void setSampleRate(float sampleRate) { this.sampleRate.setText(String.format("%.0f", sampleRate)); } - + /** * Get the sample rate, or null if sample rate is not a valid number * @return sample rate or null @@ -239,15 +239,15 @@ public class AcquisitionDialog extends PamDialog { /** * Called by the specific DaqSystem to set the number of channels when it is set by - * the DaqSystem (for instance FileInputSystem will set it to the - * number of channels in the current file. + * the DaqSystem (for instance FileInputSystem will set it to the + * number of channels in the current file. * @param nChannels Number of channels */ public void setChannels(int nChannels) { this.nChannels.setText(String.format("%d", nChannels)); } - - /** + + /** * @return the number of channels or null if invalid number */ public Integer getChannels() { @@ -258,7 +258,7 @@ public class AcquisitionDialog extends PamDialog { return null; } } - + public void setPreampGain(double gain) { preampGain.setText(String.format("%.1f", gain)); } @@ -266,13 +266,13 @@ public class AcquisitionDialog extends PamDialog { /** * Called by the specific DaqSystem to set the peak to peak voltage range. * This is used for calculating absolute SPL's in various detectors - * the DaqSystem + * the DaqSystem * @param vPeak2Peak Peak to Peak input voltage */ public void setVPeak2Peak(double vPeak2Peak) { this.vPeak2Peak.setText(String.format("%4.3f", vPeak2Peak)); } - + // read parameters back from the dialog @Override public boolean getParams() { @@ -287,15 +287,15 @@ public class AcquisitionDialog extends PamDialog { // bw[0] = Double.valueOf(bandwidth0.getText()); // bw[1] = Double.valueOf(bandwidth1.getText()); // acquisitionParameters.preamplifier.setBandwidth(bw); - - if(!currentDaqSystem.areSampleSettingsOk(acquisitionParameters.nChannels, acquisitionParameters.sampleRate)){ + + if(!currentDaqSystem.areSampleSettingsOk(acquisitionParameters.nChannels, acquisitionParameters.sampleRate)){ currentDaqSystem.showSampleSettingsDialog(this); return false; - } - + } + int nP = getNumChannels(); if (getCurrentDaqSystem().supportsChannelLists() && currentChannelListPanel != null) { - if (currentChannelListPanel.isDataOk() == false) { + if (!currentChannelListPanel.isDataOk()) { return false; } int[] chL = currentChannelListPanel.getChannelList(); @@ -312,7 +312,7 @@ public class AcquisitionDialog extends PamDialog { Ex.printStackTrace(); return false; } - + acquisitionParameters.subtractDC = subtractDC.isSelected(); if (acquisitionParameters.subtractDC) { try { @@ -325,8 +325,8 @@ public class AcquisitionDialog extends PamDialog { return showWarning("The DC bacround subtractino time constant must be greater than zero"); } } - - + + if (offlineDAQDialogPanel != null) { OfflineFileParameters ofp = offlineDAQDialogPanel.getParams(); if (ofp == null) { @@ -346,13 +346,13 @@ public class AcquisitionDialog extends PamDialog { return false; } } - + return true; } - - /** - * Read the latest sample rate value. - * @return sample rate Hz. + + /** + * Read the latest sample rate value. + * @return sample rate Hz. */ public double readSampleRate() { double sr = 0; @@ -365,22 +365,24 @@ public class AcquisitionDialog extends PamDialog { return sr; } - + @Override public void cancelButtonPressed() { acquisitionParameters = null; } @Override public void restoreDefaultSettings() { - + } - + private class NewDeviceType implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { newDeviceType(); } } private class NumChannels implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { sortChannelLists(); } @@ -395,7 +397,7 @@ public class AcquisitionDialog extends PamDialog { deviceType.addActionListener(new NewDeviceType()); return p; } - + /** * Only need to show the channel panel for certain device types, * @@ -415,20 +417,20 @@ public class AcquisitionDialog extends PamDialog { channelListPanelArea.add(standardChannelListPanel.getComponent()); // channelListPanel.setVisible(currentSystem.supportsChannelLists()); } - + } - + private JPanel SamplingPanel () { - + JPanel sP = new PamAlignmentPanel(new BorderLayout(), BorderLayout.WEST); - + JPanel p = new JPanel(); sP.setBorder(new TitledBorder("Sampling")); GridBagLayout layout; - + p.setLayout(layout = new GridBagLayout()); GridBagConstraints constraints = new PamGridBagContraints(); - + constraints.anchor = GridBagConstraints.EAST; constraints.insets = new Insets(2,2,2,2); constraints.fill = GridBagConstraints.NONE; @@ -450,31 +452,31 @@ public class AcquisitionDialog extends PamDialog { constraints.gridx ++; constraints.gridwidth = 2; addComponent(p, new JLabel(" (hit enter)"), constraints); - + sP.add(BorderLayout.NORTH, p); - + // constraints.gridy++; // constraints.gridx = 0; // constraints.gridwidth = 4; standardChannelListPanel = new StandardChannelListPanel(); // addComponent(p, channelListPanel, constraints); - + constraints.insets = new Insets(2,2,2,2); - - + + sP.add(BorderLayout.CENTER, channelListPanelArea); - + return sP; } - -// + +// // private JPanel createStandardChannelListPanel() { // // /* code for select channel */ // /* -// * put this in a separate panel so it can be hidden if -// * it's not possible to change these parameters. -// * +// * put this in a separate panel so it can be hidden if +// * it's not possible to change these parameters. +// * // * Text information updated DG & JG 12/8/08 // */ // JPanel cP; @@ -494,7 +496,7 @@ public class AcquisitionDialog extends PamDialog { // s += "
So be aware. If you've put a plug into socket 1,
you probably want to select channel 0, etc."; // for (int i = 0; i < PamConstants.MAX_CHANNELS; i++){ //Xiao Yan Deng // //for (int i = 0; i < getNumChannels(); i++){ -// +// // if (i%2 ==0){ // c2.gridx = 0; // c2.gridy ++; @@ -509,28 +511,28 @@ public class AcquisitionDialog extends PamDialog { // else { // spaceStr = ""; // } -// addComponent(cP, panelChannelLabel[i] = +// addComponent(cP, panelChannelLabel[i] = // new JLabel(spaceStr + " SW Ch " + i + " = HW Ch "), c2); // c2.gridx ++; // //constraints.gridwidth = 2; // addComponent(cP, panelChannelList[i] = new JComboBox(), c2); // panelChannelLabel[i].setToolTipText(s); // panelChannelList[i].setToolTipText(s); -// +// // } // return cP; // } -// +// private JPanel CalibrationPanel() { - + JPanel p = new PamAlignmentPanel(BorderLayout.WEST) ; - + p.setBorder(new TitledBorder("Calibration")); GridBagLayout layout; - + p.setLayout(layout = new GridBagLayout()); GridBagConstraints constraints = new PamGridBagContraints(); - + constraints.anchor = GridBagConstraints.WEST; constraints.insets = new Insets(2,2,2,2); constraints.gridx = 0; @@ -588,13 +590,13 @@ public class AcquisitionDialog extends PamDialog { enableControls(); } }); - String t = "Some input devices have a fixed (DC) offset in their voltage measurement.\n" + + String t = "Some input devices have a fixed (DC) offset in their voltage measurement.\n" + "Subtracting this off can lead to improved PAMGuard performance."; dcTimeconstant.setToolTipText(t); subtractDC.setToolTipText(t); - - - + + + return p; } @@ -604,10 +606,10 @@ public class AcquisitionDialog extends PamDialog { /** - * + * * @return the number of channels */ - int getNumChannels() { + int getNumChannels() { try { return Integer.valueOf(nChannels.getText()); } @@ -616,7 +618,7 @@ public class AcquisitionDialog extends PamDialog { } } - private void sortChannelLists() { + private void sortChannelLists() { // first of all, only show the ones in range of nPanels if (currentChannelListPanel != null) { currentChannelListPanel.setNumChannels(getNumChannels()); @@ -624,64 +626,64 @@ public class AcquisitionDialog extends PamDialog { pack(); } - - + + /** - * Called when the device type changes. Loads the appropriate panel for + * Called when the device type changes. Loads the appropriate panel for * the newly selected DaqSystem into the dialog * - */ + */ private void newDeviceType() { - + int devNumber = deviceType.getSelectedIndex(); - + if (devNumber < 0) return; - + // remove the old type specific panel and replace it with a new one. if (deviceSpecificPanel != null) { mainPanel.remove(deviceSpecificPanel); } currentDaqSystem = acquisitionControl.systemList.get(devNumber); - + deviceSpecificPanel = currentDaqSystem.getDaqSpecificDialogComponent(this); if (deviceSpecificPanel != null) { mainPanel.add(deviceSpecificPanel, 1); currentDaqSystem.dialogSetParams(); } - + sampleRate.setEnabled(currentDaqSystem.getMaxSampleRate() != DaqSystem.PARAMETER_FIXED); nChannels.setEnabled(currentDaqSystem.getMaxChannels() != DaqSystem.PARAMETER_FIXED); vPeak2Peak.setEnabled(currentDaqSystem.getPeak2PeakVoltage(0) == DaqSystem.PARAMETER_UNKNOWN); - + showHideChannelPanel(); - + if (currentChannelListPanel != null) { currentChannelListPanel.setNumChannels(getNumChannels()); currentChannelListPanel.setParams(acquisitionParameters.getHardwareChannelList()); } - + pack(); } public DaqSystem getCurrentDaqSystem() { return currentDaqSystem; } - + /** - * + * * @return the sample rate component */ public JTextField getSampleRateComponent() { return sampleRate; } - + /** - * - * @return the nChannels component. + * + * @return the nChannels component. */ public JTextField getnChanComponent() { return nChannels; } - - - + + + } diff --git a/src/Acquisition/AcquisitionLogging.java b/src/Acquisition/AcquisitionLogging.java index 447ab78a..1d46864f 100644 --- a/src/Acquisition/AcquisitionLogging.java +++ b/src/Acquisition/AcquisitionLogging.java @@ -1,20 +1,16 @@ package Acquisition; +import java.sql.Types; + +import PamguardMVC.PamDataBlock; +import PamguardMVC.PamDataUnit; import generalDatabase.PamTableDefinition; import generalDatabase.PamTableItem; import generalDatabase.SQLLogging; import generalDatabase.SQLTypes; -import java.sql.Types; - -import PamUtils.PamCalendar; -import PamguardMVC.PamDataBlock; -import PamguardMVC.PamDataUnit; -import PamguardMVC.debug.Debug; -import clickTrainDetector.CTDataUnit; - /** - * Very simple concrete implementation of SQLLogging to log the starts + * Very simple concrete implementation of SQLLogging to log the starts * and stops of PAMGUARD in the database. * @author Doug Gillespie * @@ -22,16 +18,16 @@ import clickTrainDetector.CTDataUnit; public class AcquisitionLogging extends SQLLogging { AcquisitionControl acquisitionControl; - + PamTableDefinition tableDef; - - PamTableItem adcClockTime, adcClockMillis, rawADCTime, status, reason, daqSystemType, sampleRate, nChannels, voltsPeak2Peak, + + PamTableItem adcClockTime, adcClockMillis, rawADCTime, status, reason, daqSystemType, sampleRate, nChannels, voltsPeak2Peak, gain, duration, clockError, samples, gSamples, GPSPPSTime, serverTime, daqSystemName; - + public AcquisitionLogging(PamDataBlock pamDataBlock, AcquisitionControl acquisitionControl) { super(pamDataBlock); this.acquisitionControl = acquisitionControl; - + tableDef = new PamTableDefinition(pamDataBlock.getDataName(), UPDATE_POLICY_OVERWRITE); tableDef.addTableItem(adcClockTime = new PamTableItem("ADC Clock", Types.TIMESTAMP, "Time based on PC clock and samples since last PC clock read")); tableDef.addTableItem(adcClockMillis = new PamTableItem("ADC Clock millis", Types.INTEGER, "Millis for adcClockTime if not supported by database")); @@ -50,7 +46,7 @@ public class AcquisitionLogging extends SQLLogging { tableDef.addTableItem(duration = new PamTableItem("duration", Types.DOUBLE, "Time since start in seconds")); tableDef.addTableItem(clockError = new PamTableItem("clockError", Types.DOUBLE, "Clock error in milliseconds")); tableDef.addTableItem(serverTime = new PamTableItem("Server Time", Types.TIMESTAMP, "Time taken from an Internet time server")); - + setTableDefinition(tableDef); } @@ -68,8 +64,8 @@ public class AcquisitionLogging extends SQLLogging { adcClockMillis.setValue((int)(ds.getAdcMilliseconds()%1000)); rawADCTime.setValue(sqlTypes.getTimeStamp(ds.getRawADCMillis())); long s = ds.getSamples(); - gSamples.setValue((long)(s/1000000000)); - samples.setValue((long) (s%1000000000)); + gSamples.setValue(s/1000000000); + samples.setValue(s%1000000000); Long gT = ds.getGpsPPSMilliseconds(); if (gT == null) { GPSPPSTime.setValue(null); @@ -84,7 +80,7 @@ public class AcquisitionLogging extends SQLLogging { sampleRate.setValue(ds.getSampleRate()); nChannels.setValue(ds.getNChannels()); voltsPeak2Peak.setValue(ds.getVoltsPeak2Peak()); - gain.setValue((float) daqParameters.getPreamplifier().getGain()); + gain.setValue((float) daqParameters.getPreamplifier().getGain()); duration.setValue(ds.getSampleDuration()); clockError.setValue(ds.clockError); Long sTime = ds.getServerTime(); @@ -95,55 +91,55 @@ public class AcquisitionLogging extends SQLLogging { serverTime.setValue(sqlTypes.getTimeStamp(sTime)); } } - + @Override protected DaqStatusDataUnit createDataUnit(SQLTypes sqlTypes, long timeMilliseconds, int databaseIndex) { - -// Debug.out.println("DaqStatusDataUnit sql Logging: " + PamCalendar.formatDateTime(timeMilliseconds) + " ADC: " +adcClockTime.getDeblankedStringValue() + " Samples: " + samples.getLongValue()); - - long adcClock ; + +// Debug.out.println("DaqStatusDataUnit sql Logging: " + PamCalendar.formatDateTime(timeMilliseconds) + " ADC: " +adcClockTime.getDeblankedStringValue() + " Samples: " + samples.getLongValue()); + + long adcClock ; if (adcClockTime.getDeblankedStringValue()!=null) { - adcClock = SQLTypes.millisFromTimeStamp(adcClockTime.getValue()); + adcClock = SQLTypes.millisFromTimeStamp(adcClockTime.getValue()); } else { - adcClock =-1; + adcClock =-1; } - + Long adcRawClock = SQLTypes.millisFromTimeStamp(rawADCTime.getValue()); if (adcRawClock == null) { adcRawClock = 0L; } - //long adcClockMillisVal = adcClockMillis.getLongValue(); - long gpsPPSClock ; + //long adcClockMillisVal = adcClockMillis.getLongValue(); + long gpsPPSClock ; if (GPSPPSTime.getDeblankedStringValue()!=null) { - gpsPPSClock = SQLTypes.millisFromTimeStamp(GPSPPSTime.getValue()); + gpsPPSClock = SQLTypes.millisFromTimeStamp(GPSPPSTime.getValue()); } else { - gpsPPSClock=1; + gpsPPSClock=1; } - Long samplesVal = samples.getLongValue(); - - String reasonVal = reason.getDeblankedStringValue(); - String statusVal = status.getDeblankedStringValue(); + Long samplesVal = samples.getLongValue(); - double clockErrVal = clockError.getDoubleValue(); + String reasonVal = reason.getDeblankedStringValue(); + String statusVal = status.getDeblankedStringValue(); + + double clockErrVal = clockError.getDoubleValue(); double durationValue = duration.getDoubleValue(); - + String systemName = daqSystemName.getStringValue(); - -// DaqStatusDataUnit(long timeMilliseconds, long adcMilliseconds, long samples, Long gpsPPSMillis, -// String status, String reason, + +// DaqStatusDataUnit(long timeMilliseconds, long adcMilliseconds, long samples, Long gpsPPSMillis, +// String status, String reason, // AcquisitionParameters daqParameters, double duration, double clockError) - -// Debug.out.println("DaqStatusDataUnit sql Logging: " + samplesVal); - - DaqStatusDataUnit dataUnit = new DaqStatusDataUnit(timeMilliseconds, adcClock, adcRawClock, samplesVal, gpsPPSClock, - statusVal, reasonVal, null, systemName, durationValue, clockErrVal) ; - - return dataUnit; - + +// Debug.out.println("DaqStatusDataUnit sql Logging: " + samplesVal); + + DaqStatusDataUnit dataUnit = new DaqStatusDataUnit(timeMilliseconds, adcClock, adcRawClock, samplesVal, gpsPPSClock, + statusVal, reasonVal, null, systemName, durationValue, clockErrVal) ; + + return dataUnit; + } - + } diff --git a/src/Acquisition/AcquisitionParameters.java b/src/Acquisition/AcquisitionParameters.java index a9c02698..1de7e968 100644 --- a/src/Acquisition/AcquisitionParameters.java +++ b/src/Acquisition/AcquisitionParameters.java @@ -1,7 +1,5 @@ package Acquisition; -import hfDaqCard.SmruDaqSystem; - import java.io.Serializable; import java.lang.reflect.Field; @@ -13,58 +11,59 @@ import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet.ParameterSetType; import PamModel.parametermanager.PrivatePamParameterData; import PamguardMVC.PamConstants; +import hfDaqCard.SmruDaqSystem; public class AcquisitionParameters implements Serializable, Cloneable, ManagedParameters { static final long serialVersionUID = 2; - + String daqSystemType = "Sound Card"; - + public float sampleRate = 48000; - + public int nChannels = 2; - + public double voltsPeak2Peak = 5; - + private transient boolean isNetReceive; - + /** - * List of channels data are acquired from (not necessarily 0,1,2, etc.) + * List of channels data are acquired from (not necessarily 0,1,2, etc.) * With NI boards, this has become a pain since if multiple boards are - * used, there may be repeats within this list. + * used, there may be repeats within this list. */ private int channelList[];// = new int[PamConstants.MAX_CHANNELS]; //Xiao Yan Deng - + public Preamplifier preamplifier = new Preamplifier(0, new double[] {0, 20000}); /** * Hydrophone list is a short list of length equal to the number of channels, so if - * your channel list does not start at zero, you have to first use the - * channelListIndexes before using this lookup table. + * your channel list does not start at zero, you have to first use the + * channelListIndexes before using this lookup table. */ private int[] hydrophoneList; - + /** * list of indexes for each hardware channel in channelList (i.e. opposite LUT) */ - transient int[] channelListIndexes; - + transient int[] channelListIndexes; + private PPSParameters ppsParameters; public boolean subtractDC; - public double dcTimeConstant; // time constant for DC subtraction in seconds. - + public double dcTimeConstant; // time constant for DC subtraction in seconds. + public AcquisitionParameters() { getHardwareChannelList(); // automatically create a channellist. /* * this won't work since the constructor is only ever called for a new config, so if an old - * config is loaded, this will never be called. + * config is loaded, this will never be called. */ isNetReceive = PamController.getInstance().getRunMode() == PamController.RUN_NETWORKRECEIVER; } - + @Override public AcquisitionParameters clone() { try { @@ -106,7 +105,7 @@ public class AcquisitionParameters implements Serializable, Cloneable, ManagedPa /** * Gets a list of hydrophones from channel Indexes (not channel numbers) - * @return list of hydrophones. + * @return list of hydrophones. */ public int[] getHydrophoneList() { if ((hydrophoneList == null || hydrophoneList.length < nChannels) && nChannels > 0) { @@ -119,15 +118,15 @@ public class AcquisitionParameters implements Serializable, Cloneable, ManagedPa } /** - * Set a hydrophone list. + * Set a hydrophone list. * @param hydrophoneList */ public void setHydrophoneList(int[] hydrophoneList) { this.hydrophoneList = hydrophoneList; } - /** - * Gets a hydrophone number from a channel number (not channel index) + /** + * Gets a hydrophone number from a channel number (not channel index) * @param channel software channel number * @return a specific hydrophone number from the selected array */ @@ -146,18 +145,15 @@ public class AcquisitionParameters implements Serializable, Cloneable, ManagedPa if (channel < 0) { return channel; } - if (channelListIndexes.length <= channel) return -1; + // this line no longer needed now that software channels are alwasy 0,1,2,3 - // even if hardware channels are more random. + // even if hardware channels are more random. // channel = this.channelListIndexes[channel]; //channel = this.channelListIndexes[channel]; - if (channel < 0) { - return -1; - } - if (hydrophoneList.length <= channel) return -1; + if ((channelListIndexes.length <= channel) || (channel < 0) || (hydrophoneList.length <= channel)) return -1; return hydrophoneList[channel]; } - + public int getNChannels() { return nChannels; } @@ -165,7 +161,7 @@ public class AcquisitionParameters implements Serializable, Cloneable, ManagedPa public void setNChannels(int channels) { nChannels = channels; } - + public int[] getNChannelList(){ return channelList; } @@ -196,7 +192,7 @@ public class AcquisitionParameters implements Serializable, Cloneable, ManagedPa /** * Gets / creates a list of hardware channels used.

- * i.e. converts from channel indexes to channel numbers. + * i.e. converts from channel indexes to channel numbers. * @return List of channel numbers */ public int[] getHardwareChannelList() { @@ -221,7 +217,7 @@ public class AcquisitionParameters implements Serializable, Cloneable, ManagedPa this.channelList = channelList; sortChannelListIndexes(); } - + public void setChannelList(int index, int channelNumber) { getHardwareChannelList(); if (index >= channelList.length) { @@ -230,7 +226,7 @@ public class AcquisitionParameters implements Serializable, Cloneable, ManagedPa channelList[index] = channelNumber; sortChannelListIndexes(); } - + /** * Creates a default channel list 0,1,2,3,4 etc. */ @@ -241,19 +237,19 @@ public class AcquisitionParameters implements Serializable, Cloneable, ManagedPa } sortChannelListIndexes(); } - + /** - * Gets the channel number for a particular channel index. + * Gets the channel number for a particular channel index. * @param index channel index * @return channel number */ public int getChannelList(int index) { return getHardwareChannelList()[index]; } - + /** - * Gets the complete list of channel indexes. - * @return list of channel indexes. + * Gets the complete list of channel indexes. + * @return list of channel indexes. */ public int[] getChannelListIndexes() { if (channelListIndexes == null) { @@ -261,7 +257,7 @@ public class AcquisitionParameters implements Serializable, Cloneable, ManagedPa } return channelListIndexes; } - + /** * Sets the channel list indeces * @param channelListIndexes @@ -269,11 +265,11 @@ public class AcquisitionParameters implements Serializable, Cloneable, ManagedPa public void setChannelListIndexes(int[] channelListIndexes) { this.channelListIndexes = channelListIndexes; } - + /** - * Gets the channel index for a particular hardware channel + * Gets the channel index for a particular hardware channel * @param channel - * @return channel index or -1 if it doesn't exist. + * @return channel index or -1 if it doesn't exist. */ public int getChannelListIndexes(int channel) { if (channelListIndexes == null) { @@ -284,10 +280,10 @@ public class AcquisitionParameters implements Serializable, Cloneable, ManagedPa } else return -1; } - + /** * Creates a set of easily accessible channel indexes - * which can be used to convert from channel numbers to + * which can be used to convert from channel numbers to * channel index e.g. used channel numbers might be 3 and 4 * so the listIndexes will be {-1 -1 -1 0 1] */ @@ -297,7 +293,7 @@ public class AcquisitionParameters implements Serializable, Cloneable, ManagedPa for (int i = 0; i < nChannels; i++) { max = Math.max(max, channelList[i]); } - + channelListIndexes = new int[max+1]; for (int i = 0; i < channelListIndexes.length; i++) { channelListIndexes[i] = -1; diff --git a/src/Acquisition/AcquisitionProcess.java b/src/Acquisition/AcquisitionProcess.java index c95a49ad..cf66b74b 100644 --- a/src/Acquisition/AcquisitionProcess.java +++ b/src/Acquisition/AcquisitionProcess.java @@ -1,19 +1,13 @@ package Acquisition; -import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; import javax.swing.Timer; import Acquisition.gpstiming.PPSDetector; import Acquisition.gpstiming.PPSParameters; import Array.ArrayManager; -import Array.Hydrophone; import Array.PamArray; import Array.Preamplifier; import Filters.Filter; @@ -23,40 +17,29 @@ import Filters.FilterType; import Filters.IirfFilter; import PamController.DataInputStore; import PamController.InputStoreInfo; -import PamController.OfflineDataStore; -import PamController.PamControlledUnit; import PamController.PamController; -import PamController.fileprocessing.ReprocessManager; -import PamController.fileprocessing.StoreStatus; import PamController.status.BaseProcessCheck; import PamController.status.ProcessCheck; import PamDetection.RawDataUnit; import PamUtils.PamCalendar; import PamUtils.PamUtils; -import PamUtils.time.ntp.PamNTPTime; -import PamUtils.time.ntp.PamNTPTimeException; import PamguardMVC.PamConstants; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; -import PamguardMVC.PamObserver; import PamguardMVC.PamProcess; import PamguardMVC.PamRawDataBlock; -import PamguardMVC.RequestCancellationObject; import PamguardMVC.dataOffline.OfflineDataLoadInfo; -import dataGram.DatagramManager; -import dataMap.OfflineDataMapPoint; import pamScrollSystem.AbstractScrollManager; -import pamScrollSystem.ViewLoadObserver; /** - * Data acquisition process for all types of input device. - * This arranges the output data block and starts and stops the - * device in the detected DaqSystem. Each DaqSystem should + * Data acquisition process for all types of input device. + * This arranges the output data block and starts and stops the + * device in the detected DaqSystem. Each DaqSystem should * operate a different thread to read the device / file and add its - * data to the volatile Vector newDataUnits. AcquisitonProcess will - * poll newDataUnits on a timer and when new data is found, put that - * data into PamDataUnits and PamRawDataBlocks to be sent out for + * data to the volatile Vector newDataUnits. AcquisitonProcess will + * poll newDataUnits on a timer and when new data is found, put that + * data into PamDataUnits and PamRawDataBlocks to be sent out for * processing. *

* @author Doug Gillespie @@ -66,9 +49,9 @@ import pamScrollSystem.ViewLoadObserver; * */ public class AcquisitionProcess extends PamProcess { - - public static final int LASTDATA = 2; // don't use zero since need to see if no notification has been received. - + + public static final int LASTDATA = 2; // don't use zero since need to see if no notification has been received. + public static final int FIRSTDATA = 1; AcquisitionControl acquisitionControl; @@ -90,23 +73,23 @@ public class AcquisitionProcess extends PamProcess { private volatile boolean bufferOverflow = false; private Timer restartTimer; - + private Filter sampleRateErrorFilter; - + private double totalExtraSamples; private DaqStatusDataUnit previousDaqStatus = null; private long millisecondSampleOffset; - + private AudioDataQueue newDataQueue = new AudioDataQueue(); private final double sqrt2 = Math.sqrt(2.0); private Object runingSynchObject = new Object(); - + private PPSDetector ppsDetector; - + private DCFilter dcFilter; protected AcquisitionProcess(AcquisitionControl acquisitionControl) { @@ -116,16 +99,16 @@ public class AcquisitionProcess extends PamProcess { acquisitionProcess = this; this.acquisitionControl = acquisitionControl; - + ppsDetector = new PPSDetector(this); String name = String.format("Raw input data from %s", acquisitionControl.getUnitName()); //addOutputDataBlock(rawDataBlock = new PamRawDataBlock(name, this, - // PamUtils.makeChannelMap(acquisitionControl.acquisitionParameters.nChannels), + // PamUtils.makeChannelMap(acquisitionControl.acquisitionParameters.nChannels), // acquisitionControl.acquisitionParameters.sampleRate)); - addOutputDataBlock(rawDataBlock = new PamRawDataBlock(name, this, + addOutputDataBlock(rawDataBlock = new PamRawDataBlock(name, this, PamUtils.makeChannelMap(acquisitionControl.acquisitionParameters.nChannels,acquisitionControl.acquisitionParameters.getHardwareChannelList()), acquisitionControl.acquisitionParameters.sampleRate)); @@ -134,11 +117,11 @@ public class AcquisitionProcess extends PamProcess { // daqStatusDataBlock. addOutputDataBlock(daqStatusDataBlock); daqStatusDataBlock.SetLogging(new AcquisitionLogging(daqStatusDataBlock, acquisitionControl)); - + /** * We really don't wand the binary data source set for normal ops since it stops the data getting - * written to the database by default. When using certain Network receiver settings, they use binary - * type data, so do need it. this will therefore be configured from the network receiver when required. + * written to the database by default. When using certain Network receiver settings, they use binary + * type data, so do need it. this will therefore be configured from the network receiver when required. */ // daqStatusDataBlock.setBinaryDataSource(new DaqStatusBinaryStore(daqStatusDataBlock, acquisitionControl)); AbstractScrollManager.getScrollManager().addToSpecialDatablock(daqStatusDataBlock); @@ -151,14 +134,14 @@ public class AcquisitionProcess extends PamProcess { // stallCheckTimer = new Timer(60000, new StallCheckAction()); bufferTimer = new Timer(1000, new BufferTimerTest()); - + ProcessCheck pp = new BaseProcessCheck(this, null, 0, 10); setProcessCheck(pp); - + /** - * Make a filter to low pass filter the sample rate errors. these + * Make a filter to low pass filter the sample rate errors. these * will eventually get used to update / fix estimated RawDataunit milliseconds - * times based on the total sample offset compared to UTC. + * times based on the total sample offset compared to UTC. */ FilterParams filterParams = new FilterParams(); filterParams.filterBand = FilterBand.LOWPASS; @@ -205,27 +188,27 @@ public class AcquisitionProcess extends PamProcess { // private long daqCheckInterval = 60 * 1000; @Override public void pamStart() { - // called by PamController. Don't actually start if - // we're in network receive mode. + // called by PamController. Don't actually start if + // we're in network receive mode. - if (systemPrepared == false) return; + if (!systemPrepared) return; - newDataQueue.clearList(); // clear this first to make sure nothing new comes in. + newDataQueue.clearList(); // clear this first to make sure nothing new comes in. // before starting, clear all old data rawDataBlock.clearAll(); - + sampleRateErrorFilter.prepareFilter(); totalExtraSamples = 0; millisecondSampleOffset = 0; - + if (runningSystem == null) { return; } - + boolean netRX = PamController.getInstance().getRunMode() == PamController.RUN_NETWORKRECEIVER; if (!netRX) { - if (runningSystem.startSystem(acquisitionControl) == false) return; + if (!runningSystem.startSystem(acquisitionControl)) return; } // Log a data unit asap to get the start time long daqStartedTime = PamCalendar.getTimeInMillis(); @@ -243,7 +226,7 @@ public class AcquisitionProcess extends PamProcess { acquisitionControl.fillStatusBarText(); bufferTimer.start(); - + // stallCheckTimer.start(); /** @@ -255,13 +238,13 @@ public class AcquisitionProcess extends PamProcess { addServerTime(daqStatusDataUnit); daqStatusDataBlock.addPamData(daqStatusDataUnit); previousDaqStatus = daqStatusDataUnit; - + /* * All systems work in much the same way - set up a timer to look for new data which is * put there by a separate thread that gets the data from it's source. - * + * */ - + bufferOverflow = false; // daqCheckTime = PamCalendar.getTimeInMillis(); if (!netRX) { @@ -270,9 +253,9 @@ public class AcquisitionProcess extends PamProcess { t.start(); } } - + private boolean addServerTime(DaqStatusDataUnit daqStatusDataUnit) { - if (runningSystem.isRealTime() == false) { + if (!runningSystem.isRealTime()) { return false; } // PamNTPTime pamNTPTime = PamNTPTime.getInstance(); @@ -301,7 +284,7 @@ public class AcquisitionProcess extends PamProcess { // called by PamController. // stop the running system - not the selected system since // this may have changed - + restartTimer.stop(); // stallCheckTimer.stop(); pamStop(""); @@ -316,15 +299,15 @@ public class AcquisitionProcess extends PamProcess { // Boolean s = isStalled(); //// System.out.printf("%s Stall state = %s\n", PamCalendar.formatDateTime(System.currentTimeMillis()), s.toString()); // } -// +// // } - + private long simpleSamplesToMilliseconds(long samples) { return (long) (samples * 1000. / sampleRate) + PamCalendar.getSessionStartTime(); } - + /** - * Periodic logging of ADC status into database. + * Periodic logging of ADC status into database. */ private void logRunningStatus() { if (runningSystem == null) return; @@ -334,16 +317,16 @@ public class AcquisitionProcess extends PamProcess { long adcMillis = this.absSamplesToMilliseconds(samplesRead); long simpleTime= simpleSamplesToMilliseconds(samplesRead); DaqStatusDataUnit ds = new DaqStatusDataUnit(PamCalendar.getTimeInMillis(), adcMillis, simpleTime, - samplesRead, null, "Continue", "", + samplesRead, null, "Continue", "", acquisitionControl.acquisitionParameters, runningSystem.getSystemName(), duration, clockError); addServerTime(ds); if (runningSystem.isRealTime()) { - long pcTime = PamCalendar.getTimeInMillis(); // time hopefully corrected from NTP or GPs. + long pcTime = PamCalendar.getTimeInMillis(); // time hopefully corrected from NTP or GPs. millisecondSampleOffset = (long) sampleRateErrorFilter.runFilter(pcTime-simpleTime); } // System.out.printf("Current ADC clock correction at %s %d millis\n" , PamCalendar.formatDateTime(pcTime), millisecondSampleOffset); - -// System.out.printf("Sample rate estimated at %s, %dMSamples = %7.2fHz, filtered err %3.1fHz, TotExtraSamples = %3.1f, offest %d mills\n", + +// System.out.printf("Sample rate estimated at %s, %dMSamples = %7.2fHz, filtered err %3.1fHz, TotExtraSamples = %3.1f, offest %d mills\n", // PamCalendar.formatDateTime(ds.getTimeMilliseconds()), samplesRead/1000000, estSampleRate, filteredEstSampleRateError, totalExtraSamples, millisecondSampleOffset); // if (previousDaqStatus != null) { //// Double trueSampleRate = ds.calculateTrueSampleRate(previousDaqStatus); @@ -353,14 +336,14 @@ public class AcquisitionProcess extends PamProcess { // totalExtraSamples += extExtraSamples; // millisecondSampleOffset = (long) (totalExtraSamples / getSampleRate() * 1000.); // /* -// * Extra samples +ve means that more samples have arrived than we expected. Therefore the estimate of the +// * Extra samples +ve means that more samples have arrived than we expected. Therefore the estimate of the // * UTC of the next RawDataunit is going to be too high, so we'll need to subtract off the millisecondSampleOffset -// * when we create a raw data unit. +// * when we create a raw data unit. // */ //// if (trueSampleRate != null) { -// System.out.printf("Sample rate estimated at %s, %dMSamples = %7.2fHz, filtered err %3.1fHz, TotExtraSamples = %3.1f, offest %d mills\n", +// System.out.printf("Sample rate estimated at %s, %dMSamples = %7.2fHz, filtered err %3.1fHz, TotExtraSamples = %3.1f, offest %d mills\n", // PamCalendar.formatDateTime(ds.getTimeMilliseconds()), samplesRead/1000000, estSampleRate, filteredEstSampleRateError, totalExtraSamples, millisecondSampleOffset); -// +// //// } // } daqStatusDataBlock.addPamData(ds); @@ -376,11 +359,11 @@ public class AcquisitionProcess extends PamProcess { long adcMillis = this.absSamplesToMilliseconds(samplesRead); long simpleMillis = this.simpleSamplesToMilliseconds(samplesRead); DaqStatusDataUnit ds = new DaqStatusDataUnit(PamCalendar.getTimeInMillis(), adcMillis, simpleMillis, - samplesRead, null, "Stop", reason, + samplesRead, null, "Stop", reason, acquisitionControl.acquisitionParameters, runningSystem.getSystemName(), duration, clockError); addServerTime(ds); daqStatusDataBlock.addPamData(ds); - + runningSystem.stopSystem(acquisitionControl); keepRunning = false; @@ -397,19 +380,19 @@ public class AcquisitionProcess extends PamProcess { double duration = (double) edgeSample / getSampleRate(); double clockError = checkClockSpeed(edgeSample, 0); DaqStatusDataUnit ds = new DaqStatusDataUnit(timeNow, adcMillis, simpleMillis, - edgeSample, gpsUTC, "GPSPPS", "", + edgeSample, gpsUTC, "GPSPPS", "", acquisitionControl.acquisitionParameters, runningSystem.getSystemName(), duration, clockError); ds.setServerTime(serverTime); daqStatusDataBlock.addPamData(ds); - + } public void acquisitionStopped() { - /* - * can get called by a DaqSystem thread just as it exits to + /* + * can get called by a DaqSystem thread just as it exits to * say that DAQ has stopped. Only needs to be implemented for things - * like files which will stop themselves. Can also be implemented for + * like files which will stop themselves. Can also be implemented for * other devices which might stop accidentally (e.g. UDP sources) */ @@ -427,9 +410,9 @@ public class AcquisitionProcess extends PamProcess { } } - // call acquireData one last time to make sure that - // all data have been flushed from the buffer. - if (bufferOverflow == false) { + // call acquireData one last time to make sure that + // all data have been flushed from the buffer. + if (!bufferOverflow) { acquireData(); } else { @@ -441,7 +424,7 @@ public class AcquisitionProcess extends PamProcess { /* * runningSystem needs to be set null here since the call to PamController.PamStop() * will call back to pamStop and we'll get an infinite loop ! - * Synch on runingSynchObject to stop crash during shut down of system. + * Synch on runingSynchObject to stop crash during shut down of system. */ synchronized(runingSynchObject) { runningSystem = null; @@ -459,21 +442,21 @@ public class AcquisitionProcess extends PamProcess { // PamController.pamStop will wait for that to happen, so if we call pamStop // first it will hang. sendSourceNotification(LASTDATA, null); - + // stop all controlled units // 2021-05-14 removed - not sure why this is here, and it's just causing PamController.pamStop to get called twice // acquisitionControl.pamController.pamStop(); } - + /** * Called from AcquisitionControl when all observer thread data queues * have been emptied and processing has stopped */ protected void pamHasStopped() { - - newDataQueue.clearList(); // clear this first to make sure nothing new comes in. - + + newDataQueue.clearList(); // clear this first to make sure nothing new comes in. + if (runningSystem == null){ runningSystem = acquisitionControl.findDaqSystem(null); } @@ -481,12 +464,12 @@ public class AcquisitionProcess extends PamProcess { runningSystem.daqHasEnded(); } } - + /** * Let all observers of the raw data know that the daq status has changed. Right now, * this is intended to let everyone know that the Daq has started or stopped, so that * the various threads can clean themselves up. - * + * * @param type the type of change (see global fields at the top of this class) * @param object (null for now, but added in case we need to pass something later) */ @@ -496,7 +479,7 @@ public class AcquisitionProcess extends PamProcess { rawDataBlock.getPamObserver(i).receiveSourceNotification(type, object); } } - + @Override public boolean prepareProcessOK() { super.prepareProcessOK(); @@ -512,9 +495,9 @@ public class AcquisitionProcess extends PamProcess { lastStallCheckTime = 0; lastStallCheckSamples = 0; lastStallState = false; - + if (acquisitionControl.acquisitionParameters.subtractDC) { - dcFilter = new DCFilter(acquisitionControl.acquisitionParameters.sampleRate, + dcFilter = new DCFilter(acquisitionControl.acquisitionParameters.sampleRate, acquisitionControl.acquisitionParameters.dcTimeConstant, PamConstants.MAX_CHANNELS); } else { @@ -524,20 +507,20 @@ public class AcquisitionProcess extends PamProcess { setSampleRate(acquisitionControl.acquisitionParameters.sampleRate, true); super.prepareProcess(); - + ppsDetector.prepare(acquisitionControl.acquisitionParameters); if (runningSystem != null) { pamStop(); } dataBlockLength = -1; - + runningSystem = acquisitionControl.findDaqSystem(null); if (runningSystem == null) { System.out.printf("Unable to find daq system %s\n", acquisitionControl.acquisitionParameters.daqSystemType); return; } - + systemPrepared = runningSystem.prepareSystem(acquisitionControl); } @@ -559,7 +542,7 @@ public class AcquisitionProcess extends PamProcess { /** * Set up channels when using a channel list - note * that hardware channels are no longer passed through the system - * so software channels are now used throughout. + * so software channels are now used throughout. * @param numChannels * @param channelList */ @@ -567,7 +550,7 @@ public class AcquisitionProcess extends PamProcess { acquisitionControl.acquisitionParameters.nChannels = numChannels; acquisitionControl.acquisitionParameters.setChannelList(channelList); rawDataBlock.setChannelMap(PamUtils.makeChannelMap(numChannels)); - // rawDataBlock.setChannelMap(PamUtils.makeChannelMap(numChannels, channelList)); + // rawDataBlock.setChannelMap(PamUtils.makeChannelMap(numChannels, channelList)); } /* @@ -585,6 +568,7 @@ public class AcquisitionProcess extends PamProcess { class BufferTimerTest implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { acquisitionControl.fillStatusBarText(); @@ -609,7 +593,7 @@ public class AcquisitionProcess extends PamProcess { e.printStackTrace(); } - if (acquireData() == false) { + if (!acquireData()) { break; } } @@ -641,12 +625,13 @@ public class AcquisitionProcess extends PamProcess { /** - * Used to restart after a buffer overflow. + * Used to restart after a buffer overflow. * @author Doug Gillespie * */ class RestartTimerFunction implements ActionListener { + @Override public void actionPerformed(ActionEvent arg0) { System.out.println("PAMGUARD cannot process data at the required rate and is restarting"); @@ -675,8 +660,8 @@ public class AcquisitionProcess extends PamProcess { int channel = PamUtils.getSingleChannel(threadDataUnit.getChannelBitmap()); // long unitMillis = absSamplesToMilliseconds(threadDataUnit.getStartSample()) - millisecondSampleOffset; - long unitMillis = (long) simpleSamplesToMilliseconds(threadDataUnit.getStartSample()) + millisecondSampleOffset; - newDataUnit = new RawDataUnit(unitMillis, + long unitMillis = simpleSamplesToMilliseconds(threadDataUnit.getStartSample()) + millisecondSampleOffset; + newDataUnit = new RawDataUnit(unitMillis, threadDataUnit.getChannelBitmap(), threadDataUnit.getStartSample(), threadDataUnit.getSampleDuration()); if (dcFilter != null) { @@ -688,23 +673,23 @@ public class AcquisitionProcess extends PamProcess { // calculated in the call to setRawData, to dB. newDataUnit.setCalculatedAmlitudeDB(rawAmplitude2dB(newDataUnit.getMeasuredAmplitude(), PamUtils.getSingleChannel(threadDataUnit.getChannelBitmap()), false)); - + PPSParameters ppsParams = acquisitionControl.acquisitionParameters.getPpsParameters(); if (ppsParams.useGpsPPS & newDataUnit.getChannelBitmap() == 1< statusInterval) { logRunningStatus(); @@ -726,39 +711,39 @@ public class AcquisitionProcess extends PamProcess { // * buffer with a 10s maximum // */ // if (needRestart() && finalFlush == false) { - // - // System.out.println(PamCalendar.formatDateTime(System.currentTimeMillis()) + + // + // System.out.println(PamCalendar.formatDateTime(System.currentTimeMillis()) + // " : Emergency sound system restart due to buffer overflow"); // pamStop("Buffer overflow in sound system"); - // + // // newDataUnits.clear(); - // + // // acquisitionStopped(); - // + // // restartTimer.start(); - // + // // return; // } - // + // // long now = PamCalendar.getTimeInMillis(); // if (now - daqCheckTime >= daqCheckInterval) { // double duration = (double) totalSamples[0] / getSampleRate(); // double clockError = checkClockSpeed(totalSamples[0], 1); - // DaqStatusDataUnit ds = new DaqStatusDataUnit(PamCalendar.getTimeInMillis(), "Continue", "Check", + // DaqStatusDataUnit ds = new DaqStatusDataUnit(PamCalendar.getTimeInMillis(), "Continue", "Check", // runningSystem.getSystemName(), getSampleRate(), acquisitionControl.acquisitionParameters.nChannels, // acquisitionControl.acquisitionParameters.voltsPeak2Peak, duration, clockError); // daqStatusDataBlock.addPamData(ds); // daqCheckTime = now; // } - // + // // /* - // * The blocks should be in pairs, so there should generally + // * The blocks should be in pairs, so there should generally // * be two blocks there every time this gets called. Adjust timing // * automatically to deal with just about any data rate. Start at a low // * value though since file reading only adds blocks if there are none - // * there - so would never reduce the delay ! - // * - // * Don't do this if it isn't a real time process since we want to + // * there - so would never reduce the delay ! + // * + // * Don't do this if it isn't a real time process since we want to // * keep going as fast as possible // */ //// trials++; @@ -766,25 +751,25 @@ public class AcquisitionProcess extends PamProcess { //// if (trials == 15 || counts >= 40) { //// if (trials > counts * 3) { //// daqTimer.setDelay(Math.max(10,daqTimer.getDelay() * 5 / 4)); - //// System.out.println("Increasing timer delay to " + daqTimer.getDelay() + " ms"); + //// System.out.println("Increasing timer delay to " + daqTimer.getDelay() + " ms"); //// } //// else if (counts > trials * 2) { //// daqTimer.setDelay(Math.max(1,daqTimer.getDelay() * 2 / 3)); - //// System.out.println("Reducing timer delay to " + daqTimer.getDelay() + " ms"); + //// System.out.println("Reducing timer delay to " + daqTimer.getDelay() + " ms"); //// } //// trials = counts = 0; //// } // } - // + // // RawDataUnit newDataUnit, threadDataUnit; - // + // // int readCount = 0; // while (!newDataUnits.isEmpty()) { // // threadDataUnit = newDataUnits.remove(0); - // + // // int channel = PamUtils.getSingleChannel(threadDataUnit.getChannelBitmap()); - // newDataUnit = new RawDataUnit(absSamplesToMilliseconds(threadDataUnit.getStartSample()), + // newDataUnit = new RawDataUnit(absSamplesToMilliseconds(threadDataUnit.getStartSample()), // threadDataUnit.getChannelBitmap(), threadDataUnit.getStartSample(), // threadDataUnit.getDuration()); // newDataUnit.setRawData(threadDataUnit.getRawData(), true); @@ -800,13 +785,13 @@ public class AcquisitionProcess extends PamProcess { // maxLevel = Math.max(maxLevel, Math.abs(rawData[i])); // } // levelSamples += rawData.length; - // + // // // // about every 5 seconds, check the buffer isn't filling // if (newDataUnit.getAbsBlockIndex() % (50 * acquisitionControl.acquisitionParameters.nChannels) == 0) { // double buffer = getBufferEstimate(newDataUnit.getStartSample() + newDataUnit.getDuration()); // if (buffer > 3) { - // System.out.println(PamCalendar.formatDateTime(System.currentTimeMillis()) + + // System.out.println(PamCalendar.formatDateTime(System.currentTimeMillis()) + // " : Emergency sound system restart due to Buffer overflow type 2"); // pamStop("Type 2 Buffer overflow in sound system"); // @@ -819,7 +804,7 @@ public class AcquisitionProcess extends PamProcess { // return; // } // } - // + // // // about every minute, or every 1200 blocks, check the timing // if ((newDataUnit.getAbsBlockIndex()+1) % (600 * acquisitionControl.acquisitionParameters.nChannels) == 0) { // checkClockSpeed(newDataUnit.getStartSample() + newDataUnit.getDuration(), 1); @@ -829,7 +814,7 @@ public class AcquisitionProcess extends PamProcess { // if (++readCount >= acquisitionControl.acquisitionParameters.nChannels * 4 && finalFlush == false) { // break; // } - // + // // } // if (levelSamples >= sampleRate * acquisitionControl.acquisitionParameters.nChannels * 2) { // acquisitionControl.setStatusBarLevel(maxLevel); @@ -854,7 +839,7 @@ public class AcquisitionProcess extends PamProcess { double soundCardError = (sampleSeconds - clockSeconds) / clockSeconds * 100; int missingSamples = (int) ((sampleSeconds - clockSeconds) * getSampleRate()); // if (print >= 2 || (print >= 1 && shouldPrintSoundCardError(soundCardError))) { -// System.out.println(String.format("%s at %3.2f%% PC clock speed after %d seconds (about %3.1f seconds or %d samples)", +// System.out.println(String.format("%s at %3.2f%% PC clock speed after %d seconds (about %3.1f seconds or %d samples)", // runningSystem.getSystemName(), soundCardError, (int)clockSeconds, (sampleSeconds - clockSeconds), missingSamples)); // } return soundCardError; @@ -881,19 +866,19 @@ public class AcquisitionProcess extends PamProcess { { // if (newDataUnits == null) return 0; // if (dataBlockLength <= 0) return 0; -// double blocksPerSecond = getSampleRate() / dataBlockLength * +// double blocksPerSecond = getSampleRate() / dataBlockLength * // acquisitionControl.acquisitionParameters.nChannels; // return newDataUnits.size() / blocksPerSecond; return (double) newDataQueue.getQueuedSamples(0) / getSampleRate(); - + } /** - * - * @return the maximum number of seconds of data which can be buffered. + * + * @return the maximum number of seconds of data which can be buffered. * This used to be fixed at 3, but now that individual raw data blocks contain >> 1s * of data for low frequency DAQ, this can be exceeded in a single - * data unit, which causes continual resets. + * data unit, which causes continual resets. */ public double getMaxBufferSeconds() { /** @@ -908,7 +893,7 @@ public class AcquisitionProcess extends PamProcess { System.out.printf("Restart because %ss buffer > %ss maximum\n", getBufferSeconds(), getMaxBufferSeconds()); return true; } - return false; + return false; } @Override @@ -931,20 +916,20 @@ public class AcquisitionProcess extends PamProcess { /** * Convert a raw amplitude to dB re 1 micropascal based on * calibration information held in the AcquisitionController - * + * * @param rawAmplitude raw amplitude (should be -1 < rawAmplitude < 1) * @return amplitude in dB re 1 uPa. */ public double rawAmplitude2dB(double rawAmplitude, int channel, boolean fast){ channel = checkSingleChannel(channel); - + double constantTerm; if (fast && fixedAmplitudeConstantTerm[channel] != 0) { constantTerm = fixedAmplitudeConstantTerm[channel]; } else { - constantTerm = getAmplitudeConstantTerm(channel); + constantTerm = getAmplitudeConstantTerm(channel); } double vp2p = getPeak2PeakVoltage(channel); @@ -952,7 +937,7 @@ public class AcquisitionProcess extends PamProcess { /* * Need an extra divide by 2 in here since the standard scaling of PAMGUARD * data is -1 to +1, so data really needed to be scaled against half - * the peak to peak voltage. + * the peak to peak voltage. */ double dB = 20 * Math.log10(rawAmplitude * vp2p / 2) - constantTerm; @@ -964,15 +949,15 @@ public class AcquisitionProcess extends PamProcess { } /** - * Check it's a single channel and not a channel map. + * Check it's a single channel and not a channel map. * This fundamentally messed up the amplitude calculations when the - * channels were > 2 since it was only taking the number of the lowest set - * bit. So if a genuine channel was sent, rather than a channel map with a + * channels were > 2 since it was only taking the number of the lowest set + * bit. So if a genuine channel was sent, rather than a channel map with a * single set channel, it messed up. Have made this function redundant - * and we need to be 100% sure that all amplitude calculations are sent a - * channel number not a bitmap with a single set channel. + * and we need to be 100% sure that all amplitude calculations are sent a + * channel number not a bitmap with a single set channel. * @param channel - * @return single channel if it seemed to be a bitmap. + * @return single channel if it seemed to be a bitmap. */ private int checkSingleChannel(int channel) { return channel; @@ -986,7 +971,7 @@ public class AcquisitionProcess extends PamProcess { /** * Some devices may be setting this per channel. * @param swChannel software channel number - * @return peak to peak voltage range. + * @return peak to peak voltage range. */ public double getPeak2PeakVoltage(int swChannel) { @@ -1005,17 +990,17 @@ public class AcquisitionProcess extends PamProcess { /** * A Constant used for fast amplitude calculations when things * like preamp gain will remain constant. Contains a constant - * term in the SPL calculations bases on preamp gains and - * hdrophone sensitivities. - * Changes to be channel specific since with multi threading it goes horribly - * wrong if different channels have different sensitivities. + * term in the SPL calculations bases on preamp gains and + * hdrophone sensitivities. + * Changes to be channel specific since with multi threading it goes horribly + * wrong if different channels have different sensitivities. */ private double[] fixedAmplitudeConstantTerm = new double[PamConstants.MAX_CHANNELS]; - + private DaqSystem ampSystem; /** - * Gets the fixedAmplitudeConstantTerm based on channel and hydrophone This is - * the hydrophone sensitivity + all gains + ADC sensitivity in counts / volt. + * Gets the fixedAmplitudeConstantTerm based on channel and hydrophone This is + * the hydrophone sensitivity + all gains + ADC sensitivity in counts / volt. * @param channel = single software channel * @return constant term for amplitude calculations */ @@ -1027,7 +1012,7 @@ public class AcquisitionProcess extends PamProcess { if (hydrophoneChannel < 0) hydrophoneChannel = 0; // Hydrophone hydrophone = array.getHydrophone(hydrophoneChannel); double hSens = array.getHydrophoneSensitivityAndGain(hydrophoneChannel); - + Preamplifier preamp = acquisitionControl.acquisitionParameters.preamplifier; if (getRunningSystem() != null) { ampSystem = getRunningSystem(); @@ -1037,14 +1022,14 @@ public class AcquisitionProcess extends PamProcess { } double xtra = 0; if (ampSystem != null) { - xtra = ampSystem.getChannelGain(channel); + xtra = ampSystem.getChannelGain(channel); } return (hSens + preamp.getGain() + xtra); } - + /** * Prepares for fast amplitude calculations - * @param channel number i.e. 0 - 31, NOT a bitmap. + * @param channel number i.e. 0 - 31, NOT a bitmap. */ public double prepareFastAmplitudeCalculation(int channel) { channel = checkSingleChannel(channel); @@ -1055,7 +1040,7 @@ public class AcquisitionProcess extends PamProcess { * Convert a raw amplitude to dB re 1 micropascal based on * calibration information held in the AcquisitionController * for an array of double data - * + * * @param rawAmplitude raw amplitude (should be -1 < rawAmplitude < 1) * @param channel channel number (MUST be a channel 0 - 31, not a sequence number) * @return amplitude in dB re 1 uPa. @@ -1073,10 +1058,10 @@ public class AcquisitionProcess extends PamProcess { * dB re 1 micropacal / sqrt(Hz). * @param fftAmplitude magnitude of the fft data (not the magnitude squared !) * @param channel channel number (MUST be a channel, and not a sequence number) - * @param sampleRate sample rate - this needs to be sent, since this function is - * often called from decimated data, in which case the sample rate will be different. - * @param fftLength length of the FFT (needed for Parsevals correction) - * @param isSquared is magnitude squared (in which case sqrt will be taken). + * @param sampleRate sample rate - this needs to be sent, since this function is + * often called from decimated data, in which case the sample rate will be different. + * @param fftLength length of the FFT (needed for Parsevals correction) + * @param isSquared is magnitude squared (in which case sqrt will be taken). * @param fast use fast calculation (after call to prepareFastAmplitudeCalculation(...). * @return spectrum level amplitude. */ @@ -1096,13 +1081,13 @@ public class AcquisitionProcess extends PamProcess { double dB = rawAmplitude2dB(fftAmplitude, channel, fast); return dB; } - + /** * Convert the amplitude of fft data into a spectrum level measurement in * dB re 1 micropacal / sqrt(Hz) for an array of double values. * @param fftAmplitude magnitude of the fft data (not the magnitude squared !) * @param channel the channel number (MUST be a channel, and not a sequence number) - * @param fftLength lengthof the fft (needed for Parsevals correction) + * @param fftLength lengthof the fft (needed for Parsevals correction) * @return spectrum level amplitude. */ public double[] fftAmplitude2dB(double[] fftAmplitude, int channel, float sampleRate, int fftLength, boolean isSquared){ @@ -1118,11 +1103,11 @@ public class AcquisitionProcess extends PamProcess { * Convert the amplitude of fft data into a level measurement in * dB re 1 micropacal / sqrt(Hz). *

- * Note that this function differs from fftAmplitude2dB in that this one used the - * FFT length to correct for Parsevals theorum and integratin over the length of the - * FFT, but it does NOT convert the result to a spectrum level measurement. + * Note that this function differs from fftAmplitude2dB in that this one used the + * FFT length to correct for Parsevals theorum and integratin over the length of the + * FFT, but it does NOT convert the result to a spectrum level measurement. * @param fftAmplitude magnitude of the fft data (not the magnitude squared !) - * @param fftLength lengthof the fft (needed for Parsevals correction) + * @param fftLength lengthof the fft (needed for Parsevals correction) * @return level amplitude in dB */ public double fftBandAmplitude2dB(double fftAmplitude, int channel, int fftLength, boolean isSquared, boolean fast){ @@ -1143,10 +1128,10 @@ public class AcquisitionProcess extends PamProcess { } /** - * Converts dB in micropascal to ADC counts on a 0 - 1 scale. - * @param channel channel number, i.e. channel index 0 - 31 NOT a bitmap. + * Converts dB in micropascal to ADC counts on a 0 - 1 scale. + * @param channel channel number, i.e. channel index 0 - 31 NOT a bitmap. * @param dBMuPascal db in micropascal - * @return ADC counts on a 0-1 scale. + * @return ADC counts on a 0-1 scale. */ public double dbMicropascalToSignal(int channel, double dBMuPascal) { double db = dBMuPascal + getAmplitudeConstantTerm(channel); @@ -1171,9 +1156,9 @@ public class AcquisitionProcess extends PamProcess { @Override public int getOfflineData(OfflineDataLoadInfo offlineLoadDataInfo) { - + // System.out.println("AquisitionProcess: GetofflineData: " + offlineLoadDataInfo.getCurrentObserver().getObserverName()) - + if (acquisitionControl.getOfflineFileServer() == null) { return PamDataBlock.REQUEST_NO_DATA; } @@ -1184,11 +1169,11 @@ public class AcquisitionProcess extends PamProcess { return PamDataBlock.REQUEST_NO_DATA; } } - + /** - * Get the total number of samples acquired by a particular channel. + * Get the total number of samples acquired by a particular channel. * @param iChannel - * @return number of samples. + * @return number of samples. */ public long getTotalSamples(int iChannel) { return newDataQueue.getSamplesIn(iChannel); @@ -1205,8 +1190,8 @@ public class AcquisitionProcess extends PamProcess { long lastStallCheckSamples = 0; boolean lastStallState = false; /** - * - * @return if the acquisition system seems to have stopped acquiring data. + * + * @return if the acquisition system seems to have stopped acquiring data. */ public boolean isStalled() { long samples = getTotalSamples(0); @@ -1214,13 +1199,13 @@ public class AcquisitionProcess extends PamProcess { long stallCheckSecs = getStallCheckSeconds(); long runTime = now - PamCalendar.getSessionStartTime(); if (runTime < stallCheckSecs * 2000 && samples == 0) { - return false; // give it plenty of time to get started. + return false; // give it plenty of time to get started. } - if (now - lastStallCheckTime < (stallCheckSecs*1000) && lastStallState == false) { + if (now - lastStallCheckTime < (stallCheckSecs*1000) && !lastStallState) { return lastStallState; } double aveSR = (double) (samples - lastStallCheckSamples) / (double) (now-lastStallCheckTime) * 1000.; - // check on lastStallCheckTime > 0 will stop this doing anything the first time through when it will always get a stupid small value. + // check on lastStallCheckTime > 0 will stop this doing anything the first time through when it will always get a stupid small value. boolean stalled = (aveSR < getSampleRate() * .7 && lastStallCheckTime > 0); if (stalled) { System.out.println(String.format("System stalled samples %d, lastCallSamples %d, mean SR = %5.1f", samples, lastStallCheckSamples, aveSR)); @@ -1232,7 +1217,7 @@ public class AcquisitionProcess extends PamProcess { } /** - * Get the DAQ status data block. Contains data unit with info on sample numbers etc. + * Get the DAQ status data block. Contains data unit with info on sample numbers etc. * @return the daqStatusDataBlock */ public PamDataBlock getDaqStatusDataBlock() { @@ -1261,6 +1246,6 @@ public class AcquisitionProcess extends PamProcess { } - + } diff --git a/src/Acquisition/AudioDataQueue.java b/src/Acquisition/AudioDataQueue.java index 2b5a764e..d5c71d0b 100644 --- a/src/Acquisition/AudioDataQueue.java +++ b/src/Acquisition/AudioDataQueue.java @@ -9,40 +9,40 @@ import PamUtils.PamUtils; import PamguardMVC.PamConstants; /** - * Better management of new data list. + * Better management of new data list. *

- * This is a queue that sits between individual acquisition systems and + * This is a queue that sits between individual acquisition systems and * the main Acquisition process. DAQ systems write data units into this list - * in their own thread and data are read out in a different thread. - * @author Doug Gillespie. + * in their own thread and data are read out in a different thread. + * @author Doug Gillespie. * */ public class AudioDataQueue { private volatile List newDataUnits; - + private long samplesIn[] = new long[PamConstants.MAX_CHANNELS]; private long samplesOut[] = new long[PamConstants.MAX_CHANNELS]; - + public AudioDataQueue() { newDataUnits = Collections.synchronizedList(new LinkedList()); } - + public synchronized void clearList() { newDataUnits.clear(); for (int i = 0; i < PamConstants.MAX_CHANNELS; i++) { samplesIn[i] = samplesOut[i] = 0; } } - + public synchronized boolean hasData() { return !newDataUnits.isEmpty(); } - + public synchronized int getQueueSize() { return newDataUnits.size(); } - + public synchronized RawDataUnit removeOldest() { RawDataUnit ru = newDataUnits.remove(0); if (ru != null) { @@ -54,17 +54,17 @@ public class AudioDataQueue { public void addNewData(RawDataUnit newDataUnit) { addNewData(newDataUnit, PamUtils.getSingleChannel(newDataUnit.getChannelBitmap())); - + } - + public synchronized void addNewData(RawDataUnit newDataUnit, int channel) { samplesIn[channel] += newDataUnit.getSampleDuration(); newDataUnits.add(newDataUnit); } - + /** - * Get the total number of samples in the data queue based on the difference between - * the last sample put in and the last taken out. + * Get the total number of samples in the data queue based on the difference between + * the last sample put in and the last taken out. * @param channel channel number * @return number of stored samples in queue */ diff --git a/src/Acquisition/ChannelListPanel.java b/src/Acquisition/ChannelListPanel.java index d936110f..c846a163 100644 --- a/src/Acquisition/ChannelListPanel.java +++ b/src/Acquisition/ChannelListPanel.java @@ -7,48 +7,48 @@ import javafx.scene.Node; /** * Interface allowing individual devices to provide their * own channel list panel. Some devices (such as sound cards) - * don't use this at all. ASIO cards use a standard concrete + * don't use this at all. ASIO cards use a standard concrete * implementation. NI cards use a more sophisticated one - * whereby multiple devices may be used. + * whereby multiple devices may be used. * @author Doug Gillespie * */ public interface ChannelListPanel { /** - * - * @return the component for the dialog panel. + * + * @return the component for the dialog panel. */ public Component getComponent(); - + /** - * - * @return the component for the dialog panel. + * + * @return the component for the dialog panel. */ public Node getNode(); - + /** - * Set the channel list. + * Set the channel list. * @param channelList channel list */ public void setParams(int[] channelList); - + /** - * + * * @return the channel list */ public int[] getChannelList(); - + /** - * + * * @return true if the configuration seems to be valid (i.e. no repeated channels, etc) */ public boolean isDataOk(); - + /** - * Set the total number of channels to display. - * @param nChannels the total number of channels to display. + * Set the total number of channels to display. + * @param nChannels the total number of channels to display. */ public void setNumChannels(int nChannels); - + } diff --git a/src/Acquisition/CheckWavFileHeaders.java b/src/Acquisition/CheckWavFileHeaders.java index bbb2999d..24f21f3c 100644 --- a/src/Acquisition/CheckWavFileHeaders.java +++ b/src/Acquisition/CheckWavFileHeaders.java @@ -42,7 +42,7 @@ public class CheckWavFileHeaders extends PamDialog { private CheckFiles checkFilesWorker; - private ArrayList allFiles = new ArrayList(); + private ArrayList allFiles = new ArrayList<>(); private CheckWavFileHeaders(Window parentFrame) { super(parentFrame, "Check File Headers", false); @@ -89,8 +89,8 @@ public class CheckWavFileHeaders extends PamDialog { } private void enableControls() { - getOkButton().setEnabled(nFiles > 0 & running == false && ran == false); - getCancelButton().setEnabled(running == false); + getOkButton().setEnabled(nFiles > 0 & !running && !ran); + getCancelButton().setEnabled(!running); } private int countFiles(File folder) { @@ -98,8 +98,8 @@ public class CheckWavFileHeaders extends PamDialog { File[] files = folder.listFiles(new PamAudioFileFilter()); if (files == null) return 0; File file; - for (int i = 0; i < files.length; i++) { - file = files[i]; + for (File file2 : files) { + file = file2; if (file.isDirectory() && subFolders) { System.out.println(file.getAbsoluteFile()); nF += countFiles(file.getAbsoluteFile()); @@ -146,7 +146,7 @@ public class CheckWavFileHeaders extends PamDialog { private void setProgressInfo(ProgressData progressData) { progressBar.setValue(++doneFiles); String msg = AudioFileFuncs.getMessage(progressData.headerError); - textArea.append(String.format("\n%s - %s", progressData.file.getName(), msg)); + textArea.append(String.format("\n%s - %s", progressData.file.getName(), msg)); boolean problem = progressData.headerError != AudioFileFuncs.FILE_OK; if (problem) { nErrors++; @@ -164,7 +164,7 @@ public class CheckWavFileHeaders extends PamDialog { * @return true if there is an error */ private int checkFile(File aFile) { - if (aFile.exists() == false || aFile.isDirectory() == true) { + if (!aFile.exists() || aFile.isDirectory()) { return AudioFileFuncs.FILE_DOESNTEXIST; } String fileName = aFile.getName(); @@ -179,7 +179,7 @@ public class CheckWavFileHeaders extends PamDialog { } else if (fileEnd.equalsIgnoreCase("aif")) { return checkAifFile(aFile); - } + } return AudioFileFuncs.FILE_UNKNOWNTYPE; } @@ -198,13 +198,13 @@ public class CheckWavFileHeaders extends PamDialog { protected Integer doInBackground() throws Exception { /* * need to loop over files again - * for each file, report on progress with it's name and + * for each file, report on progress with it's name and * whether or not it had an error */ int error; File aFile; - for (int i = 0; i < allFiles.size(); i++) { - error = checkFile(aFile = allFiles.get(i)); + for (File file : allFiles) { + error = checkFile(aFile = file); publish(new ProgressData(aFile, error)); } return null; @@ -220,8 +220,8 @@ public class CheckWavFileHeaders extends PamDialog { @Override protected void process(List progressData) { - for (int i = 0; i < progressData.size(); i++) { - setProgressInfo(progressData.get(i)); + for (ProgressData element : progressData) { + setProgressInfo(element); } } diff --git a/src/Acquisition/DAQChannelListManager.java b/src/Acquisition/DAQChannelListManager.java index 3fb7b060..bfe75ee2 100644 --- a/src/Acquisition/DAQChannelListManager.java +++ b/src/Acquisition/DAQChannelListManager.java @@ -4,7 +4,7 @@ import PamguardMVC.ChannelListManager; /** * Class for converting channel indexes and numbers to hydrophones - * for the main PAMGAURD DAQ. + * for the main PAMGAURD DAQ. *

* All these functions are passed through to the AcquisitionParameters class * but these ones are better organised and therefore much easier to use than @@ -16,7 +16,7 @@ import PamguardMVC.ChannelListManager; public class DAQChannelListManager extends ChannelListManager { private AcquisitionControl acquisitionControl; - + public DAQChannelListManager(AcquisitionControl acquisitionControl) { this.acquisitionControl = acquisitionControl; } @@ -25,7 +25,7 @@ public class DAQChannelListManager extends ChannelListManager { // public int channelIndexToNumber(int channelIndex) { // // return acquisitionControl.acquisitionParameters.getChannelList(channelIndex); -// +// // } @Override diff --git a/src/Acquisition/DCFilter.java b/src/Acquisition/DCFilter.java index 1cdda420..92f80aa4 100644 --- a/src/Acquisition/DCFilter.java +++ b/src/Acquisition/DCFilter.java @@ -1,7 +1,7 @@ package Acquisition; /** - * Class to remove DC offset from audio data. + * Class to remove DC offset from audio data. * @author Douglas Gillespie * */ @@ -20,7 +20,7 @@ public class DCFilter { background = new double[nChannels]; alpha = 1-1./(sampleRate*timeConstant); } - + public void filterData(int channel, double[] data) { double x; double b = background[channel]; diff --git a/src/Acquisition/DCL5System.java b/src/Acquisition/DCL5System.java index c1f49cc8..0f92a657 100644 --- a/src/Acquisition/DCL5System.java +++ b/src/Acquisition/DCL5System.java @@ -21,7 +21,7 @@ public class DCL5System extends FolderInputSystem implements PamSettings { // PamSettingManager.getInstance().registerSettings(this); // } String xmlDocName = "C:\\DCL_5_2011\\Matlab\\SpeciesFiletimes2.xml"; - + Document doc; @@ -84,9 +84,9 @@ public class DCL5System extends FolderInputSystem implements PamSettings { String timeString = e.getAttribute("time"); return super.getFileStartTime(new File(timeString)); /* - * Get the file time from the XML document. + * Get the file time from the XML document. */ // return super.getFileStartTime(file); } - + } diff --git a/src/Acquisition/DaqStatusBinaryStore.java b/src/Acquisition/DaqStatusBinaryStore.java index db829633..d5846742 100644 --- a/src/Acquisition/DaqStatusBinaryStore.java +++ b/src/Acquisition/DaqStatusBinaryStore.java @@ -13,7 +13,6 @@ import binaryFileStorage.BinaryHeader; import binaryFileStorage.BinaryObjectData; import binaryFileStorage.ModuleFooter; import binaryFileStorage.ModuleHeader; -import binaryFileStorage.PackedBinaryObject; public class DaqStatusBinaryStore extends BinaryDataSource { @@ -50,12 +49,12 @@ public class DaqStatusBinaryStore extends BinaryDataSource { @Override public PamDataUnit sinkData(BinaryObjectData binaryObjectData, BinaryHeader bh, int moduleVersion) { - ByteArrayInputStream bis = new ByteArrayInputStream(binaryObjectData.getData(), + ByteArrayInputStream bis = new ByteArrayInputStream(binaryObjectData.getData(), 0, binaryObjectData.getDataLength()); DataInputStream dis = new DataInputStream(bis); - + long adcMilliseconds = 0; - long samples = 0; + long samples = 0; Long gpsPPSMillis = null; short status = 0; short reason = 0; @@ -68,7 +67,7 @@ public class DaqStatusBinaryStore extends BinaryDataSource { gpsPPSMillis = dis.readLong(); if (gpsPPSMillis == 0) { // zero must be intrpreted as null (no data) or it can screw up some time corrections in the - // network receiver. + // network receiver. gpsPPSMillis = null; } status = dis.readShort(); @@ -97,24 +96,24 @@ public class DaqStatusBinaryStore extends BinaryDataSource { channels = PamUtils.PamUtils.makeChannelMap(acquisitionControl.acquisitionParameters.nChannels); voltsPeak2Peak = acquisitionControl.acquisitionParameters.voltsPeak2Peak; } - + AcquisitionParameters daqParams = new AcquisitionParameters(); daqParams.setVoltsPeak2Peak(voltsPeak2Peak); daqParams.setPreamplifier(new Preamplifier(0, null)); daqParams.setSampleRate(sampleRate); daqParams.setDaqSystemType(daqSystemType); /** - * Only used in netrx mode and doesn't handle corrected milliseconds. + * Only used in netrx mode and doesn't handle corrected milliseconds. */ - DaqStatusDataUnit dsdu = new DaqStatusDataUnit(binaryObjectData.getTimeMilliseconds(), - adcMilliseconds, adcMilliseconds, samples, gpsPPSMillis, (new Short(status)).toString(), + DaqStatusDataUnit dsdu = new DaqStatusDataUnit(binaryObjectData.getTimeMilliseconds(), + adcMilliseconds, adcMilliseconds, samples, gpsPPSMillis, (new Short(status)).toString(), (new Short(reason)).toString(), daqParams, null, duration, clockError); return dsdu; } @Override public ModuleHeader sinkModuleHeader(BinaryObjectData binaryObjectData, BinaryHeader bh) { - ByteArrayInputStream bis = new ByteArrayInputStream(binaryObjectData.getData(), + ByteArrayInputStream bis = new ByteArrayInputStream(binaryObjectData.getData(), 0, binaryObjectData.getDataLength()); DataInputStream dis = new DataInputStream(bis); moduleHeader = new DaqStatusModuleHeader(bh.getHeaderFormat()); @@ -127,7 +126,7 @@ public class DaqStatusBinaryStore extends BinaryDataSource { } catch (IOException e) { e.printStackTrace(); } - + return moduleHeader; } diff --git a/src/Acquisition/DaqStatusDataBlock.java b/src/Acquisition/DaqStatusDataBlock.java index 21b8ded5..4134ec9c 100644 --- a/src/Acquisition/DaqStatusDataBlock.java +++ b/src/Acquisition/DaqStatusDataBlock.java @@ -2,7 +2,6 @@ package Acquisition; import PamguardMVC.PamDataBlock; import PamguardMVC.PamProcess; -import dataMap.OfflineDataMap; import effort.EffortProvider; import effort.binary.DataMapEffortProvider; import generalDatabase.DBControlUnit; @@ -15,9 +14,9 @@ public class DaqStatusDataBlock extends PamDataBlock { @Override public EffortProvider autoEffortProvider() { - // make a provider which will pick up on the database data. - // db data are written every 60s, so put 62s as max gap. + // make a provider which will pick up on the database data. + // db data are written every 60s, so put 62s as max gap. return new DataMapEffortProvider(this, DBControlUnit.class, 62000L); } - + } diff --git a/src/Acquisition/DaqStatusDataUnit.java b/src/Acquisition/DaqStatusDataUnit.java index d82ee513..2a4c1e7a 100644 --- a/src/Acquisition/DaqStatusDataUnit.java +++ b/src/Acquisition/DaqStatusDataUnit.java @@ -1,42 +1,41 @@ package Acquisition; import PamUtils.PamCalendar; -import PamUtils.PamUtils; import PamguardMVC.PamDataUnit; /** - * Data unit containing information on run starts and stops. + * Data unit containing information on run starts and stops. *

- * The main purpose of producing these is so that they get picked up + * The main purpose of producing these is so that they get picked up * by the database and logged - * + * * @author Doug Gillespie * */ public class DaqStatusDataUnit extends PamDataUnit { private String status = "Stop"; - + private String reason = ""; - + private String daqSystemType = ""; - + public int sampleRate; - + public Double trueSampleRate; - + public int nChannels = 2; - + public double voltsPeak2Peak = 5; - + public double duration = 0; - + public double clockError; private long adcMilliseconds; - + private long samples; - + private Long gpsPPSMilliseconds; private Long serverTime; @@ -44,13 +43,13 @@ public class DaqStatusDataUnit extends PamDataUnit { private AcquisitionParameters daqParameters; private long rawADCMillis; - + private String systemName; // private static DaqStatusDataUnit previousDaqStatusUnit = null; - public DaqStatusDataUnit(long timeMilliseconds, long adcMilliseconds, long rawADCMillis, - long samples, Long gpsPPSMillis, - String status, String reason, + public DaqStatusDataUnit(long timeMilliseconds, long adcMilliseconds, long rawADCMillis, + long samples, Long gpsPPSMillis, + String status, String reason, AcquisitionParameters daqParameters, String systemName, double duration, double clockError) { super(timeMilliseconds); this.adcMilliseconds = adcMilliseconds; @@ -60,7 +59,7 @@ public class DaqStatusDataUnit extends PamDataUnit { this.status = status; this.reason = reason; if (daqParameters!=null) { - //null if statement only used in viewer mode were DAQ params are not loaded from database. + //null if statement only used in viewer mode were DAQ params are not loaded from database. this.daqSystemType = daqParameters.daqSystemType; this.daqParameters = daqParameters; this.sampleRate = (int) daqParameters.getSampleRate(); @@ -70,17 +69,17 @@ public class DaqStatusDataUnit extends PamDataUnit { this.systemName = systemName; this.duration = duration; this.clockError = clockError; - + // set the DataUnitBaseData duration (in samples) to this duration this.setSampleDuration((long) (duration*sampleRate)); - + // /* // * This won't work if data are being sent from multiple receivers ! // */ // calculateTrueSampleRate(previousDaqStatusUnit); // previousDaqStatusUnit = this; } - + /** * @return the systemName */ @@ -99,9 +98,9 @@ public class DaqStatusDataUnit extends PamDataUnit { if (previousUnit == null || gpsPPSMilliseconds == null || previousUnit.getGpsPPSMilliseconds() == null) { trueSampleRate = null; return null; - } - double samples = (double) (this.samples - previousUnit.getSamples()); - double tDiff = (double) (this.gpsPPSMilliseconds - previousUnit.getGpsPPSMilliseconds()) / 1000.; + } + double samples = this.samples - previousUnit.getSamples(); + double tDiff = (this.gpsPPSMilliseconds - previousUnit.getGpsPPSMilliseconds()) / 1000.; if (tDiff > 0 && tDiff < 900 && samples > 0) { trueSampleRate = samples/tDiff; } diff --git a/src/Acquisition/DaqStatusModuleHeader.java b/src/Acquisition/DaqStatusModuleHeader.java index 5a548a6a..3af22ed8 100644 --- a/src/Acquisition/DaqStatusModuleHeader.java +++ b/src/Acquisition/DaqStatusModuleHeader.java @@ -14,7 +14,7 @@ import binaryFileStorage.ModuleHeader; class DaqStatusModuleHeader extends ModuleHeader implements Serializable, ManagedParameters { private static final long serialVersionUID = 1L; - + public DaqStatusModuleHeader(int moduleVersion) { super(moduleVersion); } diff --git a/src/Acquisition/DaqSystem.java b/src/Acquisition/DaqSystem.java index 947da892..3546fe18 100644 --- a/src/Acquisition/DaqSystem.java +++ b/src/Acquisition/DaqSystem.java @@ -6,86 +6,84 @@ import javax.swing.JComponent; import Acquisition.layoutFX.AcquisitionPaneFX; import Acquisition.layoutFX.DAQSettingsPane; -import PamController.SettingsPane; import PamUtils.PamUtils; -import javafx.scene.Node; import soundPlayback.FilePlayback; import soundPlayback.PlaybackControl; import soundPlayback.PlaybackSystem; /** - * - * Abstraction to multiple data acquisition devices. This interface performs + * + * Abstraction to multiple data acquisition devices. This interface performs * the following tasks: *

* 1. Provides information about the device such as min and max sample rates, number of channelse, etc. * 2. Provides a dialog panel with specific options. This automatically gets incorporated into a more * general data acquisition panel - * 3. Provides threads and any other functions necessary to create packets of raw audio data in - * PamDataUnit's. - * 4. Each concrete class should, if needed, save it's own setting using the PamSettings package. + * 3. Provides threads and any other functions necessary to create packets of raw audio data in + * PamDataUnit's. + * 4. Each concrete class should, if needed, save it's own setting using the PamSettings package. *

* Current examples are in SoundCardSystem and FileInputSystem - * + * * @author Doug Gillespie * */ // is sampleRate ok? set true - return false from getparams... -// is numChannels ok? set true /override these in asio - before returning false +// is numChannels ok? set true /override these in asio - before returning false public abstract class DaqSystem { public static final int PARAMETER_UNKNOWN = -1; - + public static final int PARAMETER_FIXED = -2; - + private int streamStatus = STREAM_CLOSED; - + /** * @return The 'type' of data source for display in the Data Source dialog *

Calling functions should be able to handle 'null' */ abstract public String getSystemType(); - + /** - * + * * @return A string describing the data source, e.g. the sound card name, file name, udp port, etc. */ abstract public String getSystemName(); - + /** * The AcquisitionDialog has been designed to that each data source type can plug * in it's own panel of device specific controls. These could be things like a file * name, gain settings, channel lists, whatever is available for the specific device *

* The AcquisitionDialog will handle placing this component on the dialog when a - * particular DaqSystem is selected. The component will be placed between a drop down + * particular DaqSystem is selected. The component will be placed between a drop down * list of available DaqSystem's and a section of the dialog showing the sample rate and - * number of channels. + * number of channels. *

* @param acquisitionDialog the AcquisitionDialog this component will be added to * @return dialog component specific to this DAQ device */ abstract public JComponent getDaqSpecificDialogComponent(AcquisitionDialog acquisitionDialog); - + /** * Get a channel list panel (invented for NI cards which have many more options) * @param acquisitionDialog reference to main acquisition dialog - * @return ChannelListPanel component. + * @return ChannelListPanel component. */ public ChannelListPanel getDaqSpecificChannelListPanel(AcquisitionDialog acquisitionDialog) { return null; } - - + + /** * Called by AcquisitionDialog.SetParams so that the dialog componenet can update it's * fields * */ abstract public void dialogSetParams(); - + /** * 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 @@ -94,49 +92,49 @@ public abstract class DaqSystem { * dialog will not respond to its Ok button. */ abstract public boolean dialogGetParams(); - + /** - * Tell a DAQ system it's been selected or deselected. + * Tell a DAQ system it's been selected or deselected. * @param select */ public void setSelected(boolean select) { - + } /** - * Get model changed events. + * Get model changed events. * @param changeType */ public void notifyModelChanged(int changeType) { - + } /** - * + * * @return the maximum sample rate supporrted by the selected device, or PARAMETER_UNKNOWN */ abstract public int getMaxSampleRate(); /** - * + * * @return the maximum number of channels supporrted by the selected device, or PARAMETER_UNKNOWN */ abstract public int getMaxChannels(); - + /** - * + * * @return peak to peak voltage for the device or PARAMETER_UNKNOWN */ abstract public double getPeak2PeakVoltage(int swChannel); - + /** - * Prepare the DaqSystem. + * Prepare the DaqSystem. *

* Usually this is the time for opening files, preparing data buffers, etc. * @param daqControl AcquisitionControl unit. * @return true if OK, false otherwise. */ abstract public boolean prepareSystem(AcquisitionControl daqControl); - + /** * Start the DaqSystem. This is called immediately after PrepareSystem *

@@ -148,46 +146,46 @@ public abstract class DaqSystem { * @return true if OK, false otherwise */ abstract public boolean startSystem(AcquisitionControl daqControl); - + /** - * Stop the DaqSystem. + * Stop the DaqSystem. * @param daqControl */ abstract public void stopSystem(AcquisitionControl daqControl); /** - * + * * @return true for real time systems (e.g. sound cards, NI cards, wav files * which are being played back over speakers. false for reading files which are to be * processed as fast as possible with no playback. */ abstract public boolean isRealTime(); - + /** - * - * @return true if the system can also play back sound - likely to be true for sound cards - * and ASIO, and some NI cards, false for wav files. Simulator ? + * + * @return true if the system can also play back sound - likely to be true for sound cards + * and ASIO, and some NI cards, false for wav files. Simulator ? */ abstract public boolean canPlayBack(float sampleRate); - + /** - * - * @return the number of samples expected in each data unit. + * + * @return the number of samples expected in each data unit. */ abstract public int getDataUnitSamples(); - + /** * Gets a playback system for playing sound back out through headphones / speakers, etc. *

- * Generally, anything acquiring data in real time should play the sound back through - * itself so that clocks are correctly synchronised. i.e. A sound card input will go to the - * same sound card output, etc. At a later date, we may try to support output through + * Generally, anything acquiring data in real time should play the sound back through + * itself so that clocks are correctly synchronised. i.e. A sound card input will go to the + * same sound card output, etc. At a later date, we may try to support output through * different devices at different speeds - but this will be problematic ! *

* If data are being read from a file, then playback is through a sound card which sits - * in a stand alone implementation of PlaybackSystem - * @param playbackControl - * @param daqSystem + * in a stand alone implementation of PlaybackSystem + * @param playbackControl + * @param daqSystem * @return null if no playback available or a PlaybackSystem object. * @see PlaybackSystem * @see FilePlayback @@ -203,7 +201,7 @@ public abstract class DaqSystem { * */ abstract public void daqHasEnded(); - + public static final int STREAM_CLOSED = 0; public static final int STREAM_OPEN = 1; public static final int STREAM_RUNNING = 2; @@ -220,36 +218,36 @@ public abstract class DaqSystem { public void setStreamStatus(int streamStatus) { this.streamStatus = streamStatus; } - + public boolean areSampleSettingsOk(int numInputsRequested, float sampleRateRequested){ return true; } - + public void showSampleSettingsDialog(AcquisitionDialog acquisitionDialog){ - + } - + public Component getStatusBarComponent() { return null; } - + public boolean supportsChannelLists() { return false; } - + /** - * + * * @return a bitmap of output channels. this should ALWAYS be * a bitmap of channels 0 to n-1 even if different hardware channels - * are used since hardware channels are no longer passed through PAMGUARD. + * are used since hardware channels are no longer passed through PAMGUARD. */ public int getInputChannelMap(AcquisitionParameters acquisitionParameters) { return PamUtils.makeChannelMap(acquisitionParameters.nChannels); } - + /** * Gets a name for the acquisition device (may just be a number - * but need to generalise). + * but need to generalise). * @return */ public abstract String getDeviceName(); @@ -262,18 +260,18 @@ public abstract class DaqSystem { public double getChannelGain(int channel) { return 0; } - + /** - * Get the number of bits in each sample. - * @return the number of bits in each sample. + * Get the number of bits in each sample. + * @return the number of bits in each sample. */ public int getSampleBits() { return 16; } /** - * - * @return how often its reasonable to check whether or not the system has stalled. + * + * @return how often its reasonable to check whether or not the system has stalled. */ public long getStallCheckSeconds() { return 2; @@ -283,23 +281,23 @@ public abstract class DaqSystem { /** * Get a channel list panel (invented for NI cards which have many more options) * @param acquisitionDialog reference to main acquisition dialog - * @return ChannelListPanel component. + * @return ChannelListPanel component. */ public ChannelListPanel getDaqSpecificChannelListNode(AcquisitionPaneFX acquisitionPaneFX) { // TODO Auto-generated method stub return null; } - - + + /** * The AcquisitionDialog has been designed to that each data source type can plug * in it's own panel of device specific controls. These could be things like a file * name, gain settings, channel lists, whatever is available for the specific device *

* The AcquisitionDialog will handle placing this component on the dialog when a - * particular DaqSystem is selected. The component will be placed between a drop down + * particular DaqSystem is selected. The component will be placed between a drop down * list of available DaqSystem's and a section of the dialog showing the sample rate and - * number of channels. + * number of channels. *

* @param acquisitionDialog the AcquisitionPaneFX this component will be added to * @return dialog component specific to this DAQ device @@ -309,5 +307,5 @@ public abstract class DaqSystem { return null; } - + } diff --git a/src/Acquisition/DaqSystemInterface.java b/src/Acquisition/DaqSystemInterface.java index 2e0686be..eb1a7f9b 100644 --- a/src/Acquisition/DaqSystemInterface.java +++ b/src/Acquisition/DaqSystemInterface.java @@ -1,25 +1,23 @@ package Acquisition; import PamModel.CommonPluginInterface; -import PamModel.PamModel; -import PamModel.PamModuleInfo; /** * Interface for External DAQ Systems - * + * * @author MO * */ public interface DaqSystemInterface extends CommonPluginInterface { - + /** * Creates a new instance of the DAQ System controller, the class that extends * DaqSystem.class. The AcquisitionControl object that gets passed to the * interface provides the DAQ System with a link to hardware information - * e.g. channel list, sample rate, etc. + * e.g. channel list, sample rate, etc. *

* This field cannot be null. - * + * * @param the AcquisitionControl object * @return the DaqSystem object */ diff --git a/src/Acquisition/DaqSystemXMLManager.java b/src/Acquisition/DaqSystemXMLManager.java index d8513625..2c4ac1b2 100644 --- a/src/Acquisition/DaqSystemXMLManager.java +++ b/src/Acquisition/DaqSystemXMLManager.java @@ -15,11 +15,11 @@ import PamController.PamController; * is shared by multiple PamSettings classes. For example: the SoundCardParameters class is used * by the SoundCardSystem, ASIOSoundSystem and NewAsioSoundSystem classes. Each of these has it's own * type (see the individual getUnitType calls) but the SoundCardParameters class doesn't know who called - * it and so can't properly check whether the type matches. Further, SoundCardParameters is extended by + * it and so can't properly check whether the type matches. Further, SoundCardParameters is extended by * NIDAQParams, SimParameters and SmruDaqParameters. So trying to make SoundCardParameters check for a * type would potentially screw up those extended classes. That being said, the extended classes are * able to check for their types themselves. - * + * * @author dg50 * */ @@ -30,8 +30,8 @@ public class DaqSystemXMLManager { if (daqs == null) { return false; } - for (int i = 0; i < daqs.size(); i++) { - AcquisitionControl daq = (AcquisitionControl) daqs.get(i); + for (PamControlledUnit daq2 : daqs) { + AcquisitionControl daq = (AcquisitionControl) daq2; AcquisitionParameters daqParams = daq.getAcquisitionParameters(); if (daqParams.daqSystemType.equals(daqSystemType)) { return true; diff --git a/src/Acquisition/FileInputParameters.java b/src/Acquisition/FileInputParameters.java index 9a3f114d..842f850b 100644 --- a/src/Acquisition/FileInputParameters.java +++ b/src/Acquisition/FileInputParameters.java @@ -16,14 +16,14 @@ import PamModel.parametermanager.PamParameterSet.ParameterSetType; public class FileInputParameters implements Serializable, Cloneable, ManagedParameters { static public final long serialVersionUID = 1; - + static public final int MAX_RECENT_FILES = 20; - + /** - * A list of the recent files or folders selected. + * A list of the recent files or folders selected. */ - public ArrayList recentFiles = new ArrayList(); - + public ArrayList recentFiles = new ArrayList<>(); + public boolean realTime; public String getMostRecentFile() { @@ -34,21 +34,21 @@ public class FileInputParameters implements Serializable, Cloneable, ManagedPara return null; } } - + public String systemType; - + /** * Repeat in an infinite loop */ - public boolean repeatLoop; - + public boolean repeatLoop; + /** - * Skip a section an initial section of the file in millis. For example, use with SoundTrap calibration values. + * Skip a section an initial section of the file in millis. For example, use with SoundTrap calibration values. */ public long skipStartFileTime = 0; - + public int bitDepth; - + /** * @param systemType */ @@ -71,7 +71,7 @@ public class FileInputParameters implements Serializable, Cloneable, ManagedPara } return null; } - + @Override public PamParameterSet getParameterSet() { // if the user has not selected this system type, just return null diff --git a/src/Acquisition/FileInputSystem.java b/src/Acquisition/FileInputSystem.java index 202adedd..2acd0589 100644 --- a/src/Acquisition/FileInputSystem.java +++ b/src/Acquisition/FileInputSystem.java @@ -7,8 +7,6 @@ import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.io.ByteArrayInputStream; -import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; @@ -20,9 +18,9 @@ import java.util.Calendar; import java.util.List; import javax.sound.sampled.AudioFormat; +import javax.sound.sampled.AudioFormat.Encoding; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.UnsupportedAudioFileException; -import javax.sound.sampled.AudioFormat.Encoding; import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JCheckBox; @@ -32,33 +30,24 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.border.TitledBorder; +import javax.swing.filechooser.FileFilter; import org.jflac.FLACDecoder; +import org.jflac.PCMProcessor; import org.jflac.frame.Frame; +import org.jflac.metadata.StreamInfo; +import org.jflac.sound.spi.FlacEncoding; import org.jflac.util.ByteData; import org.pamguard.x3.sud.Chunk; import org.pamguard.x3.sud.SudAudioInputStream; import org.pamguard.x3.sud.SudFileListener; -import org.pamguard.x3.sud.SudParams; -import org.jflac.PCMProcessor; -import org.jflac.metadata.StreamInfo; -import org.jflac.sound.spi.FlacEncoding; -//import org.kc7bfi.jflac.FLACDecoder; -//import org.kc7bfi.jflac.PCMProcessor; -//import org.kc7bfi.jflac.frame.Frame; -//import org.kc7bfi.jflac.metadata.SeekPoint; -//import org.kc7bfi.jflac.metadata.StreamInfo; -//import org.kc7bfi.jflac.sound.spi.FlacEncoding; -//import org.kc7bfi.jflac.util.ByteData; - -import wavFiles.ByteConverter; import Acquisition.filedate.FileDate; import Acquisition.filedate.FileDateDialogStrip; import Acquisition.filedate.FileDateObserver; import Acquisition.filetypes.SoundFileType; -import Acquisition.pamAudio.PamAudioFileManager; import Acquisition.pamAudio.PamAudioFileFilter; +import Acquisition.pamAudio.PamAudioFileManager; import PamController.PamControlledUnitSettings; import PamController.PamController; import PamController.PamSettingManager; @@ -73,9 +62,19 @@ import PamView.panel.PamProgressBar; import pamguard.GlobalArguments; import warnings.PamWarning; +//import org.kc7bfi.jflac.FLACDecoder; +//import org.kc7bfi.jflac.PCMProcessor; +//import org.kc7bfi.jflac.frame.Frame; +//import org.kc7bfi.jflac.metadata.SeekPoint; +//import org.kc7bfi.jflac.metadata.StreamInfo; +//import org.kc7bfi.jflac.sound.spi.FlacEncoding; +//import org.kc7bfi.jflac.util.ByteData; + +import wavFiles.ByteConverter; + /** - * Implementation of DaqSystem for reading data from audio files. - * + * Implementation of DaqSystem for reading data from audio files. + * * @author Doug Gillespie * @see Acquisition.DaqSystem * @see Acquisition.AcquisitionProcess @@ -109,7 +108,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe protected PamLabel speedLabel; /** - * using a system.currentTimeMS not PamCalander time to predict eta. + * using a system.currentTimeMS not PamCalander time to predict eta. */ protected long fileStartTime; @@ -148,14 +147,14 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe protected ByteConverter byteConverter; protected FileDateDialogStrip fileDateStrip; - + /** * Sound file types present in the current selections. */ private List selectedFileTypes; /** - * Text field for skipping initial few seconds of a file. + * Text field for skipping initial few seconds of a file. */ private JTextField skipSecondsField; @@ -186,7 +185,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe /** * Gets and where necessary creates ... - * @return Daq dialog panel. + * @return Daq dialog panel. */ protected JPanel getDialogPanel() { if (daqDialog == null) { @@ -217,7 +216,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe constraints.fill = GridBagConstraints.NONE; constraints.anchor = GridBagConstraints.WEST; constraints.gridx = 0; - addComponent(p, repeat = new JCheckBox("Repeat"), constraints); + addComponent(p, repeat = new JCheckBox("Repeat"), constraints); constraints.gridx = 2; constraints.gridy = 1; constraints.gridwidth = 1; @@ -234,7 +233,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe p.add(fileDateStrip.getDialogComponent(), constraints); // if (SMRUEnable.isEnable()) { - // no reason to hide this option from users. + // no reason to hide this option from users. constraints.gridy++; constraints.gridx = 0; constraints.gridwidth = 1; @@ -287,8 +286,8 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe fileNameCombo.removeAllItems(); String file; if (fileInputParameters.recentFiles.size() == 0) return; - for (int i = 0; i < fileInputParameters.recentFiles.size(); i++){ - file = fileInputParameters.recentFiles.get(i); + for (String element : fileInputParameters.recentFiles) { + file = element; if (file == null || file.length() == 0) continue; fileNameCombo.addItem(file); } @@ -301,7 +300,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe if (file != null && file.length() > 0) { fileInputParameters.recentFiles.remove(file); fileInputParameters.recentFiles.add(0, file); - // check we're not building up too long a list. + // check we're not building up too long a list. while (fileInputParameters.recentFiles.size() > FileInputParameters.MAX_RECENT_FILES) { fileInputParameters.recentFiles.remove(fileInputParameters.recentFiles.size()-1); fileInputParameters.recentFiles.trimToSize(); @@ -317,11 +316,11 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe if (skipSecondsField!=null) { try { - Double skipSeconds = Double.valueOf(skipSecondsField.getText())*1000.; // saved in millis. + Double skipSeconds = Double.valueOf(skipSecondsField.getText())*1000.; // saved in millis. fileInputParameters.skipStartFileTime = skipSeconds.longValue(); } catch (Exception e) { - return false; + return false; } } @@ -335,13 +334,13 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe @Override public String getSystemName() { - if (fileInputParameters.recentFiles == null) return null; - if (fileInputParameters.recentFiles.size() < 1) return null; + if ((fileInputParameters.recentFiles == null) || (fileInputParameters.recentFiles.size() < 1)) return null; File f = getCurrentFile(); if (f == null) return null; return f.getName(); } + @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == fileSelect) { @@ -374,8 +373,8 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); javax.swing.filechooser.FileFilter[] filters = fileChooser .getChoosableFileFilters(); - for (int i = 0; i < filters.length; i++) { - fileChooser.removeChoosableFileFilter(filters[i]); + for (FileFilter filter : filters) { + fileChooser.removeChoosableFileFilter(filter); } fileChooser.addChoosableFileFilter(new PamAudioFileFilter()); @@ -392,7 +391,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe } /** - * Called when user selects a file in the dialog. + * Called when user selects a file in the dialog. * @param newFile */ public void setNewFile (String newFile) { @@ -403,17 +402,16 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe } /** - * Called when a new file or folder is selected. + * Called when a new file or folder is selected. * @param newFile */ public void interpretNewFile(String newFile){ - if (newFile == null) return; - if (newFile.length() == 0) return; + if ((newFile == null) || (newFile.length() == 0)) return; File file = new File(newFile); - + setSelectedFileTypes(acquisitionControl.soundFileTypes.getUsedTypes(file)); - + if (file == null) return; // try to work out the date of the file @@ -430,13 +428,13 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe // acquisitionDialog.NotifyChange(); if (file.isFile() && !file.isHidden() && acquisitionDialog != null) { try { - - System.out.println("FileInputSystem - interpretNewFile"); + + System.out.println("FileInputSystem - interpretNewFile"); AudioInputStream audioStream = PamAudioFileManager.getInstance().getAudioInputStream(file); - // // Get additional information from the header if it's a wav file. + // // Get additional information from the header if it's a wav file. // if (WavFileInputStream.class.isAssignableFrom(audioStream.getClass())) { - // WavHeader wavHeader = ((WavFileInputStream) audioStream).getWavHeader(); + // WavHeader wavHeader = ((WavFileInputStream) audioStream).getWavHeader(); // int nChunks = wavHeader.getNumHeadChunks(); // for (int i = 0; i < nChunks; i++) { // WavHeadChunk aChunk = wavHeader.getHeadChunk(i); @@ -447,7 +445,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe if (audioStream instanceof SudAudioInputStream) { acquisitionControl.getSUDNotificationManager().interpretNewFile(newFile, (SudAudioInputStream) audioStream); } - + AudioFormat audioFormat = audioStream.getFormat(); // fileLength = file.length(); fileSamples = audioStream.getFrameLength(); @@ -473,7 +471,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe super.setStreamStatus(streamStatus); // file has ended, so notify the daq control. if (streamStatus == STREAM_ENDED) { - // tell the rest of PAMGUARD to stop. + // tell the rest of PAMGUARD to stop. PamController.getInstance().stopLater(); } } @@ -511,24 +509,29 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe return false; } + @Override public Serializable getSettingsReference() { return fileInputParameters; } + @Override public long getSettingsVersion() { return FileInputParameters.serialVersionUID; } + @Override public String getUnitName() { // return "File Input System"; return acquisitionControl.getUnitName(); } + @Override public String getUnitType() { // return "Acquisition System"; return "File Input System"; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { // if (PamSettingManager.getInstance().isSettingsUnit(this, pamControlledUnitSettings)) { fileInputParameters = ((FileInputParameters) pamControlledUnitSettings.getSettings()).clone(); @@ -561,16 +564,15 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe // if (fileInputParameters.recentFiles == null) return false; // if (fileInputParameters.recentFiles.size() < 1) return false; // String fileName = fileInputParameters.recentFiles.get(0); - if (runFileAnalysis() == false) { + if (!runFileAnalysis()) { return false; } return true; } public File getCurrentFile() { -// System.out.println("fileInputParameters: " + fileInputParameters); - if (fileInputParameters.recentFiles == null) return null; - if (fileInputParameters.recentFiles.size() < 1) return null; +// System.out.println("fileInputParameters: " + fileInputParameters); + if ((fileInputParameters.recentFiles == null) || (fileInputParameters.recentFiles.size() < 1)) return null; String fileName = fileInputParameters.recentFiles.get(0); return new File(fileName); } @@ -585,8 +587,8 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe } /** - * Open the audio stream for processing. - * @return true if audio stream opened correctly. + * Open the audio stream for processing. + * @return true if audio stream opened correctly. */ public boolean prepareInputFile() { @@ -603,7 +605,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe audioStream.close(); } -// System.out.println("FileInputSystem - prepareInputFile"); +// System.out.println("FileInputSystem - prepareInputFile"); audioStream = PamAudioFileManager.getInstance().getAudioInputStream(currentFile); @@ -627,8 +629,8 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe audioFormat = audioStream.getFormat(); if (audioFormat==null) { - System.err.println("AudioFormat was null: " + currentFile.getAbsolutePath()); - return false; + System.err.println("AudioFormat was null: " + currentFile.getAbsolutePath()); + return false; } // fileLength = currentFile.length(); @@ -639,8 +641,8 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe fileInputParameters.bitDepth = audioFormat.getSampleSizeInBits(); loadByteConverter(audioFormat); - -// System.out.println("FileInputSystem - prepareInputFile done"); + +// System.out.println("FileInputSystem - prepareInputFile done"); } catch (UnsupportedAudioFileException ex) { @@ -652,7 +654,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe } catch (IOException ex) { ex.printStackTrace(); return false; - } + } return true; } @@ -671,7 +673,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe this.newDataUnits = acquisitionControl.getDaqProcess().getNewDataQueue(); // if (this.newDataUnits == null) { - // System.err.println("newDataUnits: == null: "); + // System.err.println("newDataUnits: == null: "); // return false; // } @@ -679,7 +681,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe String audioFileStr = getCurrentFile()==null? "Null File": getCurrentFile().getAbsolutePath(); String title = "Error loading audio file"; - String msg = "

There was an error trying to access the audio file

" + + String msg = "

There was an error trying to access the audio file

" + audioFileStr + "

Please check to ensure that the file exists, and that the path entered in PAMGuard is correct.

" + "

Note this error may also indicate that the file is corrupt and unreadable by PAMGuard.

"; @@ -707,9 +709,9 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe String audioFileStr = getCurrentFile()==null? "Null File": getCurrentFile().getAbsolutePath(); - System.err.println("FileInputSystem: runFileAnalysis: AudioFile format is null: " + audioFileStr); + System.err.println("FileInputSystem: runFileAnalysis: AudioFile format is null: " + audioFileStr); - return false; + return false; } nChannels = audioFormat.getChannels(); @@ -733,11 +735,11 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe } /** - * Interpret the file name to get the file time. - *

Moved to a separate function so it can be overridden in a special version - * for the DCL5 data set. - * @param file audio file. - * @return time in milliseconds. + * Interpret the file name to get the file time. + *

Moved to a separate function so it can be overridden in a special version + * for the DCL5 data set. + * @param file audio file. + * @return time in milliseconds. */ public long getFileStartTime(File file) { // if there is no file, return 0 @@ -749,11 +751,11 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe public boolean startSystem(AcquisitionControl daqControl) { - + if (audioStream == null) return false; dontStop = true; - + fullyStopped = false; theThread.start(); @@ -767,7 +769,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe public void stopSystem(AcquisitionControl daqControl) { /* * This only gets called when daq is stopped manually from the GUI menu. - * It does not get called when a file ends. + * It does not get called when a file ends. */ boolean stillRunning = (audioStream != null); @@ -813,7 +815,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe /** * FLAC uses such a different way of decoding data to wav and aif - * that it needs to use it's own reader. + * that it needs to use it's own reader. */ protected void collectFlacData() { FileInputStream fileStream; @@ -875,7 +877,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe @Override public void processPCM(ByteData byteData) { - if (dontStop == false) { + if (!dontStop) { try { fileStream.close(); // will make the flac reader bomb out ! } @@ -914,7 +916,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe sayEta(); long now = System.currentTimeMillis(); if (lastProgressTime > 0 && totalSamples > lastProgressUpdate) { - double speed = (double) (totalSamples - lastProgressUpdate) / + double speed = (double) (totalSamples - lastProgressUpdate) / getSampleRate() / ((now-lastProgressTime)/1000.); speedLabel.setText(String.format(" (%3.1f X RT)", speed)); } @@ -923,7 +925,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe } while (newDataUnits.getQueueSize() > 3*nChannels) { - if (dontStop == false) break; + if (!dontStop) break; try { Thread.sleep(2); } catch (Exception ex) { @@ -943,6 +945,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe public class CollectorThread implements Runnable { + @Override public void run() { if (audioFormat.getEncoding() == FlacEncoding.FLAC) { collectFlacData(); @@ -985,9 +988,9 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe break; // file read error } while (bytesRead < blockSize) { - // for single file operation, don't do anything, but need to have a hook + // for single file operation, don't do anything, but need to have a hook // in here to read multiple files, in which case we may just get the extra - // samples from the next file. + // samples from the next file. if (bytesRead == -1) { bytesRead = 0; } @@ -1009,7 +1012,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe } if (bytesRead > 0) { // convert byte array to set of double arrays, one per - // channel + // channel newSamples = bytesRead / audioFormat.getFrameSize(); doubleData = new double[nChannels][newSamples]; int convertedSamples = byteConverter.bytesToDouble(byteArray, doubleData, bytesRead); @@ -1038,7 +1041,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe sayEta(); long now = System.currentTimeMillis(); if (lastProgressTime > 0 && totalSamples > lastProgressUpdate) { - double speed = (double) (totalSamples - lastProgressUpdate) / + double speed = (double) (totalSamples - lastProgressUpdate) / getSampleRate() / ((now-lastProgressTime)/1000.); if (speedLabel!=null) speedLabel.setText(String.format(" (%3.1f X RT)", speed)); } @@ -1051,7 +1054,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe * unit, then set it's reference to zero. */ while (newDataUnits.getQueueSize() > 3*nChannels) { - if (dontStop == false) break; + if (!dontStop) break; try { Thread.sleep(1); } catch (Exception ex) { @@ -1062,7 +1065,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe totalSamples += newSamples; readFileSamples += newSamples; - } + } else { break; // end of file } @@ -1079,10 +1082,10 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe } } // note the reason why the file has ended. - if (dontStop == false) { // stop button pressed + if (!dontStop) { // stop button pressed setStreamStatus(STREAM_PAUSED); } - else { // file ended, since dont stop is true. + else { // file ended, since dont stop is true. setStreamStatus(STREAM_ENDED); } //acquisitionControl.getDaqProcess().acquisitionStopped(); @@ -1094,13 +1097,13 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe } /** - * Open next file in a list for continuous processing, not the + * Open next file in a list for continuous processing, not the * function that opens a file for normal processing. * @param totalSamples * @return */ protected boolean openNextFile(long totalSamples) { - if (fileInputParameters.repeatLoop == false) { + if (!fileInputParameters.repeatLoop) { return false; } // otherwise, open the same file again. @@ -1112,7 +1115,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe /** Format one channel of the data in a byte array into a sample array. */ public static double[] bytesToSamples(byte[] byteArray, long nBytes, int channel, - AudioFormat audioFormat) + AudioFormat audioFormat) { int nSamples = (int)(nBytes / audioFormat.getFrameSize()); double[] samples = new double[nSamples]; @@ -1120,7 +1123,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe int bytesPerSample = ((audioFormat.getSampleSizeInBits() + 7) / 8); int byteI = channel * bytesPerSample; for (int isamp = 0; isamp < nSamples; isamp++) { - samples[isamp] = + samples[isamp] = getSample(byteArray, byteI, bytesPerSample, audioFormat.isBigEndian()); byteI += audioFormat.getFrameSize(); } @@ -1160,7 +1163,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe } /** - * Called when all files to be processed have been processed. + * Called when all files to be processed have been processed. */ protected void fileListComplete() { if (GlobalArguments.getParam(PamController.AUTOEXIT) != null) { @@ -1248,7 +1251,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe /** * Get the acquisition control for the input system - * @return the acquisition control. + * @return the acquisition control. */ public AcquisitionControl getAquisitionControl() { return this.acquisitionControl; @@ -1272,7 +1275,7 @@ public class FileInputSystem extends DaqSystem implements ActionListener, PamSe /** * Called when the file or file list selection is changes and finds a list of all * sound file types included in the selection. this is only implemented for SUD files - * at the moment, the idea being to offer some additional functionality. + * at the moment, the idea being to offer some additional functionality. * @param selectedFileTypes the selectedFileTypes to set */ public void setSelectedFileTypes(List selectedFileTypes) { diff --git a/src/Acquisition/FolderInputParameters.java b/src/Acquisition/FolderInputParameters.java index ed2ec9d6..522db16b 100644 --- a/src/Acquisition/FolderInputParameters.java +++ b/src/Acquisition/FolderInputParameters.java @@ -7,7 +7,6 @@ import java.lang.reflect.Field; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PrivatePamParameterData; -import simulatedAcquisition.SimProcess; /** * Control parameters for FolderInputSystem @@ -18,11 +17,11 @@ import simulatedAcquisition.SimProcess; public class FolderInputParameters extends FileInputParameters implements Serializable, Cloneable, ManagedParameters { static public final long serialVersionUID = 1; - + public boolean subFolders; - + public boolean mergeFiles; - + private String[] selectedFileNames; /** @@ -38,9 +37,9 @@ public class FolderInputParameters extends FileInputParameters implements Serial } /** - * Get the list of selected files as strings. If you want them as + * Get the list of selected files as strings. If you want them as * Files, call getselectedFileFiles() - * @return List of file paths in String format. + * @return List of file paths in String format. */ public String[] getSelectedFiles() { return selectedFileNames; @@ -53,7 +52,7 @@ public class FolderInputParameters extends FileInputParameters implements Serial public void setSelectedFiles(String[] selectedFiles) { this.selectedFileNames = selectedFiles; } - + /** * Set the list of selected files. Note that these are now stored as strings * to avoid some serialisation problems with some subclasses of io.File @@ -69,11 +68,11 @@ public class FolderInputParameters extends FileInputParameters implements Serial selectedFileNames[i] = files[i].getAbsolutePath(); } } - + /** - * Get the list of selected Files, converted back to File objects + * Get the list of selected Files, converted back to File objects * from strings - * @return list of selected files. + * @return list of selected files. */ public File[] getSelectedFileFiles() { if (selectedFileNames == null) { diff --git a/src/Acquisition/FolderInputSystem.java b/src/Acquisition/FolderInputSystem.java index d3904fb4..484bd0a2 100644 --- a/src/Acquisition/FolderInputSystem.java +++ b/src/Acquisition/FolderInputSystem.java @@ -24,16 +24,14 @@ import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.Timer; import javax.swing.border.TitledBorder; + import Acquisition.filedate.FileDateDialogStrip; import Acquisition.layoutFX.AcquisitionPaneFX; import Acquisition.layoutFX.DAQSettingsPane; import Acquisition.layoutFX.FolderInputPane; -import javafx.application.Platform; -import pamguard.GlobalArguments; -import Acquisition.pamAudio.PamAudioFileManager; import Acquisition.pamAudio.PamAudioFileFilter; import Acquisition.pamAudio.PamAudioFileLoader; -import Acquisition.pamAudio.PamAudioSystem; +import Acquisition.pamAudio.PamAudioFileManager; import PamController.DataInputStore; import PamController.InputStoreInfo; import PamController.PamControlledUnitSettings; @@ -52,12 +50,14 @@ import PamView.dialog.PamLabel; import PamView.panel.PamPanel; import PamView.panel.PamProgressBar; import PamguardMVC.debug.Debug; +import javafx.application.Platform; +import pamguard.GlobalArguments; /** * 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 * */ @@ -70,7 +70,7 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D private boolean running = false; - protected ArrayList allFiles = new ArrayList(); + protected ArrayList allFiles = new ArrayList<>(); protected int currentFile; @@ -85,18 +85,18 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D protected long eta = -1; private FolderInputParameters folderInputParameters; - + public static final String GlobalWavFolderArg = "-wavfilefolder"; /** - * Text field for skipping initial few seconds of a file. + * Text field for skipping initial few seconds of a file. */ private JTextField skipSecondsField; - + /** * Panel which shows bespoke settings for certain audio loaders. Contains nothing - * if the audio loader has no settings or no file is selected. + * if the audio loader has no settings or no file is selected. */ protected PamPanel audioLoaderHolder; @@ -109,11 +109,11 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D @Override public boolean prepareInputFile() { boolean ans = super.prepareInputFile(); - if (ans == false && ++currentFile < allFiles.size()) { + if (!ans && ++currentFile < allFiles.size()) { System.out.println("Failed to open sound file. Try again with file " + allFiles.get(currentFile).getName()); /* * jumping striaght to the next file messes it up if it thinks the files - * are continuous, so we HAVE to stop and restart. + * are continuous, so we HAVE to stop and restart. */ // return prepareInputFile(); PamController.getInstance().pamStop(); @@ -138,7 +138,7 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D } /** - * Check to see if acquisition source folder was set in the command line. + * Check to see if acquisition source folder was set in the command line. */ private String[] checkComandLineFolder() { String globalFolder = GlobalArguments.getParam(GlobalWavFolderArg); @@ -146,28 +146,29 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D if (globalFolder == null) { return null; } - // see if it at least exists, though will we want to do this for Network folders ? + // see if it at least exists, though will we want to do this for Network folders ? File aFile = new File(globalFolder); - if (aFile.exists() == false) { + if (!aFile.exists()) { System.err.printf("Command line wav folder \"%s\" does not exist", globalFolder); // return null; } String[] selList = {globalFolder}; // folderInputParameters.setSelectedFiles(selList); // need to immediately make the allfiles list since it's about to get used by the reprocess manager - // need to worry about how to wait for this since it's starting in a different thread. + // need to worry about how to wait for this since it's starting in a different thread. //makeSelFileList(); return selList; } /** - * Restarts after a file has ended when processing multiple files. + * Restarts after a file has ended when processing multiple files. * 27 Jan 2011 - this now reschedules in the AWT thread * @author Doug Gillespie * */ class RestartTimer implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { // System.out.println("Restart later time action"); @@ -177,8 +178,8 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D } } - - + + @Override protected JPanel createDaqDialogPanel() { JPanel p = new JPanel(); @@ -247,7 +248,7 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D } // if (SMRUEnable.isEnable()) { - // no reason to hide this option from users. + // no reason to hide this option from users. constraints.gridy++; constraints.gridx = 0; constraints.gridwidth = 1; @@ -259,7 +260,7 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D // } - //panel to show bespoke settings for certain audio loaders. + //panel to show bespoke settings for certain audio loaders. constraints.anchor = GridBagConstraints.WEST; constraints.gridx = 0; constraints.gridy++; @@ -271,7 +272,7 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D return p; } - + class FileComboListener implements ActionListener { @Override public void actionPerformed(ActionEvent arg0) { @@ -292,12 +293,12 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D checkFileHeaders(); } } - - - + + + /** - * Checks file length matched actual file data length and repairs if necessary. + * Checks file length matched actual file data length and repairs if necessary. */ public void checkFileHeaders() { CheckWavFileHeaders.showDialog(acquisitionDialog, this); @@ -306,13 +307,14 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D class FindAudioFolder implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { selectFolder(); } - } + } @Override public void setSelected(boolean select) { @@ -323,15 +325,15 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D } /** - * Make a list of wav files within a folder. In some circumstances this can be a list - * of actual files in a folder. Also needs to handle the possibility of it using - * a globally set folder name. + * Make a list of wav files within a folder. In some circumstances this can be a list + * of actual files in a folder. Also needs to handle the possibility of it using + * a globally set folder name. * @return flag to indicate...nothing? */ public int makeSelFileList() { String[] selection = checkComandLineFolder(); - + if (selection == null) { if (fileInputParameters.recentFiles == null || fileInputParameters.recentFiles.size() < 1) { return 0; @@ -346,9 +348,9 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D } return makeSelFileList(selection); } - + /** - * Make a list of wav files within a folder. + * Make a list of wav files within a folder. * @param rootList * @return */ @@ -356,22 +358,22 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D // File[] selectedFiles = folderInputParameters.getSelectedFiles(); // if (selectedFiles.length == 1 && selectedFiles[0].isDirectory()) { // String folderName = fileInputParameters.recentFiles.get(0); - + //Swing calls a dialog with progress bar from the wavListWorker wavListStart = System.currentTimeMillis(); - + if (folderInputPane==null) { //Swing way - wavListWorker.startFileListProcess(PamController.getMainFrame(), rootList, + wavListWorker.startFileListProcess(PamController.getMainFrame(), rootList, folderInputParameters.subFolders, true); } else { //FX system - PamWorker> worker = wavListWorker.makeFileListProcess(rootList, folderInputParameters.subFolders, true); - folderInputPane.setFileWorker(worker); - if (worker!=null) worker.start(); + PamWorker> worker = wavListWorker.makeFileListProcess(rootList, folderInputParameters.subFolders, true); + folderInputPane.setFileWorker(worker); + if (worker!=null) worker.start(); } - + return 0; } @@ -413,7 +415,7 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D // folderProgress.setValue(0); // // Collections.sort(allFiles); - // + // // return allFiles.size(); // // } @@ -463,9 +465,9 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D if (ans == JFileChooser.APPROVE_OPTION) { /* - * if it's a single directory that's been selected, then + * if it's a single directory that's been selected, then * set that with setNewFile. If multiple files and directories - * are accepted, select the parent directory of all of them. + * are accepted, select the parent directory of all of them. */ File[] files = fc.getSelectedFiles(); if (files.length <= 0) return; @@ -477,12 +479,12 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D File aFile = files[0]; setNewFile(aFile.getAbsolutePath()); } - - + + /* * The file chooser is returning sub classes of File which are not - * serialisable, so we can't use them. We need to convert their - * names to strings, which can be safely serialized. This will + * serialisable, so we can't use them. We need to convert their + * names to strings, which can be safely serialized. This will * all happen in FolderInputParameters. */ folderInputParameters.setSelectedFiles(fc.getSelectedFiles()); @@ -500,12 +502,12 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D } long wavListStart; - + /** - * Creates a list of wav files. + * Creates a list of wav files. */ WavListWorker wavListWorker = new WavListWorker(new WavListReceiver()); - + private class WavListReceiver implements WavListUser { @Override @@ -522,8 +524,8 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D } /* * don't actually need to do anything ? Could make a new list, but do it from what's in the - * folder parameters, not the file parameters. do nothing here, or it gets too complicated. - * Call the search function from the file select part of the dialot. + * folder parameters, not the file parameters. do nothing here, or it gets too complicated. + * Call the search function from the file select part of the dialot. */ // test the new Wav list worker ... @@ -533,31 +535,31 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D } /** - * Callback when the file list has completed it's background task. + * Callback when the file list has completed it's background task. * @param fileListData */ public void newFileList(FileListData fileListData) { - -// System.out.printf("Wav list recieved with %d files after %d millis\n", + +// System.out.printf("Wav list recieved with %d files after %d millis\n", // fileListData.getFileCount(), System.currentTimeMillis() - wavListStart); allFiles = fileListData.getListCopy(); - + List asList = allFiles; setSelectedFileTypes(acquisitionControl.soundFileTypes.getUsedTypes(allFiles)); - //set the date of the first file. + //set the date of the first file. setFileDateText(); - - //set any bespoke options for the files to be laoded. + + //set any bespoke options for the files to be laoded. setFileOptionPanel(); - + // also open up the first file and get the sample rate and number of channels from it // and set these File file = getCurrentFile(); if (file == null) return; - AudioInputStream audioStream; - - + AudioInputStream audioStream; + + /****Swing GUI stuff****/ if (file.isFile() && !file.isHidden() && acquisitionDialog != null) { //Hidden files should not be used in analysis... @@ -574,31 +576,31 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D System.err.println("Error in file " + file.getAbsolutePath() + " " + Ex.getLocalizedMessage()); } } - + // set the min and max of the folder progress bar folderProgress.setMinimum(0); folderProgress.setMaximum(allFiles.size()); - + /****FX GUI stuff****/ if (folderInputPane!=null) { Platform.runLater(()->{ - folderInputPane.newFileList(fileListData); + folderInputPane.newFileList(fileListData); }); } } /** * Fudge function so that the RonaInputsystem can always fudge the number - * of channels to be 7. + * of channels to be 7. * @param nChannels * @return */ protected int fudgeNumChannels(int nChannels) { return nChannels; } - + /** - * Set bespoke options for certain file types. + * Set bespoke options for certain file types. */ public void setFileOptionPanel() { getDialogPanel(); // make sure panel is created @@ -606,8 +608,8 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D audioLoaderHolder.removeAll(); if (allFiles.size() > 0) { - //Get all the audio file laoders that will be used for this list of files. Usually - //just one but possible that there can be mixed files. + //Get all the audio file laoders that will be used for this list of files. Usually + //just one but possible that there can be mixed files. ArrayList loaders = PamAudioFileManager.getInstance().getAudioFileLoaders(allFiles); GridBagConstraints constraints = new GridBagConstraints(); @@ -627,7 +629,7 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D } /** - * Show the date of the first file in the dialog. + * Show the date of the first file in the dialog. */ public void setFileDateText() { if (allFiles.size() > 0) { @@ -670,9 +672,9 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D @Override protected boolean openNextFile(long totalSamples) { boolean ans = false; - if (folderInputParameters.mergeFiles == false) return false; - - + if (!folderInputParameters.mergeFiles) return false; + + long currFileStart = 0; long currFileLength = 0; long currFileEnd = 0; @@ -692,7 +694,7 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D } if (currFileEnd == 0) { // System.out.println("OpenNextfile " + currentFile + " " + allFiles.get(currentFile).getName()); - // also check to see if the start time of the next file is the same as the + // also check to see if the start time of the next file is the same as the // end time of the current file. currFileEnd = PamCalendar.getTimeInMillis(); long lastBit = (long) ((blockSamples * 1000L) / getSampleRate()); @@ -705,22 +707,22 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D currentFile--; return false; /* - * Return since it's not possible to merge this file into the + * Return since it's not possible to merge this file into the * next one. In this instance, DAQ will restart, and the currentfile - * counter will increment elsewhere. + * counter will increment elsewhere. */ } setFolderProgress(); // sayEta(); /* - * I think that here, we just need a check of the file. the prepareInputFile in - * this class will (on failure) move straight to the next file and also issue a + * I think that here, we just need a check of the file. the prepareInputFile in + * this class will (on failure) move straight to the next file and also issue a * stop/start, which is not good if it's trying a continuous file, where this is - * being called, if false is returned it should manage moving onto the next file by - * itself if we use the super.prep .... + * being called, if false is returned it should manage moving onto the next file by + * itself if we use the super.prep .... */ ans = super.prepareInputFile(); - if (ans == false) { + if (!ans) { return false; } currentFileStart = System.currentTimeMillis(); @@ -728,11 +730,11 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D // acquisitionControl.getDaqProcess().setSampleRate(currentSampleRate = audioFormat.getSampleRate(), true); // } /** - * Send a dataunit to the database to mark the file changeover. + * Send a dataunit to the database to mark the file changeover. */ - DaqStatusDataUnit daqStatusDataUnit = new DaqStatusDataUnit(currentFileStart, currentFileStart, currentFileStart, - totalSamples, null, "NextFile", "File End", - acquisitionControl.acquisitionParameters, getSystemName(), totalSamples/getSampleRate(), 0); + DaqStatusDataUnit daqStatusDataUnit = new DaqStatusDataUnit(currentFileStart, currentFileStart, currentFileStart, + totalSamples, null, "NextFile", "File End", + acquisitionControl.acquisitionParameters, getSystemName(), totalSamples/getSampleRate(), 0); acquisitionControl.getAcquisitionProcess().getDaqStatusDataBlock().addPamData(daqStatusDataUnit); } return ans; @@ -746,14 +748,14 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D } if (currentFile < allFiles.size()) { // only restart if the file ended - not if it stopped - if (getStreamStatus() == STREAM_ENDED && PamController.getInstance().isManualStop() == false) { + if (getStreamStatus() == STREAM_ENDED && !PamController.getInstance().isManualStop()) { // System.out.println(String.format("Start new file timer (file %d/%d)",currentFile+1,allFiles.size())); newFileTimer.start(); } } calculateETA(); setFolderProgress(); - + if (currentFile > 0 && currentFile >= allFiles.size()) { fileListComplete(); } @@ -776,7 +778,7 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D PamProgressBar folderProgress = new PamProgressBar(PamProgressBar.defaultColor); private FolderInputPane folderInputPane; - + @Override public Component getStatusBarComponent() { @@ -817,24 +819,24 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D currentFile = 0; if (skipSecondsField!=null) { try { - Double skipSeconds = Double.valueOf(skipSecondsField.getText())*1000.; // saved in millis. + Double skipSeconds = Double.valueOf(skipSecondsField.getText())*1000.; // saved in millis. folderInputParameters.skipStartFileTime = skipSeconds.longValue(); } catch (Exception e) { - return false; + return false; } } - - //get bespoke paramters from selected audio loaders. + + //get bespoke paramters from selected audio loaders. ArrayList loaders = PamAudioFileManager.getInstance().getAudioFileLoaders(allFiles); - + for (PamAudioFileLoader loader : loaders) { if (loader.getSettingsPane()!=null) { loader.getSettingsPane().getParams(); } } - + return super.dialogGetParams(); } @@ -845,7 +847,7 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D // would hold a null. The system type is used by the getParameterSet method to decide // whether or not to include the parameters in the XML output if (fileInputParameters.systemType==null) fileInputParameters.systemType=getSystemType(); - + super.dialogSetParams(); subFolders.setSelected(folderInputParameters.subFolders); mergeFiles.setSelected(folderInputParameters.mergeFiles); @@ -853,7 +855,7 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D if (skipSecondsField!=null) { skipSecondsField.setText(String.format("%.1f", fileInputParameters.skipStartFileTime/1000.)); } - + } @Override @@ -918,14 +920,15 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D /****JavaFX bits***/ + @Override public DAQSettingsPane getDAQSpecificPane(AcquisitionPaneFX acquisitionPaneFX) { - if (folderInputPane==null) this.folderInputPane = new FolderInputPane(this, acquisitionPaneFX); + if (folderInputPane==null) this.folderInputPane = new FolderInputPane(this, acquisitionPaneFX); return folderInputPane; } /** * Called by AcquisitionDialog.SetParams so that the dialog node can update it's - * fields. + * fields. */ public void dialogFXSetParams() { folderInputPane.setParams(folderInputParameters); @@ -933,7 +936,7 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D @Override public InputStoreInfo getStoreInfo(boolean detail) { - System.out.println("FolderInputSystem: Get store info start:"); + System.out.println("FolderInputSystem: Get store info start:"); if (allFiles == null || allFiles.size() == 0) { return null; } @@ -963,12 +966,12 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D lastFileEnd = allFileStarts[i] + (long) (lastFile.getDurationInSeconds()*1000.); } } - storeInfo.setFirstFileStart(firstFileStart); // just incase changed. + storeInfo.setFirstFileStart(firstFileStart); // just incase changed. storeInfo.setLastFileEnd(lastFileEnd); // just incase changed storeInfo.setFileStartTimes(allFileStarts); storeInfo.setFileEndTimes(allFileEnds); } - System.out.println("FolderInputSystem: Get store info complete:"); + System.out.println("FolderInputSystem: Get store info complete:"); return storeInfo; } @@ -977,8 +980,8 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D /** * Called from the reprocess manager just before PAMGuard starts with a time * we want to process from. This should be equal to the start of one of the files - * so all we have to do (in principle) is to set the currentfile to that index and - * processing will continue from there. + * so all we have to do (in principle) is to set the currentfile to that index and + * processing will continue from there. */ if (allFiles == null || allFiles.size() == 0) { System.out.println("Daq setanal start time: no files to check against"); @@ -987,7 +990,7 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D System.out.printf("setAnalysisStarttTime: checking %d files for start time of %s\n", allFiles.size(), PamCalendar.formatDBDateTime(startTime)); /* * If the starttime is maxint then there is nothing to do, but we do need to set the file index - * correctly to not over confuse the batch processing system. + * correctly to not over confuse the batch processing system. */ long lastFileTime = getFileStartTime(allFiles.get(allFiles.size()-1).getAbsoluteFile()); if (startTime > lastFileTime) { @@ -1008,13 +1011,14 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D return true; } } - + return false; } /** - * Get a status update for batch processing. + * Get a status update for batch processing. */ + @Override public String getBatchStatus() { int nFiles = 0; if (allFiles != null) { @@ -1025,8 +1029,8 @@ public class FolderInputSystem extends FileInputSystem implements PamSettings, D String bs = String.format("%d,%d,%d,%s", nFiles,currentFile,generalStatus,currFile); return bs; } - - + + } diff --git a/src/Acquisition/KETime.java b/src/Acquisition/KETime.java index 357ab6a3..40fbb3d9 100644 --- a/src/Acquisition/KETime.java +++ b/src/Acquisition/KETime.java @@ -10,18 +10,18 @@ public class KETime { /** - * Unpack the KE buoy data format. This has a decimal number of - * seconds, but is otherwise quite rational. + * Unpack the KE buoy data format. This has a decimal number of + * seconds, but is otherwise quite rational. * @param numPart - the date string * @return time in millis */ public static long getKEBuoyTime(String numPart) { int dotPos = numPart.indexOf('.', 0); - + if (dotPos < 0) { return Long.MIN_VALUE; } - + String mainBit = numPart.substring(0, dotPos); String fracPart = numPart.substring(dotPos); String fmt = "yyyyMMdd_HHmmss"; @@ -42,32 +42,32 @@ public class KETime { cl.setTimeZone(TimeZone.getTimeZone("GMT")); cl.setTime(d); long millis = cl.getTimeInMillis(); - + try { double fracBit = Double.valueOf(fracPart); millis += (long) (fracBit*1000.); } catch (NumberFormatException e) { - + } return millis; } - + /** * Unpack the PLA buoy data format (superseeds KE Buoy). This has a nanosecond value after the seconds - * e.g. would be ddmmyyyy_HHMMSS_FFFFF in MATLAB format. + * e.g. would be ddmmyyyy_HHMMSS_FFFFF in MATLAB format. * @param numPart - the date string * @return time in millis */ public static long getPLABuoyTime(String numPart) { String[] timeSections=numPart.split("_"); - - //got have a data section, time section and then nanosecond section + + //got have a data section, time section and then nanosecond section if (timeSections.length!=3 || timeSections[2].length()!=6){ return Long.MIN_VALUE; } - + String mainBit = timeSections[0]+timeSections[1]; String fracPart = timeSections[2]; String fmt = "yyyyMMddHHmmss"; @@ -88,13 +88,13 @@ public class KETime { cl.setTimeZone(TimeZone.getTimeZone("GMT")); cl.setTime(d); long millis = cl.getTimeInMillis(); - + try { double fracBit = Double.valueOf(fracPart); millis += (long) (fracBit/1000.); } catch (NumberFormatException e) { - + } return millis; diff --git a/src/Acquisition/RawDataBinaryDataSource.java b/src/Acquisition/RawDataBinaryDataSource.java index ac7dea6b..4dd36b98 100644 --- a/src/Acquisition/RawDataBinaryDataSource.java +++ b/src/Acquisition/RawDataBinaryDataSource.java @@ -8,24 +8,21 @@ import java.io.File; import java.io.IOException; import PamDetection.RawDataUnit; -import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamRawDataBlock; import binaryFileStorage.BinaryDataSource; import binaryFileStorage.BinaryHeader; import binaryFileStorage.BinaryObjectData; -import binaryFileStorage.BinaryOutputStream; import binaryFileStorage.ModuleFooter; import binaryFileStorage.ModuleHeader; -import binaryFileStorage.PackedBinaryObject; /** - * Data source for Raw acoustic data. This is set up to NEVER + * Data source for Raw acoustic data. This is set up to NEVER * be written to binary storage files - WAV files are way better - * for that. The purpose of this class is to enable sending of - * raw audio data over the network. Currently assumes 16 bit audio, - * but may make this more flexible in the future is higher res ADC's - * are in use within PAMGUARD. + * for that. The purpose of this class is to enable sending of + * raw audio data over the network. Currently assumes 16 bit audio, + * but may make this more flexible in the future is higher res ADC's + * are in use within PAMGUARD. * @author Doug Gillespie * */ @@ -35,7 +32,7 @@ public class RawDataBinaryDataSource extends BinaryDataSource { private ByteArrayOutputStream bos; private DataOutputStream dos; private long offsetSamples; - + public RawDataBinaryDataSource(PamRawDataBlock sisterDataBlock) { super(sisterDataBlock); setDoBinaryStore(false); @@ -72,8 +69,8 @@ public class RawDataBinaryDataSource extends BinaryDataSource { @Override public BinaryObjectData getPackedData(PamDataUnit pamDataUnit) { /** - * Pack a raw data unit. N.B. Raw data units in PAMGAURD only contain a single - * channel of data. The channel number will need to be packed into the header. + * Pack a raw data unit. N.B. Raw data units in PAMGAURD only contain a single + * channel of data. The channel number will need to be packed into the header. */ RawDataUnit rawDataUnit = (RawDataUnit) pamDataUnit; int duration = rawDataUnit.getSampleDuration().intValue(); @@ -98,14 +95,14 @@ public class RawDataBinaryDataSource extends BinaryDataSource { } catch (IOException e) { e.printStackTrace(); } - + return new BinaryObjectData(0, bos.toByteArray()); } @Override public PamDataUnit sinkData(BinaryObjectData binaryObjectData, BinaryHeader bh, int moduleVersion) { - ByteArrayInputStream bis = new ByteArrayInputStream(binaryObjectData.getData(), + ByteArrayInputStream bis = new ByteArrayInputStream(binaryObjectData.getData(), 0, binaryObjectData.getDataLength()); DataInputStream dis = new DataInputStream(bis); long startSample; @@ -117,15 +114,15 @@ public class RawDataBinaryDataSource extends BinaryDataSource { try { startSample = dis.readLong(); /* - * Muck a bit with the timing so that within this network received - * data, sample counts get restarted at 0. This will ensure that - * millisecond and ADC count timings end up about right for the data. + * Muck a bit with the timing so that within this network received + * data, sample counts get restarted at 0. This will ensure that + * millisecond and ADC count timings end up about right for the data. */ if (offsetSamples == 0) { offsetSamples = startSample; } - startSample -= offsetSamples; // subtract off the offset from the sample number. - + startSample -= offsetSamples; // subtract off the offset from the sample number. + channelMap = dis.readInt(); duration = dis.readInt(); nBytes = dis.readByte(); @@ -142,8 +139,8 @@ public class RawDataBinaryDataSource extends BinaryDataSource { } RawDataUnit rawDataUnit = new RawDataUnit(binaryObjectData.getTimeMilliseconds(), channelMap, startSample, duration); - rawDataUnit.setRawData(rawData, true); -// System.out.println("raw data arrived to unpack on channels " + + rawDataUnit.setRawData(rawData, true); +// System.out.println("raw data arrived to unpack on channels " + // channelMap + " sample " + startSample); return rawDataUnit; } diff --git a/src/Acquisition/RonaInputSystem.java b/src/Acquisition/RonaInputSystem.java index 6322f30b..d7c0965c 100644 --- a/src/Acquisition/RonaInputSystem.java +++ b/src/Acquisition/RonaInputSystem.java @@ -10,11 +10,9 @@ import java.util.Arrays; import java.util.Calendar; import java.util.Date; -import javax.sound.sampled.AudioFormat; +import javax.sound.sampled.AudioFormat.Encoding; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.UnsupportedAudioFileException; -import javax.sound.sampled.AudioFormat.Encoding; -import javax.swing.filechooser.FileFilter; //import org.kc7bfi.jflac.FLACDecoder; //import org.kc7bfi.jflac.PCMProcessor; @@ -25,27 +23,26 @@ import org.jflac.PCMProcessor; import org.jflac.metadata.StreamInfo; import org.jflac.util.ByteData; -import wavFiles.ByteConverter; -import Acquisition.pamAudio.PamAudioFileManager; import Acquisition.pamAudio.PamAudioFileFilter; -import Acquisition.pamAudio.PamAudioSystem; +import Acquisition.pamAudio.PamAudioFileManager; import PamDetection.RawDataUnit; import PamUtils.FileParts; import PamUtils.PamCalendar; import PamUtils.PamFileFilter; import PamUtils.PamUtils; +import wavFiles.ByteConverter; /** - * Bespoke system for handling data from the Rona hydrophone array which - * consists of sets of seven files, each with different ends in th ename. + * Bespoke system for handling data from the Rona hydrophone array which + * consists of sets of seven files, each with different ends in th ename. * @author Doug * */ public class RonaInputSystem extends FolderInputSystem { private static final int RONACHANNELS = 0x21; // channels 5 and 0 - - private static final int NCHANNELS = PamUtils.getNumChannels(RONACHANNELS); + + private static final int NCHANNELS = PamUtils.getNumChannels(RONACHANNELS); private AudioInputStream[] audioStreams = new AudioInputStream[NCHANNELS]; @@ -58,9 +55,9 @@ public class RonaInputSystem extends FolderInputSystem { private int readyMask = PamUtils.makeChannelMap(NCHANNELS); private int runningChannels; - + private long lastFileTime = 0; - + public static final String systemType = "Rona File Folders"; public RonaInputSystem(AcquisitionControl acquisitionControl) { @@ -98,7 +95,7 @@ public class RonaInputSystem extends FolderInputSystem { @Override public boolean accept(File f) { - if (super.accept(f) == false) { + if (!super.accept(f)) { return false; } if (f.isDirectory()) { @@ -108,11 +105,11 @@ public class RonaInputSystem extends FolderInputSystem { String name = f.getName(); int lastDot = name.lastIndexOf('.'); if (lastDot < 0) return false; - char ch = name.charAt(lastDot-1); + char ch = name.charAt(lastDot-1); if ('1' != ch) { return false; } - // now check all other files in the set exist. + // now check all other files in the set exist. for (int i = 1; i < NCHANNELS; i++) { File chanFile = findChannelFile(f, i, 2); if (chanFile == null) { @@ -177,14 +174,14 @@ public class RonaInputSystem extends FolderInputSystem { } catch (IOException ex) { ex.printStackTrace(); return false; - } + } return true; } /** - * swap the last digit in a file name for the higher channel - * number - rememebr the channels are one indexed. + * swap the last digit in a file name for the higher channel + * number - rememebr the channels are one indexed. * @param baseFile base file * @param index 0 based file index * @return new file with the 1 replaced by another number @@ -199,7 +196,7 @@ public class RonaInputSystem extends FolderInputSystem { } /** - * Search for a nearby file with the same name, but secondds may differ + * Search for a nearby file with the same name, but secondds may differ * by one or two secs - may need to generate complete new file names ! * @param baseFile * @param index @@ -214,7 +211,7 @@ public class RonaInputSystem extends FolderInputSystem { index = PamUtils.getNthChannel(index, RONACHANNELS); /* * files are in the format 20051209-185714-02.flac - * so get the time and add an offset to make a new file name. + * so get the time and add an offset to make a new file name. */ long fileTime = getFileStartTime(baseFile); if (fileTime <= 0) { @@ -245,7 +242,7 @@ public class RonaInputSystem extends FolderInputSystem { @Override public boolean prepareSystem(AcquisitionControl daqControl) { this.acquisitionControl = daqControl; - if (prepareInputFile() == false) { + if (!prepareInputFile()) { return false; } this.newDataUnits = acquisitionControl.getDaqProcess().getNewDataQueue(); @@ -285,7 +282,7 @@ public class RonaInputSystem extends FolderInputSystem { currentFileStart = System.currentTimeMillis(); fileStartTime = currentFileStart; - + for (int i = 0; i < NCHANNELS; i++) { Thread thread = new Thread(flacThreads[i]); thread.start(); @@ -304,7 +301,7 @@ public class RonaInputSystem extends FolderInputSystem { else { runningChannels &= ~(1< 0); } - + @Override protected void calculateETA() { long now = System.currentTimeMillis(); @@ -359,8 +356,8 @@ public class RonaInputSystem extends FolderInputSystem { double[] newRaw = Arrays.copyOf(readyDataUnits[i].getRawData(), (int) firstDataLen); readyDataUnits[i].setRawData(newRaw); /** - * Will also need to stop the run at this point since it's evident that one file is longer than others - * and will now go into a wait state while it tries to match it's data with other channels. + * Will also need to stop the run at this point since it's evident that one file is longer than others + * and will now go into a wait state while it tries to match it's data with other channels. */ dontStop = false; } @@ -368,7 +365,7 @@ public class RonaInputSystem extends FolderInputSystem { newDataUnits.addNewData(readyDataUnits[i]); } while (newDataUnits.getQueueSize() > NCHANNELS) { - if (dontStop == false) break; + if (!dontStop) break; try { Thread.sleep(2); } catch (Exception ex) { @@ -403,7 +400,7 @@ public class RonaInputSystem extends FolderInputSystem { @Override public void processPCM(ByteData byteData) { - if (dontStop == false) { + if (!dontStop) { try { fileStream.close(); // will make the flac reader bomb out ! } @@ -443,12 +440,12 @@ public class RonaInputSystem extends FolderInputSystem { // newDataUnit.timeMilliseconds = blockMillis; PamCalendar.setSoundFileTimeInMillis(blockMillis); if (fileSamples > 0 && totalSamples - lastProgressUpdate >= getSampleRate()*2) { - int progress = (int) (1000. * (float)theseFileSamples / (float) fileSamples); + int progress = (int) (1000. * theseFileSamples / fileSamples); fileProgress.setValue(progress); sayEta(); long now = System.currentTimeMillis(); if (lastProgressTime > 0 && totalSamples > lastProgressUpdate) { - double speed = (double) (totalSamples - lastProgressUpdate) / + double speed = (double) (totalSamples - lastProgressUpdate) / getSampleRate() / ((now-lastProgressTime)/1000.); speedLabel.setText(String.format(" (%3.1f X RT)", speed)); } @@ -458,18 +455,18 @@ public class RonaInputSystem extends FolderInputSystem { } /** - * Sit and wait until all threads have put there data units into the + * Sit and wait until all threads have put there data units into the * ready array, then they will release at the same time and this thread - * can continue round. + * can continue round. */ for (int ichan = 0; ichan < 1; ichan++) { while (waitingDataUnit(ichan+channelOffset)) { - if (dontStop == false) break; + if (!dontStop) break; try { Thread.sleep(2); } catch (Exception ex) { ex.printStackTrace(); - } + } } } @@ -522,7 +519,7 @@ public class RonaInputSystem extends FolderInputSystem { // byteData = flacDecoder.decodeFrame(flacFrame, byteData); // } } catch (IOException e) { - // don't print this since it happens naturally when we press the stop button. + // don't print this since it happens naturally when we press the stop button. // e.printStackTrace(); } try { diff --git a/src/Acquisition/SoundCardParameters.java b/src/Acquisition/SoundCardParameters.java index a54b62b4..3349acfb 100644 --- a/src/Acquisition/SoundCardParameters.java +++ b/src/Acquisition/SoundCardParameters.java @@ -5,7 +5,6 @@ import java.io.Serializable; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet.ParameterSetType; -import simulatedAcquisition.SimProcess; /** * Used by SoundCardSystem @@ -16,12 +15,12 @@ import simulatedAcquisition.SimProcess; public class SoundCardParameters implements Serializable, Cloneable, ManagedParameters { public static final long serialVersionUID = 1; - + public int deviceNumber; - + public String systemType; - - + + /** * @param systemType */ diff --git a/src/Acquisition/SoundCardSystem.java b/src/Acquisition/SoundCardSystem.java index 3edbdb2f..99f4e131 100644 --- a/src/Acquisition/SoundCardSystem.java +++ b/src/Acquisition/SoundCardSystem.java @@ -8,6 +8,7 @@ import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.Mixer; +import javax.sound.sampled.Mixer.Info; import javax.sound.sampled.TargetDataLine; import javax.swing.JComboBox; import javax.swing.JPanel; @@ -16,19 +17,18 @@ import javax.swing.border.TitledBorder; import Acquisition.layoutFX.AcquisitionPaneFX; import Acquisition.layoutFX.DAQSettingsPane; import Acquisition.layoutFX.SoundCardDAQPane; -import soundPlayback.PlaybackControl; -import soundPlayback.PlaybackSystem; -import soundPlayback.SoundCardPlayback; -import wavFiles.ByteConverter; import PamController.PamControlledUnitSettings; import PamController.PamSettingManager; import PamController.PamSettings; import PamDetection.RawDataUnit; -import PamguardMVC.debug.Debug; +import soundPlayback.PlaybackControl; +import soundPlayback.PlaybackSystem; +import soundPlayback.SoundCardPlayback; +import wavFiles.ByteConverter; /** * Everything and everything to do with controlling and reading sound cards. - * + * * @author Doug Gillespie * @see Acquisition.DaqSystem * @see Acquisition.AcquisitionProcess @@ -39,26 +39,26 @@ public class SoundCardSystem extends DaqSystem implements PamSettings { public static final String sysType = "Sound Card"; JPanel daqDialog; - + JComboBox audioDevices; - + SoundCardParameters soundCardParameters = new SoundCardParameters(sysType); - + private AudioFormat audioFormat; private AudioDataQueue newDataList; - + private volatile boolean stopCapture; - + private AcquisitionControl acquisitionControl; - + private int rawBufferSizeInBytes; // Might need this to be more flexible private int sampleSizeInBytes = 2; private double sampleMax = 32768; - + private int daqChannels; - + private TargetDataLine targetDataLine; private PlaybackSystem soundCardPlayback; @@ -66,34 +66,34 @@ public class SoundCardSystem extends DaqSystem implements PamSettings { private int dataUnitSamples; private ByteConverter byteConverter; - + /** * JavaFX settings pane for sound card settings */ private SoundCardDAQPane soundCardSettingsPane; - + public SoundCardSystem (AcquisitionControl daqControl) { this.acquisitionControl = daqControl; PamSettingManager.getInstance().registerSettings(this); soundCardPlayback = new SoundCardPlayback(this); } - + @Override public boolean prepareSystem(AcquisitionControl daqControl) { this.acquisitionControl = daqControl; - + // keep a reference to where data will be put. this.newDataList = daqControl.getDaqProcess().getNewDataQueue(); if (this.newDataList == null) return false; daqChannels = daqControl.acquisitionParameters.nChannels; float sampleRate = daqControl.acquisitionParameters.sampleRate; - + audioFormat = new AudioFormat(sampleRate, 16, daqChannels, true, true); dataUnitSamples = (int) (acquisitionControl.acquisitionParameters.sampleRate / 10); dataUnitSamples = Math.max(dataUnitSamples, 1000); - + ArrayList mixerinfos = getInputMixerList(); //System.out.println("soundCardParameters.deviceNumber:"+soundCardParameters.deviceNumber); if (soundCardParameters.deviceNumber < 0 || soundCardParameters.deviceNumber >= mixerinfos.size()) { @@ -106,7 +106,7 @@ public class SoundCardSystem extends DaqSystem implements PamSettings { thisMixer.getLineInfo(); return false; } - + try { // try to get the device of choice ... targetDataLine = (TargetDataLine) thisMixer.getLine(thisMixer.getTargetLineInfo()[0]); @@ -118,7 +118,7 @@ public class SoundCardSystem extends DaqSystem implements PamSettings { boolean lineOk = false; // audioFormat = new AudioFormat(sampleRate, 24, daqChannels, true, true); -// // first try to open input for 24 bit recording, +// // first try to open input for 24 bit recording, // try { // targetDataLine.open(audioFormat); // sampleSizeInBytes = 3; @@ -128,8 +128,8 @@ public class SoundCardSystem extends DaqSystem implements PamSettings { // } catch (LineUnavailableException Ex) { // lineOk = false; // } - // if the 24 bit recording failed, then try to open for 16 bit recording. - if (lineOk == false) { + // if the 24 bit recording failed, then try to open for 16 bit recording. + if (!lineOk) { audioFormat = new AudioFormat(sampleRate, 16, daqChannels, true, true); try { targetDataLine.open(audioFormat); @@ -142,14 +142,14 @@ public class SoundCardSystem extends DaqSystem implements PamSettings { } byteConverter = ByteConverter.createByteConverter(audioFormat); - + // Buffer size to hold 1/10th of a second rawBufferSizeInBytes = dataUnitSamples * daqChannels * sampleSizeInBytes; - - + + return true; } - + /* (non-Javadoc) * @see Acquisition.DaqSystem#getDataUnitSamples() @@ -161,20 +161,20 @@ public class SoundCardSystem extends DaqSystem implements PamSettings { @Override public boolean startSystem(AcquisitionControl daqControl) { - + if (targetDataLine == null) return false; // Create a thread to capture the sound card input // and start it running. Thread captureThread = new Thread(new CaptureThread()); captureThread.start(); - + // then start the device targetDataLine.start(); - + setStreamStatus(STREAM_RUNNING); return true; - + } @Override @@ -207,70 +207,70 @@ public class SoundCardSystem extends DaqSystem implements PamSettings { if (daqDialog == null) { daqDialog = createDaqDialogPanel(); } - + return daqDialog; - + } private JPanel createDaqDialogPanel() { - + JPanel p = new JPanel(); - + p.setBorder(new TitledBorder("Select audio line")); p.setLayout(new BorderLayout()); p.add(BorderLayout.CENTER, audioDevices = new JComboBox()); - + return p; } public static ArrayList getInputMixerList() { - ArrayList mixers = new ArrayList(); + ArrayList mixers = new ArrayList<>(); AudioSystem.getMixerInfo(); Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo(); Mixer mixer; - for (int i = 0; i < mixerInfo.length; i++) { - mixer = AudioSystem.getMixer(mixerInfo[i]); + for (Info element : mixerInfo) { + mixer = AudioSystem.getMixer(element); //System.out.println("mixer:"+mixer); //System.out.println(mixer.getClass().getName()); //System.out.println("mixer info:"+mixerInfo[i]); - //extra bit for Mac's where "Line In" is under mixer "Built-in Line Input" + //extra bit for Mac's where "Line In" is under mixer "Built-in Line Input" //which is com.sun.media.sound.SimpleInputDevice //cjb 2009-01-05 if (mixer.getTargetLineInfo().length > 0){ if ( (mixer.getClass().getName().equals("com.sun.media.sound.DirectAudioDevice")) || (mixer.getClass().getName().equals("com.sun.media.sound.SimpleInputDevice"))) { //System.out.println("Adding to input mixer list:"+mixer.getClass().getName()); - mixers.add(mixerInfo[i]); + mixers.add(element); } } } return mixers; } public static ArrayList getOutputMixerList() { - ArrayList mixers = new ArrayList(); + ArrayList mixers = new ArrayList<>(); AudioSystem.getMixerInfo(); Mixer.Info[] mixerInfo = AudioSystem.getMixerInfo(); Mixer mixer; - for (int i = 0; i < mixerInfo.length; i++) { + for (Info element : mixerInfo) { try { - mixer = AudioSystem.getMixer(mixerInfo[i]); + mixer = AudioSystem.getMixer(element); } catch (Exception e) { continue; } //System.out.println("Output mixer list:" + mixer); //System.out.println("Output mixer list:" + mixer.getClass().getName()); - //extra bit for Mac's where "Line Out" is under mixer "Built-in Line Input" - //which gives 0 length array for getSourceLineInfo() + //extra bit for Mac's where "Line Out" is under mixer "Built-in Line Input" + //which gives 0 length array for getSourceLineInfo() //cjb 2009-01-05 if (mixer.getSourceLineInfo().length > 0){ if ((mixer.getClass().getName().equals("com.sun.media.sound.DirectAudioDevice")) || (mixer.getClass().getName().equals("com.sun.media.sound.HeadspaceMixer"))) { //System.out.println(mixer.getClass().getName()); - mixers.add(mixerInfo[i]); + mixers.add(element); // Debug.out.printf("Use mixer %d, %s\n", i, mixerInfo[i].getName()); - } + } // else { // Debug.out.printf("Don't Use mixer %d, %s\n", i, mixerInfo[i].getName()); // } @@ -281,9 +281,9 @@ public class SoundCardSystem extends DaqSystem implements PamSettings { } return mixers; } - + public static ArrayList getDevicesList() { - ArrayList devices = new ArrayList(); + ArrayList devices = new ArrayList<>(); ArrayList mixers = getInputMixerList(); for (int i = 0; i < mixers.size(); i++) { //System.out.println("Adding Device:"+mixers.get(i).getName()); @@ -291,9 +291,9 @@ public class SoundCardSystem extends DaqSystem implements PamSettings { } return devices; - + } - + @Override public void dialogSetParams() { // do a quick check to see if the system type is stored in the parameters. This field was added @@ -304,32 +304,32 @@ public class SoundCardSystem extends DaqSystem implements PamSettings { ArrayList devices = getDevicesList(); - + audioDevices.removeAllItems(); - for (int i = 0; i < devices.size(); i++) { + for (String element : devices) { //System.out.println("Adding to audio device:"+devices.get(i)); - audioDevices.addItem(devices.get(i)); + audioDevices.addItem(element); } - + soundCardParameters.deviceNumber = Math.max(Math.min(devices.size()-1, soundCardParameters.deviceNumber), 0); if (devices.size() > 0) { audioDevices.setSelectedIndex(soundCardParameters.deviceNumber); } - + } - + @Override public boolean dialogGetParams() { //System.out.println("soundCardParameters: " + soundCardParameters + "audioDevices: " + audioDevices); if (audioDevices!=null) soundCardParameters.deviceNumber = audioDevices.getSelectedIndex(); return true; } - + @Override public String getSystemType() { return sysType; } - + @Override public String getSystemName() { // return the name of the sound card. @@ -356,7 +356,7 @@ public class SoundCardSystem extends DaqSystem implements PamSettings { //javax.sound only seems to support upto 2 channels //i.e. option of 1 or 2 - mono or stereo //even though API reading API can make one think - //could have more... cjb 2010-04-28 + //could have more... cjb 2010-04-28 return 2; } @@ -364,7 +364,7 @@ public class SoundCardSystem extends DaqSystem implements PamSettings { public int getMaxSampleRate() { return PARAMETER_UNKNOWN; } - + /* (non-Javadoc) * @see Acquisition.DaqSystem#getPeak2PeakVoltage() */ @@ -396,24 +396,29 @@ public class SoundCardSystem extends DaqSystem implements PamSettings { return PARAMETER_UNKNOWN; } + @Override public Serializable getSettingsReference() { return soundCardParameters; } + @Override public long getSettingsVersion() { return SoundCardParameters.serialVersionUID; } + @Override public String getUnitName() { // return "Sound Card System"; return acquisitionControl.getUnitName(); } + @Override public String getUnitType() { // return "Acquisition System"; return "Sound Card System"; } - + + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { // if (PamSettingManager.getInstance().isSettingsUnit(this, pamControlledUnitSettings)) { try { @@ -428,7 +433,7 @@ public class SoundCardSystem extends DaqSystem implements PamSettings { private volatile boolean captureRunning; - + // /** // * Unpack the byte data into a sensible number. // * @param buffer @@ -446,7 +451,8 @@ public class SoundCardSystem extends DaqSystem implements PamSettings { // } class CaptureThread implements Runnable { - + + @Override public void run() { stopCapture = false; captureRunning = true; @@ -472,10 +478,10 @@ public class SoundCardSystem extends DaqSystem implements PamSettings { count++; // Read data from the internal // buffer of the data line. - + int bytesRead = targetDataLine.read(tempBuffer, 0, tempBuffer.length); - + // System.out.println("Read in :" + bytesRead + " bytes"); /* * Much better to create the PamDataUnits here, since the @@ -483,11 +489,11 @@ public class SoundCardSystem extends DaqSystem implements PamSettings { * this. The main thread then just has to add the references * to the PamDataBlocks to theoutput data block. */ - + if (bytesRead > 0) { // convert byte array to set of double arrays, one per // channel e.g. framesize = 1 for 8 bit sound - + // Framesize is bytecost per Sample in time. ie chanels x sampledepth in bygtes newSamplesPerChannel = bytesRead / audioFormat.getFrameSize(); double[][] doubleData = new double[daqChannels][newSamplesPerChannel]; @@ -519,7 +525,7 @@ public class SoundCardSystem extends DaqSystem implements PamSettings { } catch (Exception ex) { ex.printStackTrace(); } - + }// end while } catch (Exception e) { System.out.println(e); @@ -529,30 +535,30 @@ public class SoundCardSystem extends DaqSystem implements PamSettings { stopCapture = false; captureRunning = false; setStreamStatus(STREAM_ENDED); - + }// end run }// end inner class CaptureThread @Override public void daqHasEnded() { // TODO Auto-generated method stub - + } @Override public String getDeviceName() { return String.format("%d", soundCardParameters.deviceNumber); } - + @Override public DAQSettingsPane getDAQSpecificPane(AcquisitionPaneFX acquisitionPaneFX) { if (soundCardSettingsPane==null) { - soundCardSettingsPane = new SoundCardDAQPane(this); + soundCardSettingsPane = new SoundCardDAQPane(this); } return soundCardSettingsPane; } /** - * Get the parameters for the sound card system. + * Get the parameters for the sound card system. * @return the parameters for the sound card system */ public SoundCardParameters getSoundCardParameters() { diff --git a/src/Acquisition/StandardChannelListPanel.java b/src/Acquisition/StandardChannelListPanel.java index e314418a..724cf097 100644 --- a/src/Acquisition/StandardChannelListPanel.java +++ b/src/Acquisition/StandardChannelListPanel.java @@ -18,10 +18,10 @@ public class StandardChannelListPanel implements ChannelListPanel { // public int channelList[] = new int[PamConstants.MAX_CHANNELS]; private JLabel panelChannelLabel[] = new JLabel[PamConstants.MAX_CHANNELS]; private JComboBox panelChannelList[] = new JComboBox[PamConstants.MAX_CHANNELS]; - + private JPanel panel; int nChannels = 0; - + public StandardChannelListPanel() { super(); panel = createStandardChannelListPanel(); @@ -47,23 +47,23 @@ public class StandardChannelListPanel implements ChannelListPanel { @Override public void setNumChannels(int nChannels) { - + nChannels = Math.min(nChannels, panelChannelList.length); - - this.nChannels = nChannels; - + + this.nChannels = nChannels; + for (int i = 0; i < PamConstants.MAX_CHANNELS; i++) { panelChannelLabel[i].setVisible(i < nChannels); panelChannelList[i].setVisible(i < nChannels); } -// +// // for (int iL = 0; iL < nChannels; iL++) { // panelChannelList[iL].removeAllItems(); // for (int i = 0; i < PamConstants.MAX_CHANNELS; i++) { // panelChannelList[iL].addItem(i); // } -// +// // } } @@ -75,23 +75,23 @@ public class StandardChannelListPanel implements ChannelListPanel { } for (int i = 0; i < Math.min(panelChannelList.length, channelList.length); i++){ panelChannelList[i].setSelectedIndex(channelList[i]); -// System.out.println(String.format("%s Set box %d to item %d and get %d", +// System.out.println(String.format("%s Set box %d to item %d and get %d", // this.toString(), i, channelList[i], panelChannelList[i].getSelectedItem())); } } @Override public boolean isDataOk() { - - // now check for repeat combinations. + + // now check for repeat combinations. for (int i = 0; i < nChannels-1; i++) { for (int j = i+1; j < nChannels; j++) { if (panelChannelList[i].getSelectedIndex() == panelChannelList[j].getSelectedIndex()) { String w = String.format("Channel %d is used twice\n"+ "only use each channel once on each device", panelChannelList[i].getSelectedIndex()); - JOptionPane.showConfirmDialog(null, w, + JOptionPane.showConfirmDialog(null, w, "Error", JOptionPane.OK_OPTION, JOptionPane.ERROR_MESSAGE); - return false; + return false; } } } @@ -103,9 +103,9 @@ public class StandardChannelListPanel implements ChannelListPanel { /* code for select channel */ /* - * put this in a separate panel so it can be hidden if - * it's not possible to change these parameters. - * + * put this in a separate panel so it can be hidden if + * it's not possible to change these parameters. + * * Text information updated DG & JG 12/8/08 */ JPanel cP; @@ -125,7 +125,7 @@ public class StandardChannelListPanel implements ChannelListPanel { s += "
So be aware. If you've put a plug into socket 1,
you probably want to select channel 0, etc."; for (int i = 0; i < PamConstants.MAX_CHANNELS; i++){ //Xiao Yan Deng //for (int i = 0; i < getNumChannels(); i++){ - + if (i%2 ==0){ c2.gridx = 0; c2.gridy ++; @@ -140,19 +140,19 @@ public class StandardChannelListPanel implements ChannelListPanel { else { spaceStr = ""; } - PamDialog.addComponent(cP, panelChannelLabel[i] = + PamDialog.addComponent(cP, panelChannelLabel[i] = new JLabel(spaceStr + " SW Ch " + i + " = HW Ch "), c2); c2.gridx ++; //constraints.gridwidth = 2; PamDialog.addComponent(cP, panelChannelList[i] = new JComboBox(), c2); panelChannelLabel[i].setToolTipText(s); panelChannelList[i].setToolTipText(s); - + // System.out.println(String.format("Fill channel list %d", i)); for (int iC = 0; iC < PamConstants.MAX_CHANNELS; iC++) { panelChannelList[i].addItem(iC); } - + } return cP; } @@ -162,6 +162,6 @@ public class StandardChannelListPanel implements ChannelListPanel { // TODO Auto-generated method stub return null; } - + } diff --git a/src/Acquisition/WavChunkData.java b/src/Acquisition/WavChunkData.java index aec9005a..7f219499 100644 --- a/src/Acquisition/WavChunkData.java +++ b/src/Acquisition/WavChunkData.java @@ -1,7 +1,7 @@ package Acquisition; public class WavChunkData { - + static final byte RIFF[] = {'R','I','F','F'}; static final byte WAVE[] = {'W','A','V','E'}; static final byte FMT[] = {'f','m','t',' '}; @@ -10,7 +10,7 @@ public class WavChunkData { static final byte ICOP[] = {'I','C','O','P'}; static final byte ICRD[] = {'I','C','R','D'}; static final byte DATA[] = {'d','a','t','a'}; - + static public final int CHUNK_OTHER = 0; static public final int CHUNK_RIFF = 1; static public final int CHUNK_WAVE = 2; @@ -19,7 +19,7 @@ public class WavChunkData { static public final int CHUNK_INFO = 5; static public final int CHUNK_ICOP = 6; static public final int CHUNK_ICRD = 7; - + int chunkSize; long fileOffset; byte[] chunkId; @@ -36,7 +36,7 @@ public class WavChunkData { // String str = new String(chunkData); // System.out.println(new String(chunkId) + " " + str); } - + public int getType() { return chunkType; } diff --git a/src/Acquisition/WavFileFuncs.java b/src/Acquisition/WavFileFuncs.java index 5bdd8511..9f7c600a 100644 --- a/src/Acquisition/WavFileFuncs.java +++ b/src/Acquisition/WavFileFuncs.java @@ -24,7 +24,7 @@ public class WavFileFuncs extends AudioFileFuncs { e.printStackTrace(); } - if (wavHead.checkSizes(aFile.length()) == false) { + if (!wavHead.checkSizes(aFile.length())) { wavHead.repairSizes(aFile.length()); return writeNewSizes(wavHead, aFile); } @@ -106,7 +106,7 @@ public class WavFileFuncs extends AudioFileFuncs { private static byte[] readChunkId(WindowsFile file) { - byte[] chunkId = new byte[4]; + byte[] chunkId = new byte[4]; try { for (int i = 0; i < 4; i++) { chunkId[i] = file.readByte(); diff --git a/src/Acquisition/WavHeader.java b/src/Acquisition/WavHeader.java index caf01ecf..8f6ee226 100644 --- a/src/Acquisition/WavHeader.java +++ b/src/Acquisition/WavHeader.java @@ -28,7 +28,7 @@ public class WavHeader { public void addChunkData(WavChunkData chunkData) { if (otherChunks == null) { - otherChunks = new ArrayList(); + otherChunks = new ArrayList<>(); } otherChunks.add(chunkData); int t = chunkData.getType(); @@ -39,12 +39,12 @@ public class WavHeader { } private boolean unpackFmtData(WavChunkData chunkData) { - // read the 12 bytes of data from the byte array. + // read the 12 bytes of data from the byte array. if (chunkData.chunkSize < 12) { return false; } WindowsBuffer winBuff = new WindowsBuffer(chunkData.chunkData); - + try { this.audioformat = winBuff.readWinShort(); this.nChannels = winBuff.readWinShort(); @@ -61,11 +61,11 @@ public class WavHeader { } /** - * Check the two size informations in the wav file. + * Check the two size informations in the wav file. * The first in the second 4 bytes in the RIFF chunk * which should be equal to the number of bytes in the file - 4 - * The second is the data length, which should be equal to the - * length of the file - the data start point. + * The second is the data length, which should be equal to the + * length of the file - the data start point. * @param length */ public boolean checkSizes(long length) { @@ -80,10 +80,10 @@ public class WavHeader { } return ok; } - - /** - * Write the correct sizes into the file data. - * @param length total length of file in bytes. + + /** + * Write the correct sizes into the file data. + * @param length total length of file in bytes. */ public void repairSizes(long length) { riffChunkSize = length - 8; diff --git a/src/Acquisition/icListenSystem.java b/src/Acquisition/icListenSystem.java index a26239e2..b7373497 100644 --- a/src/Acquisition/icListenSystem.java +++ b/src/Acquisition/icListenSystem.java @@ -16,7 +16,6 @@ import java.io.Serializable; import java.net.InetSocketAddress; import java.net.Socket; import java.net.SocketAddress; -import java.util.List; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; @@ -29,74 +28,71 @@ import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.border.TitledBorder; -import soundPlayback.PlaybackControl; -import soundPlayback.PlaybackSystem; -import soundPlayback.SoundCardPlayback; - import PamController.PamControlledUnitSettings; import PamController.PamSettingManager; import PamController.PamSettings; import PamDetection.RawDataUnit; -import hfDaqCard.SmruDaqParameters; +import soundPlayback.PlaybackControl; +import soundPlayback.PlaybackSystem; /** - * A data acquisition system that uses an Ocean Sonics icListen to acquire the data + * A data acquisition system that uses an Ocean Sonics icListen to acquire the data * to be streamed to and used by PAMGUARD. * @author John Bowdridge * */ -public class icListenSystem extends DaqSystem implements PamSettings +public class icListenSystem extends DaqSystem implements PamSettings { /******** Defined Constants ********/ - + /* Define whether diagnostics should be printed or not */ private static final boolean DEBUG = false; - + /* ports to be used with the icListens */ private final int COMMAND_PORT = 50000; private final int WAVEFORM_PORT = 51678; - + /* Command Message constants */ private final int MAX_MESSAGE_SIZE = 6706; /* number of bytes in a message before the payload bytes */ private final int MSG_BEFORE_PAYLOAD = 4; - + private final char SYNC_BYTE = 0x2A; private final char ENQUIRE_COMMAND = 0x45; private final char JOB_SETUP_COMMAND = 0x44; - + private final char JOB_SETUP_TYPE = 20; private final char NUMBER_OF_TAGS = 5; - private final char TAG_VAL_LEN = 4; - + private final char TAG_VAL_LEN = 4; + private final char SAMPLE_RATE_TAG = 14; - + private final char BIT_DEPTH_TAG = 15; private final int BIT_DEPTH_VAL = 24; - + private final char GAIN_TAG = 16; private final int GAIN_VAL = 0; - + private final char ENDIAN_TAG = 17; private final int ENDIAN_VAL = 0; - + private final char LOGGING_MODE_TAG = 18; private final int LOGGING_MODE_VAL = 0; - + private final char MIN_TAG_LEN = 4; private final char JOB_SETUP_PAYLOAD_LEN = 4 + ((MIN_TAG_LEN + TAG_VAL_LEN) * NUMBER_OF_TAGS); - - private final CommandMessage ENQUIRE_MESSAGE = + + private final CommandMessage ENQUIRE_MESSAGE = new CommandMessage(SYNC_BYTE, ENQUIRE_COMMAND, new char[]{0,0}, new char[0]); - + /* Stream message constants * Message types */ private final char TYPE_DATA = 0x31; private final char TYPE_HEADER = 0x32; private final char TYPE_START = 0x33; private final char TYPE_STOP = 0x34; - + /* chunk types */ private final char EVENT_KEY = 0x41; private final char DATA_CHUNK = 0x42; @@ -105,52 +101,52 @@ public class icListenSystem extends DaqSystem implements PamSettings private final char WAVE_SETUP_CHUNK = 0x45; private final char SCALING_CHUNK = 0x47; private final char TIME_SYNC_CHUNK = 0x50; - + /* Offsets into chunks * Offset into a chunk where the chunk size will be found */ private final int CHUNK_SIZE_OFFSET = 2; private final int CHUNK_PAYLOAD_OFFSET = 4; /* this offset is from the start of the chunk payload */ - private final int EVENT_SEQUENCE_NUMBER_OFFSET = 4; + private final int EVENT_SEQUENCE_NUMBER_OFFSET = 4; private final int SCALING_MAX_AMPLITUDE_OFFSET = 16; private final int DATA_SAMPLE_NUMBER_OFFSET = 4; private final int DATA_SAMPLES_OFFSET = 10; private final int DATA_DATA_OFFSET = 12; - + /* Constant stream messages */ - private final StreamMessage START_STREAM_MESSAGE = + private final StreamMessage START_STREAM_MESSAGE = new StreamMessage(TYPE_START, new char[]{0,4}, new char[]{0,0,0,0}); - - private final StreamMessage STOP_STREAM_MESSAGE = + + private final StreamMessage STOP_STREAM_MESSAGE = new StreamMessage(TYPE_STOP, new char[]{0,0}, new char[]{}); - + /* Bandwidth/Sample rate settings menu constants */ static final int NUMBER_OF_BANDWIDTHS = 10; - static final String[] waveformBandwidthStrings = + static final String[] waveformBandwidthStrings = new String[]{"400 Hz", "800 Hz", "1600 Hz", "3200 Hz", "6400 Hz", "12.8 kHz", "25.6 kHz", "51.2 kHz", "102.4 kHz", "204.8 kHz"}; - - static final String[] SAMPLE_RATE_STRINGS = - new String[]{"1000", "2000", "4000", "8000", "16000", "32000", + + static final String[] SAMPLE_RATE_STRINGS = + new String[]{"1000", "2000", "4000", "8000", "16000", "32000", "64000", "128000", "256000", "512000"}; private static final int[] SAMPLE_RATES = new int[]{1000, 2000, 4000, 8000, 16000, 32000, 64000, 128000, 256000, 512000}; /** * DOUG. * Set this to whatever the icListens ADC input range is to get correct calibration - * in the part of PAMGUaUARd. You'll also need to set the hydrophone sensitivity. That + * in the part of PAMGUaUARd. You'll also need to set the hydrophone sensitivity. That * is also possible to do from here, if a bit more tricky since it's in a very different - * part of the software - something for later. + * part of the software - something for later. */ - private static final double VPEAKTOPEAK = 2.5; - + private static final double VPEAKTOPEAK = 2.5; + /* Used to interpret message response */ private final int SERIAL_NUM_OFFSET = 4; private final int DEVICE_TYPE_OFFSET = 32; - + /* Status string */ private final String NO_CONNECTION_STATUS = "No icListen Connected"; - + /* Device types */ private final int DEV_TYPE_ICTALK_LF = 0x01; private final int DEV_TYPE_ICLISTEN_LF = 0x02; @@ -159,12 +155,12 @@ public class icListenSystem extends DaqSystem implements PamSettings private final int DEV_TYPE_ICLISTEN_HF = 0x05; private final int DEV_TYPE_ICLISTEN_AF = 0x07; private final int DEV_TYPE_ICLISTEN_MF = 0x41; - + //TODO Add max channels constant - - + + /******** Module Variable Declarations ********/ - + /* Data acquisition dialog box variables */ /* TODO Add variables to support multiple channels in the dialog box * Might be able to just make some of these arrays */ @@ -178,40 +174,40 @@ public class icListenSystem extends DaqSystem implements PamSettings private JComboBox waveformBandwidth; private int currentWaveBandwidth = 0; private int currentSampleRateString = 0; - - //TODO make this an array of strings to + + //TODO make this an array of strings to private String ipAddress = null; - + private int dataUnitSamples; - - + + //TODO make these sockets arrays to connect to multiple hydrophones at a time Socket commandSocket; Socket streamSocket; - + AcquisitionControl acquisitionControl; int rawBufferSizeInBytes; - + /* data stream variables */ //TODO make these arrays to support multiple data streams at once OutputStream outToServer; DataOutputStream outStream; InputStream inFromServer; DataInputStream inStream; - + /* icListen's current connection status */ //TODO make an array to show which current indexes are connected private boolean connected = false; - + private volatile boolean stopCapture; private volatile boolean captureRunning; - + /* Time for connecting before a timeout should occur in ms */ private int timeOut = 5000; - + private int currentSampleRate = 1000; - + //TODO make these arrays to describe each hydrophone connected private int serialNum; private int deviceType; @@ -220,26 +216,26 @@ public class icListenSystem extends DaqSystem implements PamSettings private AudioDataQueue newDataUnits; private AcquisitionDialog acquisitionDialog; - - + + /******** Inner Classes ********/ - + /** * Inner class used for command messages from or to the icListen * Byte order is little endian * @author John Bowdridge * */ - class CommandMessage + class CommandMessage { /*** Constants ***/ - + final int MAX_PAYLOAD_LENGTH = 6700; final int PAYLOADLEN_ARRAY_LENGTH = 2; final int CRC_ARRAY_LENGTH = 2; /* message size with no payload */ final int MIN_MESSAGE_SIZE = 6; - + /* table used when calculating the crc */ final char[] crc16_table = new char[] { @@ -276,26 +272,26 @@ public class icListenSystem extends DaqSystem implements PamSettings 0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641, /*247*/ 0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040, /*255*/ }; - - + + /*** Fields ***/ - + /* Sync character */ char sync; /* Command Character */ char command; /* Length of the data payload */ char[] payloadLength; - /* Contains the data for the command (if applicable) */ + /* Contains the data for the command (if applicable) */ char[] payload; /* CRC used to verify message validity */ - char[] crc; - + char[] crc; + /** * Standard constructor using individual message components - * + * */ - public CommandMessage(char argSync, char argCommand, char[] argPayloadLength, + public CommandMessage(char argSync, char argCommand, char[] argPayloadLength, char[] argPayload) { this.sync = argSync; @@ -304,43 +300,43 @@ public class icListenSystem extends DaqSystem implements PamSettings this.payload = argPayload; this.crc = calculateTxCrc(this); } - + /** * A constructor using a properly formated byte buffer * Useful with returned messages, CRC will need to be checked * @param buf */ public CommandMessage(byte[] buf) - { + { int payloadLength; int bufferIndex; - + /* get sync byte */ this.sync = (char) buf[0]; - + /* get command */ this.command = (char) buf[1]; - + /* get payload length */ this.payloadLength = new char[this.PAYLOADLEN_ARRAY_LENGTH]; this.payloadLength[0] = (char) buf[2]; this.payloadLength[1] = (char) buf[3]; - payloadLength = (this.payloadLength[0] & 0xFF) + payloadLength = (this.payloadLength[0] & 0xFF) | (this.payloadLength[1] & 0xFF << 8); - + /* get payload */ this.payload = new char[payloadLength]; for(bufferIndex = MSG_BEFORE_PAYLOAD; bufferIndex < (payloadLength + MSG_BEFORE_PAYLOAD) ; bufferIndex++) { this.payload[bufferIndex - MSG_BEFORE_PAYLOAD] = (char)buf[bufferIndex]; } - + /* get crc */ this.crc = new char[this.CRC_ARRAY_LENGTH]; this.crc[0] = (char)buf[bufferIndex]; this.crc[1] = (char)buf[bufferIndex + 1]; } - + /** * Calculate the CRC for a message * @param msg @@ -352,29 +348,29 @@ public class icListenSystem extends DaqSystem implements PamSettings char checksum = 0; int payloadIndex; int payloadLength; - + /* calculate a checksum using each byte */ checksum = crc_update(msg.sync, checksum); checksum = crc_update(msg.command, checksum); checksum = crc_update(msg.payloadLength[0], checksum); checksum = crc_update(msg.payloadLength[1], checksum); /* assemble payload length into one number */ - payloadLength = (msg.payloadLength[0] & 0xFF) + payloadLength = (msg.payloadLength[0] & 0xFF) | (msg.payloadLength[1] & 0xFF << 8); - + for(payloadIndex = 0; payloadIndex < payloadLength ; payloadIndex++) { checksum = crc_update(msg.payload[payloadIndex], checksum); } - crc[0] = (char) (checksum & 0xFF); + crc[0] = (char) (checksum & 0xFF); crc[1] = (char) ((checksum >> 8)& 0xFF); - + return crc; } - + /** - * Update a running accumulator with the proper number according to a byte + * Update a running accumulator with the proper number according to a byte * of data sent to create a valid CRC * @param data * @param accum @@ -383,29 +379,29 @@ public class icListenSystem extends DaqSystem implements PamSettings private char crc_update(char data, char accum) { int combValue; - + /* Get the proper CRC index */ - combValue = (int) ((( accum & 0xFF) ^ (data & 0xFF)) & 0xFF); + combValue = (( accum & 0xFF) ^ (data & 0xFF)) & 0xFF; /* Use the CRC table and the index found to update the accumulator accordingly */ accum = (char) ((accum >> 8) ^ crc16_table [(combValue & 0xFF)]); - + return accum; } - + } /* end inner class CommandMessage */ - + /** * Inner class to be used by the data acquisition to process the captured data * Contains a run where the processing will occur * @author John Bowdridge * */ - class DataProcessThread implements Runnable + class DataProcessThread implements Runnable { /* a queue to were the data captured will be stored */ private BlockingQueue msgList; //TODO add variable for the current index - + /** * Constructor that receives a queue to use for the data transfer * @param queue @@ -415,75 +411,76 @@ public class icListenSystem extends DaqSystem implements PamSettings this.msgList = queue; //TODO add which index this thread is related to } - + /** * Function where the data processing will take place - * Receives the data from the queue and performs the proper + * Receives the data from the queue and performs the proper * processing to match the required PAMGUARD RawDataUnit (-1,+1) * and passes it to PAMGUARD using the newDataUnits list */ - public void run() + @Override + public void run() { /* buffer to receive data from message queue */ byte[] buffer = new byte[MAX_MESSAGE_SIZE]; - + /* buffer to put processed samples into to pass to pamguard */ double[] doubleBuf; - + double maxAmplitude = 1; - + int payloadIndex, doubleIndex, chunkIndex; /* doubleBufLen also is the number of samples */ int chunkLen = 0, payloadLen, doubleBufLen; int sample, sampleNumber; - + char[] headerEventKey = null; boolean eventKeyMatch = false, sampleTallyInit = false; - + long milliSec, totalSamples = 0; long sequenceNumber = 0, sampleTally = 0; - + RawDataUnit newDataUnit = null; StreamMessage msg; - + if(DEBUG) { System.out.println("Data process thread running"); } - + /* Data capture is running */ stopCapture = false; captureRunning = true; totalSamples = 0; - + /* Start capturing data * Loop until requested to stop */ - + while(!stopCapture) { /* Get the next message */ - try + try { buffer = msgList.take(); - } - catch (InterruptedException e) + } + catch (InterruptedException e) { e.printStackTrace(); break; } - + msg = new StreamMessage(buffer); - + if(DEBUG) { /* Print the reply */ System.out.println("Response received"); printStreamMessageBuffer(buffer); } - - payloadLen = (int) (((msg.payloadLength[0] & 0xFF) << 8) | (msg.payloadLength[1] & 0xFF)); - + + payloadLen = ((msg.payloadLength[0] & 0xFF) << 8) | (msg.payloadLength[1] & 0xFF); + /* Check for the message type */ if(msg.type == TYPE_HEADER) { @@ -492,25 +489,25 @@ public class icListenSystem extends DaqSystem implements PamSettings for(payloadIndex = 0; payloadIndex < payloadLen; payloadIndex += chunkLen + CHUNK_PAYLOAD_OFFSET) { /* get the chunk length */ - chunkLen = (int)(((msg.payload[payloadIndex + CHUNK_SIZE_OFFSET] & 0xFF) << 8) - | (msg.payload[payloadIndex + CHUNK_SIZE_OFFSET + 1] & 0xFF)); - - + chunkLen = ((msg.payload[payloadIndex + CHUNK_SIZE_OFFSET] & 0xFF) << 8) + | (msg.payload[payloadIndex + CHUNK_SIZE_OFFSET + 1] & 0xFF); + + if(DEBUG) { System.out.printf("Chunk Type: 0x%02X Chunk Size: %d\n", (int)msg.payload[payloadIndex], chunkLen); - } + } /* check the type of chunk */ switch(msg.payload[payloadIndex]) { - case EVENT_KEY: + case EVENT_KEY: /* Save a copy of the event key to ensure that it matches the data message */ headerEventKey = new char[chunkLen]; for(chunkIndex=0; chunkIndex < chunkLen; chunkIndex++) { headerEventKey[chunkIndex] = msg.payload[payloadIndex + CHUNK_PAYLOAD_OFFSET + chunkIndex]; } - + /* Get the sequence number */ sequenceNumber = ( ((headerEventKey[EVENT_SEQUENCE_NUMBER_OFFSET] & 0xFF) << 56) | ((headerEventKey[EVENT_SEQUENCE_NUMBER_OFFSET + 1] & 0xFF) << 48) @@ -523,16 +520,16 @@ public class icListenSystem extends DaqSystem implements PamSettings ); /* check to see if any samples where missed by seeing if * the sequence number is equal to the sample tally */ - + if(sequenceNumber != sampleTally) { /* check to see if the sample tally has been initialize */ if(sampleTallyInit) { - System.out.println("Missed samples!\nSequence number: " + sequenceNumber + System.out.println("Missed samples!\nSequence number: " + sequenceNumber + " Sample tally: " + sampleTally + " Missed: " + (sequenceNumber - sampleTally)); sampleTally = sequenceNumber; - + //TODO add code to handle missed samples } else @@ -542,42 +539,42 @@ public class icListenSystem extends DaqSystem implements PamSettings sampleTallyInit = true; } } - + break; case DEVICE_CHUNK: - + break; case STATUS_CHUNK: - + break; case WAVE_SETUP_CHUNK: - + break; case SCALING_CHUNK: /* get the max amplitude */ - maxAmplitude = (double)((msg.payload[payloadIndex + SCALING_MAX_AMPLITUDE_OFFSET] << 24) + maxAmplitude = (msg.payload[payloadIndex + SCALING_MAX_AMPLITUDE_OFFSET] << 24) | ((msg.payload[payloadIndex + SCALING_MAX_AMPLITUDE_OFFSET + 1] & 0xFF) << 16) | ((msg.payload[payloadIndex + SCALING_MAX_AMPLITUDE_OFFSET + 2] & 0xFF) << 8 ) - | ((msg.payload[payloadIndex + SCALING_MAX_AMPLITUDE_OFFSET + 3] & 0xFF)) ); + | ((msg.payload[payloadIndex + SCALING_MAX_AMPLITUDE_OFFSET + 3] & 0xFF)); if(DEBUG) { System.out.println("Max Amplitude: " + maxAmplitude); } break; } - + } } else if(msg.type == TYPE_DATA) { - /* Data message received + /* Data message received * Go through payload looking for the necessary chunks */ for(payloadIndex = 0; payloadIndex < payloadLen; payloadIndex += chunkLen + CHUNK_PAYLOAD_OFFSET) { /* get the length of the chunk */ - chunkLen = (int)(((msg.payload[payloadIndex + CHUNK_SIZE_OFFSET] & 0xFF) << 8) - | (msg.payload[payloadIndex + CHUNK_SIZE_OFFSET + 1] & 0xFF)); - + chunkLen = ((msg.payload[payloadIndex + CHUNK_SIZE_OFFSET] & 0xFF) << 8) + | (msg.payload[payloadIndex + CHUNK_SIZE_OFFSET + 1] & 0xFF); + if(DEBUG) { System.out.printf("Chunk Type: 0x%02X Chunk Size: %d\n", (int)msg.payload[payloadIndex], chunkLen); @@ -586,7 +583,7 @@ public class icListenSystem extends DaqSystem implements PamSettings switch(msg.payload[payloadIndex]) { case EVENT_KEY: - + /* check to see if the event key matches */ if(headerEventKey == null) { @@ -603,21 +600,21 @@ public class icListenSystem extends DaqSystem implements PamSettings } } } - + if(DEBUG) { System.out.println("Event Keys Match?: " + eventKeyMatch); } - + break; case DATA_CHUNK: /* make sure the event key matches the header */ if(eventKeyMatch) { /* get the number of samples */ - doubleBufLen = (int)(((msg.payload[payloadIndex + DATA_SAMPLES_OFFSET] & 0xFF) << 8) - | (msg.payload[payloadIndex + DATA_SAMPLES_OFFSET + 1] & 0xFF)); - + doubleBufLen = ((msg.payload[payloadIndex + DATA_SAMPLES_OFFSET] & 0xFF) << 8) + | (msg.payload[payloadIndex + DATA_SAMPLES_OFFSET + 1] & 0xFF); + /* Check if any samples where missed since the header * by comparing the sample number to the tally minus the sequence number */ sampleNumber = ( ((msg.payload[payloadIndex + DATA_SAMPLE_NUMBER_OFFSET] & 0xFF) << 24) @@ -625,88 +622,87 @@ public class icListenSystem extends DaqSystem implements PamSettings | ((msg.payload[payloadIndex + DATA_SAMPLE_NUMBER_OFFSET + 2] & 0xFF) << 8) | (msg.payload[payloadIndex + DATA_SAMPLE_NUMBER_OFFSET + 3] & 0xFF) ); - + /* check if any samples were missed */ - if( (long)sampleNumber != (sampleTally - sequenceNumber)) + if( sampleNumber != (sampleTally - sequenceNumber)) { - System.out.println("Missed samples!\nSample number: " + sampleNumber + System.out.println("Missed samples!\nSample number: " + sampleNumber + " Samples since header: " + (sampleTally - sequenceNumber)); //TODO add code to handle missed samples } - + /* update the sample tally */ - sampleTally = sampleTally + (long)doubleBufLen; - + sampleTally = sampleTally + doubleBufLen; + if(DEBUG) { System.out.println("double buffer length: " + doubleBufLen); } - + doubleBuf = new double[doubleBufLen]; /* go through the samples and put them into the RawDataUnit list */ - for(doubleIndex = 0, chunkIndex = (payloadIndex + DATA_DATA_OFFSET); + for(doubleIndex = 0, chunkIndex = (payloadIndex + DATA_DATA_OFFSET); doubleIndex < doubleBufLen; doubleIndex++, chunkIndex += 3) - { + { /* get the samples */ - sample = (int)(((msg.payload[chunkIndex + 2])& 0xFF) + sample = ((msg.payload[chunkIndex + 2])& 0xFF) | ((msg.payload[chunkIndex + 1] & 0xFF) << 8) - | ((msg.payload[chunkIndex] & 0xFF) << 16) - ); - + | ((msg.payload[chunkIndex] & 0xFF) << 16); + if(DEBUG) { System.out.printf("Sample pre sign extension: %08X\n", sample); System.out.printf("Created from : %X %X %X\n", (int)msg.payload[chunkIndex], (int)msg.payload[chunkIndex + 1], (int)msg.payload[chunkIndex + 2]); - } - + } + /* Check the sign (most significant bit is set) and extend the sign if nesc. */ if((msg.payload[chunkIndex] & 0x0080) == 0x0080) { - + /* extend the sign */ sample = sample | 0xFF000000; if(DEBUG) { System.out.printf("Sign extended: %08X\n", sample); - } - } - + } + } + if(DEBUG) { System.out.println("sample before division: " + sample); } - + /* Scale the sample to between -1 and 1 */ doubleBuf[doubleIndex] = sample / maxAmplitude; if(DEBUG) { - System.out.println("double buffer: " + doubleBuf[doubleIndex] + System.out.println("double buffer: " + doubleBuf[doubleIndex] + "\nindex: " + doubleIndex + " double buffer len: " + doubleBufLen); } - + } /* get how much time this covers */ milliSec = acquisitionControl.getAcquisitionProcess().absSamplesToMilliseconds(totalSamples); - + if(DEBUG) { System.out.println("Milli Seconds: " + milliSec); } - + /* add it as a new data unit */ //TODO add a shift to the channelBitmap that uses the current channel index - newDataUnit = new RawDataUnit(milliSec, 0x01, totalSamples, (long)doubleBufLen); + newDataUnit = new RawDataUnit(milliSec, 0x01, totalSamples, doubleBufLen); newDataUnit.setRawData(doubleBuf); - newDataUnits.addNewData(newDataUnit); - + newDataUnits.addNewData(newDataUnit); + /* tally the total samples */ - totalSamples += (long)doubleBufLen; + totalSamples += doubleBufLen; } - + break; } - + } } else @@ -721,29 +717,29 @@ public class icListenSystem extends DaqSystem implements PamSettings } /* reset any necessary components */ sampleTallyInit = false; - + /* stop capture and return */ captureRunning = false; } /* end run */ - + } /* end inner class DataProcessThread */ - + /** * Inner class to be used by the data acquisition to capture the data in a separate thread * Contains a run where the data capture will occur * @author John Bowdridge * */ - class CaptureThread implements Runnable + class CaptureThread implements Runnable { /* amount of bytes to read */ private final int CHECK_READ = 4; - + /* queue to put the received messages */ private BlockingQueue msgList; - + //TODO add a local DataInputStream - + /** * Constructor that receives a queue to use for the data transfer * @param queue @@ -753,17 +749,18 @@ public class icListenSystem extends DaqSystem implements PamSettings this.msgList = queue; //TODO Pass this an DataInputStream } - + /** - * Function where a message will be received and put into + * Function where a message will be received and put into * the message queue for future processing */ - public void run() + @Override + public void run() { /* Data capture is running */ stopCapture = false; captureRunning = true; - + /* get a message and add it to the queue */ try { @@ -779,12 +776,12 @@ public class icListenSystem extends DaqSystem implements PamSettings } captureRunning = false; } - + /** - * Function that gets a message from the icListen and returns it + * Function that gets a message from the icListen and returns it * @return */ - public byte[] getMessage() + public byte[] getMessage() { /* Buffer to put the message */ byte[] buffer = new byte[MAX_MESSAGE_SIZE]; @@ -792,20 +789,20 @@ public class icListenSystem extends DaqSystem implements PamSettings byte[] tmpBuf = new byte[CHECK_READ]; int readSize = CHECK_READ; int offset = 0; - + boolean messageFound = false; - + /* run until capture is requested to stop */ while(!stopCapture) { /* read in bytes from the icListen will either be a check * read of 4 bytes or the rest of a message */ - try + try { //TODO replace this with the local DataInputStream inStream.read(buffer, offset , readSize); - } - catch (IOException e) + } + catch (IOException e) { System.out.println("IOException when reading start system response"); e.printStackTrace(); @@ -824,7 +821,7 @@ public class icListenSystem extends DaqSystem implements PamSettings buffer[2] = 0; buffer[3] = 0; } - + if(messageFound) { /* the message is found return it */ @@ -833,20 +830,20 @@ public class icListenSystem extends DaqSystem implements PamSettings else { /* - * The following is a form of unrolled loop that searches through the read + * The following is a form of unrolled loop that searches through the read * in message to check for a message start. When one is found it will re-order * bytes in the buffer to be correct. It will then reduce the possibility that - * a false positive was found. If it is still determined to be a message + * a false positive was found. If it is still determined to be a message * start, set up the read for the rest of the message */ - + /* no message is currently found, Check for the alignment */ if( (buffer[0] == TYPE_HEADER || buffer[0] == TYPE_DATA) && buffer[1] == SYNC_BYTE) { /* Properly aligned message * Get the message length */ readSize = ((buffer[2] & 0xFF) << 8) | (buffer[3] & 0xFF); - + /* Make Sure that the read size is valid to reduce the chance that a none message start was found */ if(readSize > MAX_MESSAGE_SIZE) { @@ -860,7 +857,7 @@ public class icListenSystem extends DaqSystem implements PamSettings /* message is now found and aligned */ messageFound = true; offset = MSG_BEFORE_PAYLOAD; - } + } } else { @@ -868,12 +865,12 @@ public class icListenSystem extends DaqSystem implements PamSettings if((buffer[1] == TYPE_HEADER || buffer[1] == TYPE_DATA) && buffer[2] == SYNC_BYTE) { /* read in the next couple of bytes to use if the message start is found */ - try + try { //TODO replace this with the local DataInputStream inStream.read(tmpBuf, 0 , CHECK_READ); - } - catch (IOException e) + } + catch (IOException e) { System.out.println("IOException when reading start system response"); e.printStackTrace(); @@ -881,7 +878,7 @@ public class icListenSystem extends DaqSystem implements PamSettings captureRunning = false; return null; } - + /* put the read in bytes into the correct location */ buffer[0] = buffer[1]; /* Type byte */ buffer[1] = buffer[2]; /* sync byte */ @@ -891,10 +888,10 @@ public class icListenSystem extends DaqSystem implements PamSettings buffer[4] = tmpBuf[1]; /* low length byte */ buffer[5] = tmpBuf[2]; /* low length byte */ buffer[6] = tmpBuf[3]; /* low length byte */ - + /*Get the message length*/ readSize = (((buffer[2] & 0xFF) << 8) | (buffer[3] & 0xFF)) - 3; - + /* Make Sure that the read size is valid to reduce the chance that a none message start was found */ if(readSize + 3 > MAX_MESSAGE_SIZE) { @@ -908,17 +905,17 @@ public class icListenSystem extends DaqSystem implements PamSettings /* message is now found and aligned */ messageFound = true; offset = MSG_BEFORE_PAYLOAD + 3; - } + } } else if((buffer[2] == TYPE_HEADER || buffer[2] == TYPE_DATA) && buffer[3] == SYNC_BYTE) { /* read in the next couple of bytes to use if the message start is found */ - try + try { //TODO replace this with the local DataInputStream inStream.read(tmpBuf, 0 , CHECK_READ); - } - catch (IOException e) + } + catch (IOException e) { System.out.println("IOException when reading start system response"); e.printStackTrace(); @@ -926,7 +923,7 @@ public class icListenSystem extends DaqSystem implements PamSettings captureRunning = false; return null; } - + /* put the read in bytes into the correct location */ buffer[0] = buffer[2]; /* Type byte */ buffer[1] = buffer[3]; /* sync byte */ @@ -935,10 +932,10 @@ public class icListenSystem extends DaqSystem implements PamSettings /* payload bytes */ buffer[4] = tmpBuf[2]; buffer[5] = tmpBuf[3]; - + /*Get the message length*/ readSize = (((buffer[2] & 0xFF) << 8) | (buffer[3] & 0xFF)) - 2; - + /* Make Sure that the read size is valid to reduce the chance that a none message start was found */ if(readSize + 2 > MAX_MESSAGE_SIZE) { @@ -952,17 +949,17 @@ public class icListenSystem extends DaqSystem implements PamSettings /* message is now found and aligned */ messageFound = true; offset = MSG_BEFORE_PAYLOAD + 2; - } + } } else if((buffer[3] == TYPE_HEADER || buffer[3] == TYPE_DATA) && tmpBuf[0] == SYNC_BYTE) { /* read in the next couple of bytes to use if the message start is found */ - try + try { //TODO replace this with the local DataInputStream inStream.read(tmpBuf, 0 , CHECK_READ); - } - catch (IOException e) + } + catch (IOException e) { System.out.println("IOException when reading start system response"); e.printStackTrace(); @@ -970,7 +967,7 @@ public class icListenSystem extends DaqSystem implements PamSettings captureRunning = false; return null; } - + /* put the read in bytes into the correct location */ buffer[0] = buffer[3]; /* Type byte */ buffer[1] = tmpBuf[0]; /* sync byte */ @@ -978,10 +975,10 @@ public class icListenSystem extends DaqSystem implements PamSettings buffer[3] = tmpBuf[2]; /* low length byte */ /* payload byte */ buffer[4] = tmpBuf[3]; /* low length byte */ - + /*Get the message length*/ readSize = (((buffer[2] & 0xFF) << 8) | (buffer[3] & 0xFF)) - 1; - + /* Make Sure that the read size is valid to reduce the chance that a none message start was found */ if(readSize + 1 > MAX_MESSAGE_SIZE) { @@ -995,13 +992,13 @@ public class icListenSystem extends DaqSystem implements PamSettings /* message is now found and aligned */ messageFound = true; offset = MSG_BEFORE_PAYLOAD + 1; - } + } } else { /* No message start found, make sure the offset and size are still set */ readSize = CHECK_READ; - + offset = 0; } } @@ -1009,36 +1006,36 @@ public class icListenSystem extends DaqSystem implements PamSettings } return null; } /* end run */ - + } /* end inner class CaptureThread */ - + /** * Inner class used to send and receive icListen stream messages * Byte order is stream order(big endian) * @author John Bowdridge * */ - class StreamMessage + class StreamMessage { /*** Constants ***/ final char SYNC_VAL = 0x2A; - + final int PAYLOADLEN_ARRAY_LENGTH = 2; - + /*** Fields ***/ - + /* the type of Character */ char type; /* Sync character */ char sync; /* Length of the data payload */ char[] payloadLength; - /* Contains the data (if applicable). It is 32 bit aligned */ + /* Contains the data (if applicable). It is 32 bit aligned */ char[] payload; - + /** * Standard constructor using individual message components - * + * */ public StreamMessage(char argType, char[] argPayloadLength, char[] argPayload) { @@ -1047,30 +1044,30 @@ public class icListenSystem extends DaqSystem implements PamSettings this.payloadLength = argPayloadLength; this.payload = argPayload; } - + /** * A constructor using a properly formated byte buffer * Useful with returned messages, CRC will need to be checked * @param buf */ public StreamMessage(byte[] buf) - { + { int payloadLength; int bufferIndex; - + /* get command */ this.type = (char) buf[0]; - + /* get sync byte */ this.sync = (char) buf[1]; - + /* get payload length */ this.payloadLength = new char[PAYLOADLEN_ARRAY_LENGTH]; this.payloadLength[0] = (char) buf[2]; this.payloadLength[1] = (char) buf[3]; - payloadLength = (int)((this.payloadLength[1] & 0xFF) - | ((this.payloadLength[0] & 0xFF) << 8)); - + payloadLength = (this.payloadLength[1] & 0xFF) + | ((this.payloadLength[0] & 0xFF) << 8); + /* get payload */ this.payload = new char[payloadLength]; for(bufferIndex = MSG_BEFORE_PAYLOAD; bufferIndex < (payloadLength + MSG_BEFORE_PAYLOAD) && bufferIndex < MAX_MESSAGE_SIZE ; bufferIndex++) @@ -1078,79 +1075,79 @@ public class icListenSystem extends DaqSystem implements PamSettings this.payload[bufferIndex - MSG_BEFORE_PAYLOAD] = (char)buf[bufferIndex]; } } - + } /* end inner class StreamMessage */ - + /******** Methods/Constructors ********/ - + /** * Constructor registers settings */ - public icListenSystem() + public icListenSystem() { PamSettingManager.getInstance().registerSettings(this); } - + /** * Returns the type of the system */ @Override - public String getSystemType() + public String getSystemType() { return "icListen"; } - + /** * Returns the name of the current system */ @Override - public String getSystemName() + public String getSystemName() { - /* TODO this will need to be re-thought when using multiple hydrophones - * Could do all of them but that would probably be too long, might just + /* TODO this will need to be re-thought when using multiple hydrophones + * Could do all of them but that would probably be too long, might just * want to reurn how many are connected if more then one is connected */ String systemName; /* Check to see if there is an icListen connected */ if(connected) - { + { /* get the device type */ switch(deviceType) { case DEV_TYPE_ICTALK_LF: /* icTalk LF */ - + systemName = "icTalk LF"; break; case DEV_TYPE_ICLISTEN_LF: /* icListen LF */ - + systemName = "icListen LF"; break; case DEV_TYPE_GUEST_SENSOR: /* Standalone Guest Sensor */ - + systemName = "Standalone Guest Sensor"; break; case DEV_TYPE_ICTALK_HF: /* icTalk HF */ - + systemName = "icTalk HF"; break; case DEV_TYPE_ICLISTEN_HF: /* icListen HF */ - + systemName = "icListen HF"; break; case DEV_TYPE_ICLISTEN_AF: /* icListen AF */ - + systemName = "icListen AF"; break; case DEV_TYPE_ICLISTEN_MF: /* icListen MF */ - + systemName = "icListen MF"; break; default: - + systemName = "Unknown Type"; break; } - + systemName = systemName + " " + serialNum; return systemName; } @@ -1158,17 +1155,17 @@ public class icListenSystem extends DaqSystem implements PamSettings { return "No icListen"; } - + } /** * Get the data acquisition dialog box component of this system */ @Override - public JComponent getDaqSpecificDialogComponent(AcquisitionDialog acquisitionDialog) + public JComponent getDaqSpecificDialogComponent(AcquisitionDialog acquisitionDialog) { this.acquisitionDialog = acquisitionDialog; - if (daqDialog == null) + if (daqDialog == null) { daqDialog = createDaqDialogPanel(); } @@ -1180,18 +1177,18 @@ public class icListenSystem extends DaqSystem implements PamSettings acquisitionDialog.setVPeak2Peak(VPEAKTOPEAK); return daqDialog; } - + /** * Get the data acquisition dialog box component of this system * Must include all the necessary components * @return */ - private JPanel createDaqDialogPanel() + private JPanel createDaqDialogPanel() { - /* TODO This will need some reworking to implement multiple hydrophones + /* TODO This will need some reworking to implement multiple hydrophones * to be able to get multple ip addresses and other settings from each hydrophone */ JPanel panel = new JPanel(); - + /*Set up the panels layout*/ panel.setBorder(new TitledBorder(null, "icListen", TitledBorder.LEFT, TitledBorder.TOP, null, null)); GridBagLayout gridBagLayout = new GridBagLayout(); @@ -1200,7 +1197,7 @@ public class icListenSystem extends DaqSystem implements PamSettings gridBagLayout.columnWeights = new double[]{1.0, 1.0, 0.0, 1.0, 0.0, Double.MIN_VALUE}; gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE}; panel.setLayout(gridBagLayout); - + /* Setup the IP address field */ JLabel lblIpAddress = new JLabel("IP Address:"); GridBagConstraints gbc_lblIpAddress = new GridBagConstraints(); @@ -1209,7 +1206,7 @@ public class icListenSystem extends DaqSystem implements PamSettings gbc_lblIpAddress.gridx = 0; gbc_lblIpAddress.gridy = 0; panel.add(lblIpAddress, gbc_lblIpAddress); - + ipAddressInput = new JTextField(); GridBagConstraints gbc_ipAddressInput = new GridBagConstraints(); gbc_ipAddressInput.insets = new Insets(0, 0, 5, 5); @@ -1218,7 +1215,7 @@ public class icListenSystem extends DaqSystem implements PamSettings gbc_ipAddressInput.gridy = 0; panel.add(ipAddressInput, gbc_ipAddressInput); ipAddressInput.setColumns(11); - + /* Setup the timeout field */ JLabel lblConnectionTimeout = new JLabel(" Connection Timeout:"); GridBagConstraints gbc_lblConnectionTimeout = new GridBagConstraints(); @@ -1227,7 +1224,7 @@ public class icListenSystem extends DaqSystem implements PamSettings gbc_lblConnectionTimeout.gridx = 2; gbc_lblConnectionTimeout.gridy = 0; panel.add(lblConnectionTimeout, gbc_lblConnectionTimeout); - + timeOutInput = new JTextField(); GridBagConstraints gbc_timeOutInput = new GridBagConstraints(); gbc_timeOutInput.insets = new Insets(0, 0, 5, 5); @@ -1236,7 +1233,7 @@ public class icListenSystem extends DaqSystem implements PamSettings gbc_timeOutInput.gridy = 0; panel.add(timeOutInput, gbc_timeOutInput); timeOutInput.setColumns(6); - + JLabel lblMs = new JLabel("ms"); GridBagConstraints gbc_lblMs = new GridBagConstraints(); gbc_lblMs.insets = new Insets(0, 0, 5, 0); @@ -1252,10 +1249,11 @@ public class icListenSystem extends DaqSystem implements PamSettings gbc_lblWaveformBandwidth.gridx = 0; gbc_lblWaveformBandwidth.gridy = 1; panel.add(lblWaveformBandwidth, gbc_lblWaveformBandwidth); - + waveformBandwidth = new JComboBox(); waveformBandwidth.addActionListener( new ActionListener () { + @Override public void actionPerformed(ActionEvent e) { /* update the sampleRate text field*/ currentSampleRateString = waveformBandwidth.getSelectedIndex(); @@ -1265,9 +1263,9 @@ public class icListenSystem extends DaqSystem implements PamSettings sampleRate.setText(SAMPLE_RATE_STRINGS[currentSampleRateString]); /* * DOUG. - * Also at this point need to tell the main dialog what sample date you - * are using ! Would be better if the SAMPLE_RATE_STRINGS had been entered - * as numbers and converted to strings, rather than having to do this + * Also at this point need to tell the main dialog what sample date you + * are using ! Would be better if the SAMPLE_RATE_STRINGS had been entered + * as numbers and converted to strings, rather than having to do this * the other way around. Anyway, once you have the sample rate as a * number you can call ... */ @@ -1286,7 +1284,7 @@ public class icListenSystem extends DaqSystem implements PamSettings gbc_waveformBandwidth.gridx = 1; gbc_waveformBandwidth.gridy = 1; panel.add(waveformBandwidth, gbc_waveformBandwidth); - + /* Setup the sample rate field */ JLabel lblSampleRate = new JLabel("Gives a sample rate of"); GridBagConstraints gbc_lblSampleRate = new GridBagConstraints(); @@ -1295,7 +1293,7 @@ public class icListenSystem extends DaqSystem implements PamSettings gbc_lblSampleRate.gridx = 2; gbc_lblSampleRate.gridy = 1; panel.add(lblSampleRate, gbc_lblSampleRate); - + sampleRate = new JTextField(); sampleRate.setEditable(false); GridBagConstraints gbc_sampleRate = new GridBagConstraints(); @@ -1305,14 +1303,14 @@ public class icListenSystem extends DaqSystem implements PamSettings gbc_sampleRate.gridy = 1; panel.add(sampleRate, gbc_sampleRate); sampleRate.setColumns(10); - + JLabel lblHz = new JLabel("Hz"); GridBagConstraints gbc_lblHz = new GridBagConstraints(); gbc_lblHz.insets = new Insets(0, 0, 5, 0); gbc_lblHz.gridx = 4; gbc_lblHz.gridy = 1; panel.add(lblHz, gbc_lblHz); - + /* Setup the status field */ icListenStatus = new JTextField(); icListenStatus.setText(NO_CONNECTION_STATUS); @@ -1325,21 +1323,21 @@ public class icListenSystem extends DaqSystem implements PamSettings gbc_icListenStatus.gridy = 2; panel.add(icListenStatus, gbc_icListenStatus); icListenStatus.setColumns(10); - + /*Create a connect button*/ - btnConnect = new JButton(" Connect "); + btnConnect = new JButton(" Connect "); btnConnect.addMouseListener( - new MouseAdapter() + new MouseAdapter() { @Override - public void mouseReleased(MouseEvent e) + public void mouseReleased(MouseEvent e) { if(!connected) { /* Call the connect function when the connect button is hit and * it is not already connected */ /* - * TODO connect to all current icListens, Loop through all of the + * TODO connect to all current icListens, Loop through all of the * current ones and pass the proper index to icListenConnect */ icListenConnect(); @@ -1353,27 +1351,27 @@ public class icListenSystem extends DaqSystem implements PamSettings gbc_btnConnect.gridx = 2; gbc_btnConnect.gridy = 2; panel.add(btnConnect, gbc_btnConnect); - + /* enable the connect button on panel creation*/ if(connected) { btnConnect.setEnabled(false); } - + /* Create a Disconnect button */ btnDisconnect = new JButton("Disconnect"); btnDisconnect.addMouseListener( - new MouseAdapter() + new MouseAdapter() { @Override - public void mouseReleased(MouseEvent e) + public void mouseReleased(MouseEvent e) { if(connected) { /* Call the disconnect function when the disconnect button is hit * and a hydrophone is connected */ /* - * TODO disconnect to all current icListens, Loop through all of the + * TODO disconnect to all current icListens, Loop through all of the * current ones and pass the proper index to icListenDisconnect */ icListenDisconnect(); @@ -1381,20 +1379,20 @@ public class icListenSystem extends DaqSystem implements PamSettings } } ); - + GridBagConstraints gbc_btnDisconnect = new GridBagConstraints(); gbc_btnDisconnect.anchor = GridBagConstraints.WEST; gbc_btnDisconnect.insets = new Insets(0, 0, 5, 5); gbc_btnDisconnect.gridx = 3; gbc_btnDisconnect.gridy = 2; panel.add(btnDisconnect, gbc_btnDisconnect); - + /* disable disconnect button at panel creation */ if(!connected) { btnDisconnect.setEnabled(false); - } - + } + return panel; } @@ -1402,36 +1400,36 @@ public class icListenSystem extends DaqSystem implements PamSettings * Sets the fields of the data acquisition when the settings are brought up */ @Override - public void dialogSetParams() + public void dialogSetParams() { /* TODO This will need to be updated based on the update to the dialog box * when implementing multiple channels */ /* all the settings fields to the appropriate value */ ipAddressInput.setText(ipAddress); timeOutInput.setText(Integer.toString(timeOut)); - + waveformBandwidth.removeAllItems(); - for (int i = 0; i < NUMBER_OF_BANDWIDTHS; i++) + for (int i = 0; i < NUMBER_OF_BANDWIDTHS; i++) { waveformBandwidth.addItem(waveformBandwidthStrings[i]); } - + waveformBandwidth.setSelectedIndex(currentWaveBandwidth); } - + /** * Function gets called when the OK of the settings panel is pressed. - * It saves all the settings entered by the user + * It saves all the settings entered by the user * Make sure the IP Address is set to the latest address entered by the user, * Get the Time out specified and get the sample rate using the bandwidth */ @Override - public boolean dialogGetParams() + public boolean dialogGetParams() { /* TODO This will need to be updated based on the update to the dialog box * when implementing multiple channels */ ipAddress = ipAddressInput.getText(); - + /* Ensure an IP address was received */ // if(ipAddress == null || !ipAddress.matches("[0-9.]+")) if(ipAddress == null) @@ -1440,7 +1438,7 @@ public class icListenSystem extends DaqSystem implements PamSettings JOptionPane.showMessageDialog(null, "Please enter an IP Address"); return false; } - + /* get time out and ensure it is a number */ String timeOutString = timeOutInput.getText(); if(timeOutString == null || !timeOutString.matches("[0-9]+")) @@ -1449,38 +1447,38 @@ public class icListenSystem extends DaqSystem implements PamSettings JOptionPane.showMessageDialog(null, "Please enter a number into the time out field"); return false; } - + timeOut = Integer.parseInt(timeOutString); - + /* get the bandwidth selected to get the proper sample rate */ currentWaveBandwidth = waveformBandwidth.getSelectedIndex(); currentSampleRate = Integer.parseInt(SAMPLE_RATE_STRINGS[currentWaveBandwidth]); - + if(DEBUG) { - System.out.println("IP Address: " + ipAddress + " Time Out: " + timeOut + " ms" + - " Bandwidth Index: " + currentWaveBandwidth + " Sample rate: " + currentSampleRate); + System.out.println("IP Address: " + ipAddress + " Time Out: " + timeOut + " ms" + + " Bandwidth Index: " + currentWaveBandwidth + " Sample rate: " + currentSampleRate); } - + return true; } @Override - public int getMaxSampleRate() + public int getMaxSampleRate() { /* return PARAMETER_FIXED so that the field isn't active */ return PARAMETER_FIXED; } @Override - public int getMaxChannels() + public int getMaxChannels() { /* return PARAMETER_FIXED so that the field isn't active */ return PARAMETER_FIXED; } @Override - public double getPeak2PeakVoltage(int swChannel) + public double getPeak2PeakVoltage(int swChannel) { /* return PARAMETER_FIXED so that the field isn't active */ return PARAMETER_FIXED; @@ -1488,8 +1486,8 @@ public class icListenSystem extends DaqSystem implements PamSettings /** * Connect to an icListen using the current IP - * ensure that the connected variable is updated accordingly - */ + * ensure that the connected variable is updated accordingly + */ private void icListenConnect() { //TODO pass this the index to be connected to @@ -1503,9 +1501,9 @@ public class icListenSystem extends DaqSystem implements PamSettings } return; } - - boolean reconnect = false; - + + boolean reconnect = false; + /* Connect to the icListen */ do { @@ -1516,25 +1514,25 @@ public class icListenSystem extends DaqSystem implements PamSettings System.out.println("Connecting to " + ipAddress + " on port " + COMMAND_PORT); } - + /* Connecting to command port */ SocketAddress socketAddress = new InetSocketAddress(ipAddress, COMMAND_PORT); //TODO connect to the socket of the passed index commandSocket = new Socket(); commandSocket.connect(socketAddress, timeOut); - + /* connected so do not attempt to reconnect */ - reconnect = false; + reconnect = false; } catch(IOException ex) { /* no connection found */ ex.printStackTrace(); - + /* See if the user would like to attempt to reconnect using the current setting, * such as in the case of an unplugged cable that can be plugged back in */ if(JOptionPane.showConfirmDialog(null, - ("Would you like to attempt to reconnect to\nicListen IP: " + ipAddress), + ("Would you like to attempt to reconnect to\nicListen IP: " + ipAddress), "No icListen Found", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { reconnect = true; @@ -1550,43 +1548,43 @@ public class icListenSystem extends DaqSystem implements PamSettings } } } while(reconnect); - + /* Connection has been established */ connected = true; - + if(DEBUG) { System.out.println("Just connected to "+ commandSocket.getRemoteSocketAddress()); } - + /* Set up data streams*/ - try + try { //TODO create data streams for the passed index outToServer = commandSocket.getOutputStream(); outStream = new DataOutputStream(outToServer); - + inFromServer = commandSocket.getInputStream(); inStream = new DataInputStream(inFromServer); - } - catch (IOException ex) + } + catch (IOException ex) { ex.printStackTrace(); - } - + } + /* create a buffer to hold the reply message */ byte[] buffer = new byte[MAX_MESSAGE_SIZE]; - + /* Set up proper communications with the icListen */ //TODO pass this the index to send to sendCommandMessage(ENQUIRE_MESSAGE); - + if(DEBUG) { //TODO use the index received to get correct outStream System.out.println("Enquire message sent\nBytes sent to date: " + outStream.size()); } - + /* Read the reply */ try { @@ -1599,14 +1597,14 @@ public class icListenSystem extends DaqSystem implements PamSettings e.printStackTrace(); return; } - + if(DEBUG) { /* Print the reply */ System.out.println("Enquire response received"); printCommandMessageBuffer(buffer); } - + /* Check the crc of the message */ CommandMessage enquireResponse = new CommandMessage(buffer); if(!checkCommandMessageCrc(enquireResponse)) @@ -1616,18 +1614,18 @@ public class icListenSystem extends DaqSystem implements PamSettings JOptionPane.showMessageDialog(null, "Error with command transmission.\nConnection aborted"); - + if(DEBUG) { //TODO use the index received to get correct socket System.out.println("Disconnecting from "+ commandSocket.getRemoteSocketAddress()); } - try + try { //TODO use the index received to get correct socket commandSocket.close(); - } - catch (IOException e) + } + catch (IOException e) { if(DEBUG) { @@ -1638,31 +1636,31 @@ public class icListenSystem extends DaqSystem implements PamSettings } return; } - + /* Message has been received and verified, obtain necessary information */ - serialNum = (int)(buffer[SERIAL_NUM_OFFSET] | (buffer[SERIAL_NUM_OFFSET + 1] << 8)); - deviceType = (int)buffer[DEVICE_TYPE_OFFSET]; - + serialNum = buffer[SERIAL_NUM_OFFSET] | (buffer[SERIAL_NUM_OFFSET + 1] << 8); + deviceType = buffer[DEVICE_TYPE_OFFSET]; + if(DEBUG) { System.out.println("Serial Number: " + serialNum + " Device type: " + deviceType); } - + /* Send the job setup using the tag system */ //TODO pass the index to the job setup in order to send it to the right icListen jobSetup(); - + /* No longer using command port so close it */ if(DEBUG) { //TODO use the index received to get correct socket System.out.println("Disconnecting from "+ commandSocket.getRemoteSocketAddress()); } - try + try { commandSocket.close(); - } - catch (IOException e) + } + catch (IOException e) { if(DEBUG) { @@ -1672,12 +1670,12 @@ public class icListenSystem extends DaqSystem implements PamSettings return; } connected = false; - + if(DEBUG) { System.out.println("Disconnected from command port"); } - + try { if(DEBUG) @@ -1685,64 +1683,64 @@ public class icListenSystem extends DaqSystem implements PamSettings System.out.println("Connecting to " + ipAddress + " on port " + WAVEFORM_PORT); } - + /* Connecting to stream port */ SocketAddress socketAddress = new InetSocketAddress(ipAddress, WAVEFORM_PORT); - + //TODO use the index received to connect to the proper socket streamSocket = new Socket(); streamSocket.connect(socketAddress, timeOut); - + } catch(IOException ex) { /* no connection found */ ex.printStackTrace(); - + JOptionPane.showMessageDialog(null, "Connection Failed"); System.out.println("Failed to connect to waveform streaming port"); - + return; } - + /* Connection has been established */ connected = true; - + if(DEBUG) { System.out.println("Just connected to "+ streamSocket.getRemoteSocketAddress()); } - + /* Enable/disable the appropriate buttons/Settings in the settings panel */ //TODO these will need to be updated based on settings implementation btnConnect.setEnabled(false); btnDisconnect.setEnabled(true); - + ipAddressInput.setEnabled(false); timeOutInput.setEnabled(false); waveformBandwidth.setEnabled(false); - + /* update the status field in the settings */ updateStatus(); - + /* Set up data streams*/ - try + try { //TODO create the proper data streams using the index outToServer = streamSocket.getOutputStream(); outStream = new DataOutputStream(outToServer); - + inFromServer = streamSocket.getInputStream(); inStream = new DataInputStream(inFromServer); - } - catch (IOException ex) + } + catch (IOException ex) { ex.printStackTrace(); } } - + /** - * Updates the status field in the settings to + * Updates the status field in the settings to * give some information on the hydrophone */ private void updateStatus() @@ -1761,7 +1759,7 @@ public class icListenSystem extends DaqSystem implements PamSettings icListenStatus.setText(NO_CONNECTION_STATUS); } } - + /** * Checks the CRC of the message versus what the CRC should be * If they are the same returns true if not returns false @@ -1772,19 +1770,19 @@ public class icListenSystem extends DaqSystem implements PamSettings { char[] crcReceived = new char[msg.CRC_ARRAY_LENGTH]; char[] crcCreated = msg.calculateTxCrc(msg); - + crcReceived[0] = (char) ((msg.crc[0]) & 0xFF); - crcReceived[1] = (char) ((msg.crc[1]) & 0xFF); - + crcReceived[1] = (char) ((msg.crc[1]) & 0xFF); + if(DEBUG) - { + { System.out.printf("CRC received: %X %X CRC created: %X %X\n", (int)crcReceived[0], (int)crcReceived[1], (int)crcCreated[0], (int)crcCreated[1]); - } + } return ((crcReceived[0] == crcCreated[0]) && (crcReceived[1] == crcCreated[1])); } - + /** * Create and send the job setup using tags * Setup the job using tags to setup the waveform parameters @@ -1793,52 +1791,52 @@ public class icListenSystem extends DaqSystem implements PamSettings private boolean jobSetup() { //TODO pass this the index to send the setup to - /* Get the payload length */ + /* Get the payload length */ char[] payloadLength = new char[] {0xFF & JOB_SETUP_PAYLOAD_LEN, (0xFF & (JOB_SETUP_PAYLOAD_LEN >> 8))}; - + /* Create the payload array */ char[] payload = new char[]{ /* Enter the type of job setup */ (char)(JOB_SETUP_TYPE & 0xFF), (char)((JOB_SETUP_TYPE >> 8) & 0xFF), - + /* The number of tags being used */ (NUMBER_OF_TAGS & 0xFF), ((NUMBER_OF_TAGS >> 8) & 0xFF), - + /* Set up the sample rate using its tag and the sample rate from the settings */ (SAMPLE_RATE_TAG & 0xFF), ((SAMPLE_RATE_TAG >> 8) & 0xFF), (TAG_VAL_LEN & 0xFF), ((TAG_VAL_LEN & 0xFF) >> 8), - (char) (currentSampleRate & 0xFF), (char) ((currentSampleRate >> 8) & 0xFF), + (char) (currentSampleRate & 0xFF), (char) ((currentSampleRate >> 8) & 0xFF), (char) ((currentSampleRate >> 16) & 0xFF), (char) ((currentSampleRate >> 24) & 0xFF), - + /* Set up the bit depth using its tag, set to 24 bit */ (BIT_DEPTH_TAG & 0xFF), ((BIT_DEPTH_TAG >> 8) & 0xFF), (TAG_VAL_LEN & 0xFF), ((TAG_VAL_LEN & 0xFF) >> 8), - (char) (BIT_DEPTH_VAL & 0xFF), (char) ((BIT_DEPTH_VAL >> 8) & 0xFF), + (char) (BIT_DEPTH_VAL & 0xFF), (char) ((BIT_DEPTH_VAL >> 8) & 0xFF), (char) ((BIT_DEPTH_VAL >> 16) & 0xFF), (char) ((BIT_DEPTH_VAL >> 24) & 0xFF), - + /* Set up the digital gain using its tag, set to no gain */ (GAIN_TAG & 0xFF), ((GAIN_TAG >> 8) & 0xFF), (TAG_VAL_LEN & 0xFF), ((TAG_VAL_LEN & 0xFF) >> 8), - (char) (GAIN_VAL & 0xFF), (char) ((GAIN_VAL >> 8) & 0xFF), + (char) (GAIN_VAL & 0xFF), (char) ((GAIN_VAL >> 8) & 0xFF), (char) ((GAIN_VAL >> 16) & 0xFF), (char) ((GAIN_VAL >> 24) & 0xFF), - + /* Set up the endianness using its tag, set to Big endian */ (ENDIAN_TAG & 0xFF), ((ENDIAN_TAG >> 8) & 0xFF), (TAG_VAL_LEN & 0xFF), ((TAG_VAL_LEN >> 8) & 0xFF), - (ENDIAN_VAL & 0xFF), ((ENDIAN_VAL >> 8) & 0xFF), + (ENDIAN_VAL & 0xFF), ((ENDIAN_VAL >> 8) & 0xFF), ((ENDIAN_VAL >> 16) & 0xFF), ((ENDIAN_VAL >> 24) & 0xFF), - + /* Disable logging using its tag */ (LOGGING_MODE_TAG & 0xFF), ((LOGGING_MODE_TAG >> 8) & 0xFF), (TAG_VAL_LEN & 0xFF), ((TAG_VAL_LEN >> 8) & 0xFF), - (LOGGING_MODE_VAL & 0xFF), ((LOGGING_MODE_VAL >> 8) & 0xFF), + (LOGGING_MODE_VAL & 0xFF), ((LOGGING_MODE_VAL >> 8) & 0xFF), ((LOGGING_MODE_VAL >> 16) & 0xFF), ((LOGGING_MODE_VAL >> 24) & 0xFF), }; - + /* construct the message */ CommandMessage jobSetup = new CommandMessage(SYNC_BYTE, JOB_SETUP_COMMAND, payloadLength, payload); - + /* send the job setup message */ //TODO pass the send the index received to send to the correct icListen if(!sendCommandMessage(jobSetup)) @@ -1849,59 +1847,59 @@ public class icListenSystem extends DaqSystem implements PamSettings } return false; } - + /* create a buffer to hold the reply message */ byte[] buffer = new byte[MAX_MESSAGE_SIZE]; - + if(DEBUG) { System.out.println("Job setup message sent\nBytes sent to date: " + outStream.size()); } - + /* Read the reply */ - try + try { //TODO use an index to use the proper inStream inStream.read(buffer); - } - catch (IOException e) + } + catch (IOException e) { System.out.println("IOException when reading enquire response"); e.printStackTrace(); return false; } - + if(DEBUG) { /* Print the reply */ System.out.println("Job setup response received"); printCommandMessageBuffer(buffer); } - + /* Check the crc of the message */ CommandMessage jobSetupResponse = new CommandMessage(buffer); if(!checkCommandMessageCrc(jobSetupResponse)) { /* CRC does not match, disconnect and return */ System.out.println("CRC of the enquire message incorrect error in transmission"); - + JOptionPane.showMessageDialog(null, "Error with command transmission.\nConnection aborted"); icListenDisconnect(); return false; } - + //TODO check response setup for correct configuration - + return true; } - + /** * Disconnect from a currently connected icListen * Request the data capture to stop then close the socket */ private void icListenDisconnect() - { + { //TODO pass this an index to tell which icListen to disconnect from /* request capture to stop */ stopCapture = true; @@ -1909,11 +1907,11 @@ public class icListenSystem extends DaqSystem implements PamSettings will set stopCapture back to false. Set max 2s timeout */ int count = 0; while (stopCapture && captureRunning && ++count < 100) { - try + try { Thread.sleep(20); } - catch (Exception ex) + catch (Exception ex) { ex.printStackTrace(); } @@ -1922,7 +1920,7 @@ public class icListenSystem extends DaqSystem implements PamSettings System.out.println("Sleeping while thread exits"); } } - + if(DEBUG) { //TODO use the index to get the proper socket @@ -1932,30 +1930,30 @@ public class icListenSystem extends DaqSystem implements PamSettings //TODO use the index to get the proper connected statuses if(connected) { - try + try { //TODO use the index to get the proper socket streamSocket.close(); } - catch (IOException e) + catch (IOException e) { e.printStackTrace(); } } connected = false; - + /* Enable/disable the appropriate buttons/settings in the settings panel */ //TODO these will need to be updated based on dialog box implementation btnDisconnect.setEnabled(false); btnConnect.setEnabled(true); - + ipAddressInput.setEnabled(true); timeOutInput.setEnabled(true); waveformBandwidth.setEnabled(true); - + /* update the status field in the settings menu */ updateStatus(); - + if(DEBUG) { System.out.println("Disconnected"); @@ -1963,7 +1961,7 @@ public class icListenSystem extends DaqSystem implements PamSettings //TODO check if it was the last phone connected setStreamStatus(STREAM_CLOSED); } - + /** * Prepares the system to Start its data acquisition * An icListen should be connected at this point @@ -1971,7 +1969,7 @@ public class icListenSystem extends DaqSystem implements PamSettings * acquisition control's fields with the proper values */ @Override - public boolean prepareSystem(AcquisitionControl daqControl) + public boolean prepareSystem(AcquisitionControl daqControl) { /* Check to make sure an icListen is connected */ if(!connected) @@ -1980,14 +1978,14 @@ public class icListenSystem extends DaqSystem implements PamSettings "Please Connect to an icListen using the sound acquisition settings"); return false; } - + this.acquisitionControl = daqControl; - + /* make sure the proper values are set in the acquisition control */ acquisitionControl.getDaqProcess().setSampleRate(currentSampleRate, true); - - dataUnitSamples = (int) (currentSampleRate / 10); - + + dataUnitSamples = currentSampleRate / 10; + /* keep a reference to where data will be put. */ // DOUG changed type of this in latest version for some better queue management this.newDataUnits = daqControl.getDaqProcess().getNewDataQueue(); @@ -1995,34 +1993,34 @@ public class icListenSystem extends DaqSystem implements PamSettings { return false; } - + /* Preparation complete */ return true; } - + /** - * Start the data acquisition system by telling the icListen to start streaming data + * Start the data acquisition system by telling the icListen to start streaming data * then start separate threads to handle capturing data and processing it * as well as sets up a queue to pass messages between these threads */ @Override - public boolean startSystem(AcquisitionControl daqControl) + public boolean startSystem(AcquisitionControl daqControl) { /* If not connected return false */ if(!connected) { return false; } - + /* create a shared queue */ /* TODO make this an array of queues for every channel */ BlockingQueue queue = new LinkedBlockingQueue<>(); - + if(DEBUG) { System.out.println("Start stream message sent\nBytes sent to date: " + outStream.size()); } - + /* start a thread for capturing data */ //TODO Loop through this code to create a new capture/processing thread for every channel Thread captureThread = new Thread(new CaptureThread(queue)); @@ -2031,18 +2029,18 @@ public class icListenSystem extends DaqSystem implements PamSettings //TODO pass the current index to the data process thread Thread dataProcessThread = new Thread(new DataProcessThread(queue)); dataProcessThread.start(); - + /* Send a message to tell the icListen to start streaming */ sendStreamMessage(START_STREAM_MESSAGE); - + setStreamStatus(STREAM_RUNNING); return true; } - + /** * Send the message that has been passed to this function * This function sets up of a message buffer from a created - * CommandMessage class then sends it to the icListen on + * CommandMessage class then sends it to the icListen on * the command port * @param msg * @return @@ -2052,52 +2050,52 @@ public class icListenSystem extends DaqSystem implements PamSettings /* TODO pass this an index to send to the proper icListen */ int payloadLength; int bufferIndex; - - /* get payload length + + /* get payload length * assemble payload length into one number */ - payloadLength = (msg.payloadLength[0] & 0xFF) + payloadLength = (msg.payloadLength[0] & 0xFF) | (msg.payloadLength[1] & 0xFF << 8); /* create transmission buffer and fill it with the correct values from the message */ - byte[] buffer = new byte[msg.MIN_MESSAGE_SIZE + payloadLength]; - - buffer[0] = (byte) (msg.sync & 0xFF); + byte[] buffer = new byte[msg.MIN_MESSAGE_SIZE + payloadLength]; + + buffer[0] = (byte) (msg.sync & 0xFF); buffer[1] = (byte)(msg.command & 0xFF); buffer[2] = (byte)(msg.payloadLength[0] & 0xFF); buffer[3] = (byte)(msg.payloadLength[1] & 0xFF); - - for(bufferIndex = MSG_BEFORE_PAYLOAD; + + for(bufferIndex = MSG_BEFORE_PAYLOAD; bufferIndex < (payloadLength + MSG_BEFORE_PAYLOAD) ; bufferIndex++) { buffer[bufferIndex] = (byte)(msg.payload[bufferIndex - MSG_BEFORE_PAYLOAD] & 0xFF); - + if(DEBUG) { - System.out.println("Buffer: " + (int)buffer[bufferIndex] + " Payload: " + System.out.println("Buffer: " + (int)buffer[bufferIndex] + " Payload: " + (int)msg.payload[bufferIndex - MSG_BEFORE_PAYLOAD] + " Index: " + bufferIndex); } } - + buffer[bufferIndex] = (byte)(msg.crc[0] & 0xFF); buffer[bufferIndex + 1] = (byte)(msg.crc[1] & 0xFF); - + if(DEBUG) { printCommandMessageBuffer(buffer); } /* Send the created buffer */ - try + try { //TODO use the index to get the proper outStream outStream.write(buffer, 0, (msg.MIN_MESSAGE_SIZE + payloadLength)); - } + } catch (IOException e) { e.printStackTrace(); return false; } - + return true; } - + /** * Print a command message given a buffer that is properly formatted * Prints the messages bytes as its hexadecimal equivalents @@ -2106,15 +2104,15 @@ public class icListenSystem extends DaqSystem implements PamSettings * @return */ private void printCommandMessageBuffer(byte[] buf) - { + { /* No need to print unless debugging */ if(DEBUG) { int payloadLength; int bufferIndex, count = 0; - + payloadLength = (buf[2] & 0xFF) | (buf[3] & 0xFF << 8); - + System.out.println("\nPrint Message: (All bytes ordered LS->MS)"); /* Print sync */ System.out.printf("Sync: %02X\n", buf[0]); @@ -2125,7 +2123,7 @@ public class icListenSystem extends DaqSystem implements PamSettings /* print payload */ System.out.printf("payload: \n"); - for(bufferIndex = MSG_BEFORE_PAYLOAD; + for(bufferIndex = MSG_BEFORE_PAYLOAD; bufferIndex < (payloadLength + MSG_BEFORE_PAYLOAD) ; bufferIndex++) { System.out.printf("%02X ", buf[bufferIndex]); @@ -2141,7 +2139,7 @@ public class icListenSystem extends DaqSystem implements PamSettings System.out.printf("CRC: %02X %02X\n", buf[bufferIndex], buf[bufferIndex+1]); } } - + /** * Print a stream message given a buffer that is properly formatted * Prints the messages bytes as its hexadecimal equivalents @@ -2150,18 +2148,18 @@ public class icListenSystem extends DaqSystem implements PamSettings * @return */ private void printStreamMessageBuffer(byte[] buf) - { + { /* No need to print unless debugging */ if(DEBUG) { int payloadLength; int bufferIndex, count = 0; - + payloadLength = (buf[3] & 0xFF) | (buf[2] & 0xFF << 8); - + System.out.println("\nPrint Message: (All bytes ordered MS->LS)"); /* Print type */ - System.out.printf("Type: %02X\n", buf[0]); + System.out.printf("Type: %02X\n", buf[0]); /* Print sync */ System.out.printf("Sync: %02X\n", buf[1]); /* Print payload length */ @@ -2169,7 +2167,7 @@ public class icListenSystem extends DaqSystem implements PamSettings /* print payload */ System.out.printf("payload: \n"); - for(bufferIndex = MSG_BEFORE_PAYLOAD; + for(bufferIndex = MSG_BEFORE_PAYLOAD; bufferIndex < (payloadLength + MSG_BEFORE_PAYLOAD) && bufferIndex < MAX_MESSAGE_SIZE ; bufferIndex++) { System.out.printf("%02X ", buf[bufferIndex]); @@ -2183,11 +2181,11 @@ public class icListenSystem extends DaqSystem implements PamSettings System.out.printf("\n"); } } - + /** * Send the message that has been passed to this function - * This function sets up of a message buffer from a created - * StreamMessage class then sends it to the icListen on the + * This function sets up of a message buffer from a created + * StreamMessage class then sends it to the icListen on the * waveform port * @param msg * @return @@ -2197,47 +2195,47 @@ public class icListenSystem extends DaqSystem implements PamSettings /* TODO pass this an index to send to the proper icListen */ int payloadLength; int bufferIndex; - + /* get payload length */ /* assemble payload length into one number */ - payloadLength = (msg.payloadLength[1] & 0xFF) + payloadLength = (msg.payloadLength[1] & 0xFF) | (msg.payloadLength[0] & 0xFF << 8); /* create transmission buffer */ - byte[] buffer = new byte[MSG_BEFORE_PAYLOAD + payloadLength]; - + byte[] buffer = new byte[MSG_BEFORE_PAYLOAD + payloadLength]; + buffer[0] = (byte)(msg.type & 0xFF); - buffer[1] = (byte) (msg.sync & 0xFF); + buffer[1] = (byte) (msg.sync & 0xFF); buffer[2] = (byte)(msg.payloadLength[0] & 0xFF); buffer[3] = (byte)(msg.payloadLength[1] & 0xFF); - - for(bufferIndex = MSG_BEFORE_PAYLOAD; + + for(bufferIndex = MSG_BEFORE_PAYLOAD; bufferIndex < (payloadLength + MSG_BEFORE_PAYLOAD) ; bufferIndex++) { buffer[bufferIndex] = (byte)(msg.payload[bufferIndex - MSG_BEFORE_PAYLOAD] & 0xFF); - + if(DEBUG) { - System.out.println("Buffer: " + (int)buffer[bufferIndex] + " Payload: " + System.out.println("Buffer: " + (int)buffer[bufferIndex] + " Payload: " + (int)msg.payload[bufferIndex - MSG_BEFORE_PAYLOAD] + " Index: " + bufferIndex); } } - + if(DEBUG) { printStreamMessageBuffer(buffer); } /* Send the created buffer */ - try + try { //TODO use index to get proper outStream outStream.write(buffer, 0, (MSG_BEFORE_PAYLOAD + payloadLength)); - } - catch (IOException e) + } + catch (IOException e) { e.printStackTrace(); return false; } - + return true; } @@ -2247,20 +2245,20 @@ public class icListenSystem extends DaqSystem implements PamSettings * then close/free all the nesc. objects */ @Override - public void stopSystem(AcquisitionControl daqControl) + public void stopSystem(AcquisitionControl daqControl) { /* request capture to stop */ stopCapture = true; /* now wait for the thread to finish - when it does it - will set stopCapture back to false. + will set stopCapture back to false. Set max 2s timeout (20ms sleep 100 times) */ int count = 0; while (stopCapture && captureRunning && ++count < 100) { - try + try { Thread.sleep(20); } - catch (Exception ex) + catch (Exception ex) { ex.printStackTrace(); } @@ -2269,7 +2267,7 @@ public class icListenSystem extends DaqSystem implements PamSettings System.out.println("Sleeping while thread exits"); } } - + /* tell the icListen to stop the data stream */ //TODO loop through all the channels and send the stop messages sendStreamMessage(STOP_STREAM_MESSAGE); @@ -2278,58 +2276,58 @@ public class icListenSystem extends DaqSystem implements PamSettings } @Override - public boolean isRealTime() + public boolean isRealTime() { return true; } @Override - public boolean canPlayBack(float sampleRate) + public boolean canPlayBack(float sampleRate) { // TODO Auto-generated method stub return true; } @Override - public int getDataUnitSamples() + public int getDataUnitSamples() { return dataUnitSamples; } @Override - public void daqHasEnded() + public void daqHasEnded() { // TODO Auto-generated method stub } @Override - public String getDeviceName() + public String getDeviceName() { // TODO Auto-generated method stub return getSystemName(); } @Override - public String getUnitName() + public String getUnitName() { return "icListen System"; } @Override - public String getUnitType() + public String getUnitType() { return "Acquisition System"; } @Override - public Serializable getSettingsReference() + public Serializable getSettingsReference() { // TODO Auto-generated method stub return null; } @Override - public long getSettingsVersion() + public long getSettingsVersion() { // TODO Auto-generated method stub return 0; @@ -2337,14 +2335,14 @@ public class icListenSystem extends DaqSystem implements PamSettings @Override public boolean restoreSettings( - PamControlledUnitSettings pamControlledUnitSettings) + PamControlledUnitSettings pamControlledUnitSettings) { // TODO Auto-generated method stub return false; } - + @Override - public PlaybackSystem getPlaybackSystem(PlaybackControl playbackControl, DaqSystem daqSystem) + public PlaybackSystem getPlaybackSystem(PlaybackControl playbackControl, DaqSystem daqSystem) { // TODO Create a playback system return null; diff --git a/src/AirgunDisplay/AirgunControl.java b/src/AirgunDisplay/AirgunControl.java index 7888b3c9..f9a5b448 100644 --- a/src/AirgunDisplay/AirgunControl.java +++ b/src/AirgunDisplay/AirgunControl.java @@ -19,32 +19,35 @@ import PamController.positionreference.PositionReference; public class AirgunControl extends PamControlledUnit implements PamSettings, PositionReference { AirgunParameters airgunParameters; - + AirgunProcess airgunProcess; protected boolean initialisationComplete; - + public AirgunControl(String unitName) { - + super("Airgun Display", unitName); airgunParameters = new AirgunParameters(); - + addPamProcess(airgunProcess = new AirgunProcess(this)); - + PamSettingManager.getInstance().registerSettings(this); - + airgunProcess.findSourceData(); } + @Override public Serializable getSettingsReference() { return airgunParameters; } + @Override public long getSettingsVersion() { return AirgunParameters.serialVersionUID; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { if (pamControlledUnitSettings.getVersionNo() != AirgunParameters.serialVersionUID) { return false; @@ -60,15 +63,16 @@ public class AirgunControl extends PamControlledUnit implements PamSettings, Pos menuItem.addActionListener(new AirgunDisplayOptions(parentFrame)); return menuItem; } - + private class AirgunDisplayOptions implements ActionListener { - + Frame frame; public AirgunDisplayOptions(Frame frame) { this.frame = frame; } + @Override public void actionPerformed(ActionEvent e) { AirgunParameters newParams = AirgunParametersDialog.showDialog(frame, airgunParameters); @@ -76,8 +80,8 @@ public class AirgunControl extends PamControlledUnit implements PamSettings, Pos airgunParameters = newParams.clone(); airgunProcess.findSourceData(); } - } - + } + } @Override @@ -87,11 +91,11 @@ public class AirgunControl extends PamControlledUnit implements PamSettings, Pos switch (changeType) { case PamControllerInterface.INITIALIZATION_COMPLETE: initialisationComplete = true; - airgunProcess.findSourceData(); + airgunProcess.findSourceData(); break; case PamControllerInterface.ADD_CONTROLLEDUNIT: if (initialisationComplete) { - airgunProcess.findSourceData(); + airgunProcess.findSourceData(); } break; case PamControllerInterface.NEW_SCROLL_TIME: diff --git a/src/AirgunDisplay/AirgunDimensionsDrawing.java b/src/AirgunDisplay/AirgunDimensionsDrawing.java index 08f31e0c..08e27ac5 100644 --- a/src/AirgunDisplay/AirgunDimensionsDrawing.java +++ b/src/AirgunDisplay/AirgunDimensionsDrawing.java @@ -13,9 +13,9 @@ public class AirgunDimensionsDrawing extends ShipDimensionsDrawing { private double dimE = 0.1; static private double dimF = 0.5; - + PamSymbol airgunSymbol; - + public AirgunDimensionsDrawing() throws HeadlessException { super(); airgunSymbol = new PamSymbol(PamSymbolType.SYMBOL_HEXAGRAM, 10, 10, false, Color.BLUE, Color.BLUE); diff --git a/src/AirgunDisplay/AirgunGraphics.java b/src/AirgunDisplay/AirgunGraphics.java index 5b206b62..a9b02760 100644 --- a/src/AirgunDisplay/AirgunGraphics.java +++ b/src/AirgunDisplay/AirgunGraphics.java @@ -14,21 +14,21 @@ import PamUtils.Coordinate3d; import PamUtils.LatLong; import PamView.BasicKeyItem; import PamView.GeneralProjector; +import PamView.GeneralProjector.ParameterType; +import PamView.GeneralProjector.ParameterUnits; import PamView.PamKeyItem; import PamView.PamSymbol; import PamView.PamSymbolType; import PamView.PanelOverlayDraw; -import PamView.GeneralProjector.ParameterType; -import PamView.GeneralProjector.ParameterUnits; import PamView.symbol.SymbolData; import PamguardMVC.PamDataUnit; public class AirgunGraphics extends PanelOverlayDraw { AirgunControl airgunControl; - + // PamSymbol gunsSymbol; - + public static final SymbolData defaultSymbol = new SymbolData(PamSymbolType.SYMBOL_CIRCLE, 6, 6, true, Color.RED, Color.RED); public AirgunGraphics(AirgunControl airgunControl) { @@ -39,18 +39,20 @@ public class AirgunGraphics extends PanelOverlayDraw { @Override public boolean canDraw(ParameterType[] parameterTypes, ParameterUnits[] parameterUnits) { - return (parameterTypes[0] == GeneralProjector.ParameterType.LATITUDE && + return (parameterTypes[0] == GeneralProjector.ParameterType.LATITUDE && parameterTypes[1] == GeneralProjector.ParameterType.LONGITUDE); } + @Override public PamKeyItem createKeyItem(GeneralProjector generalProjector,int keyType) { return new BasicKeyItem(getPamSymbol(null, generalProjector), airgunControl.getUnitName()); - + } + @Override public Rectangle drawDataUnit(Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector) { - + AirgunDataUnit airgunDataUnit = (AirgunDataUnit) pamDataUnit; double verticalRotation = 0.; @@ -66,7 +68,7 @@ public class AirgunGraphics extends PanelOverlayDraw { return drawRotatedMap(g, airgunDataUnit, generalProjector); // } } - + public Rectangle drawRotatedMap(Graphics g, AirgunDataUnit airgunDataUnit, GeneralProjector generalProjector) { GpsData gpsData = airgunDataUnit.getGpsData(); MapRectProjector mapProj = (MapRectProjector) generalProjector; @@ -74,156 +76,157 @@ public class AirgunGraphics extends PanelOverlayDraw { double yScale = Math.cos(Math.toRadians(verticalRotation)); double radiusX = mapProj.getPixelsPerMetre()*airgunControl.airgunParameters.exclusionRadius; double radiusY = Math.max(radiusX * yScale, 0); - + double gunZ = -airgunControl.airgunParameters.gunDepth; - - // need to move from the gps position to the gund position. - LatLong gunsGps = gpsData.travelDistanceMeters(gpsData.getCourseOverGround() + 90, - airgunControl.airgunParameters.dimF); - gunsGps = gunsGps.travelDistanceMeters(gpsData.getCourseOverGround() + 180, - airgunControl.airgunParameters.dimE); + + // need to move from the gps position to the gund position. + LatLong gunsGps = gpsData.travelDistanceMeters(gpsData.getCourseOverGround() + 90, + airgunControl.airgunParameters.dimF); + gunsGps = gunsGps.travelDistanceMeters(gpsData.getCourseOverGround() + 180, + airgunControl.airgunParameters.dimE); // int mitigationRadius = airgunControl.airgunParameters.exclusionRadius; Coordinate3d gunsCentre = generalProjector.getCoord3d(gunsGps.getLatitude(), gunsGps.getLongitude(), gunZ); // draw the guns - Point gc = gunsCentre.getXYPoint(); + Point gc = gunsCentre.getXYPoint(); PamSymbol gunsSymbol = getPamSymbol(airgunDataUnit, generalProjector); gunsSymbol.setFillColor(airgunControl.airgunParameters.exclusionColor); gunsSymbol.setLineColor(airgunControl.airgunParameters.exclusionColor); gunsSymbol.draw(g, gc); generalProjector.addHoverData(gunsCentre, airgunDataUnit); - + if (airgunControl.airgunParameters.showExclusionZone) { // LatLong rEnd = gunsGps.addDistanceMeters(mitigationRadius, 0); -// +// // Coordinate3d gunsCirc = generalProjector.getCoord3d(rEnd.getLatitude(), rEnd.getLongitude(), 0); -// double radius = Math.pow(gunsCentre.x-gunsCirc.x, 2) + +// double radius = Math.pow(gunsCentre.x-gunsCirc.x, 2) + // Math.pow(gunsCentre.y-gunsCirc.y, 2); if (radiusX > 5) { - g.drawOval((int) (gunsCentre.x - radiusX), (int) (gunsCentre.y - radiusY), + g.drawOval((int) (gunsCentre.x - radiusX), (int) (gunsCentre.y - radiusY), (int) (2*radiusX), (int) (2*radiusY)); } - + if (airgunControl.airgunParameters.predictAhead) { double mapAngle = (int) (90 - gpsData.getCourseOverGround() - 90) - mapProj.getMapRotationDegrees(); - double predictionLengthMiles = airgunControl.airgunParameters.secondsAhead * + double predictionLengthMiles = airgunControl.airgunParameters.secondsAhead * gpsData.getSpeed() / 3600; LatLong predictedPos = gunsGps.TravelDistanceMiles(gpsData.getCourseOverGround(), predictionLengthMiles); Coordinate3d pCirc = generalProjector.getCoord3d(predictedPos.getLatitude(), predictedPos.getLongitude(), gunZ); // int a1 = 90 - gpsData.getTrueCourse() + 90; -// g.drawArc((int) (pCirc.x - radius), (int) (pCirc.y - radius), (int) radius*2, (int) radius*2, +// g.drawArc((int) (pCirc.x - radius), (int) (pCirc.y - radius), (int) radius*2, (int) radius*2, // 50, 180); float[] dashes = {2, 6}; ((Graphics2D) g).setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1, dashes, 0)); - g.drawOval((int) (pCirc.x - radiusX), (int) (pCirc.y - radiusY), + g.drawOval((int) (pCirc.x - radiusX), (int) (pCirc.y - radiusY), (int) (2*radiusX), (int) (2*radiusY)); -// g.drawArc((int) (pCirc.x - radiusX), (int) (pCirc.y - radiusY), (int) radiusX*2, (int) ((int) 2*radiusY), +// g.drawArc((int) (pCirc.x - radiusX), (int) (pCirc.y - radiusY), (int) radiusX*2, (int) ((int) 2*radiusY), // (int) mapAngle, 180); // now need to find the edge points of all this to link up to other circle LatLong ll1, ll2; Coordinate3d p1, p2; - ll1 = gunsGps.travelDistanceMeters(gpsData.getCourseOverGround()+90, + ll1 = gunsGps.travelDistanceMeters(gpsData.getCourseOverGround()+90, airgunControl.airgunParameters.exclusionRadius); - ll2 = predictedPos.travelDistanceMeters(gpsData.getCourseOverGround()+90, + ll2 = predictedPos.travelDistanceMeters(gpsData.getCourseOverGround()+90, airgunControl.airgunParameters.exclusionRadius); p1 = generalProjector.getCoord3d(ll1.getLatitude(), ll1.getLongitude(), gunZ); p2 = generalProjector.getCoord3d(ll2.getLatitude(), ll2.getLongitude(), gunZ); g.drawLine((int) p1.x, (int) p1.y, (int) p2.x, (int) p2.y); - ll1 = gunsGps.travelDistanceMeters(gpsData.getCourseOverGround()-90, + ll1 = gunsGps.travelDistanceMeters(gpsData.getCourseOverGround()-90, airgunControl.airgunParameters.exclusionRadius); - ll2 = predictedPos.travelDistanceMeters(gpsData.getCourseOverGround()-90, + ll2 = predictedPos.travelDistanceMeters(gpsData.getCourseOverGround()-90, airgunControl.airgunParameters.exclusionRadius); p1 = generalProjector.getCoord3d(ll1.getLatitude(), ll1.getLongitude(), gunZ); p2 = generalProjector.getCoord3d(ll2.getLatitude(), ll2.getLongitude(), gunZ); g.drawLine((int) p1.x, (int) p1.y, (int) p2.x, (int) p2.y); // g.setColor(Color.RED); -// g.drawOval((int) (pCirc.x - radius), (int) (pCirc.y - radius), +// g.drawOval((int) (pCirc.x - radius), (int) (pCirc.y - radius), // (int) (2*radius), (int) (2*radius)); - - + + // put it back to a solid line, otherwise the next drawn object will be dashed ! ((Graphics2D) g).setStroke(new BasicStroke(1)); } } - + return null; } public Rectangle drawFlatMap(Graphics g, AirgunDataUnit airgunDataUnit, GeneralProjector generalProjector) { - + GpsData gpsData = airgunDataUnit.getGpsData(); - - // need to move from the gps position to the gund position. - LatLong gunsGps = gpsData.travelDistanceMeters(gpsData.getCourseOverGround() + 90, - airgunControl.airgunParameters.dimF); - gunsGps = gunsGps.travelDistanceMeters(gpsData.getCourseOverGround() + 180, - airgunControl.airgunParameters.dimE); + + // need to move from the gps position to the gund position. + LatLong gunsGps = gpsData.travelDistanceMeters(gpsData.getCourseOverGround() + 90, + airgunControl.airgunParameters.dimF); + gunsGps = gunsGps.travelDistanceMeters(gpsData.getCourseOverGround() + 180, + airgunControl.airgunParameters.dimE); int mitigationRadius = airgunControl.airgunParameters.exclusionRadius; Coordinate3d gunsCentre = generalProjector.getCoord3d(gunsGps.getLatitude(), gunsGps.getLongitude(), 0); // draw the guns - Point gc = gunsCentre.getXYPoint(); + Point gc = gunsCentre.getXYPoint(); PamSymbol gunsSymbol = getPamSymbol(airgunDataUnit, generalProjector); gunsSymbol.setFillColor(airgunControl.airgunParameters.exclusionColor); gunsSymbol.setLineColor(airgunControl.airgunParameters.exclusionColor); gunsSymbol.draw(g, gc); generalProjector.addHoverData(gunsCentre, airgunDataUnit); - + if (airgunControl.airgunParameters.showExclusionZone) { LatLong rEnd = gunsGps.addDistanceMeters(mitigationRadius, 0); - + Coordinate3d gunsCirc = generalProjector.getCoord3d(rEnd.getLatitude(), rEnd.getLongitude(), 0); - double radius = Math.pow(gunsCentre.x-gunsCirc.x, 2) + + double radius = Math.pow(gunsCentre.x-gunsCirc.x, 2) + Math.pow(gunsCentre.y-gunsCirc.y, 2); if (radius > 25) { radius = Math.sqrt(radius); - - g.drawOval((int) (gunsCentre.x - radius), (int) (gunsCentre.y - radius), + + g.drawOval((int) (gunsCentre.x - radius), (int) (gunsCentre.y - radius), (int) (2*radius), (int) (2*radius)); } - + if (airgunControl.airgunParameters.predictAhead) { - double predictionLengthMiles = airgunControl.airgunParameters.secondsAhead * + double predictionLengthMiles = airgunControl.airgunParameters.secondsAhead * gpsData.getSpeed() / 3600; LatLong predictedPos = gunsGps.TravelDistanceMiles(gpsData.getCourseOverGround(), predictionLengthMiles); Coordinate3d pCirc = generalProjector.getCoord3d(predictedPos.getLatitude(), predictedPos.getLongitude(), 0); // int a1 = 90 - gpsData.getTrueCourse() + 90; -// g.drawArc((int) (pCirc.x - radius), (int) (pCirc.y - radius), (int) radius*2, (int) radius*2, +// g.drawArc((int) (pCirc.x - radius), (int) (pCirc.y - radius), (int) radius*2, (int) radius*2, // 50, 180); float[] dashes = {2, 6}; ((Graphics2D) g).setStroke(new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1, dashes, 0)); - - g.drawArc((int) (pCirc.x - radius), (int) (pCirc.y - radius), (int) radius*2, (int) radius*2, + + g.drawArc((int) (pCirc.x - radius), (int) (pCirc.y - radius), (int) radius*2, (int) radius*2, (int) (90 - gpsData.getCourseOverGround() - 90), 180); // now need to find the edge points of all this to link up to other circle LatLong ll1, ll2; Coordinate3d p1, p2; - ll1 = gunsGps.travelDistanceMeters(gpsData.getCourseOverGround()+90, + ll1 = gunsGps.travelDistanceMeters(gpsData.getCourseOverGround()+90, airgunControl.airgunParameters.exclusionRadius); - ll2 = predictedPos.travelDistanceMeters(gpsData.getCourseOverGround()+90, + ll2 = predictedPos.travelDistanceMeters(gpsData.getCourseOverGround()+90, airgunControl.airgunParameters.exclusionRadius); p1 = generalProjector.getCoord3d(ll1.getLatitude(), ll1.getLongitude(), 0); p2 = generalProjector.getCoord3d(ll2.getLatitude(), ll2.getLongitude(), 0); g.drawLine((int) p1.x, (int) p1.y, (int) p2.x, (int) p2.y); - ll1 = gunsGps.travelDistanceMeters(gpsData.getCourseOverGround()-90, + ll1 = gunsGps.travelDistanceMeters(gpsData.getCourseOverGround()-90, airgunControl.airgunParameters.exclusionRadius); - ll2 = predictedPos.travelDistanceMeters(gpsData.getCourseOverGround()-90, + ll2 = predictedPos.travelDistanceMeters(gpsData.getCourseOverGround()-90, airgunControl.airgunParameters.exclusionRadius); p1 = generalProjector.getCoord3d(ll1.getLatitude(), ll1.getLongitude(), 0); p2 = generalProjector.getCoord3d(ll2.getLatitude(), ll2.getLongitude(), 0); g.drawLine((int) p1.x, (int) p1.y, (int) p2.x, (int) p2.y); // g.setColor(Color.RED); -// g.drawOval((int) (pCirc.x - radius), (int) (pCirc.y - radius), +// g.drawOval((int) (pCirc.x - radius), (int) (pCirc.y - radius), // (int) (2*radius), (int) (2*radius)); - - + + // put it back to a solid line, otherwise the next drawn object will be dashed ! ((Graphics2D) g).setStroke(new BasicStroke(1)); } } - + return null; } + @Override public String getHoverText(GeneralProjector generalProjector, PamDataUnit dataUnit, int iSide) { String str = "" + airgunControl.getUnitName(); if (airgunControl.airgunParameters.showExclusionZone) { @@ -242,5 +245,5 @@ public class AirgunGraphics extends PanelOverlayDraw { public boolean showOptions(Window parentWindow, GeneralProjector generalProjector) { return false; - } + } } diff --git a/src/AirgunDisplay/AirgunParameters.java b/src/AirgunDisplay/AirgunParameters.java index 5fae8317..79f9870c 100644 --- a/src/AirgunDisplay/AirgunParameters.java +++ b/src/AirgunDisplay/AirgunParameters.java @@ -17,15 +17,15 @@ public class AirgunParameters implements Serializable, Cloneable, ManagedParamet public static final int GUNS_FIXEDPOSITION = 2; static public final long serialVersionUID = 1; - + /** * True if guns are on this vessel */ private boolean gunsThisVessel = true; - + public int gunsReferencePosition = GUNS_THIS_VESSEL; private boolean hasGunsReferencePosition = false; - + /** * mmsi number of vessel if guns are on another vessel */ @@ -35,54 +35,54 @@ public class AirgunParameters implements Serializable, Cloneable, ManagedParamet * distance in m towards the stern from the vessels GPS receiver */ double dimE = 20; - + /** * distance in m towards the starboard side from the vessels GPS receiver */ double dimF = 0; - + /** - * Gun depth in metres. + * Gun depth in metres. */ double gunDepth = 0; - + /** * Show exclusion zone on the map */ boolean showExclusionZone = true; - + /** * radius of exclusion xone in m */ int exclusionRadius = 500; - + /** * Colour for exclusion zone on map. */ Color exclusionColor = Color.RED; - + /** * predict where we'll be in a certain time */ boolean predictAhead = false; - + /** * prediction time in seconds */ int secondsAhead = 600; - + public LatLong fixedPosition; - + @Override public AirgunParameters clone() { try { AirgunParameters np = (AirgunParameters) super.clone(); - if (np.hasGunsReferencePosition == false) { + if (!np.hasGunsReferencePosition) { // sort out what happens if old boolean ref was used - // instead of new int type. + // instead of new int type. np.hasGunsReferencePosition = true; - if (np.gunsThisVessel == false) { + if (!np.gunsThisVessel) { np.gunsReferencePosition = GUNS_AIS_VESSEL; } } @@ -93,7 +93,7 @@ public class AirgunParameters implements Serializable, Cloneable, ManagedParamet } return null; } - + @Override public PamParameterSet getParameterSet() { PamParameterSet ps = PamParameterSet.autoGenerate(this, ParameterSetType.DISPLAY); diff --git a/src/AirgunDisplay/AirgunParametersDialog.java b/src/AirgunDisplay/AirgunParametersDialog.java index bdd52f84..023310c7 100644 --- a/src/AirgunDisplay/AirgunParametersDialog.java +++ b/src/AirgunDisplay/AirgunParametersDialog.java @@ -17,6 +17,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.BevelBorder; import javax.swing.border.TitledBorder; @@ -29,19 +30,19 @@ import PamView.dialog.PamDialog; public class AirgunParametersDialog extends PamDialog { private static AirgunParametersDialog airgunParametersDialog; - + private AirgunParameters airgunParameters; - + private ShipDimensionsPanel shipDrawing; - + private ShipDimensionsFields shipDimensionsFields; - + private ShipIDPanel shipIDPanel; - + private ExclusionPanel exclusionPanel; - + private String[] fieldNames = {"E","F","Depth"}; - + public AirgunParametersDialog(Frame parentFrame) { super(parentFrame, "Airgun display parameters", false); JPanel p = new JPanel(); @@ -49,7 +50,7 @@ public class AirgunParametersDialog extends PamDialog { AirgunDimensionsDrawing ad = new AirgunDimensionsDrawing(); p.add(shipDrawing = new ShipDimensionsPanel(ad, shipDimensionsFields = new ShipDimensionsFields(fieldNames))); - + JPanel q = new JPanel(); q.setLayout(new BoxLayout(q, BoxLayout.Y_AXIS)); q.add(shipIDPanel = new ShipIDPanel()); @@ -58,7 +59,7 @@ public class AirgunParametersDialog extends PamDialog { setDialogComponent(p); // setModal(true); } - + public static AirgunParameters showDialog(Frame parentFrame, AirgunParameters airgunParameters) { if (airgunParametersDialog == null || airgunParametersDialog.getParent() != parentFrame) { airgunParametersDialog = new AirgunParametersDialog(parentFrame); @@ -66,16 +67,16 @@ public class AirgunParametersDialog extends PamDialog { airgunParametersDialog.airgunParameters = airgunParameters.clone(); airgunParametersDialog.setParams(); airgunParametersDialog.setVisible(true); - + return airgunParametersDialog.airgunParameters; } - + @Override public void cancelButtonPressed() { // TODO Auto-generated method stub - + } - + public void setParams() { double[] dim = new double[3]; dim[0] = airgunParameters.dimE; @@ -84,9 +85,9 @@ public class AirgunParametersDialog extends PamDialog { shipDimensionsFields.setDimensions(dim); shipIDPanel.setParams(); exclusionPanel.setParams(); - + } - + @Override public boolean getParams() { double[] dim = shipDimensionsFields.getDimensions(); @@ -94,23 +95,22 @@ public class AirgunParametersDialog extends PamDialog { airgunParameters.dimE = dim[0]; airgunParameters.dimF = dim[1]; airgunParameters.gunDepth = dim[2]; - if (shipIDPanel.getParams() == false) return false; - if (exclusionPanel.getParams() == false) return false; + if (!shipIDPanel.getParams() || !exclusionPanel.getParams()) return false; return true; } - + @Override public void restoreDefaultSettings() { // TODO Auto-generated method stub - + } - + class ShipIDPanel extends JPanel implements ActionListener { private JRadioButton thisVessel, otherVessel, fixedLocation; private JTextField mmsiNumber; private LatLongEditableDialogStrip llStrip; - + public ShipIDPanel() { super(); setBorder(new TitledBorder("Source Vessel Identification")); @@ -131,7 +131,7 @@ public class AirgunParametersDialog extends PamDialog { c.gridy++; c.gridx = 0; c.gridwidth = 1; - addComponent(this, new JLabel("Source vessel mmsi number ", JLabel.RIGHT), c); + addComponent(this, new JLabel("Source vessel mmsi number ", SwingConstants.RIGHT), c); c.gridx++; addComponent(this, mmsiNumber = new JTextField(7), c); c.gridx = 0; @@ -144,18 +144,19 @@ public class AirgunParametersDialog extends PamDialog { addComponent(this, llStrip.getDialogComponent(), c); bg.add(fixedLocation); fixedLocation.addActionListener(this); - + } + @Override public void actionPerformed(ActionEvent e) { enableControls(); } - + public void enableControls() { mmsiNumber.setEnabled(otherVessel.isSelected()); llStrip.enableControls(fixedLocation.isSelected()); } - + public void setParams() { thisVessel.setSelected(airgunParameters.gunsReferencePosition == AirgunParameters.GUNS_THIS_VESSEL); otherVessel.setSelected(airgunParameters.gunsReferencePosition == AirgunParameters.GUNS_AIS_VESSEL); @@ -164,7 +165,7 @@ public class AirgunParametersDialog extends PamDialog { llStrip.setLatLong(airgunParameters.fixedPosition); enableControls(); } - + public boolean getParams() { if (thisVessel.isSelected()) { airgunParameters.gunsReferencePosition = AirgunParameters.GUNS_THIS_VESSEL; @@ -192,22 +193,22 @@ public class AirgunParametersDialog extends PamDialog { } return true; } - + } class ExclusionPanel extends JPanel implements ActionListener { JTextField exRadius; - + JCheckBox showExclusion; - + JPanel exPanel; - + JButton exButton; - + JCheckBox predictAhead; - + JTextField predictionTime; - + public ExclusionPanel() { super(); setBorder(new TitledBorder("Guns mitigation zone")); @@ -229,7 +230,7 @@ public class AirgunParametersDialog extends PamDialog { addComponent(this, exRadius = new JTextField(6), c); c.gridx++; addComponent(this, new JLabel(" m"), c); - + c.gridwidth = 1; c.gridy++; c.gridx = 0; @@ -239,7 +240,7 @@ public class AirgunParametersDialog extends PamDialog { c.gridx++; addComponent(this, exButton = new JButton("Colour"), c); exButton.addActionListener(this); - + c.gridx = 0; c.gridy ++; c.gridwidth = 3; @@ -248,13 +249,13 @@ public class AirgunParametersDialog extends PamDialog { c.gridx = 0; c.gridy ++; c.gridwidth = 1; - addComponent(this, new JLabel("Predict ahead for ", JLabel.RIGHT), c); + addComponent(this, new JLabel("Predict ahead for ", SwingConstants.RIGHT), c); c.gridx++; addComponent(this, predictionTime = new JTextField(6), c); c.gridx++; - addComponent(this, new JLabel(" seconds ", JLabel.LEFT), c); - - + addComponent(this, new JLabel(" seconds ", SwingConstants.LEFT), c); + + } public void setParams() { showExclusion.setSelected(airgunParameters.showExclusionZone); @@ -282,9 +283,10 @@ public class AirgunParametersDialog extends PamDialog { } return true; } + @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == exButton) { - Color newColor = JColorChooser.showDialog(this, "Mitigation zone colour", + Color newColor = JColorChooser.showDialog(this, "Mitigation zone colour", airgunParameters.exclusionColor); if (newColor != null) { setColour(newColor); @@ -296,7 +298,7 @@ public class AirgunParametersDialog extends PamDialog { else if (e.getSource() == predictAhead) { enableControls(); } - + } private void enableControls() { predictAhead.setEnabled(showExclusion.isSelected()); @@ -305,5 +307,5 @@ public class AirgunParametersDialog extends PamDialog { predictionTime.setEnabled(predictAhead.isSelected() && showExclusion.isSelected()); } } - + } diff --git a/src/AirgunDisplay/AirgunProcess.java b/src/AirgunDisplay/AirgunProcess.java index 0931614e..0822cc24 100644 --- a/src/AirgunDisplay/AirgunProcess.java +++ b/src/AirgunDisplay/AirgunProcess.java @@ -7,11 +7,9 @@ import AIS.AISDataUnit; import AIS.AISPositionReport; import GPS.GpsData; import GPS.GpsDataUnit; -import Map.MapCommentOverlayGraphics; import PamController.PamController; import PamUtils.LatLong; import PamUtils.PamCalendar; -import PamView.symbol.PamSymbolManager; import PamView.symbol.StandardSymbolManager; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; @@ -22,11 +20,11 @@ import PamguardMVC.SingletonDataBlock; public class AirgunProcess extends PamProcess { AirgunControl airgunControl; - + PamDataBlock gpsDataBlock; AISDataBlock aisDataBlock; PamDataBlock outputDataBlock; - + public AirgunProcess(AirgunControl airgunControl) { super(airgunControl, null); this.airgunControl = airgunControl; @@ -53,10 +51,10 @@ public class AirgunProcess extends PamProcess { public void newData(PamObservable o, PamDataUnit arg) { useData(o, arg); } - + /** - * AIS data are generally updated rather than created new, so - * use newData and updateData in the same way, + * AIS data are generally updated rather than created new, so + * use newData and updateData in the same way, * @param o PamObservable sent to updateData or newData * @param arg PamDataUnit sent to updateData or newData */ @@ -72,7 +70,7 @@ public class AirgunProcess extends PamProcess { useAisData((PamDataBlock) o, (AISDataUnit) arg); } } - + private void useGpsData(PamDataBlock dataBlock, GpsDataUnit gpsDataUnit) { if (gpsDataUnit == null) { return; @@ -80,7 +78,7 @@ public class AirgunProcess extends PamProcess { GpsData gpsData = gpsDataUnit.getGpsData(); createAirgunData(gpsData); } - + private void useAisData(PamDataBlock dataBlock, AISDataUnit aisDataUnit) { if (aisDataUnit.mmsiNumber != airgunControl.airgunParameters.gunsMMSIVessel) return; // if (aisDataUnit.isComplete() == false) { @@ -104,29 +102,29 @@ public class AirgunProcess extends PamProcess { gpsData.setTimeInMillis(aisDataUnit.getTimeMilliseconds()); createAirgunData(gpsData); } - - + + private void createAirgunData(GpsData gpsData) { // PamDataUnit nU = outputDataBlock.getNewUnit(0,0,0); AirgunDataUnit nU = new AirgunDataUnit(PamCalendar.getTimeInMillis(), gpsData); outputDataBlock.addPamData(nU); } - + @Override public void noteNewSettings() { // super.noteNewSettings(); findSourceData(); } synchronized public void findSourceData(){ - + PamDataBlock newDataBlock = null; if (airgunControl.airgunParameters.gunsReferencePosition == AirgunParameters.GUNS_THIS_VESSEL) { aisDataBlock = null; // find and subscribe to the GPS data block /* * 4/3/13 Change this to ensure it get's the correct GPS data block. In past it was picking up itself if the - * airgun unit was before the GPS unit since the airgun data unit is a subclass of GPSDataUnit. Should now get - * the correct GPS data. + * airgun unit was before the GPS unit since the airgun data unit is a subclass of GPSDataUnit. Should now get + * the correct GPS data. */ // newDataBlock = PamController.getInstance().getDataBlock(GpsDataUnit.class, 0); ArrayList gpsBlocks = PamController.getInstance().getDataBlocks(GpsDataUnit.class, false); @@ -149,7 +147,7 @@ public class AirgunProcess extends PamProcess { setParentDataBlock(aisDataBlock); } else { - + System.out.println("Unable to find AIS data block for airgun display"); } } @@ -158,10 +156,10 @@ public class AirgunProcess extends PamProcess { } } - + /** - * Called when view times change so that the display can update it's - * location based on the new time. + * Called when view times change so that the display can update it's + * location based on the new time. */ protected void newViewTime(){ if (airgunControl.airgunParameters.gunsReferencePosition == AirgunParameters.GUNS_THIS_VESSEL) { @@ -195,18 +193,18 @@ public class AirgunProcess extends PamProcess { @Override public void pamStart() { // TODO Auto-generated method stub - + } @Override public void pamStop() { // TODO Auto-generated method stub - + } /** - * Implementation of PositionReference. Will try to return a ref position - * for a given time. + * Implementation of PositionReference. Will try to return a ref position + * for a given time. * @param timeMillis * @return */ @@ -220,7 +218,7 @@ public class AirgunProcess extends PamProcess { if (airgunControl.airgunParameters.gunsReferencePosition == AirgunParameters.GUNS_FIXEDPOSITION){ return getFixedPosition(timeMillis); } - + return null; } @@ -237,9 +235,9 @@ public class AirgunProcess extends PamProcess { return null; } GpsData gpsData = gpsDataUnit.getGpsData(); - LatLong gunPos = gpsData.travelDistanceMeters(gpsData.getHeading() + 180, + LatLong gunPos = gpsData.travelDistanceMeters(gpsData.getHeading() + 180, airgunControl.airgunParameters.dimE); - gunPos = gunPos.travelDistanceMeters(gpsData.getHeading() + 90, + gunPos = gunPos.travelDistanceMeters(gpsData.getHeading() + 90, airgunControl.airgunParameters.dimF); GpsData gunGPS = gpsData.clone(); gunGPS.setLatitude(gunPos.getLatitude()); @@ -247,7 +245,7 @@ public class AirgunProcess extends PamProcess { return gunGPS; } - private GpsData getAISBasedPosition(long timeMillis) { + private GpsData getAISBasedPosition(long timeMillis) { if (aisDataBlock == null) { return null; } @@ -260,9 +258,9 @@ public class AirgunProcess extends PamProcess { return null; } LatLong gunPos = aisPositionReport.latLong; - gunPos = gunPos.travelDistanceMeters(aisPositionReport.courseOverGround + 180, + gunPos = gunPos.travelDistanceMeters(aisPositionReport.courseOverGround + 180, airgunControl.airgunParameters.dimE); - gunPos = gunPos.travelDistanceMeters(aisPositionReport.courseOverGround + 90, + gunPos = gunPos.travelDistanceMeters(aisPositionReport.courseOverGround + 90, airgunControl.airgunParameters.dimF); GpsData gunGPS = new GpsData(gunPos); gunGPS.setCourseOverGround(aisPositionReport.courseOverGround); diff --git a/src/Array/ArrayDialog.java b/src/Array/ArrayDialog.java index 4475d7bb..1f9ff43e 100644 --- a/src/Array/ArrayDialog.java +++ b/src/Array/ArrayDialog.java @@ -8,6 +8,7 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.util.ArrayList; + import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JFileChooser; @@ -16,6 +17,7 @@ import javax.swing.JPanel; import javax.swing.JSplitPane; import javax.swing.border.TitledBorder; import javax.swing.filechooser.FileFilter; + import Acquisition.AcquisitionControl; import Acquisition.AcquisitionParameters; import PamController.PamController; @@ -170,7 +172,7 @@ public class ArrayDialog extends PamDialog implements ActionListener { public boolean getParams() { // all OK, so // move the selected array to the top of the list in the ArrayManager - if (okOK(true) == false) return false; + if (!okOK(true)) return false; PamArray array = hydrophoneDialogPanel.getDialogSelectedArray(); ArrayManager.getArrayManager().setCurrentArray(array); @@ -179,7 +181,7 @@ public class ArrayDialog extends PamDialog implements ActionListener { hydrophoneDialogPanel.getParams(); instrumentIdentityPanel.getParams(array); - if (checkDaqChannels(array) == false) { + if (!checkDaqChannels(array)) { return false; } @@ -198,7 +200,7 @@ public class ArrayDialog extends PamDialog implements ActionListener { ArrayList daqControllers = AcquisitionControl.getControllers(); boolean allOk = true; for (int i = 0; i < daqControllers.size(); i++) { - if (checkDaqChannels(daqControllers.get(i), array) == false) { + if (!checkDaqChannels(daqControllers.get(i), array)) { allOk = false; } } @@ -238,7 +240,7 @@ public class ArrayDialog extends PamDialog implements ActionListener { } return false; } - else if (environmentPanel.getParams() == false) { + else if (!environmentPanel.getParams()) { return false; } @@ -274,6 +276,7 @@ public class ArrayDialog extends PamDialog implements ActionListener { deleteArrayButton.setEnabled(ArrayManager.getArrayManager().getArrayCount() > 1); } + @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == cancelButton) { this.setVisible(false); diff --git a/src/Array/ArrayManager.java b/src/Array/ArrayManager.java index 3fa7a21a..f1af49db 100644 --- a/src/Array/ArrayManager.java +++ b/src/Array/ArrayManager.java @@ -8,11 +8,9 @@ import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; + import javax.swing.JFrame; -import pamMaths.PamQuaternion; -import pamMaths.PamVector; -import userDisplay.UserDisplayControl; import Array.importHydrophoneData.HydrophoneImport; import Array.importHydrophoneData.StreamerImport; import Array.layoutFX.ArrayGUIFX; @@ -26,6 +24,7 @@ import PamController.PamControlledUnit; import PamController.PamControlledUnitGUI; import PamController.PamControlledUnitSettings; import PamController.PamController; +import PamController.PamControllerInterface; import PamController.PamGUIManager; import PamController.PamSettingManager; import PamController.PamSettings; @@ -40,6 +39,9 @@ import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamObserver; import dataPlotsFX.data.TDDataProviderRegisterFX; +import pamMaths.PamQuaternion; +import pamMaths.PamVector; +import userDisplay.UserDisplayControl; /** * Manager for different array configurations. Each array configuration is @@ -169,32 +171,33 @@ public class ArrayManager extends PamControlledUnit implements PamSettings, PamO } private boolean initComplete = false; + @Override public void notifyModelChanged(int changeType) { - if (changeType == PamController.INITIALIZATION_COMPLETE) { + if (changeType == PamControllerInterface.INITIALIZATION_COMPLETE) { initComplete = true; } getCurrentArray().notifyModelChanged(changeType, initComplete); - if (changeType == PamController.INITIALIZATION_COMPLETE) { + if (changeType == PamControllerInterface.INITIALIZATION_COMPLETE) { // create data units and save - is this needed in the viewer ? // if (PamController.getInstance().getRunMode() == PamController.RUN_NORMAL) { hydrophonesProcess.createArrayData(); // } } - if (changeType == PamController.OFFLINE_DATA_LOADED){ + if (changeType == PamControllerInterface.OFFLINE_DATA_LOADED){ if (isViewer) { getHydrophoneDataBlock().clearChannelIterators(); } } - if (changeType == PamController.HYDROPHONE_ARRAY_CHANGED){ + if (changeType == PamControllerInterface.HYDROPHONE_ARRAY_CHANGED){ if (isViewer) { getHydrophoneDataBlock().clearChannelIterators(); } } - if (changeType == PamController.GLOBAL_MEDIUM_UPDATE){ + if (changeType == PamControllerInterface.GLOBAL_MEDIUM_UPDATE){ this.getCurrentArray().setSpeedOfSound(this.getPamController().getGlobalMediumManager().getDefaultSoundSpeed()); this.getCurrentArray().setDefaultSensitivity(this.getPamController().getGlobalMediumManager().getDefaultRecieverSens()); } @@ -229,7 +232,7 @@ public class ArrayManager extends PamControlledUnit implements PamSettings, PamO if (selectedArray != null) { hydrophonesProcess.createArrayData(); // need to tell all modules that the array may have changed. - PamController.getInstance().notifyModelChanged(PamController.HYDROPHONE_ARRAY_CHANGED); + PamController.getInstance().notifyModelChanged(PamControllerInterface.HYDROPHONE_ARRAY_CHANGED); } } @@ -257,6 +260,7 @@ public class ArrayManager extends PamControlledUnit implements PamSettings, PamO /* (non-Javadoc) * @see PamController.PamSettings#GetSettingsReference() */ + @Override public Serializable getSettingsReference() { /* * Save the entire array classes in the serialised file @@ -275,6 +279,7 @@ public class ArrayManager extends PamControlledUnit implements PamSettings, PamO /* (non-Javadoc) * @see PamController.PamSettings#GetSettingsVersion() */ + @Override public long getSettingsVersion() { return ArrayParameters.serialVersionUID; } @@ -282,6 +287,7 @@ public class ArrayManager extends PamControlledUnit implements PamSettings, PamO /* (non-Javadoc) * @see PamController.PamSettings#GetUnitName() */ + @Override public String getUnitName() { return "Array Manager"; } @@ -289,6 +295,7 @@ public class ArrayManager extends PamControlledUnit implements PamSettings, PamO /* (non-Javadoc) * @see PamController.PamSettings#getUnitType() */ + @Override public String getUnitType() { return "Array Manager"; } @@ -296,6 +303,7 @@ public class ArrayManager extends PamControlledUnit implements PamSettings, PamO /* (non-Javadoc) * @see PamController.PamSettings#RestoreSettings(PamController.PamControlledUnitSettings) */ + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { try { if (pamControlledUnitSettings.getSettings() != null) { @@ -385,23 +393,28 @@ public class ArrayManager extends PamControlledUnit implements PamSettings, PamO // } // } + @Override public String getObserverName() { return "Array Manager"; } + @Override public long getRequiredDataHistory(PamObservable o, Object arg) { // would be better to work out how long the Gps data are being kept for and do the same return 3600*1000; } + @Override public void noteNewSettings() { } + @Override public void removeObservable(PamObservable o) { } + @Override public void setSampleRate(float sampleRate, boolean notify) { // TODO Auto-generated method stub @@ -659,10 +672,10 @@ public class ArrayManager extends PamControlledUnit implements PamSettings, PamO } // need to find the direction vector for the plane. // can do this by finding any non zero vector product. - PamVector planePerpendicular = null;; + PamVector planePerpendicular = null; for (int i = 0; i < nPairs; i++) { for (int j = (i+1); j < nPairs; j++) { - if (vectorPairs[i].isParallel(vectorPairs[j]) == false) { + if (!vectorPairs[i].isParallel(vectorPairs[j])) { planePerpendicular = vectorPairs[i].vecProd(vectorPairs[j]); break; } @@ -771,7 +784,7 @@ public class ArrayManager extends PamControlledUnit implements PamSettings, PamO int nPairs = pvs.length; for (int i = 0; i < nPairs; i++) { for (int j = i+1; j < nPairs; j++) { - if (pvs[i].isInLine(pvs[j]) == false) { + if (!pvs[i].isInLine(pvs[j])) { return false; } } diff --git a/src/Array/ArrayParameters.java b/src/Array/ArrayParameters.java index 3a35ec99..898239f4 100644 --- a/src/Array/ArrayParameters.java +++ b/src/Array/ArrayParameters.java @@ -1,7 +1,6 @@ package Array; import java.io.Serializable; -import java.lang.reflect.Modifier; import java.util.ArrayList; import PamModel.parametermanager.ManagedParameters; diff --git a/src/Array/ArraySidePanelControl.java b/src/Array/ArraySidePanelControl.java index 9ae5da59..0c50f5e4 100644 --- a/src/Array/ArraySidePanelControl.java +++ b/src/Array/ArraySidePanelControl.java @@ -9,7 +9,7 @@ import Array.sensors.swing.ArrayDisplayParamsDialog; import Array.swing.sidepanel.ArraySidePanel; import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; -import PamController.PamController; +import PamController.PamControllerInterface; import PamController.PamSettingManager; import PamController.PamSettings; import PamUtils.PamCalendar; @@ -45,13 +45,13 @@ public class ArraySidePanelControl extends PamControlledUnit implements ArrayDis public void notifyModelChanged(int changeType) { super.notifyModelChanged(changeType); switch (changeType) { - case PamController.INITIALIZATION_COMPLETE: - case PamController.HYDROPHONE_ARRAY_CHANGED: + case PamControllerInterface.INITIALIZATION_COMPLETE: + case PamControllerInterface.HYDROPHONE_ARRAY_CHANGED: if (arraySidePanel != null) { arraySidePanel.update(); } break; - case PamController.NEW_SCROLL_TIME: + case PamControllerInterface.NEW_SCROLL_TIME: if (isViewer()) { arraySidePanel.updateViewerTime(PamCalendar.getTimeInMillis()); } diff --git a/src/Array/ChannelPanel.java b/src/Array/ChannelPanel.java index 5169676c..d5e590af 100644 --- a/src/Array/ChannelPanel.java +++ b/src/Array/ChannelPanel.java @@ -59,6 +59,7 @@ public class ChannelPanel implements ActionListener, ListSelectionListener { channelTableData.fireTableDataChanged(); } + @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == daqControllerList) { selectDaqController(); @@ -167,10 +168,12 @@ public class ChannelPanel implements ActionListener, ListSelectionListener { class ChannelTableData extends AbstractTableModel { + @Override public int getColumnCount() { return channelColumns.length; } + @Override public int getRowCount() { if (acquisitionControl == null) return 0; return (acquisitionControl.acquisitionParameters.nChannels); @@ -181,6 +184,7 @@ public class ChannelPanel implements ActionListener, ListSelectionListener { return channelColumns[column]; } + @Override public Object getValueAt(int rowIndex, int columnIndex) { if (acquisitionControl == null) return null; // see if the controller has a hydrophone list @@ -247,6 +251,7 @@ public class ChannelPanel implements ActionListener, ListSelectionListener { /* (non-Javadoc) * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent) */ + @Override public void valueChanged(ListSelectionEvent e) { enableButtons(); } diff --git a/src/Array/EmptyLocatorSettings.java b/src/Array/EmptyLocatorSettings.java index 9883072b..94938e22 100644 --- a/src/Array/EmptyLocatorSettings.java +++ b/src/Array/EmptyLocatorSettings.java @@ -1,7 +1,5 @@ package Array; -import GPS.GpsData; - public class EmptyLocatorSettings extends LocatorSettings { public EmptyLocatorSettings(Class locatorClass) { diff --git a/src/Array/Hydrophone.java b/src/Array/Hydrophone.java index be3b11f8..a89b6f28 100644 --- a/src/Array/Hydrophone.java +++ b/src/Array/Hydrophone.java @@ -30,9 +30,9 @@ import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet.ParameterSetType; import PamModel.parametermanager.PrivatePamParameterData; -import pamMaths.PamVector; import PamView.PamSymbol; import PamView.PamSymbolType; +import pamMaths.PamVector; /** * diff --git a/src/Array/HydrophoneDataBlock.java b/src/Array/HydrophoneDataBlock.java index a5c17785..e9d26111 100644 --- a/src/Array/HydrophoneDataBlock.java +++ b/src/Array/HydrophoneDataBlock.java @@ -3,12 +3,11 @@ package Array; import java.util.ListIterator; import GPS.NavDataSynchronisation; -import pamScrollSystem.ViewLoadObserver; import PamController.PamController; -import PamUtils.PamCalendar; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.dataOffline.OfflineDataLoadInfo; +import pamScrollSystem.ViewLoadObserver; public class HydrophoneDataBlock extends PamDataBlock { @@ -104,7 +103,7 @@ public class HydrophoneDataBlock extends PamDataBlock { long difference; ListIterator listIterator = getListIterator(ITERATOR_END); - if (listIterator.hasPrevious() == false) { + if (!listIterator.hasPrevious()) { return null; } unit = listIterator.previous(); diff --git a/src/Array/HydrophoneDiagram.java b/src/Array/HydrophoneDiagram.java index 63057ab7..09c7bcb9 100644 --- a/src/Array/HydrophoneDiagram.java +++ b/src/Array/HydrophoneDiagram.java @@ -9,17 +9,19 @@ import java.awt.Point; import java.awt.event.MouseEvent; import java.awt.geom.Rectangle2D; import java.util.Arrays; + import javax.swing.JPanel; import javax.swing.border.TitledBorder; + import Acquisition.AcquisitionControl; import GPS.GpsData; import Layout.PamAxis; import Layout.PamAxisPanel; import PamController.PamController; import PamUtils.LatLong; +import PamView.PamColors.PamColor; import PamView.PamSymbol; import PamView.PamSymbolType; -import PamView.PamColors.PamColor; import PamView.panel.PamBorder; import pamMaths.PamVector; diff --git a/src/Array/HydrophoneDialogPanel.java b/src/Array/HydrophoneDialogPanel.java index d55dedc8..2f4041b7 100644 --- a/src/Array/HydrophoneDialogPanel.java +++ b/src/Array/HydrophoneDialogPanel.java @@ -25,8 +25,6 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.table.AbstractTableModel; - - import Array.streamerOrigin.HydrophoneOriginMethod; import PamController.PamController; @@ -219,6 +217,7 @@ public class HydrophoneDialogPanel implements ActionListener, ListSelectionListe hydrophoneTableData.fireTableDataChanged(); } + @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == recentArrays) { arrayDialog.newArraySelection(); @@ -573,7 +572,7 @@ public class HydrophoneDialogPanel implements ActionListener, ListSelectionListe /** * and the hydrophones ... */ - if (phonesToo == false) { + if (!phonesToo) { return; } int nPhones = currentArray.getHydrophoneCount(); @@ -694,11 +693,13 @@ public class HydrophoneDialogPanel implements ActionListener, ListSelectionListe class HydrophoneTableData extends AbstractTableModel { + @Override public int getColumnCount() { return hydrophoneColumns.length; } + @Override public int getRowCount() { PamArray currentArray = getDialogSelectedArray(); if (currentArray == null) return 0; @@ -710,6 +711,7 @@ public class HydrophoneDialogPanel implements ActionListener, ListSelectionListe return hydrophoneColumns[column]; } + @Override public Object getValueAt(int rowIndex, int columnIndex) { PamArray array = getDialogSelectedArray(); Hydrophone hydrophone = array.getHydrophone(rowIndex); @@ -750,6 +752,7 @@ public class HydrophoneDialogPanel implements ActionListener, ListSelectionListe /* (non-Javadoc) * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent) */ + @Override public void valueChanged(ListSelectionEvent e) { enableButtons(); } diff --git a/src/Array/HydrophoneElementDialog.java b/src/Array/HydrophoneElementDialog.java index 76eabacd..c308628e 100644 --- a/src/Array/HydrophoneElementDialog.java +++ b/src/Array/HydrophoneElementDialog.java @@ -110,8 +110,8 @@ public class HydrophoneElementDialog extends PamDialog { @Override public boolean getParams() { - if (generalPanel.getParams() == false) return false; - if (coordinatePanel.getParams() == false) return false; + if (!generalPanel.getParams()) return false; + if (!coordinatePanel.getParams()) return false; // if (sensitivityPanel.getParams() == false) return false; int hi = interpolationDialogPanel.getSelection(); if (hi >= 0) { @@ -158,7 +158,7 @@ public class HydrophoneElementDialog extends PamDialog { constraints.gridwidth = 1; constraints.gridx = 0; constraints.gridy++; - addComponent(this, recieverTypeLabel = new JLabel("", JLabel.RIGHT), constraints); + addComponent(this, recieverTypeLabel = new JLabel("", SwingConstants.RIGHT), constraints); constraints.gridx++; constraints.gridwidth = 2; addComponent(this, type = new JTextField(12), constraints); @@ -169,7 +169,7 @@ public class HydrophoneElementDialog extends PamDialog { constraints.gridx = 0; constraints.gridy++; constraints.anchor = GridBagConstraints.EAST; - addComponent(this, recieverSensLabel = new JLabel("", JLabel.RIGHT), constraints); + addComponent(this, recieverSensLabel = new JLabel("", SwingConstants.RIGHT), constraints); constraints.gridx++; constraints.anchor = GridBagConstraints.WEST; addComponent(this, hSens = new JTextField(5), constraints); @@ -181,7 +181,7 @@ public class HydrophoneElementDialog extends PamDialog { constraints.gridx = 0; constraints.gridy++; constraints.anchor = GridBagConstraints.EAST; - addComponent(this, new JLabel("Preamplifier gain ", JLabel.RIGHT), constraints); + addComponent(this, new JLabel("Preamplifier gain ", SwingConstants.RIGHT), constraints); constraints.gridx++; constraints.anchor = GridBagConstraints.WEST; addComponent(this, preampGain = new JTextField(5), constraints); @@ -380,7 +380,7 @@ public class HydrophoneElementDialog extends PamDialog { double zCoeff = PamController.getInstance().getGlobalMediumManager().getZCoeff(); setRecieverLabelText(); - if (newHydrophone == false) { + if (!newHydrophone) { x.setText(formatDouble(hydrophone.getX())); y.setText(formatDouble(hydrophone.getY())); depth.setText(formatDouble(zCoeff*hydrophone.getZ())); diff --git a/src/Array/HydrophoneLocator.java b/src/Array/HydrophoneLocator.java index 5d6c9d7c..eef0a9c5 100644 --- a/src/Array/HydrophoneLocator.java +++ b/src/Array/HydrophoneLocator.java @@ -3,14 +3,12 @@ package Array; import java.io.Serializable; import java.lang.reflect.Field; -import Array.streamerOrigin.StreamerDataIterator; import GPS.GpsData; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet.ParameterSetType; import PamModel.parametermanager.PrivatePamParameterData; import PamUtils.LatLong; -import PamguardMVC.PamDataBlock; import pamMaths.PamQuaternion; import pamMaths.PamVector; diff --git a/src/Array/HydrophoneLocators.java b/src/Array/HydrophoneLocators.java index dacb495a..549d02e8 100644 --- a/src/Array/HydrophoneLocators.java +++ b/src/Array/HydrophoneLocators.java @@ -3,7 +3,6 @@ package Array; import java.util.ArrayList; import PamController.PamController; -import PamController.PamguardVersionInfo; public class HydrophoneLocators { diff --git a/src/Array/HydrophoneProcess.java b/src/Array/HydrophoneProcess.java index 6c5c9f68..5c5acbde 100644 --- a/src/Array/HydrophoneProcess.java +++ b/src/Array/HydrophoneProcess.java @@ -1,11 +1,10 @@ package Array; -import pamScrollSystem.AbstractScrollManager; import PamUtils.PamCalendar; import PamView.symbol.StandardSymbolManager; -import PamguardMVC.PamConstants; import PamguardMVC.PamDataBlock; import PamguardMVC.PamProcess; +import pamScrollSystem.AbstractScrollManager; public class HydrophoneProcess extends PamProcess{ diff --git a/src/Array/HydrophoneSQLLogging.java b/src/Array/HydrophoneSQLLogging.java index ba3d0b86..a72d511a 100644 --- a/src/Array/HydrophoneSQLLogging.java +++ b/src/Array/HydrophoneSQLLogging.java @@ -1,9 +1,9 @@ package Array; -import generalDatabase.SQLLogging; -import generalDatabase.SQLTypes; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; +import generalDatabase.SQLLogging; +import generalDatabase.SQLTypes; public class HydrophoneSQLLogging extends SQLLogging { diff --git a/src/Array/InstrumentIdentityPanel.java b/src/Array/InstrumentIdentityPanel.java index b8f21137..015f467b 100644 --- a/src/Array/InstrumentIdentityPanel.java +++ b/src/Array/InstrumentIdentityPanel.java @@ -7,6 +7,7 @@ import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; import PamView.dialog.PamGridBagContraints; @@ -30,12 +31,12 @@ public class InstrumentIdentityPanel { mainPanel.setBorder(new TitledBorder("Instrument information")); mainPanel.setLayout(new GridBagLayout()); GridBagConstraints c = new PamGridBagContraints(); - mainPanel.add(new JLabel("Instrument Type ", JLabel.RIGHT), c); + mainPanel.add(new JLabel("Instrument Type ", SwingConstants.RIGHT), c); c.gridx++; mainPanel.add(instrumentType = new JTextField(20), c); c.gridx = 0; c.gridy++; - mainPanel.add(new JLabel("Instrument Id ", JLabel.RIGHT), c); + mainPanel.add(new JLabel("Instrument Id ", SwingConstants.RIGHT), c); c.gridx++; mainPanel.add(instrumentId = new JTextField(20), c); diff --git a/src/Array/MasterLocator.java b/src/Array/MasterLocator.java index 33e9bb02..e0c1bab2 100644 --- a/src/Array/MasterLocator.java +++ b/src/Array/MasterLocator.java @@ -2,23 +2,12 @@ package Array; import java.io.Serializable; import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Arrays; -import Array.streamerOrigin.OriginSettings; -import GPS.GPSControl; import GPS.GpsData; -import GPS.GpsDataUnit; -import PamController.PamController; -import PamController.PamSettingsSource; -import PamController.SettingsObject; -import PamController.masterReference.MasterReferencePoint; +import PamController.PamControllerInterface; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PrivatePamParameterData; -import PamUtils.LatLong; -import PamUtils.PamCalendar; -import PamguardMVC.PamDataBlock; /** * Master PAMGuard array localiser. There is now one of these and @@ -192,8 +181,8 @@ public class MasterLocator extends HydrophoneLocator implements Serializable, Cl // streamerLocators[i].notifyModelChanged(changeType); // } if (initComplete) switch (changeType) { - case PamController.HYDROPHONE_ARRAY_CHANGED: - case PamController.INITIALIZATION_COMPLETE: + case PamControllerInterface.HYDROPHONE_ARRAY_CHANGED: + case PamControllerInterface.INITIALIZATION_COMPLETE: setupLocators(ArrayManager.getArrayManager().getCurrentArray()); } } @@ -238,7 +227,7 @@ public class MasterLocator extends HydrophoneLocator implements Serializable, Cl boolean isStat = true; for (int i = 0; i < n; i++) { Streamer streamer = pamArray.getStreamer(i); - if (streamer.getHydrophoneLocator().isStatic() == false) { + if (!streamer.getHydrophoneLocator().isStatic()) { isStat = false; } } diff --git a/src/Array/MovingHydrophoneLocator.java b/src/Array/MovingHydrophoneLocator.java index faf88005..61d9a388 100644 --- a/src/Array/MovingHydrophoneLocator.java +++ b/src/Array/MovingHydrophoneLocator.java @@ -1,10 +1,5 @@ package Array; -import GPS.GpsData; -import GPS.GpsDataUnit; -import PamUtils.LatLong; -import PamguardMVC.PamDataBlock; - abstract public class MovingHydrophoneLocator extends SimpleHydrophoneLocator { /** diff --git a/src/Array/PamArray.java b/src/Array/PamArray.java index 8bc8fd8d..0f6e6103 100644 --- a/src/Array/PamArray.java +++ b/src/Array/PamArray.java @@ -23,27 +23,21 @@ package Array; import java.io.Serializable; import java.lang.reflect.Field; -import java.lang.reflect.Modifier; import java.util.ArrayList; import java.util.Arrays; import Acquisition.AcquisitionControl; -import pamMaths.PamVector; -import Array.streamerOrigin.HydrophoneOriginMethod; import Array.streamerOrigin.OriginSettings; -import Array.streamerOrigin.StreamerDataIterator; -import GPS.GpsData; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet.ParameterSetType; import PamModel.parametermanager.PrivatePamParameterData; -import PamUtils.LatLong; import PamUtils.PamArrayUtils; -import PamUtils.PamCalendar; import PamView.PamSymbol; import PamguardMVC.ChannelIterator; import PamguardMVC.PamConstants; import PamguardMVC.PamDataBlock; +import pamMaths.PamVector; /** * @@ -1281,7 +1275,7 @@ public class PamArray implements Serializable, Cloneable, ManagedParameters { return preceeding.getStreamerData(); } // otherwise, we also want the next one ... - if (streamerIterator.hasNext() == false) { + if (!streamerIterator.hasNext()) { return preceeding.getStreamerData(); } nextUnit = streamerIterator.next(); @@ -1293,7 +1287,7 @@ public class PamArray implements Serializable, Cloneable, ManagedParameters { double w1 = nextUnit.getTimeMilliseconds()-timeMilliseconds; double w2 = timeMilliseconds-preceeding.getTimeMilliseconds(); double wTot = w1+w2; - if (wTot == 0 || Double.isFinite(wTot) == false) { + if (wTot == 0 || !Double.isFinite(wTot)) { w1 = w2 = 0.5; } else { diff --git a/src/Array/Preamplifier.java b/src/Array/Preamplifier.java index 20a7dc18..6233d529 100644 --- a/src/Array/Preamplifier.java +++ b/src/Array/Preamplifier.java @@ -73,7 +73,7 @@ public class Preamplifier implements Serializable, Cloneable, ManagedParameters return (Preamplifier) super.clone(); } catch (CloneNotSupportedException Ex) { - Ex.printStackTrace();; + Ex.printStackTrace(); return null; } } diff --git a/src/Array/SimpleHydrophoneLocator.java b/src/Array/SimpleHydrophoneLocator.java index c61e1188..c855be6b 100644 --- a/src/Array/SimpleHydrophoneLocator.java +++ b/src/Array/SimpleHydrophoneLocator.java @@ -2,11 +2,6 @@ package Array; import java.util.ArrayList; -import javax.vecmath.Point3d; -import javax.vecmath.Point3f; - -import GPS.GpsData; - import pamMaths.PamVector; /** diff --git a/src/Array/StraightHydrophoneLocator.java b/src/Array/StraightHydrophoneLocator.java index 0e2b29ce..394f19da 100644 --- a/src/Array/StraightHydrophoneLocator.java +++ b/src/Array/StraightHydrophoneLocator.java @@ -1,21 +1,13 @@ package Array; import java.lang.reflect.Field; -import java.util.ListIterator; -import depthReadout.DepthControl; -import depthReadout.DepthDataBlock; -import depthReadout.DepthDataUnit; -import Array.streamerOrigin.HydrophoneOriginMethod; import GPS.GpsData; import GPS.GpsDataUnit; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PrivatePamParameterData; -import PamUtils.LatLong; -import PamUtils.PamUtils; import PamguardMVC.PamDataBlock; -import PamguardMVC.PamObservable; /** * Straight Hydrophone Locator, uses GPS heading information from diff --git a/src/Array/Streamer.java b/src/Array/Streamer.java index f7fad355..49e79059 100644 --- a/src/Array/Streamer.java +++ b/src/Array/Streamer.java @@ -13,7 +13,7 @@ import Array.streamerOrigin.GPSOriginSettings; import Array.streamerOrigin.HydrophoneOriginMethod; import Array.streamerOrigin.HydrophoneOriginMethods; import Array.streamerOrigin.OriginSettings; -import PamController.PamController; +import PamController.PamControllerInterface; import PamController.masterReference.MasterReferencePoint; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; @@ -560,7 +560,7 @@ public class Streamer implements Serializable, Cloneable, ManagedParameters { hydrophoneOrigin.prepare(); } switch (changeType) { - case PamController.INITIALIZATION_COMPLETE: + case PamControllerInterface.INITIALIZATION_COMPLETE: // if (PamController.getInstance().getRunMode() == PamController.RUN_NORMAL) { // makeStreamerDataUnit(); // } @@ -886,7 +886,7 @@ public class Streamer implements Serializable, Cloneable, ManagedParameters { break; case HEIGHT: if (value != null) { - setZ(value);; + setZ(value); } break; case PITCH: diff --git a/src/Array/StreamerDataBlock.java b/src/Array/StreamerDataBlock.java index 49a7c412..f749f888 100644 --- a/src/Array/StreamerDataBlock.java +++ b/src/Array/StreamerDataBlock.java @@ -94,6 +94,7 @@ public class StreamerDataBlock extends PamDataBlock{ } } + @Override public boolean loadViewerData(OfflineDataLoadInfo offlineDataLoadInfo, ViewLoadObserver loadObserver) { return super.loadViewerData(offlineDataLoadInfo, loadObserver); } diff --git a/src/Array/StreamerDataUnit.java b/src/Array/StreamerDataUnit.java index 9c63f37c..d87549c2 100644 --- a/src/Array/StreamerDataUnit.java +++ b/src/Array/StreamerDataUnit.java @@ -2,9 +2,7 @@ package Array; import Array.sensors.ArrayParameterType; import Array.sensors.ArraySensorFieldType; -import Array.streamerOrigin.HydrophoneOriginMethod; import Array.streamerOrigin.OriginSettings; -import Array.streamerOrigin.StaticOriginMethod; import Array.streamerOrigin.StaticOriginSettings; import GPS.GpsData; import GPS.GpsDataUnit; diff --git a/src/Array/StreamerDialog.java b/src/Array/StreamerDialog.java index 52bea18c..97fb00c4 100644 --- a/src/Array/StreamerDialog.java +++ b/src/Array/StreamerDialog.java @@ -7,16 +7,15 @@ import java.awt.Insets; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.ListIterator; import javax.swing.BoxLayout; -import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JSeparator; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; @@ -123,7 +122,7 @@ public class StreamerDialog extends PamDialog { addComponent(p, new JLabel("Error"), c); c.gridx = 0; c.gridy ++; - addComponent(p, new JLabel("x ", JLabel.RIGHT), c); + addComponent(p, new JLabel("x ", SwingConstants.RIGHT), c); c.gridx++; addComponent(p, x = new JTextField(textLength), c); c.gridx++; @@ -133,7 +132,7 @@ public class StreamerDialog extends PamDialog { c.gridx = 0; c.gridy ++; - addComponent(p, new JLabel("y ", JLabel.RIGHT), c); + addComponent(p, new JLabel("y ", SwingConstants.RIGHT), c); c.gridx++; addComponent(p, y = new JTextField(textLength), c); c.gridx++; @@ -143,7 +142,7 @@ public class StreamerDialog extends PamDialog { c.gridx = 0; c.gridy ++; - addComponent(p, streamerHeightLabel = new JLabel(" ", JLabel.RIGHT), c); // set in setStreamerLabels + addComponent(p, streamerHeightLabel = new JLabel(" ", SwingConstants.RIGHT), c); // set in setStreamerLabels c.gridx++; addComponent(p, z = new JTextField(textLength), c); c.gridx++; @@ -196,29 +195,29 @@ public class StreamerDialog extends PamDialog { String degsLab = LatLong.deg + " "; c.gridx = 0; c.gridy++; - addComponent(headPanel, new JLabel("Heading ", JLabel.RIGHT), c); + addComponent(headPanel, new JLabel("Heading ", SwingConstants.RIGHT), c); c.gridx++; addComponent(headPanel, heading = new JTextField(orWidth), c); c.gridx++; - addComponent(headPanel, new JLabel(degsLab, JLabel.LEFT), c); + addComponent(headPanel, new JLabel(degsLab, SwingConstants.LEFT), c); c.gridx++; addComponent(headPanel, sensorComponents[ArraySensorFieldType.HEADING.ordinal()].getComponent(), c); c.gridx = 0; c.gridy++; - addComponent(headPanel, new JLabel("Pitch ", JLabel.RIGHT), c); + addComponent(headPanel, new JLabel("Pitch ", SwingConstants.RIGHT), c); c.gridx++; addComponent(headPanel, pitch = new JTextField(orWidth), c); c.gridx++; - addComponent(headPanel, new JLabel(degsLab, JLabel.LEFT), c); + addComponent(headPanel, new JLabel(degsLab, SwingConstants.LEFT), c); c.gridx++; addComponent(headPanel, sensorComponents[ArraySensorFieldType.PITCH.ordinal()].getComponent(), c); c.gridx = 0; c.gridy++; - addComponent(headPanel, new JLabel("Roll ", JLabel.RIGHT), c); + addComponent(headPanel, new JLabel("Roll ", SwingConstants.RIGHT), c); c.gridx++; addComponent(headPanel, roll = new JTextField(orWidth), c); c.gridx++; - addComponent(headPanel, new JLabel(degsLab, JLabel.LEFT), c); + addComponent(headPanel, new JLabel(degsLab, SwingConstants.LEFT), c); c.gridx++; addComponent(headPanel, sensorComponents[ArraySensorFieldType.ROLL.ordinal()].getComponent(), c); @@ -240,7 +239,7 @@ public class StreamerDialog extends PamDialog { locPanel.setLayout(new BorderLayout()); locPanel.setBorder(locateRecieverBorder = new TitledBorder("")); //set by steStreamerLabels locPanel.add(BorderLayout.WEST, relPanel); - locPanel.add(BorderLayout.CENTER, new JSeparator(JSeparator.VERTICAL)); + locPanel.add(BorderLayout.CENTER, new JSeparator(SwingConstants.VERTICAL)); locPanel.add(BorderLayout.EAST, headPanel); getMainPanel().add(locPanel); getMainPanel().add(interpolationPanel.getComponent(getOwner())); @@ -403,7 +402,7 @@ public class StreamerDialog extends PamDialog { } OriginDialogComponent mthDialogComponent = currentOriginMethod.getDialogComponent(); if (mthDialogComponent != null) { - if (mthDialogComponent.getParams() == false) { + if (!mthDialogComponent.getParams()) { return false; } } @@ -517,7 +516,7 @@ public class StreamerDialog extends PamDialog { } public void newOriginMethod() { - if (constructed == false) { + if (!constructed) { return; } int methInd = originMethod.getSelectedIndex(); diff --git a/src/Array/StreamerLogging.java b/src/Array/StreamerLogging.java index 7337fa1b..1f5b27d4 100644 --- a/src/Array/StreamerLogging.java +++ b/src/Array/StreamerLogging.java @@ -1,6 +1,5 @@ package Array; -import java.sql.Connection; import java.sql.Types; import Array.sensors.ArrayParameterType; @@ -8,11 +7,6 @@ import Array.sensors.ArraySensorFieldType; import Array.streamerOrigin.HydrophoneOriginMethod; import Array.streamerOrigin.HydrophoneOriginMethods; import Array.streamerOrigin.HydrophoneOriginSystem; -import Array.streamerOrigin.OriginSettings; -import Array.streamerOrigin.StaticOriginSettings; -import GPS.GPSDataBlock; -import GPS.GpsData; -import GPS.GpsDataUnit; import PamUtils.PamCalendar; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; diff --git a/src/Array/StreamerOverlayGraphics.java b/src/Array/StreamerOverlayGraphics.java index f27772ce..6a5499f6 100644 --- a/src/Array/StreamerOverlayGraphics.java +++ b/src/Array/StreamerOverlayGraphics.java @@ -5,18 +5,16 @@ import java.awt.Graphics; import java.awt.Rectangle; import java.awt.Window; -import Array.streamerOrigin.HydrophoneOriginMethod; import GPS.GpsData; -import GPS.GpsDataUnit; import PamUtils.Coordinate3d; import PamUtils.PamCalendar; import PamView.GeneralProjector; +import PamView.GeneralProjector.ParameterType; +import PamView.GeneralProjector.ParameterUnits; import PamView.PamKeyItem; import PamView.PamSymbol; import PamView.PamSymbolType; import PamView.PanelOverlayDraw; -import PamView.GeneralProjector.ParameterType; -import PamView.GeneralProjector.ParameterUnits; import PamView.symbol.SymbolData; import PamguardMVC.PamDataUnit; diff --git a/src/Array/ThreadingHydrophoneLocator.java b/src/Array/ThreadingHydrophoneLocator.java index f372306c..99f12144 100644 --- a/src/Array/ThreadingHydrophoneLocator.java +++ b/src/Array/ThreadingHydrophoneLocator.java @@ -1,15 +1,10 @@ package Array; import java.lang.reflect.Field; -import java.util.ListIterator; -import pamMaths.PamVector; -import Array.sensors.StreamerSensorManager; + import Array.streamerOrigin.HydrophoneOriginMethod; import Array.streamerOrigin.OriginIterator; -import GPS.GPSControl; -import GPS.GPSDataBlock; import GPS.GpsData; -import GPS.GpsDataUnit; import GPS.NavDataSynchronisation; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; @@ -92,7 +87,7 @@ public class ThreadingHydrophoneLocator extends StraightHydrophoneLocator implem */ gpsUnit = gpsIt.previous(); } - if (gpsIt.hasPrevious() == false) { + if (!gpsIt.hasPrevious()) { /** * We're off the start of the available track, so can do nothing except use the stright model to * interpolate backwards. diff --git a/src/ArrayAccelerometer/ArrayAccelControl.java b/src/ArrayAccelerometer/ArrayAccelControl.java index 94d3ecdf..d972afe6 100644 --- a/src/ArrayAccelerometer/ArrayAccelControl.java +++ b/src/ArrayAccelerometer/ArrayAccelControl.java @@ -7,13 +7,13 @@ import java.io.Serializable; import javax.swing.JMenuItem; -import mcc.MccJniInterface; import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; import PamController.PamSettingManager; import PamController.PamSettings; import PamView.PamSidePanel; import PamView.dialog.warn.WarnOnce; +import mcc.MccJniInterface; public class ArrayAccelControl extends PamControlledUnit implements PamSettings { diff --git a/src/ArrayAccelerometer/ArrayAccelDataUnit.java b/src/ArrayAccelerometer/ArrayAccelDataUnit.java index 3104f810..5da61c17 100644 --- a/src/ArrayAccelerometer/ArrayAccelDataUnit.java +++ b/src/ArrayAccelerometer/ArrayAccelDataUnit.java @@ -1,10 +1,10 @@ package ArrayAccelerometer; -import pamMaths.PamVector; import Array.sensors.ArraySensorDataUnit; import Array.sensors.ArraySensorFieldType; import PamUtils.PamUtils; import PamguardMVC.PamDataUnit; +import pamMaths.PamVector; public class ArrayAccelDataUnit extends PamDataUnit implements ArraySensorDataUnit { diff --git a/src/ArrayAccelerometer/ArrayAccelDialog.java b/src/ArrayAccelerometer/ArrayAccelDialog.java index ebde0ddd..ed2d3ed5 100644 --- a/src/ArrayAccelerometer/ArrayAccelDialog.java +++ b/src/ArrayAccelerometer/ArrayAccelDialog.java @@ -9,18 +9,18 @@ import java.awt.event.ActionListener; import javax.swing.BoxLayout; import javax.swing.JButton; -import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; +import PamView.dialog.PamDialog; +import PamView.dialog.PamGridBagContraints; import mcc.MccJniInterface; import mcc.MccPanel; import mcc.mccjna.MCCException; import mcc.mccjna.MCCUtils; -import PamView.dialog.PamDialog; -import PamView.dialog.PamGridBagContraints; public class ArrayAccelDialog extends PamDialog { @@ -52,17 +52,17 @@ public class ArrayAccelDialog extends PamDialog { JPanel rPanel = new JPanel(new GridBagLayout()); rPanel.setBorder(new TitledBorder("Readout")); GridBagConstraints c = new PamGridBagContraints(); - rPanel.add(new JLabel("Read interval ", JLabel.RIGHT), c); + rPanel.add(new JLabel("Read interval ", SwingConstants.RIGHT), c); c.gridx++; rPanel.add(readInterval = new JTextField(5), c); readInterval.setToolTipText("Readout interval in seconds"); c.gridx++; - rPanel.add(new JLabel(" s", JLabel.LEFT), c); + rPanel.add(new JLabel(" s", SwingConstants.LEFT), c); for (int i = 0; i < ArrayAccelParams.NDIMENSIONS; i++) { c.gridx = 0; c.gridy++; c.fill = GridBagConstraints.HORIZONTAL; - rPanel.add(new JLabel("Channel " + ArrayAccelParams.DIMENSIONNAME[i] + " ", JLabel.RIGHT), c); + rPanel.add(new JLabel("Channel " + ArrayAccelParams.DIMENSIONNAME[i] + " ", SwingConstants.RIGHT), c); c.gridx++; c.fill = GridBagConstraints.NONE; rPanel.add(dimChannel[i] = new JTextField(3), c); @@ -75,23 +75,23 @@ public class ArrayAccelDialog extends PamDialog { calPanel.setBorder(new TitledBorder("Calibration")); c = new PamGridBagContraints(); c.gridx = 1; - calPanel.add(new JLabel("Zero", JLabel.CENTER), c); + calPanel.add(new JLabel("Zero", SwingConstants.CENTER), c); c.gridx += 2; - calPanel.add(new JLabel("Scale", JLabel.CENTER), c); + calPanel.add(new JLabel("Scale", SwingConstants.CENTER), c); for (int i = 0; i < ArrayAccelParams.NDIMENSIONS; i++) { c.gridy ++; c.gridx = 0; - calPanel.add(new JLabel(ArrayAccelParams.DIMENSIONNAME[i] + " ", JLabel.RIGHT), c); + calPanel.add(new JLabel(ArrayAccelParams.DIMENSIONNAME[i] + " ", SwingConstants.RIGHT), c); c.gridx++; calPanel.add(zeroVolts[i] = new JTextField(5), c); zeroVolts[i].setToolTipText(String.format("Offset voltage for %s coordinate", ArrayAccelParams.DIMENSIONNAME[i])); c.gridx++; - calPanel.add(new JLabel(" V, ", JLabel.LEFT), c); + calPanel.add(new JLabel(" V, ", SwingConstants.LEFT), c); c.gridx++; calPanel.add(voltsPerG[i] = new JTextField(5), c); voltsPerG[i].setToolTipText(String.format("Voltage scale for %s coordinate", ArrayAccelParams.DIMENSIONNAME[i])); c.gridx++; - calPanel.add(new JLabel(" V/g ", JLabel.LEFT), c); + calPanel.add(new JLabel(" V/g ", SwingConstants.LEFT), c); } c.gridx = 0; c.gridwidth = 3; @@ -103,23 +103,23 @@ public class ArrayAccelDialog extends PamDialog { c.gridy++; c.gridx = 0; c.gridwidth = 3; - calPanel.add(new JLabel("Roll offset ", JLabel.RIGHT), c); + calPanel.add(new JLabel("Roll offset ", SwingConstants.RIGHT), c); c.gridx += c.gridwidth; c.gridwidth = 1; calPanel.add(rollOffset = new JTextField(5), c); rollOffset.setToolTipText("This value gets ADDED to the measured roll"); c.gridx++; - calPanel.add(new JLabel(" deg.", JLabel.LEFT), c); + calPanel.add(new JLabel(" deg.", SwingConstants.LEFT), c); c.gridy++; c.gridx = 0; c.gridwidth = 3; - calPanel.add(new JLabel("Pitch offset ", JLabel.RIGHT), c); + calPanel.add(new JLabel("Pitch offset ", SwingConstants.RIGHT), c); c.gridx += c.gridwidth; c.gridwidth = 1; calPanel.add(pitchOffset = new JTextField(5), c); pitchOffset.setToolTipText("This value gets ADDED to the measured pitch"); c.gridx++; - calPanel.add(new JLabel(" deg.", JLabel.LEFT), c); + calPanel.add(new JLabel(" deg.", SwingConstants.LEFT), c); @@ -226,7 +226,7 @@ public class ArrayAccelDialog extends PamDialog { * Set the zero voltage for each channel. */ public void findZero() { - if (getParams() == false) { + if (!getParams()) { return; } // read the voltages from the three channels and set as diff --git a/src/ArrayAccelerometer/ArrayAccelPanel.java b/src/ArrayAccelerometer/ArrayAccelPanel.java index c4daa6db..ef2dbec1 100644 --- a/src/ArrayAccelerometer/ArrayAccelPanel.java +++ b/src/ArrayAccelerometer/ArrayAccelPanel.java @@ -15,12 +15,10 @@ import PamUtils.LatLong; import PamView.PamColors; import PamView.PamColors.PamColor; import PamView.panel.PamBorder; -import PamView.panel.PamBorderPanel; import PamView.panel.PamPanel; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; -import PamguardMVC.PamObserver; import PamguardMVC.PamObserverAdapter; /* @@ -36,7 +34,7 @@ public class ArrayAccelPanel { private long zeroGraphTime; private ArrayAccelDataBlock accelDataBlock; private int panelDurationSecs = 300; - private double timeScale = 1;; + private double timeScale = 1; public ArrayAccelPanel(ArrayAccelControl accelControl) { diff --git a/src/ArrayAccelerometer/ArrayAccelParams.java b/src/ArrayAccelerometer/ArrayAccelParams.java index 7ce91290..42051640 100644 --- a/src/ArrayAccelerometer/ArrayAccelParams.java +++ b/src/ArrayAccelerometer/ArrayAccelParams.java @@ -1,12 +1,10 @@ package ArrayAccelerometer; import java.io.Serializable; -import java.util.Arrays; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet.ParameterSetType; -import mcc.MccJniInterface; import mcc.mccjna.MCCConstants; public class ArrayAccelParams implements Serializable, Cloneable, ManagedParameters { diff --git a/src/ArrayAccelerometer/ArrayAccelProcess.java b/src/ArrayAccelerometer/ArrayAccelProcess.java index db2f1dec..4105907e 100644 --- a/src/ArrayAccelerometer/ArrayAccelProcess.java +++ b/src/ArrayAccelerometer/ArrayAccelProcess.java @@ -5,17 +5,12 @@ import java.awt.event.ActionListener; import javax.swing.Timer; +import PamController.PamController; +import PamUtils.PamCalendar; +import PamguardMVC.PamProcess; import mcc.MccJniInterface; import mcc.mccjna.MCCException; import mcc.mccjna.MCCUtils; -import Array.ArrayManager; -import Array.PamArray; -import Array.Streamer; -import PamController.PamControlledUnit; -import PamController.PamController; -import PamUtils.PamCalendar; -import PamguardMVC.PamDataBlock; -import PamguardMVC.PamProcess; public class ArrayAccelProcess extends PamProcess { diff --git a/src/ArrayAccelerometer/ArrayAccelSidePanel.java b/src/ArrayAccelerometer/ArrayAccelSidePanel.java index a2873a6d..f447f775 100644 --- a/src/ArrayAccelerometer/ArrayAccelSidePanel.java +++ b/src/ArrayAccelerometer/ArrayAccelSidePanel.java @@ -1,11 +1,8 @@ package ArrayAccelerometer; import javax.swing.JComponent; -import javax.swing.JPanel; import javax.swing.border.TitledBorder; -import PamView.PamColors.PamColor; -import PamView.panel.PamPanel; import PamView.PamSidePanel; public class ArrayAccelSidePanel implements PamSidePanel { diff --git a/src/Azigram/AzigramDataUnit.java b/src/Azigram/AzigramDataUnit.java index 218ec9bd..51aabe73 100644 --- a/src/Azigram/AzigramDataUnit.java +++ b/src/Azigram/AzigramDataUnit.java @@ -2,8 +2,6 @@ package Azigram; import java.util.Arrays; -import Acquisition.AcquisitionProcess; -import PamUtils.PamUtils; import PamUtils.complex.ComplexArray; import fftManager.FFTDataUnit; diff --git a/src/Azigram/AzigramParameters.java b/src/Azigram/AzigramParameters.java index f0f88c71..8dbd17c2 100644 --- a/src/Azigram/AzigramParameters.java +++ b/src/Azigram/AzigramParameters.java @@ -8,8 +8,6 @@ import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet.ParameterSetType; import PamModel.parametermanager.PrivatePamParameterData; import PamView.GroupedSourceParameters; -import PamguardMVC.PamConstants; -import whistlesAndMoans.WhistleToneParameters; public class AzigramParameters implements Serializable, ManagedParameters, Cloneable { diff --git a/src/Filters/FilterControl.java b/src/Filters/FilterControl.java index f6b41d50..191e74e2 100644 --- a/src/Filters/FilterControl.java +++ b/src/Filters/FilterControl.java @@ -8,19 +8,14 @@ import java.io.Serializable; import javax.swing.JMenu; import javax.swing.JMenuItem; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - import Filters.layoutFX.FilterGUIFX; import PamController.PamControlledUnit; import PamController.PamControlledUnitGUI; import PamController.PamControlledUnitSettings; -import PamController.PamController; import PamController.PamControllerInterface; import PamController.PamGUIManager; import PamController.PamSettingManager; import PamController.PamSettings; -import fftManager.layoutFX.FFTGuiFX; /** * Filters raw data using a specified filter. @@ -71,6 +66,7 @@ public class FilterControl extends PamControlledUnit implements PamSettings { this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { FilterParameters_2 newParams = FilterDataSourceDialog.showDialog(filterParams, parentFrame, filterProcess.outputData); @@ -90,6 +86,7 @@ public class FilterControl extends PamControlledUnit implements PamSettings { super(); this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { FilterParams newParams = FilterDialog.showDialog(parentFrame, @@ -109,7 +106,7 @@ public class FilterControl extends PamControlledUnit implements PamSettings { public void notifyModelChanged(int changeType) { //System.out.println("FFTControl: notifyModelChanged : " +changeType); super.notifyModelChanged(changeType); - if (changeType == PamController.INITIALIZATION_COMPLETE) { + if (changeType == PamControllerInterface.INITIALIZATION_COMPLETE) { filterProcess.setupProcess(); } if (filterGUIFX!=null) { @@ -117,14 +114,17 @@ public class FilterControl extends PamControlledUnit implements PamSettings { } } + @Override public Serializable getSettingsReference() { return filterParams; } + @Override public long getSettingsVersion() { return FilterParams.serialVersionUID; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { filterParams = ((FilterParameters_2) pamControlledUnitSettings.getSettings()).clone(); return true; diff --git a/src/Filters/FilterDataSourceDialog.java b/src/Filters/FilterDataSourceDialog.java index 366b3986..3511551d 100644 --- a/src/Filters/FilterDataSourceDialog.java +++ b/src/Filters/FilterDataSourceDialog.java @@ -1,6 +1,7 @@ package Filters; import java.awt.Frame; + import javax.swing.JPanel; import javax.swing.border.TitledBorder; diff --git a/src/Filters/FilterDialog.java b/src/Filters/FilterDialog.java index e6e48414..71648dde 100644 --- a/src/Filters/FilterDialog.java +++ b/src/Filters/FilterDialog.java @@ -21,6 +21,7 @@ package Filters; import java.awt.Window; + import PamView.dialog.PamDialog; public class FilterDialog extends PamDialog { diff --git a/src/Filters/FilterDialogPanel.java b/src/Filters/FilterDialogPanel.java index 9b1368c8..33ea11dd 100644 --- a/src/Filters/FilterDialogPanel.java +++ b/src/Filters/FilterDialogPanel.java @@ -37,10 +37,14 @@ import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; import javax.swing.table.AbstractTableModel; +import com.opencsv.CSVReader; +import com.opencsv.exceptions.CsvException; + import Layout.PamAxis; import PamUtils.PamFileChooser; import PamUtils.PamFileFilter; @@ -49,9 +53,6 @@ import PamView.PamColors.PamColor; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; import PamView.panel.PamPanel; -import com.opencsv.CSVReader; -import com.opencsv.exceptions.CsvException; - import fftManager.Complex; /** @@ -188,8 +189,9 @@ public class FilterDialogPanel implements ActionListener { repaintAll(); } + @Override public void actionPerformed(ActionEvent e) { - if (isSetup == false) { + if (!isSetup) { return; } if (e.getSource() == filterTypes) { @@ -235,7 +237,7 @@ public class FilterDialogPanel implements ActionListener { break; } boolean isArb = filterType == 4; - normalPanel.setVisible(isArb == false); + normalPanel.setVisible(!isArb); arbPanel.setVisible(isArb); } @@ -321,14 +323,14 @@ public class FilterDialogPanel implements ActionListener { c.gridwidth = 1; c.gridy++; c.gridx = xc; - normalPanel.add(new JLabel(" High Pass", JLabel.RIGHT), c); + normalPanel.add(new JLabel(" High Pass", SwingConstants.RIGHT), c); c.gridx++; normalPanel.add(highCut, c); c.gridx++; normalPanel.add(new JLabel(" Hz"), c); c.gridy++; c.gridx = xc; - normalPanel.add(new JLabel(" Low Pass", JLabel.RIGHT), c); + normalPanel.add(new JLabel(" Low Pass", SwingConstants.RIGHT), c); c.gridx++; normalPanel.add(lowCut, c); c.gridx++; @@ -702,10 +704,10 @@ public class FilterDialogPanel implements ActionListener { if (filterMethod == null) { return; } - if (IIRFilterMethod.class.isAssignableFrom(filterMethod.getClass()) == true) { + if (IIRFilterMethod.class.isAssignableFrom(filterMethod.getClass())) { paintPoleZeros(g); } - else if (FIRFilterMethod.class.isAssignableFrom(filterMethod.getClass()) == true) { + else if (FIRFilterMethod.class.isAssignableFrom(filterMethod.getClass())) { paintImpulseResponse(g); } } diff --git a/src/Filters/FilterMethod.java b/src/Filters/FilterMethod.java index 78b0ae10..69613c4d 100644 --- a/src/Filters/FilterMethod.java +++ b/src/Filters/FilterMethod.java @@ -20,8 +20,6 @@ */ package Filters; -import fftManager.Complex; - /** * @author Doug Gillespie *

diff --git a/src/Filters/FilterParameters_2.java b/src/Filters/FilterParameters_2.java index 788db4d8..c40962bd 100644 --- a/src/Filters/FilterParameters_2.java +++ b/src/Filters/FilterParameters_2.java @@ -2,9 +2,6 @@ package Filters; import java.io.Serializable; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet.ParameterSetType; diff --git a/src/Filters/FilterParams.java b/src/Filters/FilterParams.java index f8260f44..f166c7c2 100644 --- a/src/Filters/FilterParams.java +++ b/src/Filters/FilterParams.java @@ -22,12 +22,7 @@ package Filters; import java.io.File; import java.io.Serializable; -import java.util.Arrays; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import PamController.PamControlledUnit; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet.ParameterSetType; diff --git a/src/Filters/FilterSpeed.java b/src/Filters/FilterSpeed.java index 373b97a2..4c26b169 100644 --- a/src/Filters/FilterSpeed.java +++ b/src/Filters/FilterSpeed.java @@ -28,7 +28,7 @@ public class FilterSpeed { data[i] = r.nextGaussian(); } testData = data.clone(); - long sn, en, mn = 0;; + long sn, en, mn = 0; double a; long startTime = System.currentTimeMillis(); for (int i = 0; i < nTrials; i++) { diff --git a/src/Filters/IIRFilterMethod.java b/src/Filters/IIRFilterMethod.java index bd902e69..dbc60c77 100644 --- a/src/Filters/IIRFilterMethod.java +++ b/src/Filters/IIRFilterMethod.java @@ -229,6 +229,7 @@ public abstract class IIRFilterMethod extends FilterMethod { * Get coefficients from poles and zeros for fast filter computations. * @return */ + @Override public double[] getFastFilterCoefficients() { Complex[] poles = getPoles(filterParams); Complex[] zeros = getZeros(filterParams); diff --git a/src/Filters/IirfFilter.java b/src/Filters/IirfFilter.java index 67cf11af..8f90d834 100644 --- a/src/Filters/IirfFilter.java +++ b/src/Filters/IirfFilter.java @@ -195,6 +195,7 @@ public class IirfFilter implements Filter { /* (non-Javadoc) * @see Filters.Filter#runFilter(double[]) */ + @Override synchronized public void runFilter(double[] inputData) { int f; for (int i = 0; i < inputData.length; i++) { @@ -208,6 +209,7 @@ public class IirfFilter implements Filter { /* (non-Javadoc) * @see Filters.Filter#runFilter(double[], double[]) */ + @Override synchronized public void runFilter(double[] inputData, double[] outputData) { int f; if (outputData == null || outputData.length != inputData.length) { @@ -225,6 +227,7 @@ public class IirfFilter implements Filter { /* (non-Javadoc) * @see Filters.Filter#runFilter(double) */ + @Override synchronized public double runFilter(double aData) { double newData = aData; for (int f = 0; f < nFilterUnits; f++) { diff --git a/src/GPS/FormatGpsData.java b/src/GPS/FormatGpsData.java index 44144c6f..f0df714c 100644 --- a/src/GPS/FormatGpsData.java +++ b/src/GPS/FormatGpsData.java @@ -52,14 +52,14 @@ public class FormatGpsData { Date dateO; FormatGpsData() { - }; + } FormatGpsData(StringBuffer nmeaString) { /* * Unpack the string buffer to populate the above datas */ - }; + } public static String formatTime(int intTime) { SimpleDateFormat gpsTimeFormat = new SimpleDateFormat("HHmmss"); diff --git a/src/GPS/GPSControl.java b/src/GPS/GPSControl.java index 23f1fe8f..5d44695a 100644 --- a/src/GPS/GPSControl.java +++ b/src/GPS/GPSControl.java @@ -9,11 +9,6 @@ import java.util.ListIterator; import javax.swing.JMenu; import javax.swing.JMenuItem; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import warnings.PamWarning; -import warnings.WarningSystem; import NMEA.NMEADataBlock; import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; @@ -21,9 +16,10 @@ import PamController.PamController; import PamController.PamSettingManager; import PamController.PamSettings; import PamController.positionreference.PositionReference; -import PamUtils.PamCalendar; import PamView.dialog.warn.WarnOnce; import PamguardMVC.PamDataBlock; +import warnings.PamWarning; +import warnings.WarningSystem; public class GPSControl extends PamControlledUnit implements PamSettings, PositionReference { @@ -144,7 +140,9 @@ public class GPSControl extends PamControlledUnit implements PamSettings, Positi @Override public void actionPerformed(ActionEvent arg0) { String currentPath; - ImportGPSParams newParams=ImportGPSDialog.showDialog(PamController.getInstance().getMainFrame(), PamController.getInstance().getMainFrame().getMousePosition(),gpsImportParams, importGPSData); + PamController.getInstance(); + PamController.getInstance(); + ImportGPSParams newParams=ImportGPSDialog.showDialog(PamController.getMainFrame(), PamController.getMainFrame().getMousePosition(),gpsImportParams, importGPSData); if (newParams!=null) gpsImportParams=newParams.clone(); @@ -168,6 +166,7 @@ public class GPSControl extends PamControlledUnit implements PamSettings, Positi this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { GPSParameters newP = GPSParametersDialog.showDialog(parentFrame, gpsParameters); if (newP != null) { @@ -184,6 +183,7 @@ public class GPSControl extends PamControlledUnit implements PamSettings, Positi this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { String message = "Clock management is now controlled from the \"File/Global time settings\" menu

" + "The Global time settings do not require administrator privilidges

" + @@ -195,13 +195,16 @@ public class GPSControl extends PamControlledUnit implements PamSettings, Positi } } } + @Override public Serializable getSettingsReference() { return gpsParameters; } + @Override public long getSettingsVersion() { return GPSParameters.serialVersionUID; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { if (pamControlledUnitSettings.getUnitType().equals(this.getUnitType()) @@ -260,7 +263,7 @@ public class GPSControl extends PamControlledUnit implements PamSettings, Positi * @return interpolated gps position. */ public GpsDataUnit getShipPosition(long timeMilliseconds, boolean interpolate) { - if (interpolate == false) { + if (!interpolate) { return getGpsDataBlock().getClosestUnitMillis(timeMilliseconds); } // otherwise try to fine a point either side and weighted mean them or extrapolate. diff --git a/src/GPS/GPSDataBlock.java b/src/GPS/GPSDataBlock.java index fc0f8f84..b911808a 100644 --- a/src/GPS/GPSDataBlock.java +++ b/src/GPS/GPSDataBlock.java @@ -3,12 +3,12 @@ package GPS; import java.util.ListIterator; import GPS.effort.GpsEffortProvider; -import nmeaEmulator.EmulatedData; -import nmeaEmulator.NMEAEmulator; -import pamScrollSystem.ViewLoadObserver; import PamguardMVC.PamDataBlock; import PamguardMVC.PamProcess; import PamguardMVC.dataOffline.OfflineDataLoadInfo; +import nmeaEmulator.EmulatedData; +import nmeaEmulator.NMEAEmulator; +import pamScrollSystem.ViewLoadObserver; /** * Add a bit of extra functionality to GPSDataBlock so @@ -44,7 +44,7 @@ public class GPSDataBlock extends PamDataBlock implements NMEAEmula @Override public void addPamData(GpsDataUnit gpsDataUnit) { boolean r = isReasonable(gpsDataUnit); - if (r == false) { + if (!r) { gpsDataUnit.getGpsData().setDataOk(false); } else { @@ -68,7 +68,7 @@ public class GPSDataBlock extends PamDataBlock implements NMEAEmula GpsData thisData, thatData; thisData = gpsDataUnit.getGpsData(); - if (thisData.isDataOk() == false) { + if (!thisData.isDataOk()) { return false; } @@ -83,7 +83,7 @@ public class GPSDataBlock extends PamDataBlock implements NMEAEmula return true; } // ignore gps points flagged as bad. - if (thatData.isDataOk() == false) { + if (!thatData.isDataOk()) { continue; } // OK if it's gone too far back in time @@ -118,7 +118,7 @@ public class GPSDataBlock extends PamDataBlock implements NMEAEmula readyGGAData = null; return dd; } - if (emulatorIterator.hasNext() == false) { + if (!emulatorIterator.hasNext()) { return null; } GpsDataUnit gpsUnit = emulatorIterator.next(); diff --git a/src/GPS/GPSDataMatcher.java b/src/GPS/GPSDataMatcher.java index 59adf5b1..68fbe999 100644 --- a/src/GPS/GPSDataMatcher.java +++ b/src/GPS/GPSDataMatcher.java @@ -2,7 +2,6 @@ package GPS; import java.util.ListIterator; -import PamUtils.PamCalendar; import PamguardMVC.dataOffline.OfflineDataLoadInfo; /** diff --git a/src/GPS/GPSOverlayGraphics.java b/src/GPS/GPSOverlayGraphics.java index b1e968ca..7920bc5c 100644 --- a/src/GPS/GPSOverlayGraphics.java +++ b/src/GPS/GPSOverlayGraphics.java @@ -7,22 +7,19 @@ import java.awt.Point; import java.awt.Rectangle; import java.awt.Window; -import Map.MapProjector; import Map.MapRectProjector; import Map.Vessel; import PamUtils.Coordinate3d; import PamUtils.PamCalendar; import PamView.GeneralProjector; -import PamView.ManagedSymbol; +import PamView.GeneralProjector.ParameterType; +import PamView.GeneralProjector.ParameterUnits; import PamView.ManagedSymbolInfo; import PamView.PamKeyItem; import PamView.PamSymbol; -import PamView.PamOldSymbolManager; import PamView.PamSymbolType; import PamView.PanelOverlayDraw; import PamView.SymbolKeyItem; -import PamView.GeneralProjector.ParameterType; -import PamView.GeneralProjector.ParameterUnits; import PamView.symbol.SymbolData; import PamguardMVC.PamDataUnit; @@ -69,7 +66,7 @@ public class GPSOverlayGraphics extends PanelOverlayDraw { Coordinate3d coord = generalProjector.getCoord3d( gpsData.getLatitude(), gpsData.getLongitude(),gpsData.getHeight()); Point p = coord.getXYPoint(); if (lastDrawnDataUnit != null && Math.abs(lastDrawnDataUnit.getAbsBlockIndex()-gpsDataUnit.getAbsBlockIndex()) == 1) { - if (p.equals(lastCoord) == false) { + if (!p.equals(lastCoord)) { g.setColor(s.getLineColor()); g.drawLine(p.x, p.y, lastCoord.x, lastCoord.y); } diff --git a/src/GPS/GPSParametersDialog.java b/src/GPS/GPSParametersDialog.java index 52babe5a..ef0a85ea 100644 --- a/src/GPS/GPSParametersDialog.java +++ b/src/GPS/GPSParametersDialog.java @@ -4,7 +4,6 @@ import java.awt.BorderLayout; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; -import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -18,11 +17,9 @@ import javax.swing.JRadioButton; import javax.swing.JTabbedPane; import javax.swing.JTextArea; import javax.swing.JTextField; -import javax.swing.border.EtchedBorder; import javax.swing.border.TitledBorder; import NMEA.NMEADataUnit; -import PamController.PamControlledUnit; import PamController.PamController; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; @@ -104,7 +101,7 @@ public class GPSParametersDialog extends PamDialog { // setModal(true); } private void dimensionsChanged() { - if (gpsParametersDialog.getParams() == true) { + if (gpsParametersDialog.getParams()) { // shipDrawing.setDimensions(gpsParameters.dimA, gpsParameters.dimB, // gpsParameters.dimC, gpsParameters.dimD); } @@ -198,9 +195,9 @@ public class GPSParametersDialog extends PamDialog { gpsParameters.dimB = dims[1]; gpsParameters.dimC = dims[2]; gpsParameters.dimD = dims[3]; - if (predictPanel.getParams() == false) return false; - if (readOptions.getParams() == false) return false; - if (smoothingOptions.getParams() == false) return false; + if (!predictPanel.getParams()) return false; + if (!readOptions.getParams()) return false; + if (!smoothingOptions.getParams()) return false; return headingPanel.getParams(gpsParameters); } @@ -408,6 +405,7 @@ public class GPSParametersDialog extends PamDialog { return true; } + @Override public void actionPerformed(ActionEvent e) { enableControls(); } diff --git a/src/GPS/GpsData.java b/src/GPS/GpsData.java index f52d4b55..22d5c263 100644 --- a/src/GPS/GpsData.java +++ b/src/GPS/GpsData.java @@ -20,8 +20,6 @@ */ package GPS; -import geoMag.MagneticVariation; - import java.lang.reflect.Field; import java.text.SimpleDateFormat; import java.util.Calendar; @@ -29,8 +27,6 @@ import java.util.TimeZone; import Array.sensors.ArraySensorDataUnit; import Array.sensors.ArraySensorFieldType; -import pamMaths.PamQuaternion; -import pamMaths.PamVector; import NMEA.AcquireNmeaData; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; @@ -38,6 +34,9 @@ import PamModel.parametermanager.PrivatePamParameterData; import PamUtils.LatLong; import PamUtils.PamCalendar; import PamUtils.PamUtils; +import geoMag.MagneticVariation; +import pamMaths.PamQuaternion; +import pamMaths.PamVector; /** * Note on times for GPS data ... @@ -176,7 +175,7 @@ public class GpsData extends LatLong implements Cloneable, ManagedParameters, Ar // sortDistanceFromLast(); - }; + } /** * Constructor to create a GPSData object from a lat long. @@ -276,9 +275,9 @@ public class GpsData extends LatLong implements Cloneable, ManagedParameters, Ar break; } - if (dataOk == false) return; + if (!dataOk) return; - }; + } protected void sortDistanceFromLast() { @@ -471,7 +470,7 @@ public class GpsData extends LatLong implements Cloneable, ManagedParameters, Ar foundPoint = true; continue; } - if (foundPoint == false) { + if (!foundPoint) { newDigit = (nmeaSentence[i] - 48); number = (number * 10 + newDigit); } diff --git a/src/GPS/GpsLogger.java b/src/GPS/GpsLogger.java index f0f990c8..712156b4 100644 --- a/src/GPS/GpsLogger.java +++ b/src/GPS/GpsLogger.java @@ -30,15 +30,6 @@ package GPS; -import generalDatabase.DBControlUnit; -import generalDatabase.DBProcess; -import generalDatabase.PamConnection; -import generalDatabase.PamTableDefinition; -import generalDatabase.PamTableItem; -import generalDatabase.SQLLogging; -import generalDatabase.SQLTypes; - -import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; @@ -46,16 +37,16 @@ import java.sql.Types; import javax.swing.JOptionPane; - - - - - - import PamController.PamViewParameters; -import PamUtils.PamCalendar; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; +import generalDatabase.DBControlUnit; +import generalDatabase.DBProcess; +import generalDatabase.PamConnection; +import generalDatabase.PamTableDefinition; +import generalDatabase.PamTableItem; +import generalDatabase.SQLLogging; +import generalDatabase.SQLTypes; public class GpsLogger extends SQLLogging { @@ -117,7 +108,7 @@ public class GpsLogger extends SQLLogging { @Override public synchronized boolean doExtraChecks(DBProcess dbProcess, PamConnection connection) { - if (dbProcess.tableExists(tableDefinition) == false) { + if (!dbProcess.tableExists(tableDefinition)) { return true; // PAMGUARD will create the table normally. } // make sure the table has the right columns. @@ -136,7 +127,7 @@ public class GpsLogger extends SQLLogging { // boolean hasId = dbProcess.columnExists(tableDefinition, tableDefinition.getIndexItem()); boolean hasUTC = dbProcess.columnNull(tableDefinition.getTableName(), tableDefinition.getTimeStampItem()) != 2; // boolean hasLoctime = dbProcess.columnExists(tableDefinition, tableDefinition.getLocalTimeItem()); - if (hasIndex && hasPCTime && hasUTC == false) { + if (hasIndex && hasPCTime && !hasUTC) { // seems to be a logger table String warningText = String.format("The data in table %s appear to be from the IFAW\n" + "Logger 2000 software and are incompatible with PAMGUARD\n\n" + @@ -297,7 +288,7 @@ public class GpsLogger extends SQLLogging { int gpsIntTimeVal = gpsTime.getIntegerValue(); PamTableDefinition pamTableDef = (PamTableDefinition) getTableDefinition(); Object ts = pamTableDef.getTimeStampItem().getValue(); - long gpsDate = sqlTypes.millisFromTimeStamp(ts); + long gpsDate = SQLTypes.millisFromTimeStamp(ts); if (gpsDate%1000 == 0) { // some databases may have stored the milliseconds, in which // case this next bit is redundant. @@ -318,9 +309,9 @@ public class GpsLogger extends SQLLogging { if (nmeaProcess != null) { // this should apply the rules of how much GPD data to keep as it's loading // can reduce amount of data loaded in viewer mode to something sensible. - if (nmeaProcess.wantDataUnit(gpsDataUnit) == false) { + if (!nmeaProcess.wantDataUnit(gpsDataUnit)) { return null; - }; + } } String fixTypeStr = fixType.getDeblankedStringValue(); diff --git a/src/GPS/ImportGPSData.java b/src/GPS/ImportGPSData.java index 9e746ed3..97187481 100644 --- a/src/GPS/ImportGPSData.java +++ b/src/GPS/ImportGPSData.java @@ -76,7 +76,8 @@ public class ImportGPSData { */ public void loadFile(String fileString){ - importLoadBar=ImportLoadBar.showDialog(PamController.getInstance().getMainFrame(), "Load GPS Data"); + PamController.getInstance(); + importLoadBar=ImportLoadBar.showDialog(PamController.getMainFrame(), "Load GPS Data"); importLoadBar.setProgress(0); importLoadBar.setIntermediate(true); PamController.getInstance().enableGUIControl(false); @@ -137,7 +138,9 @@ public class ImportGPSData { Collection nmeaStrings=importFileStrings( file.getAbsolutePath()); if (checkGGA(nmeaStrings)) { - ImportGPSParams newParams=ImportGGADialog.showDialog(PamController.getInstance().getMainFrame(), PamController.getInstance().getMainFrame().getMousePosition(), gpsControl.gpsImportParams, this) ; + PamController.getInstance(); + PamController.getInstance(); + ImportGPSParams newParams=ImportGGADialog.showDialog(PamController.getMainFrame(), PamController.getMainFrame().getMousePosition(), gpsControl.gpsImportParams, this) ; if (newParams!=null) gpsControl.gpsImportParams=newParams.clone(); } } @@ -375,7 +378,7 @@ public class ImportGPSData { if (gpsData.isDataOk()) saveGPSData(gpsData); } - gpsData=new GpsData(nmeaString, gpsControl.gpsParameters.READ_GGA); + gpsData=new GpsData(nmeaString, GPSParameters.READ_GGA); ///GGA strings contain no date so we need to set it. gpsData.getGpsCalendar().set(Calendar.YEAR, gpsControl.gpsImportParams.year); gpsData.getGpsCalendar().set(Calendar.MONTH, gpsControl.gpsImportParams.month); @@ -397,7 +400,7 @@ public class ImportGPSData { } // System.out.println("nmea string: "+nmeaString); - gpsData=new GpsData(nmeaString, gpsControl.gpsParameters.READ_RMC); + gpsData=new GpsData(nmeaString, GPSParameters.READ_RMC); break; } @@ -452,7 +455,7 @@ public class ImportGPSData { gpsDataBlock.saveViewerData(); - }; + } public void saveGPSData(GpsData gpsData){ //System.out.println("GPSData to save: " +gpsData + "gpsDataBlock: "+gpsDataBlock); @@ -508,7 +511,7 @@ public class ImportGPSData { private void loadKMLFile(File file , ImportGPSThread importGPSThread){ // TODO Auto-generated method stub - }; + } private void loadGPXFile(File file2, ImportGPSThread importGPSThread) { // TODO Auto-generated method stub diff --git a/src/GPS/ImportGPSDialog.java b/src/GPS/ImportGPSDialog.java index 049179bf..373a88d3 100644 --- a/src/GPS/ImportGPSDialog.java +++ b/src/GPS/ImportGPSDialog.java @@ -63,7 +63,7 @@ public class ImportGPSDialog extends PamDialog{ importGPS.add(BorderLayout.CENTER, p); setDialogComponent(importGPS); - setLocation(location);; + setLocation(location); @@ -115,6 +115,7 @@ public class ImportGPSDialog extends PamDialog{ class BrowseButtonAction implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { File lastFile; diff --git a/src/GPS/ProcessHeadingData.java b/src/GPS/ProcessHeadingData.java index 9d5975a6..e20e853d 100644 --- a/src/GPS/ProcessHeadingData.java +++ b/src/GPS/ProcessHeadingData.java @@ -3,6 +3,7 @@ package GPS; import NMEA.NMEADataBlock; import NMEA.NMEADataUnit; import PamController.PamController; +import PamController.PamControllerInterface; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; @@ -50,7 +51,7 @@ where: @Override public void newData(PamObservable o, PamDataUnit arg) { - if (gpsControl.gpsParameters.readHeading == false) { + if (!gpsControl.gpsParameters.readHeading) { return; } NMEADataUnit nmeaData = (NMEADataUnit) arg; @@ -121,7 +122,7 @@ where: } private void findDataSource() { - if (gpsControl.isGpsMaster() == false) { + if (!gpsControl.isGpsMaster()) { return; } NMEADataBlock newSource = (NMEADataBlock) PamController.getInstance(). @@ -134,9 +135,9 @@ where: @Override public void notifyModelChanged(int changeType) { switch (changeType) { - case PamController.ADD_CONTROLLEDUNIT: - case PamController.REMOVE_CONTROLLEDUNIT: - case PamController.INITIALIZATION_COMPLETE: + case PamControllerInterface.ADD_CONTROLLEDUNIT: + case PamControllerInterface.REMOVE_CONTROLLEDUNIT: + case PamControllerInterface.INITIALIZATION_COMPLETE: noteNewSettings(); } } diff --git a/src/GPS/ProcessNmeaData.java b/src/GPS/ProcessNmeaData.java index f76e4654..f2561e67 100644 --- a/src/GPS/ProcessNmeaData.java +++ b/src/GPS/ProcessNmeaData.java @@ -20,15 +20,11 @@ */ package GPS; -import warnings.PamWarning; -import warnings.WarningSystem; -import geoMag.MagneticVariation; import NMEA.NMEADataBlock; import NMEA.NMEADataUnit; import PamController.PamController; -import PamController.masterReference.MasterReferencePoint; +import PamController.PamControllerInterface; import PamController.status.BaseProcessCheck; -import PamController.status.ProcessCheck; import PamModel.PamModel; import PamModel.SMRUEnable; import PamUtils.PamCalendar; @@ -38,7 +34,9 @@ import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; -import autecPhones.AutecGraphics; +import geoMag.MagneticVariation; +import warnings.PamWarning; +import warnings.WarningSystem; /** * @author Doug Gillespie @@ -90,7 +88,7 @@ public class ProcessNmeaData extends PamProcess { findNMEADataBlock(); addOutputDataBlock((gpsDataBlock = new GPSDataBlock(this))); - if (gpsControl.isGpsMaster() == false) { + if (!gpsControl.isGpsMaster()) { gpsDataBlock.setOverlayDraw(new GPSOverlayGraphics(gpsControl)); gpsDataBlock.setPamSymbolManager(new StandardSymbolManager(gpsDataBlock, GPSOverlayGraphics.defSymbol, false)); } @@ -123,7 +121,7 @@ public class ProcessNmeaData extends PamProcess { boolean findNMEADataBlock() { PamDataBlock newDataBlock = null; - if (gpsController.isGpsMaster() == false) { + if (!gpsController.isGpsMaster()) { return false; } @@ -151,9 +149,9 @@ public class ProcessNmeaData extends PamProcess { @Override public void notifyModelChanged(int changeType) { switch (changeType) { - case PamController.ADD_CONTROLLEDUNIT: - case PamController.REMOVE_CONTROLLEDUNIT: - case PamController.INITIALIZATION_COMPLETE: + case PamControllerInterface.ADD_CONTROLLEDUNIT: + case PamControllerInterface.REMOVE_CONTROLLEDUNIT: + case PamControllerInterface.INITIALIZATION_COMPLETE: noteNewSettings(); } } @@ -193,7 +191,7 @@ public class ProcessNmeaData extends PamProcess { } // newUnit.data = gpsData; - if (wantDataUnit(newUnit) == false) { + if (!wantDataUnit(newUnit)) { return; } diff --git a/src/GPS/ShipDimensionsFields.java b/src/GPS/ShipDimensionsFields.java index dfceda6d..56fbc218 100644 --- a/src/GPS/ShipDimensionsFields.java +++ b/src/GPS/ShipDimensionsFields.java @@ -8,6 +8,7 @@ import java.awt.event.ActionListener; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.EmptyBorder; import PamView.dialog.PamDialog; @@ -32,7 +33,7 @@ public class ShipDimensionsFields extends JPanel implements ActionListener{ for (int i = 0; i < dimNames.length; i++) { gbs.gridy = i; gbs.gridx = 0; - PamDialog.addComponent(this, new JLabel(" " + dimNames[i] + " ", JLabel.RIGHT), gbs); + PamDialog.addComponent(this, new JLabel(" " + dimNames[i] + " ", SwingConstants.RIGHT), gbs); gbs.gridx = 1; PamDialog.addComponent(this, shipDims[i] = new JTextField(4), gbs); gbs.gridx = 2; @@ -62,6 +63,7 @@ public class ShipDimensionsFields extends JPanel implements ActionListener{ return dimensions; } + @Override public void actionPerformed(ActionEvent e) { // TODO Auto-generated method stub // dimensionsChanged(); diff --git a/src/GPS/UpdateClockDialog.java b/src/GPS/UpdateClockDialog.java index 03a33bf1..623b4fb2 100644 --- a/src/GPS/UpdateClockDialog.java +++ b/src/GPS/UpdateClockDialog.java @@ -19,17 +19,16 @@ import javax.swing.Timer; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; -import warnings.PamWarning; -import warnings.WarningSystem; import NMEA.NMEADataBlock; import NMEA.NMEADataUnit; import PamController.AdminTools; -import PamController.PamController; import PamUtils.PamCalendar; import PamUtils.SystemTiming; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamObserver; +import warnings.PamWarning; +import warnings.WarningSystem; /** * Dialog to update the PC clock from GPRMC data. @@ -127,13 +126,13 @@ public class UpdateClockDialog extends JDialog implements ActionListener, PamObs singleInstance = new UpdateClockDialog(parentFrame); } - if (AdminTools.isAdmin() == false) { + if (!AdminTools.isAdmin()) { JOptionPane.showMessageDialog(singleInstance, "The PC Clock can only be set automatically if you run PAMGuard as Administrator", "Warning", JOptionPane.ERROR_MESSAGE); } singleInstance.autoUpdate = autoUpdate; - singleInstance.setModal(autoUpdate == false); // bodge it so it doens't halt program execution during auto update + singleInstance.setModal(!autoUpdate); // bodge it so it doens't halt program execution during auto update singleInstance.setAlwaysOnTop(autoUpdate); singleInstance.gpsControl = gpsControl; singleInstance.newDataCount = 0; @@ -165,6 +164,7 @@ public class UpdateClockDialog extends JDialog implements ActionListener, PamObs } Timer timer = new Timer(500, new ActionListener() { + @Override public void actionPerformed(ActionEvent evt) { tellTime(); } @@ -174,6 +174,7 @@ public class UpdateClockDialog extends JDialog implements ActionListener, PamObs pcTime.setText(PamCalendar.formatDateTime(PamCalendar.getTimeInMillis())); } + @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == cancelButton) { this.setVisible(false); @@ -190,14 +191,17 @@ public class UpdateClockDialog extends JDialog implements ActionListener, PamObs return this; } + @Override public String getObserverName() { return "Update Clock dialog"; } + @Override public long getRequiredDataHistory(PamObservable o, Object arg) { return 0; } + @Override public void noteNewSettings() { } @@ -216,13 +220,14 @@ public class UpdateClockDialog extends JDialog implements ActionListener, PamObs // don't do anything by default } + @Override public void addData(PamObservable o, PamDataUnit arg) { // look to see if it's an RMC String and if so get the date and time out. // NMEADataBlock nmeaDataBlock = (NMEADataBlock) o; NMEADataUnit nmeaDataUnit = (NMEADataUnit) arg; StringBuffer nmeaData = nmeaDataUnit.getCharData(); String stringId = NMEADataBlock.getSubString(nmeaData, 0); - if (gpsControl.wantString(stringId) == false) { + if (!gpsControl.wantString(stringId)) { return; } if (gpsControl.gpsParameters.mainString == GPSParameters.READ_GGA) { @@ -373,7 +378,7 @@ public class UpdateClockDialog extends JDialog implements ActionListener, PamObs private void setTimeNow(Calendar nmeaCalendar) { - if (SystemTiming.setSystemTime(nmeaCalendar) == false) { + if (!SystemTiming.setSystemTime(nmeaCalendar)) { String msg = "The PC Clock can only be set automatically if you run PAMGuard as Administrator"; JOptionPane.showMessageDialog(singleInstance, msg, "Warning", JOptionPane.ERROR_MESSAGE); @@ -385,6 +390,7 @@ public class UpdateClockDialog extends JDialog implements ActionListener, PamObs System.out.println(String.format("PC Clock updated to " + PamCalendar.formatDateTime(nmeaCalendar.getTimeInMillis()))); } } + @Override public void removeObservable(PamObservable o) { // TODO Auto-generated method stub diff --git a/src/IshmaelDetector/EnergySumControl.java b/src/IshmaelDetector/EnergySumControl.java index 58c30a3b..197efe63 100644 --- a/src/IshmaelDetector/EnergySumControl.java +++ b/src/IshmaelDetector/EnergySumControl.java @@ -15,14 +15,12 @@ import java.io.Serializable; import javax.swing.JMenuItem; -import IshmaelDetector.dataPlotFX.IshmaelDetPlotProvider; import IshmaelDetector.layoutFX.IshEnergyPaneFX; import PamController.PamControlledUnitSettings; import PamController.PamController; import PamController.PamSettings; import PamguardMVC.PamDataBlock; import PamguardMVC.PamRawDataBlock; -import dataPlotsFX.data.TDDataProviderRegisterFX; import pamViewFX.fxNodes.pamDialogFX.PamDialogFX2AWT; @SuppressWarnings("rawtypes") @@ -70,6 +68,7 @@ public class EnergySumControl extends IshDetControl implements PamSettings { } class menuSmoothingDetection implements ActionListener { + @Override public void actionPerformed(ActionEvent ev) { // KernelSmoothingParameters newParams = KernelSmoothingDialog.show(smoothingParameters, smoothingProcess.getOutputDataBlock(0)); // if (newParams != null) { @@ -129,6 +128,7 @@ public class EnergySumControl extends IshDetControl implements PamSettings { return super.restoreSettings(pamControlledUnitSettings); } + @Override public Serializable getSettingsReference() { return ishDetParams; } @@ -136,6 +136,7 @@ public class EnergySumControl extends IshDetControl implements PamSettings { /** * @return An integer version number for the settings */ + @Override public long getSettingsVersion() { return EnergySumParams.serialVersionUID; } diff --git a/src/IshmaelDetector/EnergySumParamsDialog.java b/src/IshmaelDetector/EnergySumParamsDialog.java index 27495e1e..340091bd 100644 --- a/src/IshmaelDetector/EnergySumParamsDialog.java +++ b/src/IshmaelDetector/EnergySumParamsDialog.java @@ -21,6 +21,7 @@ package IshmaelDetector; import java.awt.Frame; + import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JCheckBox; diff --git a/src/IshmaelDetector/EnergySumProcess.java b/src/IshmaelDetector/EnergySumProcess.java index bec3dfb7..2f416911 100644 --- a/src/IshmaelDetector/EnergySumProcess.java +++ b/src/IshmaelDetector/EnergySumProcess.java @@ -1,13 +1,12 @@ package IshmaelDetector; +import PamUtils.complex.ComplexArray; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import fftManager.FFTDataBlock; import fftManager.FFTDataUnit; -import IshmaelDetector.IshDetFnDataUnit; -import PamUtils.complex.ComplexArray; /* * Process for the energy sum detector. diff --git a/src/IshmaelDetector/IshAnchorGroup.java b/src/IshmaelDetector/IshAnchorGroup.java index 79fcb3d8..35cd2989 100644 --- a/src/IshmaelDetector/IshAnchorGroup.java +++ b/src/IshmaelDetector/IshAnchorGroup.java @@ -1,8 +1,6 @@ package IshmaelDetector; import PamDetection.PamDetection; -import PamguardMVC.AcousticDataUnit; -import PamguardMVC.PamDataUnit; import PamguardMVC.superdet.SuperDetection; /** diff --git a/src/IshmaelDetector/IshBinaryDataSource.java b/src/IshmaelDetector/IshBinaryDataSource.java index f02a82e2..4e92e298 100644 --- a/src/IshmaelDetector/IshBinaryDataSource.java +++ b/src/IshmaelDetector/IshBinaryDataSource.java @@ -6,7 +6,6 @@ import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.IOException; -import java.util.ArrayList; import PamguardMVC.DataUnitBaseData; import PamguardMVC.PamDataBlock; diff --git a/src/IshmaelDetector/IshDetControl.java b/src/IshmaelDetector/IshDetControl.java index 989ae448..1c1a88ca 100644 --- a/src/IshmaelDetector/IshDetControl.java +++ b/src/IshmaelDetector/IshDetControl.java @@ -136,6 +136,7 @@ public abstract class IshDetControl extends PamControlledUnit implements PamSett public IshDetSettings(Frame parentFrame) { this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { //old way: showParamsDialog(parentFrame, ishDetParams); showParamsDialog1(parentFrame); @@ -163,6 +164,7 @@ public abstract class IshDetControl extends PamControlledUnit implements PamSett /** This is called after a settings file is read. The subclass should * get newParams and clone it as ishDetParams before calling here. */ + @Override public boolean restoreSettings(PamControlledUnitSettings dummy) { //Subclass should clone newParams before calling here!! if (ishDetFnProcess != null) ishDetFnProcess .setupConnections(); diff --git a/src/IshmaelDetector/IshDetFnProcess.java b/src/IshmaelDetector/IshDetFnProcess.java index 76a8879b..eedf32d1 100644 --- a/src/IshmaelDetector/IshDetFnProcess.java +++ b/src/IshmaelDetector/IshDetFnProcess.java @@ -5,10 +5,10 @@ package IshmaelDetector; //import PamDetection.RawDataUnit; //import fftManager.FFTDataUnit; import PamController.PamController; -import PamguardMVC.PamDataBlock; -import PamguardMVC.PamDataUnit; //import PamguardMVC.PamDataUnit; import PamDetection.LocContents; +import PamguardMVC.PamDataBlock; +import PamguardMVC.PamDataUnit; import PamguardMVC.PamProcess; /** diff --git a/src/IshmaelDetector/IshDetGraphics.java b/src/IshmaelDetector/IshDetGraphics.java index 7d6f7ce7..00637179 100644 --- a/src/IshmaelDetector/IshDetGraphics.java +++ b/src/IshmaelDetector/IshDetGraphics.java @@ -79,10 +79,12 @@ public class IshDetGraphics implements DisplayPanelProvider, PamSettings { PamSettingManager.getInstance().registerSettings(this); } + @Override public DisplayPanel createDisplayPanel(DisplayPanelContainer displayPanelContainer) { return new IshDisplayPanel(this, displayPanelContainer); } + @Override public String getDisplayPanelName() { return ishDetControl.getUnitName() + " graphics"; } @@ -145,8 +147,9 @@ public class IshDetGraphics implements DisplayPanelProvider, PamSettings { //menuAutoScale = new JCheckBoxMenuItem(" Test"); scaleMenuItem = new JMenuItem("Scale settings..."); scaleMenuItem.addActionListener( action ->{ + PamController.getInstance(); //show a dialog with options to change Ishmael detectior scale settings. - IshDisplayParams newIshDisplayParams = IshDisplayDialog.showDialog(PamController.getInstance().getMainFrame(), ishDisplayParams); + IshDisplayParams newIshDisplayParams = IshDisplayDialog.showDialog(PamController.getMainFrame(), ishDisplayParams); //System.out.println("NewIshDisplayParams: " + newIshDisplayParams.verticalScaleFactor); if (newIshDisplayParams!=null) { ishDisplayParams=newIshDisplayParams; @@ -183,17 +186,21 @@ public class IshDetGraphics implements DisplayPanelProvider, PamSettings { ishDetDataBlock.deleteObserver(this); } + @Override public String getObserverName() { return displayPanelProvider.getDisplayPanelName(); } + @Override public long getRequiredDataHistory(PamObservable o, Object arg) { return 0; } + @Override public void noteNewSettings() { } + @Override public void removeObservable(PamObservable o) { } @@ -224,10 +231,12 @@ public class IshDetGraphics implements DisplayPanelProvider, PamSettings { } + @Override public void setSampleRate(float sampleRate, boolean notify) { this.sampleRate = sampleRate; } + @Override public void addData(PamObservable o, PamDataUnit dataUnit1) { IshDetFnDataUnit dataUnit = (IshDetFnDataUnit)dataUnit1; //This is called whenever new data arrives from my parent. diff --git a/src/IshmaelDetector/IshDetParams.java b/src/IshmaelDetector/IshDetParams.java index f8d4c2a9..185ea636 100644 --- a/src/IshmaelDetector/IshDetParams.java +++ b/src/IshmaelDetector/IshDetParams.java @@ -16,8 +16,8 @@ import java.lang.reflect.Field; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; +import PamModel.parametermanager.PrivatePamParameterData; import PamView.GroupedSourceParameters; public class IshDetParams implements Serializable, Cloneable, ManagedParameters { diff --git a/src/IshmaelDetector/IshDetParamsDialog.java b/src/IshmaelDetector/IshDetParamsDialog.java index 8e737b8b..bdf9ab65 100644 --- a/src/IshmaelDetector/IshDetParamsDialog.java +++ b/src/IshmaelDetector/IshDetParamsDialog.java @@ -20,10 +20,7 @@ */ package IshmaelDetector; -import java.awt.BorderLayout; -import java.awt.Dimension; import java.awt.Frame; -import java.util.ArrayList; import javax.swing.BorderFactory; import javax.swing.BoxLayout; @@ -32,11 +29,8 @@ import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.border.EmptyBorder; -import PamController.PamController; import PamView.dialog.GroupedSourcePanel; import PamView.dialog.PamDialog; -import PamView.dialog.SourcePanel; -import PamguardMVC.PamDataBlock; public abstract class IshDetParamsDialog extends PamDialog { diff --git a/src/IshmaelDetector/IshDetSave.java b/src/IshmaelDetector/IshDetSave.java index 5b4c0266..e0be9309 100644 --- a/src/IshmaelDetector/IshDetSave.java +++ b/src/IshmaelDetector/IshDetSave.java @@ -6,7 +6,6 @@ package IshmaelDetector; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; -import PamguardMVC.PamObserver; import PamguardMVC.PamObserverAdapter; public class IshDetSave extends PamObserverAdapter @@ -23,6 +22,7 @@ public class IshDetSave extends PamObserverAdapter ishPeakDataBlock.addObserver(this); //call update() when unit added } + @Override public void addData(PamObservable o, PamDataUnit arg1) { IshDetection arg = (IshDetection)arg1; //inputData = arg.detData; @@ -35,10 +35,12 @@ public class IshDetSave extends PamObserverAdapter public void saveData() { } + @Override public String getObserverName() { return "File Saver for Energy Sum"; } + @Override public void setSampleRate(float sampleRate, boolean notify) { this.sampleRate = sampleRate; } diff --git a/src/IshmaelDetector/IshDetWrapper.java b/src/IshmaelDetector/IshDetWrapper.java index 73810088..dd16e826 100644 --- a/src/IshmaelDetector/IshDetWrapper.java +++ b/src/IshmaelDetector/IshDetWrapper.java @@ -1,7 +1,6 @@ package IshmaelDetector; import PamDetection.PamDetection; -import PamguardMVC.AcousticDataUnit; import PamguardMVC.PamDataUnit; /** diff --git a/src/IshmaelDetector/IshLogger.java b/src/IshmaelDetector/IshLogger.java index 6bd47109..ca2c7d0a 100644 --- a/src/IshmaelDetector/IshLogger.java +++ b/src/IshmaelDetector/IshLogger.java @@ -1,9 +1,5 @@ package IshmaelDetector; -import generalDatabase.PamTableDefinition; -import generalDatabase.PamTableItem; -import generalDatabase.SQLTypes; - import java.sql.Types; import PamguardMVC.PamDataBlock; @@ -12,6 +8,8 @@ import generalDatabase.EmptyTableDefinition; //import pamDatabase.SQLLogging; //import PamguardMVC.RecyclingDataBlock; import generalDatabase.PamDetectionLogging; +import generalDatabase.PamTableItem; +import generalDatabase.SQLTypes; public class IshLogger extends PamDetectionLogging { IshDetControl ishDetControl; diff --git a/src/IshmaelDetector/MatchFiltControl.java b/src/IshmaelDetector/MatchFiltControl.java index d49a53d2..a1e0fac1 100644 --- a/src/IshmaelDetector/MatchFiltControl.java +++ b/src/IshmaelDetector/MatchFiltControl.java @@ -52,6 +52,7 @@ public class MatchFiltControl extends IshDetControl implements PamSettings } class menuSmoothingDetection implements ActionListener { + @Override public void actionPerformed(ActionEvent ev) { } } @@ -77,6 +78,7 @@ public class MatchFiltControl extends IshDetControl implements PamSettings return super.restoreSettings(pamControlledUnitSettings); } + @Override public Serializable getSettingsReference() { return ishDetParams; } @@ -84,6 +86,7 @@ public class MatchFiltControl extends IshDetControl implements PamSettings /** * @return An integer version number for the settings */ + @Override public long getSettingsVersion() { return MatchFiltParams.serialVersionUID; } diff --git a/src/IshmaelDetector/MatchFiltParamsDialog.java b/src/IshmaelDetector/MatchFiltParamsDialog.java index 28aa086b..5ba13561 100644 --- a/src/IshmaelDetector/MatchFiltParamsDialog.java +++ b/src/IshmaelDetector/MatchFiltParamsDialog.java @@ -89,6 +89,7 @@ public class MatchFiltParamsDialog extends IshDetParamsDialog implements ActionL kernelFilenameBox.setSelectedIndex(0); } + @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == kernelFileButton) //user clicked "Select file" selectFile(); diff --git a/src/IshmaelDetector/MatchFiltProcess.java b/src/IshmaelDetector/MatchFiltProcess.java index 59ca4be7..59831198 100644 --- a/src/IshmaelDetector/MatchFiltProcess.java +++ b/src/IshmaelDetector/MatchFiltProcess.java @@ -8,10 +8,10 @@ import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import Acquisition.FileInputSystem; +import PamDetection.RawDataUnit; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; -import PamDetection.RawDataUnit; import fftManager.FFT; diff --git a/src/IshmaelDetector/SgramCorrControl.java b/src/IshmaelDetector/SgramCorrControl.java index dc55858f..a92f0642 100644 --- a/src/IshmaelDetector/SgramCorrControl.java +++ b/src/IshmaelDetector/SgramCorrControl.java @@ -15,7 +15,6 @@ import java.io.Serializable; import javax.swing.JMenuItem; -import IshmaelDetector.layoutFX.IshEnergyPaneFX; import IshmaelDetector.layoutFX.IshSpecCorrelationPaneFX; import PamController.PamControlledUnitSettings; import PamController.PamController; @@ -67,6 +66,7 @@ public class SgramCorrControl extends IshDetControl implements PamSettings } class menuSmoothingDetection implements ActionListener { + @Override public void actionPerformed(ActionEvent ev) { // KernelSmoothingParameters newParams = KernelSmoothingDialog.show(smoothingParameters, smoothingProcess.getOutputDataBlock(0)); // if (newParams != null) { @@ -120,6 +120,7 @@ public class SgramCorrControl extends IshDetControl implements PamSettings return super.restoreSettings(pamControlledUnitSettings); } + @Override public Serializable getSettingsReference() { return ishDetParams; } @@ -127,6 +128,7 @@ public class SgramCorrControl extends IshDetControl implements PamSettings /** * @return An integer version number for the settings */ + @Override public long getSettingsVersion() { return SgramCorrParams.serialVersionUID; } diff --git a/src/IshmaelDetector/SgramCorrParamsDialog.java b/src/IshmaelDetector/SgramCorrParamsDialog.java index b8c11de8..d3875328 100644 --- a/src/IshmaelDetector/SgramCorrParamsDialog.java +++ b/src/IshmaelDetector/SgramCorrParamsDialog.java @@ -21,6 +21,7 @@ package IshmaelDetector; import java.awt.Frame; + import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JCheckBox; diff --git a/src/IshmaelLocator/IshDetectionWrapper.java b/src/IshmaelLocator/IshDetectionWrapper.java index d60eac71..638295f5 100644 --- a/src/IshmaelLocator/IshDetectionWrapper.java +++ b/src/IshmaelLocator/IshDetectionWrapper.java @@ -1,6 +1,6 @@ package IshmaelLocator; -import java.util.*; +import java.util.HashMap; import IshmaelDetector.IshDetection; diff --git a/src/IshmaelLocator/IshLocControl.java b/src/IshmaelLocator/IshLocControl.java index 2fe02fc3..9eb5fb80 100644 --- a/src/IshmaelLocator/IshLocControl.java +++ b/src/IshmaelLocator/IshLocControl.java @@ -13,8 +13,6 @@ import java.io.Serializable; import javax.swing.JMenuItem; -import IshmaelDetector.IshDetection; -import IshmaelDetector.IshLogger; import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; import PamController.PamController; @@ -71,6 +69,7 @@ public class IshLocControl extends PamControlledUnit implements PamSettings { /** This is called after a settings file is read. The subclass should * get newParams and clone it as ishDetParams before calling here. */ + @Override public boolean restoreSettings(PamControlledUnitSettings settings) { IshLocParams newParams = (IshLocParams)settings.getSettings(); //I can't figure out why inputDataSource is not in the newParams @@ -97,6 +96,7 @@ public class IshLocControl extends PamControlledUnit implements PamSettings { public LocationActionListener(Frame parentFrame) { this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { PamDataBlock b = (ishLocProcessHy == null) ? null : ishLocProcessHy.outputDataBlock; @@ -120,6 +120,7 @@ public class IshLocControl extends PamControlledUnit implements PamSettings { } } + @Override public Serializable getSettingsReference() { return ishLocParams; } @@ -127,6 +128,7 @@ public class IshLocControl extends PamControlledUnit implements PamSettings { /** * @return An integer version number for the settings */ + @Override public long getSettingsVersion() { return IshLocParams.serialVersionUID; } diff --git a/src/IshmaelLocator/IshLocGraphics.java b/src/IshmaelLocator/IshLocGraphics.java index 579bd988..6d4f8ba8 100644 --- a/src/IshmaelLocator/IshLocGraphics.java +++ b/src/IshmaelLocator/IshLocGraphics.java @@ -6,8 +6,7 @@ package IshmaelLocator; import java.awt.Graphics2D; import java.awt.image.BufferedImage; - - +import IshmaelDetector.IshDetFnDataUnit; import Layout.DisplayPanel; import Layout.DisplayPanelContainer; import Layout.DisplayPanelProvider; @@ -19,7 +18,6 @@ import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamObserver; -import IshmaelDetector.IshDetFnDataUnit; /** * @author Hisham @@ -35,10 +33,12 @@ IshLocControl ishLocControl; this.ishLocControl = ishLocControl; } + @Override public DisplayPanel createDisplayPanel(DisplayPanelContainer displayPanelContainer) { return new IshDisplayPanel(this, displayPanelContainer); } + @Override public String getDisplayPanelName() { return ishLocControl.getUnitName() + " Graphics"; // return "Ishmael Graphics Panel"; @@ -80,19 +80,23 @@ IshLocControl ishLocControl; ishmaelDataHy.deleteObserver(this); } + @Override public String getObserverName() { return displayPanelProvider.getDisplayPanelName(); } + @Override public long getRequiredDataHistory(PamObservable o, Object arg) { return 0; } + @Override public void noteNewSettings() { // TODO Auto-generated method stub } + @Override public void removeObservable(PamObservable o) { // TODO Auto-generated method stub @@ -110,12 +114,14 @@ IshLocControl ishLocControl; } + @Override public void setSampleRate(float sampleRate, boolean notify) { this.sampleRate = sampleRate; } int lastX = 0; int lastY = 0; + @Override public void addData(PamObservable o, PamDataUnit dataUnit1) { /** diff --git a/src/IshmaelLocator/IshLocHyperbProcess.java b/src/IshmaelLocator/IshLocHyperbProcess.java index c2a01052..89a095d3 100644 --- a/src/IshmaelLocator/IshLocHyperbProcess.java +++ b/src/IshmaelLocator/IshLocHyperbProcess.java @@ -1,16 +1,12 @@ package IshmaelLocator; -import fftManager.FFT; -import Localiser.*; +import Localiser.DelayMeasurementParams; import Localiser.algorithms.Correlations; +import PamDetection.LocContents; import PamUtils.CoordUtils; import PamguardMVC.PamDataUnit; -import IshmaelLocator.IshLocProcess; -import IshmaelLocator.IshLocalisation; -import IshmaelLocator.LM; -import PamDetection.AbstractLocalisation; -import PamDetection.LocContents; +import fftManager.FFT; /** Two-hydrophone bearing calculation. diff --git a/src/IshmaelLocator/IshLocPairProcess.java b/src/IshmaelLocator/IshLocPairProcess.java index b5122a96..441c2b49 100644 --- a/src/IshmaelLocator/IshLocPairProcess.java +++ b/src/IshmaelLocator/IshLocPairProcess.java @@ -2,15 +2,12 @@ package IshmaelLocator; -import fftManager.FFT; -import Localiser.*; +import Localiser.DelayMeasurementParams; import Localiser.algorithms.Correlations; -import PamDetection.AbstractLocalisation; import PamDetection.LocContents; import PamUtils.CoordUtils; import PamguardMVC.PamDataUnit; -import IshmaelLocator.IshLocProcess; -import IshmaelLocator.IshLocalisation; +import fftManager.FFT; // import IshmaelDetector.OutputDataBlkIntfc; diff --git a/src/IshmaelLocator/IshLocParamsDialog.java b/src/IshmaelLocator/IshLocParamsDialog.java index 5a8f66ed..ca892f56 100644 --- a/src/IshmaelLocator/IshLocParamsDialog.java +++ b/src/IshmaelLocator/IshLocParamsDialog.java @@ -31,13 +31,13 @@ import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JCheckBox; import javax.swing.JLabel; -import javax.swing.JTextField; //import javax.swing.JButton; //import javax.swing.JCheckBox; //import javax.swing.JComboBox; //import javax.swing.JDialog; //import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.JTextField; //import javax.swing.JTextField; import javax.swing.border.EmptyBorder; @@ -48,7 +48,6 @@ import PamView.dialog.SourcePanel; import PamguardMVC.PamDataBlock; import warnings.PamWarning; import warnings.WarningSystem; -import whistlesAndMoans.AbstractWhistleDataUnit; public abstract class IshLocParamsDialog extends PamDialog implements ActionListener { @@ -112,6 +111,7 @@ public abstract class IshLocParamsDialog extends PamDialog implements ActionList public IshLocActionListener(Frame parentFrame) { this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { enableFromCheckBox(); } @@ -153,6 +153,7 @@ public abstract class IshLocParamsDialog extends PamDialog implements ActionList } */ + @Override public void actionPerformed(ActionEvent e) { //if (e.getSource() == sourceList) { //showChannelList(); diff --git a/src/IshmaelLocator/IshLocProcess.java b/src/IshmaelLocator/IshLocProcess.java index 9b34462d..bf0ce412 100644 --- a/src/IshmaelLocator/IshLocProcess.java +++ b/src/IshmaelLocator/IshLocProcess.java @@ -11,25 +11,24 @@ import Array.PamArray; import Array.SnapshotGeometry; import IshmaelDetector.IshDetControl; import IshmaelDetector.IshDetection; -import PamguardMVC.AcousticDataUnit; -import PamguardMVC.PamDataBlock; -import PamguardMVC.PamDataUnit; -import PamguardMVC.PamObservable; -import PamguardMVC.PamRawDataBlock; -import PamguardMVC.RawDataUnavailableException; import PamController.PamController; import PamDetection.PamDetection; import PamView.symbol.StandardSymbolManager; +import PamguardMVC.PamDataBlock; +import PamguardMVC.PamDataUnit; +import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; +import PamguardMVC.PamRawDataBlock; +import PamguardMVC.RawDataUnavailableException; +import Spectrogram.SpectrogramDisplay; +import Spectrogram.SpectrogramMarkObserver; +import Spectrogram.SpectrogramMarkObservers; +import dataPlotsFX.layout.TDGraphFX; import fftManager.Complex; import fftManager.FFTDataBlock; import pamMaths.PamVector; import warnings.PamWarning; import warnings.WarningSystem; -import Spectrogram.*; -import autecPhones.AutecGraphics; -import dataPlotsFX.data.TDDataInfoFX; -import dataPlotsFX.layout.TDGraphFX; /** Various location algorithms can fail to find a solution. If so, * they just throw this Exception. @@ -124,6 +123,7 @@ abstract public class IshLocProcess extends PamProcess implements SpectrogramMar } } + @Override public void setupProcess() { super.setupProcess(); outputDataBlock.setNaturalLifetime(300); @@ -180,6 +180,7 @@ abstract public class IshLocProcess extends PamProcess implements SpectrogramMar * @param durationMsec * @param f0,f1 frequency range of the selection */ + @Override public boolean spectrogramNotification(SpectrogramDisplay display, MouseEvent mouseEvent, int downUp, int channel, long startMsec, long durationMsec, double f0, double f1, TDGraphFX tdDisplay) { @@ -424,6 +425,7 @@ abstract public class IshLocProcess extends PamProcess implements SpectrogramMar outputDataBlock.addPamData(outputUnit); } + @Override public String getMarkObserverName() { return getProcessName(); } diff --git a/src/IshmaelLocator/IshLocSqlLogging.java b/src/IshmaelLocator/IshLocSqlLogging.java index c43539d0..bab26f9f 100644 --- a/src/IshmaelLocator/IshLocSqlLogging.java +++ b/src/IshmaelLocator/IshLocSqlLogging.java @@ -1,15 +1,7 @@ package IshmaelLocator; -import generalDatabase.PamTableDefinition; -import generalDatabase.PamTableItem; -import generalDatabase.SQLTypes; - import java.sql.Types; - - - -import Array.ArrayManager; import IshmaelDetector.IshDetection; import PamUtils.LatLong; import PamguardMVC.PamDataBlock; @@ -18,6 +10,8 @@ import generalDatabase.EmptyTableDefinition; //import pamDatabase.SQLLogging; //import PamguardMVC.RecyclingDataBlock; import generalDatabase.PamDetectionLogging; +import generalDatabase.PamTableItem; +import generalDatabase.SQLTypes; public class IshLocSqlLogging extends PamDetectionLogging { IshLocControl ishLocControl; diff --git a/src/IshmaelLocator/LM.java b/src/IshmaelLocator/LM.java index b5a21fd7..f083882a 100644 --- a/src/IshmaelLocator/LM.java +++ b/src/IshmaelLocator/LM.java @@ -284,7 +284,7 @@ public abstract class LM { //The original Fortran (and C) code had 'goto L300' statements. //Here we replace them with 'throw new L300()' in a try/catch block. - class L300 extends Exception { static final long serialVersionUID = 0; }; + class L300 extends Exception { static final long serialVersionUID = 0; } try { /* Check the input parameters for errors. @@ -551,7 +551,7 @@ public abstract class LM { */ } - } catch (L300 ex) {}; //this used to be labeled 'L300:' + } catch (L300 ex) {} //this used to be labeled 'L300:' /* Termination, either normal or user imposed. */ diff --git a/src/JSSHTerminal/Esc.java b/src/JSSHTerminal/Esc.java index 5ce7216b..b3dc585c 100644 --- a/src/JSSHTerminal/Esc.java +++ b/src/JSSHTerminal/Esc.java @@ -1,8 +1,9 @@ package JSSHTerminal; import static java.lang.annotation.ElementType.METHOD; -import java.lang.annotation.Retention; import static java.lang.annotation.RetentionPolicy.RUNTIME; + +import java.lang.annotation.Retention; import java.lang.annotation.Target; /** diff --git a/src/JSSHTerminal/GraphicTerminal.java b/src/JSSHTerminal/GraphicTerminal.java index 75989194..c32f676e 100644 --- a/src/JSSHTerminal/GraphicTerminal.java +++ b/src/JSSHTerminal/GraphicTerminal.java @@ -1,17 +1,14 @@ package JSSHTerminal; -import javax.imageio.ImageIO; -import javax.swing.*; -import java.awt.*; -import java.awt.datatransfer.Clipboard; -import java.awt.datatransfer.DataFlavor; -import java.awt.datatransfer.StringSelection; -import java.awt.datatransfer.UnsupportedFlavorException; -import java.awt.event.*; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import java.io.IOException; +import javax.imageio.ImageIO; + /** * Terminal component: Use bitmap font to render * @@ -64,7 +61,8 @@ public class GraphicTerminal extends TerminalEvent { } - public void dispose() { + @Override +public void dispose() { tmpImgG.dispose(); tmpImg = null; @@ -74,7 +72,8 @@ public class GraphicTerminal extends TerminalEvent { } - public void sizeComponent(int width,int height) { + @Override +public void sizeComponent(int width,int height) { //GraphicsEnvironment env = GraphicsEnvironment.getLocalGraphicsEnvironment(); //GraphicsDevice device = env.getDefaultScreenDevice(); @@ -85,7 +84,8 @@ public class GraphicTerminal extends TerminalEvent { } - public synchronized void drawComponent(Graphics g) { + @Override +public synchronized void drawComponent(Graphics g) { if (terminal == null) { g.setColor(Color.BLACK); diff --git a/src/JSSHTerminal/JSchSession.java b/src/JSSHTerminal/JSchSession.java index 5e28757a..fdcfc3e3 100644 --- a/src/JSSHTerminal/JSchSession.java +++ b/src/JSSHTerminal/JSchSession.java @@ -22,7 +22,11 @@ package JSSHTerminal; -import com.jcraft.jsch.*; +import com.jcraft.jsch.IdentityRepository; +import com.jcraft.jsch.JSch; +import com.jcraft.jsch.JSchException; +import com.jcraft.jsch.Proxy; +import com.jcraft.jsch.UserInfo; public class JSchSession { diff --git a/src/JSSHTerminal/MainPanel.java b/src/JSSHTerminal/MainPanel.java index 299265e2..9f8a854e 100644 --- a/src/JSSHTerminal/MainPanel.java +++ b/src/JSSHTerminal/MainPanel.java @@ -1,11 +1,20 @@ package JSSHTerminal; -import javax.swing.*; - -import java.awt.*; -import java.awt.event.*; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.event.AdjustmentEvent; +import java.awt.event.AdjustmentListener; +import java.awt.event.MouseWheelEvent; +import java.awt.event.MouseWheelListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; import java.io.IOException; +import javax.swing.JFrame; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollBar; + /** * SSH Terminal frame * diff --git a/src/JSSHTerminal/MultiTerminal.java b/src/JSSHTerminal/MultiTerminal.java index 115d13e4..b413f951 100644 --- a/src/JSSHTerminal/MultiTerminal.java +++ b/src/JSSHTerminal/MultiTerminal.java @@ -1,7 +1,7 @@ package JSSHTerminal; -import javax.swing.*; -import java.awt.*; +import java.awt.Dimension; +import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.WindowAdapter; @@ -11,6 +11,17 @@ import java.io.FileReader; import java.io.IOException; import java.util.prefs.Preferences; +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.JTextField; +import javax.swing.WindowConstants; + /** * Launch several terminal a place them on the screen */ @@ -115,7 +126,8 @@ public class MultiTerminal extends JFrame implements ActionListener { loadButton.setBounds(145, 145, 105, 25); addWindowListener(new WindowAdapter() { - public void windowClosing(WindowEvent e) { + @Override + public void windowClosing(WindowEvent e) { // Save pref prefs.put("HostList",hostList.getText()); prefs.put("User",userText.getText()); @@ -130,7 +142,7 @@ public class MultiTerminal extends JFrame implements ActionListener { setTitle("MultiTerminal"); pack(); setLocationRelativeTo(null); - setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setVisible(true); } diff --git a/src/JSSHTerminal/SSHSession.java b/src/JSSHTerminal/SSHSession.java index af5ccd56..3ce333a4 100644 --- a/src/JSSHTerminal/SSHSession.java +++ b/src/JSSHTerminal/SSHSession.java @@ -1,9 +1,25 @@ package JSSHTerminal; -import com.jcraft.jsch.*; +import java.io.BufferedReader; +import java.io.Closeable; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.Reader; +import java.io.Writer; -import javax.swing.*; -import java.io.*; +import javax.swing.JDialog; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JPasswordField; +import javax.swing.JTextField; +import javax.swing.WindowConstants; + +import com.jcraft.jsch.ChannelShell; +import com.jcraft.jsch.JSch; +import com.jcraft.jsch.JSchException; +import com.jcraft.jsch.UserInfo; /** * SSH session @@ -396,13 +412,14 @@ public final class SSHSession implements UserInfo { JOptionPane pane = new JOptionPane(panel, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION) { - public void selectInitialValue() { + @Override + public void selectInitialValue() { } }; JDialog dialog = pane.createDialog(_parent, message); - dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); + dialog.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); dialog.setVisible(true); Object o = pane.getValue(); diff --git a/src/JSSHTerminal/TerminalEmulator.java b/src/JSSHTerminal/TerminalEmulator.java index c1b2c486..8ccb5abe 100644 --- a/src/JSSHTerminal/TerminalEmulator.java +++ b/src/JSSHTerminal/TerminalEmulator.java @@ -1,5 +1,10 @@ package JSSHTerminal; +import static java.lang.Math.max; +import static java.lang.Math.min; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.util.Arrays; import java.util.HashMap; import java.util.Map; @@ -7,12 +12,6 @@ import java.util.Map.Entry; import java.util.regex.Matcher; import java.util.regex.Pattern; -import static java.lang.Math.max; -import static java.lang.Math.min; - -import java.lang.reflect.Method; -import java.lang.reflect.InvocationTargetException; - /** * Screen buffer and escape sequence handling * @@ -642,7 +641,7 @@ class Screen { return height+scrollFill; } -}; +} // ------------------------------------------------------------------------------------ @@ -1110,7 +1109,8 @@ public class TerminalEmulator { } private static final EscapeSequence NONE = new EscapeSequence() { - public void handle(TerminalEmulator t, String s, Matcher m) { + @Override + public void handle(TerminalEmulator t, String s, Matcher m) { } }; @@ -1145,7 +1145,8 @@ public class TerminalEmulator { if (esc != null) { for (String s : esc.value()) { ESCAPE_SEQUENCES.put(s, new EscapeSequence() { - public void handle(TerminalEmulator t, String s, Matcher m2) { + @Override + public void handle(TerminalEmulator t, String s, Matcher m2) { try { m.invoke(t); } catch (IllegalAccessException e) { @@ -1159,7 +1160,8 @@ public class TerminalEmulator { } if (m.getName().startsWith("csi_") && m.getName().length() == 5) { CSI_SEQUENCE.put(m.getName().charAt(4), new CsiSequence() { - void handle(TerminalEmulator t, int[] args) { + @Override + void handle(TerminalEmulator t, int[] args) { try { m.invoke(t, new Object[]{args}); } catch (IllegalAccessException e) { @@ -1192,7 +1194,8 @@ public class TerminalEmulator { REGEXP_ESCAPE_SEQUENCES.put( Pattern.compile("\u001B\\[\\??([0-9;]*)([@ABCDEFGHJKLMPSTXacdefghlmnqrstu`])"), new EscapeSequence() { - public void handle(TerminalEmulator t, String s2, Matcher m) { + @Override + public void handle(TerminalEmulator t, String s2, Matcher m) { String s = m.group(1); CsiSequence seq = CSI_SEQUENCE.get(m.group(2).charAt(0)); if (seq != null) { @@ -1217,7 +1220,8 @@ public class TerminalEmulator { // OSC Pattern.compile("\u001B\\]([0-9];[\\p{Alpha}\\p{Digit}\\p{Punct} ]*)\u0007"), new EscapeSequence() { - public void handle(TerminalEmulator t, String s2, Matcher m) { + @Override + public void handle(TerminalEmulator t, String s2, Matcher m) { try { String s = m.group(1); String[] tokens = s.split(";"); diff --git a/src/JSSHTerminal/TerminalEvent.java b/src/JSSHTerminal/TerminalEvent.java index 64d671bd..ec439d18 100644 --- a/src/JSSHTerminal/TerminalEvent.java +++ b/src/JSSHTerminal/TerminalEvent.java @@ -1,14 +1,25 @@ package JSSHTerminal; -import javax.swing.*; -import java.awt.*; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.StringSelection; import java.awt.datatransfer.UnsupportedFlavorException; -import java.awt.event.*; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; import java.io.IOException; +import javax.swing.JComponent; +import javax.swing.SwingUtilities; + /** * Terminal component super class * Handle events @@ -82,7 +93,8 @@ public abstract class TerminalEvent extends JComponent implements MouseListener, resizeComponent(width, height); addComponentListener(new ComponentAdapter() { - public void componentResized(ComponentEvent e) { + @Override + public void componentResized(ComponentEvent e) { resize(); } }); @@ -126,7 +138,8 @@ public abstract class TerminalEvent extends JComponent implements MouseListener, if(session!=null) session.resize(termWidth,termHeight); } - public Dimension getPreferredSize() { + @Override +public Dimension getPreferredSize() { return size; } @@ -155,7 +168,8 @@ public abstract class TerminalEvent extends JComponent implements MouseListener, } public abstract void drawComponent(Graphics g); - public void paint(Graphics g) { + @Override +public void paint(Graphics g) { //long t0 = System.currentTimeMillis(); drawComponent(g); @@ -175,7 +189,8 @@ public abstract class TerminalEvent extends JComponent implements MouseListener, } - public void processKeyEvent(KeyEvent e) { + @Override +public void processKeyEvent(KeyEvent e) { int id=e.getID(); diff --git a/src/JSSHTerminal/TextTerminal.java b/src/JSSHTerminal/TextTerminal.java index 619b60fc..8075c6c9 100644 --- a/src/JSSHTerminal/TextTerminal.java +++ b/src/JSSHTerminal/TextTerminal.java @@ -1,6 +1,9 @@ package JSSHTerminal; -import java.awt.*; +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Graphics2D; import java.awt.font.FontRenderContext; import java.awt.font.LineMetrics; import java.awt.geom.Rectangle2D; @@ -76,15 +79,18 @@ public class TextTerminal extends TerminalEvent { } - public void dispose() { + @Override +public void dispose() { dummyImg = null; } - public void sizeComponent(int width,int height) { + @Override +public void sizeComponent(int width,int height) { charBuffer = new char[width]; } - public synchronized void drawComponent(Graphics g) { + @Override +public synchronized void drawComponent(Graphics g) { Graphics2D g2 = (Graphics2D)g; diff --git a/src/KernelSmoothing/KernelSmoothingControl.java b/src/KernelSmoothing/KernelSmoothingControl.java index 2f5d3df4..29f0e027 100644 --- a/src/KernelSmoothing/KernelSmoothingControl.java +++ b/src/KernelSmoothing/KernelSmoothingControl.java @@ -88,6 +88,7 @@ public class KernelSmoothingControl extends PamControlledUnit implements PamSett this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent ev) { KernelSmoothingParameters newParams = KernelSmoothingDialog.showDialog(parentFrame, smoothingParameters, smoothingProcess.getOutputDataBlock(0)); @@ -99,14 +100,17 @@ public class KernelSmoothingControl extends PamControlledUnit implements PamSett } } + @Override public Serializable getSettingsReference() { return smoothingParameters; } + @Override public long getSettingsVersion() { return KernelSmoothingParameters.serialVersionUID; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { smoothingParameters = ((KernelSmoothingParameters) pamControlledUnitSettings.getSettings()).clone(); newSettings(); diff --git a/src/KernelSmoothing/KernelSmoothingDialog.java b/src/KernelSmoothing/KernelSmoothingDialog.java index fc98293a..fd8b8a91 100644 --- a/src/KernelSmoothing/KernelSmoothingDialog.java +++ b/src/KernelSmoothing/KernelSmoothingDialog.java @@ -8,12 +8,11 @@ import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JPanel; -import fftManager.FFTDataUnit; - import PamController.PamController; import PamView.dialog.PamDialog; import PamView.dialog.SourcePanel; import PamguardMVC.PamDataBlock; +import fftManager.FFTDataUnit; /** * Dialog for smoothing kernel options. diff --git a/src/KernelSmoothing/KernelSmoothingProcess.java b/src/KernelSmoothing/KernelSmoothingProcess.java index aa27a27b..6883d2a6 100644 --- a/src/KernelSmoothing/KernelSmoothingProcess.java +++ b/src/KernelSmoothing/KernelSmoothingProcess.java @@ -22,12 +22,11 @@ package KernelSmoothing; import PamUtils.PamUtils; import PamUtils.complex.ComplexArray; -import PamguardMVC.ProcessAnnotation; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; -import fftManager.Complex; +import PamguardMVC.ProcessAnnotation; import fftManager.FFTDataBlock; import fftManager.FFTDataUnit; diff --git a/src/Layout/DisplayPanel.java b/src/Layout/DisplayPanel.java index 7a623ae4..c98b5886 100644 --- a/src/Layout/DisplayPanel.java +++ b/src/Layout/DisplayPanel.java @@ -329,7 +329,7 @@ abstract public class DisplayPanel { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); - if (isShowing() == false) return; + if (!isShowing()) return; if (getWidth() != imageWidth || getHeight() != imageHeight) { displayPanel.createImage(); diff --git a/src/Layout/DisplayProviderList.java b/src/Layout/DisplayProviderList.java index b35118de..95fc1b80 100644 --- a/src/Layout/DisplayProviderList.java +++ b/src/Layout/DisplayProviderList.java @@ -20,7 +20,7 @@ public class DisplayProviderList { static ArrayList displayPanelProviders = new ArrayList(); public static void addDisplayPanelProvider(DisplayPanelProvider displayPanelProvider) { - if (displayPanelProviders.contains(displayPanelProvider) == false) { + if (!displayPanelProviders.contains(displayPanelProvider)) { displayPanelProviders.add(displayPanelProvider); } } diff --git a/src/Layout/PamAxis.java b/src/Layout/PamAxis.java index c0aa2d81..34ac854c 100644 --- a/src/Layout/PamAxis.java +++ b/src/Layout/PamAxis.java @@ -853,7 +853,7 @@ public class PamAxis { interval = Math.log10(interval); int iint = (int) interval; double baseinterval = Math.pow(10., iint); - if (allowScaleMultiples == false || fractionalScale) { + if (!allowScaleMultiples || fractionalScale) { baseinterval = 1; interval = Math.abs(intervals[intervals.length-1]); } @@ -1131,7 +1131,7 @@ public class PamAxis { public double getPosition(double dataValue) { // totalPixs = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)); double pixs; - if (logScale == false) { + if (!logScale) { pixs = totalPixs * (dataValue - getMinVal()) / (getMaxVal() - getMinVal()); } else { @@ -1162,7 +1162,7 @@ public class PamAxis { public double getOuterPosition(double dataValue) { // totalPixs = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)); double pixs; - if (logScale == false) { + if (!logScale) { pixs = totalPixs * (dataValue - getMinVal()) / (getMaxVal() - getMinVal()); } else { @@ -1198,7 +1198,7 @@ public class PamAxis { if (x1 == x2) { position = totalPixs - position; // y axis, so go from other side. } - if (logScale == false) { + if (!logScale) { dataValue = position * (getMaxVal() - getMinVal()) / totalPixs + getMinVal(); } else { diff --git a/src/Layout/PamFramePlots.java b/src/Layout/PamFramePlots.java index ca589791..2bb58fb6 100644 --- a/src/Layout/PamFramePlots.java +++ b/src/Layout/PamFramePlots.java @@ -21,6 +21,7 @@ package Layout; import java.awt.Component; + import javax.swing.JMenuItem; import PamView.ClipboardCopier; diff --git a/src/Localiser/ModelControlPanel.java b/src/Localiser/ModelControlPanel.java index 2b63bfa6..e5d5249d 100644 --- a/src/Localiser/ModelControlPanel.java +++ b/src/Localiser/ModelControlPanel.java @@ -11,6 +11,7 @@ import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JPanel; + import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; import PamguardMVC.PamDataUnit; diff --git a/src/Map/GebcoMapFile.java b/src/Map/GebcoMapFile.java index acb2112c..0ae4c3f6 100644 --- a/src/Map/GebcoMapFile.java +++ b/src/Map/GebcoMapFile.java @@ -31,6 +31,7 @@ public class GebcoMapFile implements MapFileManager { /* (non-Javadoc) * @see Map.MapFile#selectMapFile() */ + @Override public File selectMapFile(File currentFile) { JFileChooser fileChooser; File gebcoFile= null; @@ -77,6 +78,7 @@ public class GebcoMapFile implements MapFileManager { return gebcoFile; } + @Override public boolean readFileData(File file, boolean contours) { return readMapFile(file, contours); } @@ -84,6 +86,7 @@ public class GebcoMapFile implements MapFileManager { /* (non-Javadoc) * @see Map.MapFile#readFileData(java.io.File) */ + @Override public boolean readFileData(File file) { try { return readMapFile(file, true); @@ -100,7 +103,7 @@ public class GebcoMapFile implements MapFileManager { mapContours.removeAllElements(); - if (gebcoFile == null || gebcoFile.exists() == false) return false; + if (gebcoFile == null || !gebcoFile.exists()) return false; FileReader fileReader = null; BufferedReader reader; @@ -149,7 +152,7 @@ public class GebcoMapFile implements MapFileManager { mapContour.addLatLong(new LatLong(lat, lon)); } if (depth == 0 || readContours) { - if (hasMapContour(depth) == false) { + if (!hasMapContour(depth)) { availableContours.add(depth); } mapContours.add(mapContour); @@ -184,6 +187,7 @@ public class GebcoMapFile implements MapFileManager { /* (non-Javadoc) * @see Map.MapFileManager#getContourIndex(double) */ + @Override public int getContourIndex(double depth) { for (int i = 0; i < availableContours.size(); i++) { if (availableContours.get(i) == depth) { @@ -205,6 +209,7 @@ public class GebcoMapFile implements MapFileManager { /* (non-Javadoc) * @see Map.MapFile#getAvailableContours() */ + @Override public Vector getAvailableContours() { return availableContours; } @@ -212,6 +217,7 @@ public class GebcoMapFile implements MapFileManager { /* (non-Javadoc) * @see Map.MapFileManager#getContourCount() */ + @Override public int getContourCount() { if (mapContours == null) return 0; return mapContours.size(); @@ -220,6 +226,7 @@ public class GebcoMapFile implements MapFileManager { /* (non-Javadoc) * @see Map.MapFile#getMapContour(int) */ + @Override public MapContour getMapContour(int contourIndex) { return mapContours.get(contourIndex); } @@ -227,6 +234,7 @@ public class GebcoMapFile implements MapFileManager { /* (non-Javadoc) * @see Map.MapFileManager#clearFileData() */ + @Override public void clearFileData() { mapContours.removeAllElements(); availableContours.removeAllElements(); diff --git a/src/Map/GpsTextDisplay.java b/src/Map/GpsTextDisplay.java index eecf3fe5..4e6dfb22 100644 --- a/src/Map/GpsTextDisplay.java +++ b/src/Map/GpsTextDisplay.java @@ -20,12 +20,9 @@ */ package Map; -import geoMag.MagneticVariation; - import java.awt.Color; import java.awt.Component; import java.awt.Dimension; -import java.awt.Font; import java.awt.Graphics; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -48,6 +45,7 @@ import PamUtils.LatLong; import PamUtils.PamCalendar; import PamView.PamColors; import PamView.PamColors.PamColor; +import geoMag.MagneticVariation; public class GpsTextDisplay extends JPanel { diff --git a/src/Map/MapCommentDialog.java b/src/Map/MapCommentDialog.java index e7967a00..17dfe36f 100644 --- a/src/Map/MapCommentDialog.java +++ b/src/Map/MapCommentDialog.java @@ -57,7 +57,7 @@ public class MapCommentDialog extends PamView.dialog.PamDialog { @Override public void setVisible(boolean visible) { - if (visible == true) { + if (visible) { // now positions it close to the mouse click. // but make sure it's still on the window. Point newPoint = new Point(mapPoint); @@ -121,6 +121,7 @@ public class MapCommentDialog extends PamView.dialog.PamDialog { class TextListener implements KeyListener { + @Override public void keyPressed(KeyEvent e) { //if(e.getKeyText(e.getKeyCode())=="Enter"){ if(e.getKeyCode()==KeyEvent.VK_ENTER){ @@ -128,10 +129,12 @@ public class MapCommentDialog extends PamView.dialog.PamDialog { } } + @Override public void keyReleased(KeyEvent e) { // TODO Auto-generated method stub } + @Override public void keyTyped(KeyEvent e) { diff --git a/src/Map/MapCommentOverlayGraphics.java b/src/Map/MapCommentOverlayGraphics.java index aef44d4c..b065f512 100644 --- a/src/Map/MapCommentOverlayGraphics.java +++ b/src/Map/MapCommentOverlayGraphics.java @@ -8,11 +8,11 @@ import PamUtils.Coordinate3d; import PamUtils.LatLong; import PamUtils.PamCalendar; import PamView.GeneralProjector; +import PamView.GeneralProjector.ParameterType; +import PamView.GeneralProjector.ParameterUnits; import PamView.PamDetectionOverlayGraphics; import PamView.PamSymbol; import PamView.PamSymbolType; -import PamView.GeneralProjector.ParameterType; -import PamView.GeneralProjector.ParameterUnits; import PamView.symbol.SymbolData; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; diff --git a/src/Map/MapCommentSQLLogging.java b/src/Map/MapCommentSQLLogging.java index 4fe30cc1..6c18648a 100644 --- a/src/Map/MapCommentSQLLogging.java +++ b/src/Map/MapCommentSQLLogging.java @@ -2,12 +2,12 @@ package Map; import java.sql.Types; +import PamUtils.LatLong; +import PamguardMVC.PamDataUnit; import generalDatabase.PamTableDefinition; import generalDatabase.PamTableItem; import generalDatabase.SQLLogging; import generalDatabase.SQLTypes; -import PamUtils.LatLong; -import PamguardMVC.PamDataUnit; public class MapCommentSQLLogging extends SQLLogging { diff --git a/src/Map/MapController.java b/src/Map/MapController.java index fec3506b..4f45be9c 100644 --- a/src/Map/MapController.java +++ b/src/Map/MapController.java @@ -9,26 +9,18 @@ import java.util.ArrayList; import javax.swing.JMenu; import javax.swing.JMenuBar; -import javax.swing.JMenuItem; import javax.swing.Timer; -import userDisplay.UserDisplayControl; - -import Array.ArrayManager; -import Array.PamArray; import GPS.GPSControl; -import GPS.GpsData; -import GPS.GpsDataUnit; import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; import PamController.PamController; -import PamController.PamControllerInterface; import PamController.PamSettingManager; import PamController.PamSettings; import PamUtils.LatLong; import PamUtils.MapContourValues; import PamView.PamGui; -import PamguardMVC.PamDataUnit; +import userDisplay.UserDisplayControl; public class MapController extends PamControlledUnit implements PamSettings { @@ -121,6 +113,7 @@ public class MapController extends PamControlledUnit implements PamSettings { this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent ev) { //getMapFile.openMapDialog(); if (getMapFile.openMapDialog() != null){ diff --git a/src/Map/MapDetectionsDialog.java b/src/Map/MapDetectionsDialog.java index ed79530d..a6e5a3a1 100644 --- a/src/Map/MapDetectionsDialog.java +++ b/src/Map/MapDetectionsDialog.java @@ -9,7 +9,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.text.DecimalFormat; -import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JLabel; @@ -17,7 +16,6 @@ import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.border.TitledBorder; -import org.kordamp.ikonli.materialdesign2.MaterialDesignC; import org.kordamp.ikonli.swing.FontIcon; import PamController.PamController; @@ -207,6 +205,7 @@ public class MapDetectionsDialog extends PamDialog { iOverlay = overlay; } + @Override public void actionPerformed(ActionEvent e) { enableRow(iOverlay); } @@ -216,15 +215,15 @@ public class MapDetectionsDialog extends PamDialog { boolean e = plotCheckBox[iOverlay].isSelected(); boolean e2 = allAvailable[iOverlay].isSelected(); boolean viewer = PamController.getInstance().getRunMode() == PamController.RUN_PAMVIEW; - showTimes[iOverlay].setEnabled(e && e2 == false); - defaults[iOverlay].setEnabled(e && e2 == false); + showTimes[iOverlay].setEnabled(e && !e2); + defaults[iOverlay].setEnabled(e && !e2); allAvailable[iOverlay].setEnabled(e); PamDataBlock pdb = mapDetectionsParameters.mapDetectionDatas.get(iOverlay).dataBlock; boolean e3 = e & pdb.getDataSelectCreator() != null; options[iOverlay].setEnabled(e3); options[iOverlay].setVisible(pdb.getDataSelectCreator() != null); - fades[iOverlay].setEnabled(e == true && e2 == false); - if (fades[iOverlay].isEnabled() == false) { + fades[iOverlay].setEnabled(e && !e2); + if (!fades[iOverlay].isEnabled()) { fades[iOverlay].setSelected(false); } } @@ -237,6 +236,7 @@ public class MapDetectionsDialog extends PamDialog { iOverlay = overlay; } + @Override public void actionPerformed(ActionEvent e) { showTimes[iOverlay].setText(String.format("%d", mapDetectionsManager.getDefaultTime())); @@ -253,6 +253,7 @@ public class MapDetectionsDialog extends PamDialog { iOverlay = overlay; } + @Override public void actionPerformed(ActionEvent e) { enableRow(iOverlay); diff --git a/src/Map/MapDetectionsManager.java b/src/Map/MapDetectionsManager.java index 54856a9e..36a1190e 100644 --- a/src/Map/MapDetectionsManager.java +++ b/src/Map/MapDetectionsManager.java @@ -7,6 +7,7 @@ import java.util.Comparator; import PamController.PamControlledUnitSettings; import PamController.PamController; +import PamController.PamControllerInterface; import PamController.PamSettingManager; import PamController.PamSettings; import PamguardMVC.PamDataBlock; @@ -56,12 +57,12 @@ public class MapDetectionsManager implements PamSettings { * createblocksList searches units for plottable blocks, it can't actually find them ! */ switch (changeType) { - case PamController.INITIALIZATION_COMPLETE: + case PamControllerInterface.INITIALIZATION_COMPLETE: initialisationComplete = true; - case PamController.ADD_DATABLOCK: - case PamController.REMOVE_DATABLOCK: - case PamController.ADD_CONTROLLEDUNIT: - case PamController.REMOVE_CONTROLLEDUNIT: + case PamControllerInterface.ADD_DATABLOCK: + case PamControllerInterface.REMOVE_DATABLOCK: + case PamControllerInterface.ADD_CONTROLLEDUNIT: + case PamControllerInterface.REMOVE_CONTROLLEDUNIT: if (initialisationComplete) { createBlockList(); } @@ -196,22 +197,27 @@ public class MapDetectionsManager implements PamSettings { * functions for storing of settings ... */ + @Override public Serializable getSettingsReference() { return mapDetectionsParameters; } + @Override public long getSettingsVersion() { return MapDetectionsParameters.serialVersionUID; } + @Override public String getUnitName() { return mapControl.getUnitName(); } + @Override public String getUnitType() { return "Map Detections Manager"; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { mapDetectionsParameters = ((MapDetectionsParameters) pamControlledUnitSettings.getSettings()).clone(); return true; diff --git a/src/Map/MapDetectionsParameters.java b/src/Map/MapDetectionsParameters.java index bfc72e9b..4851abb2 100644 --- a/src/Map/MapDetectionsParameters.java +++ b/src/Map/MapDetectionsParameters.java @@ -2,7 +2,6 @@ package Map; import java.io.Serializable; import java.util.ArrayList; -import java.util.Iterator; import java.util.ListIterator; import PamModel.parametermanager.ManagedParameters; @@ -21,7 +20,7 @@ public class MapDetectionsParameters implements Serializable, Cloneable, Managed static public final long serialVersionUID = 0; - protected ArrayList mapDetectionDatas = new ArrayList();; + protected ArrayList mapDetectionDatas = new ArrayList(); @Override public MapDetectionsParameters clone() { diff --git a/src/Map/MapDisplayProvider.java b/src/Map/MapDisplayProvider.java index b7621150..111d4655 100644 --- a/src/Map/MapDisplayProvider.java +++ b/src/Map/MapDisplayProvider.java @@ -1,7 +1,5 @@ package Map; -import java.awt.Component; - import pamScrollSystem.PamScrollSlider; import userDisplay.UserDisplayComponent; import userDisplay.UserDisplayControl; diff --git a/src/Map/MapPanel.java b/src/Map/MapPanel.java index e18e67af..b44f4f09 100644 --- a/src/Map/MapPanel.java +++ b/src/Map/MapPanel.java @@ -47,6 +47,7 @@ import javax.swing.JCheckBoxMenuItem; import javax.swing.JFrame; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; + import Array.ArrayManager; import Array.PamArray; import Array.SnapshotGeometry; @@ -70,12 +71,12 @@ import PamView.ColorManaged; import PamView.ColourArray; import PamView.ColourScheme; import PamView.PamColors; +import PamView.PamColors.PamColor; import PamView.PamKeyItem; import PamView.PamSymbol; import PamView.PamSymbolType; import PamView.PanelOverlayDraw; import PamView.SymbolKeyItem; -import PamView.PamColors.PamColor; import PamView.panel.JPanelWithPamKey; import PamView.panel.KeyPanel; import PamView.paneloverlay.OverlayCheckboxMenuItem; @@ -84,7 +85,6 @@ import PamView.paneloverlay.overlaymark.MarkOverlayDraw; import PamView.symbol.PamSymbolChooser; import PamView.symbol.PamSymbolManager; import PamView.symbol.SymbolData; -import PamView.symbol.modifier.SymbolModifier; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; @@ -211,7 +211,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana @Override public void paintComponent(Graphics g) { - if (isShowing() == false || g == null) + if (!isShowing() || g == null) return; super.paintComponent(g); @@ -246,7 +246,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana */ if (repaintBase || lastHeight != getHeight() || lastWidth != getWidth() || lastMapRangeMetres != mapRangeMetres || lastMapRotationDegrees != rectProj.getMapRotationDegrees() - || lastMapCentreDegrees.equals(mapCentreDegrees) == false) { + || !lastMapCentreDegrees.equals(mapCentreDegrees)) { lastHeight = getHeight(); lastWidth = getWidth(); lastMapCentreDegrees = mapCentreDegrees.clone(); @@ -397,7 +397,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana } if (grid != null) { - if (simpleMapRef.mapParameters.hideGrid == false) { + if (!simpleMapRef.mapParameters.hideGrid) { grid.drawGrid(g, rectProj); } myCompass.drawCompass(g, rectProj); @@ -469,7 +469,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana } private void drawRotatedSurface(Graphics2D g) { - double mapScale = 2 * Math.PI * rectProj.EARTHRADIUS * rectProj.pixelsPerMetre / 360.0; + double mapScale = 2 * Math.PI * MapRectProjector.EARTHRADIUS * rectProj.pixelsPerMetre / 360.0; mapScale = rectProj.pixelsPerMetre; int[] px = new int[4]; int[] py = new int[4]; @@ -502,7 +502,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana * @return true if the entire surface should be filled, not a rated rectangle. */ public boolean isFillSurface() { - return (rectProj.getMapVerticalRotationDegrees() == 0. && simpleMapRef.getMapParameters().hideSurface == false); + return (rectProj.getMapVerticalRotationDegrees() == 0. && !simpleMapRef.getMapParameters().hideSurface); } /** @@ -660,7 +660,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana } private void paintContours(Graphics g) { - if (prepareContourData() == false) { + if (!prepareContourData()) { return; } MapFileManager mapManager = simpleMapRef.mapFileManager; @@ -806,7 +806,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana } public EffortProvider findEffortProvider() { - if (simpleMapRef.mapParameters.colourByEffort == false) { + if (!simpleMapRef.mapParameters.colourByEffort) { return null; } if (simpleMapRef.effortDataBlock == null) { @@ -924,7 +924,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana } gpsData = dataUnit.getGpsData(); - if (gpsData.isDataOk() == false) { + if (!gpsData.isDataOk()) { continue; } c2 = rectProj.getCoord3d(gpsData.getLatitude(), gpsData.getLongitude(), 0.); @@ -1169,7 +1169,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana if (mapDetectionData == null) { return; // this should never happen ! } - if (mapDetectionData.select == false) { + if (!mapDetectionData.select) { return; } if (mapDetectionData.fade) { @@ -1191,10 +1191,10 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana rectProj.setPamSymbolChooser(null); } boolean contin = dataBlock.getOverlayDraw().preDrawAnything(g, dataBlock, rectProj); - if (contin == false) { + if (!contin) { return; } - if (mapDetectionData.allAvailable == true) { + if (mapDetectionData.allAvailable) { earliestToPlot = 0; } else if (sliderVal != null) { earliestToPlot = now - 1000 * sliderVal; @@ -1210,7 +1210,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana } // tempDataUnitId = dataBlock.getDataName() + ", " // + dataBlock.getParentProcess().getProcessName(); - if (mapDetectionData.select == false) { + if (!mapDetectionData.select) { return; } ds = dataBlock.getDataSelector(simpleMapRef.getUnitName(), false, DATASELECTNAME); @@ -1223,7 +1223,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana // dataUnit.getLastChangeTime() < earliestToPlot) { // continue; // functionality moved into shouldPlot. // } - if (simpleMapRef.shouldPlot(dataUnit, mapDetectionData, earliestToPlot, now, null) == false) { + if (!simpleMapRef.shouldPlot(dataUnit, mapDetectionData, earliestToPlot, now, null)) { continue; } rectProj.setDataSelector(ds); @@ -1394,6 +1394,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana repaint(250); } + @Override public String getObserverName() { return "Map Panel"; } @@ -1479,10 +1480,10 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana } protected void createKey() { - if (PamController.getInstance().isInitializationComplete() == false) { + if (!PamController.getInstance().isInitializationComplete()) { return; } - if (simpleMapRef.mapParameters.showKey == false) { + if (!simpleMapRef.mapParameters.showKey) { // keyPanel.getPanel().setVisible(false); this.setKeyPanel(null); return; @@ -1499,7 +1500,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana dataBlock = detectorDataBlocks.get(m); // tempDataUnitId = detectorDataBlocks.get(m).getDataName() + ", " // + detectorDataBlocks.get(m).getParentProcess().getProcessName(); - if (dataBlock.canDraw(rectProj) == false) + if (!dataBlock.canDraw(rectProj)) continue; if (simpleMapRef.shouldPlot(dataBlock)) { SymbolData symbolData = null; @@ -1530,7 +1531,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana // private Color[] contourColours = null; // private int[] contourDepths = null; for (int i = 0; i < wantedContours.length; i++) { - if (wantedContours[i] == false) { + if (!wantedContours[i]) { continue; } keyPanel.add(createContourKeyItem(contourDepths[i], contourColours[i])); @@ -1685,6 +1686,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana JCheckBoxMenuItem panZoomMenu, showGpsMenu, showKeyMenu; class ShowKey implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { simpleMapRef.mapParameters.showKey = showKeyMenu.isSelected(); createKey(); @@ -1692,6 +1694,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana } class ShowPanZoom implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { simpleMapRef.mapParameters.showPanZoom = panZoomMenu.isSelected(); simpleMapRef.showMapObjects(); @@ -1699,6 +1702,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana } class ShowGpsMenu implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { simpleMapRef.mapParameters.showGpsData = showGpsMenu.isSelected(); simpleMapRef.showMapObjects(); @@ -1713,6 +1717,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana this.mapDetectionData = mapDetectionData; } + @Override public void actionPerformed(ActionEvent e) { OverlayCheckboxMenuItem menuItem = (OverlayCheckboxMenuItem) e.getSource(); Point mousePoint = MouseInfo.getPointerInfo().getLocation(); @@ -1767,6 +1772,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana class OverlayOptions implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { Frame frame = (JFrame) PamController.getMainFrame(); if (mapController.getPamView() != null) { @@ -1855,11 +1861,13 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana // } class SettingsAction implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { // spectrogramDisplay.SetSettings(); } } + @Override public long getRequiredDataHistory(PamObservable o, Object arg) { MapDetectionData mdd = simpleMapRef.mapDetectionsManager.findDetectionData((PamDataBlock) o); if (mdd != null) { @@ -1869,6 +1877,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana } } + @Override public void noteNewSettings() { createKey(); } @@ -1895,6 +1904,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana this.setMapRangeMetres(newVal); } + @Override public void removeObservable(PamObservable o) { } @@ -1994,7 +2004,7 @@ public class MapPanel extends JPanelWithPamKey implements PamObserver, ColorMana if (tip == null) { return tip; } - if (tip.startsWith("GPS") == false) { + if (!tip.startsWith("GPS")) { return tip; } diff --git a/src/Map/MapParameters.java b/src/Map/MapParameters.java index 77bf309e..a9ff7823 100644 --- a/src/Map/MapParameters.java +++ b/src/Map/MapParameters.java @@ -22,13 +22,11 @@ package Map; import java.io.File; import java.io.Serializable; -import java.lang.reflect.Field; import Array.Hydrophone; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet.ParameterSetType; -import PamModel.parametermanager.PrivatePamParameterData; public class MapParameters implements Serializable, Cloneable, ManagedParameters { diff --git a/src/Map/MapParametersDialog.java b/src/Map/MapParametersDialog.java index 20a9c0c0..dbd71048 100644 --- a/src/Map/MapParametersDialog.java +++ b/src/Map/MapParametersDialog.java @@ -3,7 +3,6 @@ package Map; import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.FlowLayout; -import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.GridLayout; @@ -24,6 +23,7 @@ import javax.swing.JSpinner; import javax.swing.JTabbedPane; import javax.swing.JTextField; import javax.swing.SpinnerNumberModel; +import javax.swing.SwingConstants; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; @@ -32,7 +32,6 @@ import Map.gridbaselayer.GridDialogPanel; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; import PamView.dialog.SettingsButton; -import PamView.dialog.SourcePanel; import PamView.panel.PamNorthPanel; import PamguardMVC.PamDataBlock; import effort.EffortProvider; @@ -157,7 +156,7 @@ public class MapParametersDialog extends PamDialog { keepShipOnMap.setSelected(mapParameters.keepShipOnMap); keepShipCentred.setSelected(mapParameters.keepShipCentred); headingUp.setSelected(mapParameters.headingUp); - showSurface.setSelected(mapParameters.hideSurface == false); + showSurface.setSelected(!mapParameters.hideSurface); colourByEffort.setSelected(mapParameters.colourByEffort); effortSourcePanel.setSource(mapParameters.effortDataSource); @@ -187,7 +186,7 @@ public class MapParametersDialog extends PamDialog { mapParameters.keepShipOnMap = keepShipOnMap.isSelected(); mapParameters.keepShipCentred = keepShipCentred.isSelected(); mapParameters.headingUp = headingUp.isSelected(); - mapParameters.hideSurface = showSurface.isSelected() == false; + mapParameters.hideSurface = !showSurface.isSelected(); mapParameters.symbolSize = forceEven((Integer) symbolSize.getValue()); mapParameters.showRangeRings = ringsType.getSelectedIndex(); if (mapParameters.showRangeRings > 0) { @@ -206,7 +205,7 @@ public class MapParametersDialog extends PamDialog { mapParameters.mapContours = filePanel.getContoursList(); mapParameters.allow3D = allow3D.isSelected(); mapParameters.hideGrid = !showGrid.isSelected(); - if (gridDialogPanel.getParams() == false) { + if (!gridDialogPanel.getParams()) { return false; } return true; @@ -258,12 +257,12 @@ public class MapParametersDialog extends PamDialog { addComponent(this, colourByEffort, constraints); constraints.gridx += 2; constraints.gridwidth = 1; - constraints.fill = constraints.NONE; - constraints.anchor = constraints.LINE_END; + constraints.fill = GridBagConstraints.NONE; + constraints.anchor = GridBagConstraints.LINE_END; addComponent(this, effortSettings, constraints); constraints.gridx = 0; constraints.gridy ++; - constraints.anchor = constraints.LINE_START; + constraints.anchor = GridBagConstraints.LINE_START; addComponent(this,new JLabel("Data storage time "), constraints); constraints.gridx ++; addComponent(this,dataKeepTime = new JTextField(7), constraints); @@ -271,7 +270,7 @@ public class MapParametersDialog extends PamDialog { addComponent(this,new JLabel(" s "), constraints); constraints.gridx++; constraints.gridwidth = 3; - constraints.fill = constraints.HORIZONTAL; + constraints.fill = GridBagConstraints.HORIZONTAL; addComponent(this, effortSourcePanel.getPanel(), constraints); constraints.gridx = 0; constraints.gridy ++; @@ -326,7 +325,7 @@ public class MapParametersDialog extends PamDialog { addComponent(this, colourByChannel, c); c.gridy++; c.gridwidth = 1; - addComponent(this, new JLabel("Symbol size ", JLabel.RIGHT), c); + addComponent(this, new JLabel("Symbol size ", SwingConstants.RIGHT), c); c.gridx++; symbolSize = new SpinnerNumberModel(Hydrophone.DefaultSymbolSize, 4, 30, 2); addComponent(this, symbolSizeSpinner = new JSpinner(symbolSize), c); @@ -359,7 +358,7 @@ public class MapParametersDialog extends PamDialog { ringsPanel.setBorder(new TitledBorder("Range Rings")); ringsPanel.setLayout(new GridBagLayout()); GridBagConstraints c = new PamGridBagContraints(); - ringsPanel.add(new JLabel("Show ", JLabel.RIGHT), c); + ringsPanel.add(new JLabel("Show ", SwingConstants.RIGHT), c); c.gridx++; ringsPanel.add(ringsType = new JComboBox(), c); ringsType.addItem("No range rings"); @@ -368,7 +367,7 @@ public class MapParametersDialog extends PamDialog { ringsType.addItem("Rings in Nautical miles"); c.gridx = 0; c.gridy++; - ringsPanel.add(new JLabel("Sepration ", JLabel.RIGHT), c); + ringsPanel.add(new JLabel("Sepration ", SwingConstants.RIGHT), c); c.gridx++; ringsPanel.add(ringsRange = new JTextField(6), c); ringsType.addActionListener(new ActionListener() { @@ -507,21 +506,25 @@ public class MapParametersDialog extends PamDialog { } } private class BrowseButton implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { browseMaps(); } } private class ClearButton implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { clearMap(); } } private class AllButton implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { selectAllContours(true); } } private class NoneButton implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { selectAllContours(false); } diff --git a/src/Map/MapRectProjector.java b/src/Map/MapRectProjector.java index 41550890..7620d126 100644 --- a/src/Map/MapRectProjector.java +++ b/src/Map/MapRectProjector.java @@ -28,12 +28,10 @@ import java.util.ListIterator; import GPS.GPSControl; import GPS.GPSDataBlock; import GPS.GpsDataUnit; -import PamController.PamController; import PamUtils.Coordinate3d; import PamUtils.LatLong; import PamUtils.PamCoordinate; import PamUtils.PamUtils; -import PamguardMVC.debug.Debug; import effort.EffortDataUnit; /** diff --git a/src/Map/PamZoomOnMapPanel.java b/src/Map/PamZoomOnMapPanel.java index 1034c9b1..b726449c 100644 --- a/src/Map/PamZoomOnMapPanel.java +++ b/src/Map/PamZoomOnMapPanel.java @@ -63,6 +63,7 @@ public class PamZoomOnMapPanel implements PanZoomBehaviour { } Timer t = new Timer(50, new ActionListener() { + @Override public void actionPerformed(ActionEvent evt) { ll = mp.getMapCentreDegrees(); mp.setMapCentreCoords(new Coordinate3d((mp.getWidth() / 2.0) @@ -77,6 +78,7 @@ public class PamZoomOnMapPanel implements PanZoomBehaviour { } }); + @Override public void handleMBReleased() { t.stop(); mouseButtonDown = false; @@ -86,56 +88,66 @@ public class PamZoomOnMapPanel implements PanZoomBehaviour { rotationAdj = 0.0; } + @Override public void handleUp() { latAdj = -1.0; t.start(); } + @Override public void handleDown() { latAdj = 1.0; t.start(); } + @Override public void handleLeft() { longAdj = -1.0; t.start(); } + @Override public void handleRight() { longAdj = 1.0; t.start(); } + @Override public void handleUpRight() { latAdj = -1.0; longAdj = 1.0; t.start(); } + @Override public void handleUpLeft() { latAdj = -1.0; longAdj = -1.0; t.start(); } + @Override public void handleDownLeft() { latAdj = 1.0; longAdj = -1.0; t.start(); } + @Override public void handleDownRight() { latAdj = 1.0; longAdj = 1.0; t.start(); } + @Override public void handleZoomIn() { zoomAdj = -1; // Math.pow((double)mp.getMapRangeMetres()/125.0,1.05); t.start(); } + @Override public void handleZoomOut() { zoomAdj = 1; // Math.pow((double)mp.getMapRangeMetres()/125.0,1.05); // //100; @@ -147,16 +159,19 @@ public class PamZoomOnMapPanel implements PanZoomBehaviour { t.start(); } + @Override public void handleRotateClockwise() { rotationAdj = 1; t.start(); } + @Override public void handleRotateAntiClockwise() { rotationAdj = -1; t.start(); } + @Override public void handleNorthUp() { if (mp != null) { mp.rotateNorthUp(true); @@ -164,6 +179,7 @@ public class PamZoomOnMapPanel implements PanZoomBehaviour { } } + @Override public void handleHeadUp() { if (mp != null) { mp.rotateHeadingUp(true); @@ -171,15 +187,18 @@ public class PamZoomOnMapPanel implements PanZoomBehaviour { } } + @Override public void handleCentreOnShip() { mp.setMapCentreDegrees(MasterReferencePoint.getLatLong()); mp.repaint(); } + @Override public void handleMeasureWithMouse() { mp.mapController.setMouseMoveAction(MapController.MOUSE_MEASURE); } + @Override public void handlePanWithMouse() { mp.mapController.setMouseMoveAction(MapController.MOUSE_PAN); } diff --git a/src/Map/SimpleMap.java b/src/Map/SimpleMap.java index 651594b7..22e84182 100644 --- a/src/Map/SimpleMap.java +++ b/src/Map/SimpleMap.java @@ -24,7 +24,6 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; import java.awt.Cursor; -import java.awt.FlowLayout; import java.awt.Frame; import java.awt.Graphics; import java.awt.Point; @@ -55,11 +54,6 @@ import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.event.MouseInputAdapter; -import pamScrollSystem.AbstractPamScroller; -import pamScrollSystem.AbstractPamScrollerAWT; -import pamScrollSystem.PamScrollObserver; -import pamScrollSystem.PamScrollSlider; -import userDisplay.UserDisplayComponent; import Array.ArrayManager; import Array.PamArray; import GPS.GPSControl; @@ -79,11 +73,8 @@ import PamUtils.Coordinate3d; import PamUtils.LatLong; import PamUtils.PamCalendar; import PamView.ClipboardCopier; -import PamView.GeneralProjector; import PamView.PamColors; import PamView.PamColors.PamColor; -import PamView.PamGui; -import PamView.PanelOverlayDraw; import PamView.dialog.PamRadioButton; import PamView.hidingpanel.HidingDialogPanel; import PamView.panel.CornerLayoutContraint; @@ -92,7 +83,6 @@ import PamView.paneloverlay.overlaymark.ExtMapMouseHandler; import PamView.paneloverlay.overlaymark.MarkDataSelector; import PamView.paneloverlay.overlaymark.MarkOverlayDraw; import PamView.paneloverlay.overlaymark.OverlayMark; -import PamView.paneloverlay.overlaymark.OverlayMarkObserver; import PamView.paneloverlay.overlaymark.OverlayMarkProviders; import PamView.paneloverlay.overlaymark.OverlayMarker; import PamguardMVC.PamDataBlock; @@ -100,8 +90,12 @@ import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamObserver; import PamguardMVC.dataSelector.DataSelector; -import PamguardMVC.debug.Debug; import effort.EffortProvider; +import pamScrollSystem.AbstractPamScroller; +import pamScrollSystem.AbstractPamScrollerAWT; +import pamScrollSystem.PamScrollObserver; +import pamScrollSystem.PamScrollSlider; +import userDisplay.UserDisplayComponent; /** * Mainly a container for map objects, holding the main MapPanel and the right @@ -221,7 +215,7 @@ public class SimpleMap extends JPanel implements PamObserver, PamScrollObserver, mapParameters = new MapParameters(); thisMapIndex = simpleMapIndex++; - if (isMainTab == false) { + if (!isMainTab) { initialisationComplete = true; } PamSettingManager.getInstance().registerSettings(this); @@ -275,6 +269,7 @@ public class SimpleMap extends JPanel implements PamObserver, PamScrollObserver, return getUnitName(); } + @Override public String getUnitName() { if (thisMapIndex != 0) { return mapController.getUnitName()+thisMapIndex; @@ -366,7 +361,7 @@ public class SimpleMap extends JPanel implements PamObserver, PamScrollObserver, * @return */ public boolean shouldPlot(PamDataUnit pamDataUnit, MapDetectionData mapDetectionData, long earliestToPlot, long now, DataSelector ds) { - if (mapDetectionData.select == false) { + if (!mapDetectionData.select) { return false; } if (ds != null && ds.scoreData(pamDataUnit) == 0) { @@ -691,14 +686,17 @@ public class SimpleMap extends JPanel implements PamObserver, PamScrollObserver, } + @Override public String getObserverName() { return "simple map display component"; } + @Override public void noteNewSettings() { } + @Override public void setSampleRate(float sampleRate, boolean notify) { } @@ -708,6 +706,7 @@ public class SimpleMap extends JPanel implements PamObserver, PamScrollObserver, } + @Override public long getRequiredDataHistory(PamObservable o, Object arg) { PamDataBlock block = (PamDataBlock) o; if (block.getUnitClass() == GpsDataUnit.class) { @@ -954,6 +953,7 @@ public class SimpleMap extends JPanel implements PamObserver, PamScrollObserver, private class MouseWheelHandler implements MouseWheelListener { + @Override public void mouseWheelMoved(MouseWheelEvent arg0) { // if (arg0.getWheelRotation() < 0 @@ -1004,6 +1004,7 @@ public class SimpleMap extends JPanel implements PamObserver, PamScrollObserver, * * @see Map.PamMap#removeObservable(PamguardMVC.PamObservable) */ + @Override public void removeObservable(PamObservable o) { // TODO Auto-generated method stub @@ -1146,7 +1147,7 @@ public class SimpleMap extends JPanel implements PamObserver, PamScrollObserver, dataBlock = detectorDataBlocks.get(i); if (mapDetectionsManager.isShouldPlot(dataBlock)) { // if (dataBlock.getNumOfflineDataMaps() > 0) { - if (viewerScroller.isDataBlockUsed(dataBlock) == false) { + if (!viewerScroller.isDataBlockUsed(dataBlock)) { viewerScroller.addDataBlock(dataBlock); changes = true; } @@ -1204,6 +1205,7 @@ public class SimpleMap extends JPanel implements PamObserver, PamScrollObserver, this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent ev) { showParametersDialog(parentFrame); } @@ -1253,6 +1255,7 @@ public class SimpleMap extends JPanel implements PamObserver, PamScrollObserver, OverlayMarkProviders.singleInstance().removeProvider(mapMarker); } + @Override public void notifyModelChanged(int changeType) { mapDetectionsManager.notifyModelChanged(changeType); diff --git a/src/Map/TransformUtilities.java b/src/Map/TransformUtilities.java index e3767f58..908be373 100644 --- a/src/Map/TransformUtilities.java +++ b/src/Map/TransformUtilities.java @@ -21,11 +21,8 @@ package Map; import java.awt.Polygon; -import java.awt.geom.AffineTransform; -import GPS.GpsData; import PamUtils.Coordinate3d; -import PamUtils.LatLong; import PamUtils.PamCoordinate; /** diff --git a/src/Map/Vessel.java b/src/Map/Vessel.java index 29dd9d45..1b98f2fa 100644 --- a/src/Map/Vessel.java +++ b/src/Map/Vessel.java @@ -38,9 +38,9 @@ import PamUtils.Coordinate3d; import PamUtils.LatLong; import PamUtils.PamCalendar; import PamView.PamColors; +import PamView.PamColors.PamColor; import PamView.PamSymbol; import PamView.PamSymbolType; -import PamView.PamColors.PamColor; public class Vessel extends PamSymbol implements Serializable, Cloneable, ManagedParameters { @@ -344,7 +344,7 @@ public class Vessel extends PamSymbol implements Serializable, Cloneable, Manage if (shipGps == null) { return null; } - else if (predict == false) { + else if (!predict) { return shipGps; } else { @@ -426,6 +426,7 @@ public class Vessel extends PamSymbol implements Serializable, Cloneable, Manage return y; } + @Override public PamParameterSet getParameterSet() { PamParameterSet ps = super.getParameterSet(); try { diff --git a/src/NMEA/AcquireNmeaData.java b/src/NMEA/AcquireNmeaData.java index 0402017c..62f68806 100644 --- a/src/NMEA/AcquireNmeaData.java +++ b/src/NMEA/AcquireNmeaData.java @@ -20,8 +20,6 @@ */ package NMEA; -import geoMag.MagneticVariation; - import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.IOException; @@ -40,10 +38,6 @@ import java.util.Random; import javax.swing.SwingUtilities; import javax.swing.Timer; -import serialComms.jserialcomm.PJSerialComm; -import serialComms.jserialcomm.PJSerialException; -import serialComms.jserialcomm.PJSerialLineListener; -import warnings.PamWarning; import GPS.GpsData; import NMEA.NMEAParameters.NmeaSources; import PamController.PamController; @@ -55,7 +49,11 @@ import PamUtils.PamCalendar; import PamUtils.PamUtils; import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; -import PamguardMVC.debug.Debug; +import geoMag.MagneticVariation; +import serialComms.jserialcomm.PJSerialComm; +import serialComms.jserialcomm.PJSerialException; +import serialComms.jserialcomm.PJSerialLineListener; +import warnings.PamWarning; /** * @author Doug Gillespie, Dave McLaren, Paul Redmond @@ -297,6 +295,7 @@ public class AcquireNmeaData extends PamProcess implements ActionListener, Modul // Start pdu packaging timer class SimThread implements Runnable { + @Override public void run() { //System.out.println("********GPS SIM THREAD*********"); @@ -540,6 +539,7 @@ public class AcquireNmeaData extends PamProcess implements ActionListener, Modul class UdpThread implements Runnable { + @Override public void run() { /* * Sit here reading data from the port. Every time a new NMEA string @@ -596,6 +596,7 @@ public class AcquireNmeaData extends PamProcess implements ActionListener, Modul } class MulticastThread implements Runnable { + @Override public void run() { /* * Sit here reading data from the port. Every time a new NMEA string @@ -670,6 +671,7 @@ public class AcquireNmeaData extends PamProcess implements ActionListener, Modul } } + @Override public void actionPerformed(ActionEvent event) { /* * As called by Timer this gets called every 100ms or so. Look in the diff --git a/src/NMEA/ChannelAISData.java b/src/NMEA/ChannelAISData.java index 19b7353d..07892e51 100644 --- a/src/NMEA/ChannelAISData.java +++ b/src/NMEA/ChannelAISData.java @@ -112,6 +112,7 @@ public class ChannelAISData implements AISDataSet { /* (non-Javadoc) * @see NMEA.AISDataSet#getNext() */ + @Override public String getNext() { String str = aisStrings[next]; if (++next >= aisStrings.length) { @@ -123,6 +124,7 @@ public class ChannelAISData implements AISDataSet { /* (non-Javadoc) * @see NMEA.AISDataSet#reset() */ + @Override public void reset() { next = 0; } diff --git a/src/NMEA/NMEAControl.java b/src/NMEA/NMEAControl.java index d600483a..c4bdc7c6 100644 --- a/src/NMEA/NMEAControl.java +++ b/src/NMEA/NMEAControl.java @@ -28,14 +28,12 @@ import java.io.Serializable; import javax.swing.JMenu; import javax.swing.JMenuItem; -import nmeaEmulator.NMEAFrontEnd; - import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; import PamController.PamController; import PamController.PamSettingManager; import PamController.PamSettings; -import PamController.status.BaseProcessCheck; +import nmeaEmulator.NMEAFrontEnd; /** @@ -121,6 +119,7 @@ public class NMEAControl extends PamControlledUnit implements PamSettings { this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { showNMEADialog(parentFrame); } @@ -143,6 +142,7 @@ public class NMEAControl extends PamControlledUnit implements PamSettings { super(); this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { NMEAStringsTable.show(parentFrame, nmeaControl); } @@ -153,6 +153,7 @@ public class NMEAControl extends PamControlledUnit implements PamSettings { super(); this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { emulateNMEAData(parentFrame); } @@ -178,10 +179,12 @@ public class NMEAControl extends PamControlledUnit implements PamSettings { * public void setNmeaSource(int source){ * acquireNmeaData.setNMEASource(source); } */ + @Override public Serializable getSettingsReference() { return nmeaParameters; } + @Override public long getSettingsVersion() { return NMEAParameters.serialVersionUID; } @@ -191,6 +194,7 @@ public class NMEAControl extends PamControlledUnit implements PamSettings { * Stuff for settings interface */ + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { if (pamControlledUnitSettings.getUnitType().equals(this.getUnitType()) diff --git a/src/NMEA/NMEADataBlock.java b/src/NMEA/NMEADataBlock.java index 4fb943cb..89abb8ae 100644 --- a/src/NMEA/NMEADataBlock.java +++ b/src/NMEA/NMEADataBlock.java @@ -40,7 +40,7 @@ public class NMEADataBlock extends PamDataBlock { // need to start by getting the first five characters for the scentence identifier. StringBuffer nmeaString = pamDataUnit.getCharData(); if (nmeaString == null) return; - if (nmeaString.length() < 6 || isNmeaStartCharacter(nmeaString.charAt(0)) == false) return; + if (nmeaString.length() < 6 || !isNmeaStartCharacter(nmeaString.charAt(0))) return; String newId = getSubString(nmeaString, 0); if (newId == null) return; String oldId; diff --git a/src/NMEA/NMEAParametersDialog.java b/src/NMEA/NMEAParametersDialog.java index ccd8c7f0..1fbf646c 100644 --- a/src/NMEA/NMEAParametersDialog.java +++ b/src/NMEA/NMEAParametersDialog.java @@ -40,13 +40,13 @@ import javax.swing.JRadioButton; import javax.swing.JTextField; import javax.swing.border.TitledBorder; -import serialComms.jserialcomm.PJSerialComm; import NMEA.NMEAParameters.NmeaSources; import PamView.dialog.PamCheckBox; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; import PamView.dialog.PamLabel; import PamView.dialog.PamTextField; +import serialComms.jserialcomm.PJSerialComm; public class NMEAParametersDialog extends PamDialog implements ActionListener { @@ -278,6 +278,7 @@ public class NMEAParametersDialog extends PamDialog implements ActionListener { } + @Override public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub enableControls(); diff --git a/src/NMEA/NMEAStringSelector.java b/src/NMEA/NMEAStringSelector.java index f415c21d..e7e71067 100644 --- a/src/NMEA/NMEAStringSelector.java +++ b/src/NMEA/NMEAStringSelector.java @@ -4,12 +4,9 @@ import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JLabel; -import PamController.PamControlledUnit; import PamController.PamController; -import PamView.dialog.PamDialogPanel; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; -import PamguardMVC.PamObserver; import PamguardMVC.PamObserverAdapter; /** diff --git a/src/NMEA/NMEAStringsTable.java b/src/NMEA/NMEAStringsTable.java index 59b2eed3..61708a0c 100644 --- a/src/NMEA/NMEAStringsTable.java +++ b/src/NMEA/NMEAStringsTable.java @@ -3,11 +3,9 @@ package NMEA; import java.awt.Dimension; import java.awt.Frame; import java.awt.GridLayout; -import java.awt.HeadlessException; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; @@ -110,12 +108,13 @@ public class NMEAStringsTable extends PamDialog { class TimerListener implements ActionListener { boolean doneLayout; + @Override public void actionPerformed(ActionEvent ev) { // table. // nmeaTableData.fireTableRowsUpdated(0, 10); nmeaTableData.fireTableDataChanged(); - if (doneLayout == false && nmeaTableData.getRowCount() > 0) { + if (!doneLayout && nmeaTableData.getRowCount() > 0) { doneLayout = true; } } @@ -135,6 +134,7 @@ public class NMEAStringsTable extends PamDialog { /* (non-Javadoc) * @see javax.swing.table.TableModel#getColumnCount() */ + @Override public int getColumnCount() { return tableColumns.length; } @@ -142,6 +142,7 @@ public class NMEAStringsTable extends PamDialog { /* (non-Javadoc) * @see javax.swing.table.TableModel#getRowCount() */ + @Override public int getRowCount() { if (nmeaDataBlock == null) return 0; return nmeaDataBlock.getUnitsCount(); @@ -150,6 +151,7 @@ public class NMEAStringsTable extends PamDialog { /* (non-Javadoc) * @see javax.swing.table.TableModel#getValueAt(int, int) */ + @Override public Object getValueAt(int rowIndex, int columnIndex) { NMEADataUnit pamDataUnit = nmeaDataBlock.getDataUnit(rowIndex, PamDataBlock.REFERENCE_CURRENT); switch(columnIndex) { diff --git a/src/PamController/DeserialisationWarning.java b/src/PamController/DeserialisationWarning.java index 0983005a..35886501 100644 --- a/src/PamController/DeserialisationWarning.java +++ b/src/PamController/DeserialisationWarning.java @@ -3,8 +3,6 @@ package PamController; import java.awt.Window; import java.util.ArrayList; -import PamView.dialog.warn.WarnOnce; - /** * Class to handle warnings from deserialisations which occurr when classes no longer exist. These warnings * are occurring more often because of the plugin system which means users are opening viewer databases and diff --git a/src/PamController/DisplayScalingDialog.java b/src/PamController/DisplayScalingDialog.java index a306eaec..48ece44a 100644 --- a/src/PamController/DisplayScalingDialog.java +++ b/src/PamController/DisplayScalingDialog.java @@ -33,7 +33,6 @@ import javax.swing.JTextField; import javax.swing.border.EmptyBorder; import PamView.dialog.PamDialog; -import javafx.scene.layout.Border; /** * @author mo55 diff --git a/src/PamController/ModuleOrderDialog.java b/src/PamController/ModuleOrderDialog.java index 964b299e..bade2f77 100644 --- a/src/PamController/ModuleOrderDialog.java +++ b/src/PamController/ModuleOrderDialog.java @@ -96,6 +96,7 @@ ListSelectionListener{ localLUTTable[i] = i; } } + @Override public void actionPerformed(ActionEvent e) { int r = moduleTable.getSelectedRow(); int dum; @@ -122,6 +123,7 @@ ListSelectionListener{ /* (non-Javadoc) * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent) */ + @Override public void valueChanged(ListSelectionEvent e) { enableButtons(); @@ -141,6 +143,7 @@ ListSelectionListener{ /* (non-Javadoc) * @see javax.swing.table.TableModel#getColumnCount() */ + @Override public int getColumnCount() { return columnNames.length; } @@ -148,6 +151,7 @@ ListSelectionListener{ /* (non-Javadoc) * @see javax.swing.table.TableModel#getRowCount() */ + @Override public int getRowCount() { return pamController.getNumControlledUnits(); } @@ -155,6 +159,7 @@ ListSelectionListener{ /* (non-Javadoc) * @see javax.swing.table.TableModel#getValueAt(int, int) */ + @Override public Object getValueAt(int rowIndex, int columnIndex) { if (rowIndex >= pamController.getNumControlledUnits()) return null; diff --git a/src/PamController/OfflineDataStore.java b/src/PamController/OfflineDataStore.java index 20a34041..55d17b73 100644 --- a/src/PamController/OfflineDataStore.java +++ b/src/PamController/OfflineDataStore.java @@ -2,13 +2,11 @@ package PamController; import java.awt.Window; -import PamController.fileprocessing.StoreStatus; +import PamguardMVC.PamDataBlock; +import PamguardMVC.dataOffline.OfflineDataLoadInfo; import dataGram.DatagramManager; import dataMap.OfflineDataMapPoint; import pamScrollSystem.ViewLoadObserver; -import PamguardMVC.PamDataBlock; -import PamguardMVC.RequestCancellationObject; -import PamguardMVC.dataOffline.OfflineDataLoadInfo; /** * Interface implemented by PamControlledUnits which diff --git a/src/PamController/OfflineFileDataStore.java b/src/PamController/OfflineFileDataStore.java index ffff4567..6348130c 100644 --- a/src/PamController/OfflineFileDataStore.java +++ b/src/PamController/OfflineFileDataStore.java @@ -2,7 +2,6 @@ package PamController; import PamguardMVC.PamDataBlock; import PamguardMVC.PamProcess; -import PamguardMVC.PamRawDataBlock; import dataMap.filemaps.OfflineFileServer; /** diff --git a/src/PamController/PSFXReadWriter.java b/src/PamController/PSFXReadWriter.java index 883e1c76..32beaa1d 100644 --- a/src/PamController/PSFXReadWriter.java +++ b/src/PamController/PSFXReadWriter.java @@ -12,7 +12,6 @@ import java.util.ArrayList; import PamUtils.PamCalendar; import PamView.dialog.warn.WarnOnce; - import binaryFileStorage.BinaryFooter; import binaryFileStorage.BinaryHeader; import binaryFileStorage.BinaryStore; @@ -154,7 +153,7 @@ public class PSFXReadWriter { if (file == null) { return null; } - if (file.exists() == false) { + if (!file.exists()) { return null; } diff --git a/src/PamController/PamConfiguration.java b/src/PamController/PamConfiguration.java index 16496901..f99433a5 100644 --- a/src/PamController/PamConfiguration.java +++ b/src/PamController/PamConfiguration.java @@ -4,7 +4,6 @@ import java.io.File; import java.io.Serializable; import java.util.ArrayList; -import Array.ArrayManager; import PamController.settings.output.xml.PamguardXMLWriter; import PamDetection.PamDetection; import PamDetection.RawDataUnit; @@ -63,7 +62,7 @@ public class PamConfiguration { */ public boolean canClose() { for (int i = 0; i < pamControlledUnits.size(); i++) { - if (pamControlledUnits.get(i).canClose() == false) { + if (!pamControlledUnits.get(i).canClose()) { return false; } } @@ -365,7 +364,7 @@ public class PamConfiguration { * @return List of current instances of this class. */ public ArrayList findControlledUnits(Class unitClass, boolean includeSubClasses) { - if (includeSubClasses == false) { + if (!includeSubClasses) { return findControlledUnits(unitClass); } ArrayList foundUnits = new ArrayList<>(); @@ -499,7 +498,7 @@ public class PamConfiguration { public void destroyModel() { for (int i = 0; i < pamControlledUnits.size(); i++) { - pamControlledUnits.get(i).notifyModelChanged(PamController.DESTROY_EVERYTHING); + pamControlledUnits.get(i).notifyModelChanged(PamControllerInterface.DESTROY_EVERYTHING); } pamControlledUnits.clear(); } @@ -526,7 +525,7 @@ public class PamConfiguration { if (storeLoc == null) { return ""; } - if (storeLoc.endsWith(File.separator) == false) { + if (!storeLoc.endsWith(File.separator)) { storeLoc += File.separator; } return storeLoc; diff --git a/src/PamController/PamControlledUnit.java b/src/PamController/PamControlledUnit.java index 5ced4925..c79f8815 100644 --- a/src/PamController/PamControlledUnit.java +++ b/src/PamController/PamControlledUnit.java @@ -31,8 +31,6 @@ import javax.swing.JMenuBar; import javax.swing.JMenuItem; import javax.swing.JOptionPane; -import offlineProcessing.OfflineTaskGroup; - import PamController.status.ModuleStatus; import PamController.status.ModuleStatusManager; import PamController.status.ProcessCheck; @@ -45,9 +43,9 @@ import PamView.PamSidePanel; import PamView.PamTabPanel; import PamView.PamView; import PamguardMVC.PamConstants; -import PamguardMVC.PamDataBlock; import PamguardMVC.PamProcess; import backupmanager.BackupInformation; +import offlineProcessing.OfflineTaskGroup; /** * @author Doug Gillespie @@ -470,6 +468,7 @@ public abstract class PamControlledUnit implements SettingsNameProvider { * * @return the name of the unit */ + @Override public String getUnitName() { return unitName; } diff --git a/src/PamController/PamControlledUnitSettings.java b/src/PamController/PamControlledUnitSettings.java index 4d8c1ecc..e09546aa 100644 --- a/src/PamController/PamControlledUnitSettings.java +++ b/src/PamController/PamControlledUnitSettings.java @@ -26,13 +26,13 @@ import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; import java.io.InvalidClassException; -import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.net.URL; import java.net.URLClassLoader; import org.apache.commons.io.input.ClassLoaderObjectInputStream; + import PamModel.PamModel; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; @@ -348,7 +348,8 @@ public class PamControlledUnitSettings implements Serializable, ManagedParameter else { classLoader = new URLClassLoader(new URL[0], PamControlledUnitSettings.class.getClassLoader()) { - public void addURL(URL url) { + @Override + public void addURL(URL url) { super.addURL(url); } }; diff --git a/src/PamController/PamController.java b/src/PamController/PamController.java index 1f8d340c..54380898 100644 --- a/src/PamController/PamController.java +++ b/src/PamController/PamController.java @@ -28,37 +28,14 @@ import java.io.Serializable; import java.net.URISyntaxException; import java.util.ArrayList; import java.util.Locale; + import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.Timer; -import javax.swing.ToolTipManager; - -import com.jcraft.jsch.ConfigRepository.Config; -import com.sun.xml.bind.v2.TODO; import Acquisition.AcquisitionControl; import Acquisition.AcquisitionProcess; - -//import com.sun.org.apache.xerces.internal.dom.DocumentImpl; -//import com.sun.org.apache.xml.internal.serialize.OutputFormat; -//import com.sun.org.apache.xml.internal.serialize.XMLSerializer; - -import pamScrollSystem.AbstractScrollManager; -import pamViewFX.PamGuiManagerFX; -import pamViewFX.pamTask.PamTaskUpdate; -import pamguard.GlobalArguments; -import pamguard.Pamguard; -import soundPlayback.PlaybackControl; -import warnings.PamWarning; -import warnings.WarningSystem; -import zipUnpacker.ZipUnpacker; -import fftManager.FFTDataBlock; -import fftManager.FFTDataUnit; -import generalDatabase.DBControlUnit; -import javafx.application.Platform; -import javafx.stage.Stage; -import metadata.MetaDataContol; import Array.ArrayManager; import PamController.command.MulticastController; import PamController.command.NetworkController; @@ -67,7 +44,6 @@ import PamController.command.WatchdogComms; import PamController.fileprocessing.ReprocessManager; import PamController.masterReference.MasterReferencePoint; import PamController.settings.BatchViewSettingsImport; -import PamController.settings.output.xml.PamguardXMLWriter; import PamController.settings.output.xml.XMLWriterDialog; import PamController.soundMedium.GlobalMediumManager; import PamDetection.PamDetection; @@ -83,17 +59,13 @@ import PamView.GuiFrameManager; import PamView.PamColors; import PamView.PamView; import PamView.PamViewInterface; -import PamView.PanelOverlayDraw; import PamView.TopToolBar; import PamView.dialog.warn.WarnOnce; import PamView.paneloverlay.overlaymark.MarkRelationships; import PamView.symbol.PamSymbolManager; import PamguardMVC.PamDataBlock; -import PamguardMVC.PamDataUnit; -import PamguardMVC.PamObserver; import PamguardMVC.PamProcess; import PamguardMVC.PamRawDataBlock; -import PamguardMVC.ThreadedObserver; import PamguardMVC.dataSelector.DataSelectorCreator; import PamguardMVC.datakeeper.DataKeeper; import PamguardMVC.uid.UIDManager; @@ -101,7 +73,25 @@ import PamguardMVC.uid.UIDOnlineManager; import PamguardMVC.uid.UIDViewerManager; import binaryFileStorage.BinaryStore; import export.ExportOptions; -import PamguardMVC.debug.Debug; +import fftManager.FFTDataUnit; +import generalDatabase.DBControlUnit; +import javafx.application.Platform; +import javafx.stage.Stage; +import metadata.MetaDataContol; + +//import com.sun.org.apache.xerces.internal.dom.DocumentImpl; +//import com.sun.org.apache.xml.internal.serialize.OutputFormat; +//import com.sun.org.apache.xml.internal.serialize.XMLSerializer; + +import pamScrollSystem.AbstractScrollManager; +import pamViewFX.PamGuiManagerFX; +import pamViewFX.pamTask.PamTaskUpdate; +import pamguard.GlobalArguments; +import pamguard.Pamguard; +import soundPlayback.PlaybackControl; +import warnings.PamWarning; +import warnings.WarningSystem; +import zipUnpacker.ZipUnpacker; /** * @author Doug Gillespie @@ -511,7 +501,7 @@ public class PamController implements PamControllerInterface, PamSettings { /* * We are running as a remote application, start process straight away! */ - if (PamSettingManager.RUN_REMOTE == false) { + if (!PamSettingManager.RUN_REMOTE) { addView(guiFrameManager.initPrimaryView(this, pamModelInterface)); } @@ -546,7 +536,7 @@ public class PamController implements PamControllerInterface, PamSettings { */ if (getRunMode() == RUN_NOTHING) { - } else if (PamSettingManager.RUN_REMOTE == true) { + } else if (PamSettingManager.RUN_REMOTE) { // Initialisation is complete. initializationComplete = true; notifyModelChanged(PamControllerInterface.INITIALIZATION_COMPLETE); @@ -853,7 +843,7 @@ public class PamController implements PamControllerInterface, PamSettings { System.err.println("Exception while loading " + moduleName); //this.removeControlledUnt(unitBeingLoaded); this.clearLoadedUnit(); - ; + } if (unitBeingLoaded == null) { return null; @@ -1076,6 +1066,7 @@ public class PamController implements PamControllerInterface, PamSettings { return uniqueController; } + @Override public PamModel getModelInterface() { return pamModelInterface; } @@ -1272,13 +1263,12 @@ public class PamController implements PamControllerInterface, PamSettings { if (getRunMode() != RUN_NETWORKRECEIVER) { pamControlledUnits.get(iU).getPamProcess(iP).clearOldData(); } - if (pamControlledUnits.get(iU).getPamProcess(iP).prepareProcessOK() == false) { + if (!pamControlledUnits.get(iU).getPamProcess(iP).prepareProcessOK()) { setPamStatus(PAM_IDLE); System.out.println("Can't start since unable to prepare process " + pamControlledUnits.get(iU).getPamProcess(iP).getProcessName()); prepErrors++; } - ; } // long t2 = System.currentTimeMillis(); // System.out.printf("***********************************Time taken to prepare @@ -1299,7 +1289,7 @@ public class PamController implements PamControllerInterface, PamSettings { if (saveSettings && getRunMode() == RUN_NORMAL) { // only true on a button press or network start. ReprocessManager reprocessManager = new ReprocessManager(); boolean goonthen = reprocessManager.checkOutputDataStatus(); - if (goonthen == false) { + if (!goonthen) { System.out.println( "Data processing will not start since you've chosen not to overwrite existing output data"); pamStop(); @@ -1352,10 +1342,10 @@ public class PamController implements PamControllerInterface, PamSettings { // starting the DAQ may take a little while, so recheck and reset the // start time. long startDelay = PamCalendar.getTimeInMillis() - PamCalendar.getSessionStartTime(); - if (PamCalendar.isSoundFile() == false) { + if (!PamCalendar.isSoundFile()) { PamCalendar.setSessionStartTime(PamCalendar.getTimeInMillis()); } - if (PamCalendar.isSoundFile() == false) { + if (!PamCalendar.isSoundFile()) { System.out.printf("PAMGUARD Startup took %d milliseconds at time %s\n", startDelay, PamCalendar.formatDateTime(PamCalendar.getSessionStartTime())); } @@ -1456,7 +1446,7 @@ public class PamController implements PamControllerInterface, PamSettings { * that have stuff still) */ public void dumpBufferStatus(String message, boolean sayEmpties) { - if (debugDumpBufferAtRestart == false) + if (!debugDumpBufferAtRestart) return; System.out.println("**** Dumping process buffer status: " + message); @@ -2011,7 +2001,7 @@ public class PamController implements PamControllerInterface, PamSettings { * @return true if modules added or removed after initialisation complete */ public boolean moduleChange(int changeType) { - if (isInitializationComplete() == false) { + if (!isInitializationComplete()) { return false; } switch (changeType) { @@ -2049,7 +2039,7 @@ public class PamController implements PamControllerInterface, PamSettings { public void setupGarbageCollector() { PamModelSettings ms = pamModelInterface.getPamModelSettings(); - if (ms.enableGC == false) { + if (!ms.enableGC) { if (garbageTimer != null) { garbageTimer.stop(); } @@ -2165,7 +2155,7 @@ public class PamController implements PamControllerInterface, PamSettings { */ public int getRealStatus() { PamController pamController = PamController.getInstance(); - if (pamController.isInitializationComplete() == false) { + if (!pamController.isInitializationComplete()) { return PamController.PAM_INITIALISING; } int runMode = PamController.getInstance().getRunMode(); @@ -2200,7 +2190,7 @@ public class PamController implements PamControllerInterface, PamSettings { * of any of them. */ if (getRunMode() == RUN_PAMVIEW) { - if (firstDataLoadComplete == false) { + if (!firstDataLoadComplete) { status = PAM_INITIALISING; } try { @@ -2514,7 +2504,7 @@ public class PamController implements PamControllerInterface, PamSettings { private boolean loadOtherSettings(String psfxName) { File psfxFile = new File(psfxName); - if (psfxFile.exists() == false) { + if (!psfxFile.exists()) { return false; } @@ -2591,7 +2581,7 @@ public class PamController implements PamControllerInterface, PamSettings { System.out.println(String.format("%d existing modules are not needed", toRemove.size())); for (int i = 0; i < toRemove.size(); i++) { mi = PamModuleInfo.findModuleInfo(toRemove.get(i).getClass().getName()); - if (mi != null && mi.canRemove() == false) { + if (mi != null && !mi.canRemove()) { continue; } System.out.println("Remove module " + toRemove.get(i).toString()); @@ -2610,7 +2600,7 @@ public class PamController implements PamControllerInterface, PamSettings { aModuleInfo = toAdd.get(i); System.out.println(" Add module " + aModuleInfo.toString()); mi = PamModuleInfo.findModuleInfo(aModuleInfo.className); - if (mi == null || mi.canCreate() == false) { + if (mi == null || !mi.canCreate()) { continue; } addModule(mi, aModuleInfo.unitName); @@ -2869,7 +2859,6 @@ public class PamController implements PamControllerInterface, PamSettings { } else { break; } - ; } // int pos = version.indexOf('.'); // get the index of the first decimal diff --git a/src/PamController/PamFolders.java b/src/PamController/PamFolders.java index 7d7bfd1a..c84df304 100644 --- a/src/PamController/PamFolders.java +++ b/src/PamController/PamFolders.java @@ -24,15 +24,15 @@ public class PamFolders { } File fullFile = new File(fullName); if (create) { - if (fullFile.exists() == false) { - if (fullFile.mkdir() == false) { + if (!fullFile.exists()) { + if (!fullFile.mkdir()) { throw new PamFolderException("Unable to create folder " + fullFile); - }; + } } } - if (fullFile.exists() == false) { + if (!fullFile.exists()) { throw new PamFolderException("Folder " + fullFile + " does not exist"); - }; + } return true; } diff --git a/src/PamController/PamSettingManager.java b/src/PamController/PamSettingManager.java index 49b0bfef..3a5f6510 100644 --- a/src/PamController/PamSettingManager.java +++ b/src/PamController/PamSettingManager.java @@ -20,10 +20,6 @@ */ package PamController; -import generalDatabase.DBControl; -import generalDatabase.DBControlSettings; -import javafx.scene.control.Alert.AlertType; - import java.io.EOFException; import java.io.File; import java.io.FileInputStream; @@ -42,6 +38,15 @@ import javax.swing.JOptionPane; import javax.swing.UIManager; import javax.swing.plaf.FontUIResource; +import PamController.settings.SettingsNameChange; +import PamController.settings.SettingsNameChanger; +import PamUtils.PamCalendar; +import PamUtils.PamFileChooser; +import PamUtils.PamFileFilter; +import PamView.dialog.warn.WarnOnce; +import generalDatabase.DBControl; +import generalDatabase.DBControlSettings; +import javafx.scene.control.Alert.AlertType; import pamViewFX.fxNodes.utilsFX.PamUtilsFX; import pamViewFX.fxSettingsPanes.SettingsFileDialogFX; import pamguard.GlobalArguments; @@ -68,13 +73,6 @@ import tipOfTheDay.TipOfTheDayManager; //import javax.swing.filechooser.FileFilter; //import javax.swing.filechooser.FileNameExtensionFilter; -import PamController.settings.SettingsNameChange; -import PamController.settings.SettingsNameChanger; -import PamUtils.PamCalendar; -import PamUtils.PamFileChooser; -import PamUtils.PamFileFilter; -import PamView.dialog.warn.WarnOnce; - //import PamUtils.PamFileFilter; @@ -462,7 +460,7 @@ public class PamSettingManager { public PamSettings findSettingsOwner(String unitType, String unitName, String unitClassName) { for (PamSettings owner:owners) { if (owner.getClass() != null && unitClassName != null) { - if (owner.getClass().getName().equals(unitClassName) == false) { + if (!owner.getClass().getName().equals(unitClassName)) { continue; } } @@ -502,7 +500,7 @@ public class PamSettingManager { */ public boolean saveSettings(int saveWhere) { - if (initializationComplete == false) { + if (!initializationComplete) { // if PAMGAURD hasn't finished loading, then don't save the settings // or the file will get wrecked (bug tracker 2269579) String msg = "There was an error loading settings from this configuration, so the configuration" @@ -1015,7 +1013,7 @@ public class PamSettingManager { loadSettingsFileData(); - if (PamSettingManager.RUN_REMOTE == false && GlobalArguments.isBatch() == false) { + if (!PamSettingManager.RUN_REMOTE && !GlobalArguments.isBatch()) { if (settingsFileData != null) { TipOfTheDayManager.getInstance().setShowAtStart(settingsFileData.showTipAtStartup); if (settingsFileData.showTipAtStartup) { @@ -1215,8 +1213,8 @@ public class PamSettingManager { PamSettings owner; for (int i = 0; i < ownersList.size(); i++) { owner = ownersList.get(i); - if (owner.getUnitType().equals(unitType) == false) continue; - if (unitName != null && owner.getUnitName().equals(unitName) == false) continue; + if (!owner.getUnitType().equals(unitType)) continue; + if (unitName != null && !owner.getUnitName().equals(unitName)) continue; return owner; } @@ -1664,7 +1662,7 @@ public class PamSettingManager { * then create the file (and do a few other things) */ File slFile = getSettingsListFile(); - if (slFile.exists() == false) { + if (!slFile.exists()) { createSettingsListFile(); } @@ -1770,7 +1768,7 @@ public class PamSettingManager { if (settingsFileData == null) { return false; } - if (PamSettingManager.RUN_REMOTE == false) { + if (!PamSettingManager.RUN_REMOTE) { settingsFileData.showTipAtStartup = TipOfTheDayManager.getInstance().isShowAtStart(); } settingsFileData.trimList(); diff --git a/src/PamController/PamSettingsGroup.java b/src/PamController/PamSettingsGroup.java index 5baa766e..a35b1b3e 100644 --- a/src/PamController/PamSettingsGroup.java +++ b/src/PamController/PamSettingsGroup.java @@ -1,10 +1,9 @@ package PamController; -import generalDatabase.DBControlUnit; - import java.util.ArrayList; import binaryFileStorage.BinaryStore; +import generalDatabase.DBControlUnit; //import sun.jdbc.odbc.OdbcDef; diff --git a/src/PamController/PamViewParameters.java b/src/PamController/PamViewParameters.java index fc384ded..7349b233 100644 --- a/src/PamController/PamViewParameters.java +++ b/src/PamController/PamViewParameters.java @@ -82,6 +82,7 @@ public class PamViewParameters extends PAMSelectClause implements Serializable, * @param sqlTypes SQL types for any bespoke formatting * @return results query. */ + @Override public String getSelectClause(SQLTypes sqlTypes) { /** * Moved this here so that it can be overridden. It used @@ -158,7 +159,7 @@ public class PamViewParameters extends PAMSelectClause implements Serializable, if (otherParameters.useAnalysisTime != useAnalysisTime) { return false; } - if (useAnalysisTime == false) { + if (!useAnalysisTime) { return true; // no need to shcek the other parameters in this instance } if (otherParameters.analStartTime != analStartTime) { diff --git a/src/PamController/PamguardVersionInfo.java b/src/PamController/PamguardVersionInfo.java index 5bc76dbd..b581b14a 100644 --- a/src/PamController/PamguardVersionInfo.java +++ b/src/PamController/PamguardVersionInfo.java @@ -9,7 +9,7 @@ package PamController; */ public class PamguardVersionInfo { - public static enum ReleaseType {CORE, BETA, OTHER}; + public static enum ReleaseType {CORE, BETA, OTHER} /** * Type of release - used to switch off and on some features. @@ -31,7 +31,7 @@ public class PamguardVersionInfo { * Version number, major version.minorversion.sub-release. * Note: can't go higher than sub-release 'f' */ - static public final String version = "2.02.13"; + static public final String version = "2.02.13a"; /** * Release date diff --git a/src/PamController/SettingsFileDialog.java b/src/PamController/SettingsFileDialog.java index 73fab149..79a0f2be 100644 --- a/src/PamController/SettingsFileDialog.java +++ b/src/PamController/SettingsFileDialog.java @@ -16,7 +16,6 @@ import javax.swing.JFileChooser; import javax.swing.JPanel; import javax.swing.border.TitledBorder; -import PamController.PamguardVersionInfo.ReleaseType; import PamUtils.PamFileChooser; import PamUtils.PamFileFilter; import PamView.dialog.PamDialog; @@ -79,6 +78,7 @@ public class SettingsFileDialog extends PamDialog { private class BrowseButton implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == browseButton) { browseForFiles(); @@ -112,7 +112,7 @@ public class SettingsFileDialog extends PamDialog { * If the new file is really a "new" file, that doesnt' actually exist, * We'll need to check it has the correct end. */ - if (newFile.exists() == false) { + if (!newFile.exists()) { newFile = PamFileFilter.checkFileEnd(newFile, PamSettingManager.getCurrentSettingsFileEnd(), true); } @@ -124,6 +124,7 @@ public class SettingsFileDialog extends PamDialog { fileList.setSelectedIndex(0); } private class NewButton implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == browseButton) { newConfig(); diff --git a/src/PamController/StorageOptions.java b/src/PamController/StorageOptions.java index 667bd364..6a5586e0 100644 --- a/src/PamController/StorageOptions.java +++ b/src/PamController/StorageOptions.java @@ -1,14 +1,12 @@ package PamController; -import generalDatabase.DBControlUnit; - import java.io.Serializable; import java.util.ArrayList; import javax.swing.JFrame; -import binaryFileStorage.BinaryStore; import PamguardMVC.PamDataBlock; +import generalDatabase.DBControlUnit; public class StorageOptions implements PamSettings { @@ -82,7 +80,7 @@ public class StorageOptions implements PamSettings { * storing to the database by default */ boolean haveBinary = (aBlock.getBinaryDataSource() != null); - doLog = storageParameters.isStoreDatabase(aBlock, haveBinary == false); + doLog = storageParameters.isStoreDatabase(aBlock, !haveBinary); aBlock.setShouldLog(doLog); doLog = storageParameters.isStoreBinary(aBlock, true); aBlock.setShouldBinary(doLog); diff --git a/src/PamController/StorageOptionsDialog.java b/src/PamController/StorageOptionsDialog.java index 78448614..6e0beb49 100644 --- a/src/PamController/StorageOptionsDialog.java +++ b/src/PamController/StorageOptionsDialog.java @@ -1,8 +1,5 @@ package PamController; -import generalDatabase.DBControlUnit; - -import java.awt.Color; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Window; @@ -13,12 +10,14 @@ import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; -import binaryFileStorage.BinaryStore; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; import PamguardMVC.PamDataBlock; +import binaryFileStorage.BinaryStore; +import generalDatabase.DBControlUnit; public class StorageOptionsDialog extends PamDialog { @@ -83,7 +82,7 @@ public class StorageOptionsDialog extends PamDialog { l.setToolTipText("Binary Storage is more efficient than the database for many types of detection data"); } c.gridx++; - addComponent(mainPanel, l = new JLabel(" Database ", JLabel.CENTER), c); + addComponent(mainPanel, l = new JLabel(" Database ", SwingConstants.CENTER), c); if (binaryStore == null) { l.setToolTipText("Database module is not loaded"); } @@ -107,7 +106,7 @@ public class StorageOptionsDialog extends PamDialog { c.gridx = 0; c.gridy++; c.fill = GridBagConstraints.HORIZONTAL; - addComponent(mainPanel, l = new JLabel(aDataBlock.getDataName(), JLabel.RIGHT), c); + addComponent(mainPanel, l = new JLabel(aDataBlock.getDataName(), SwingConstants.RIGHT), c); pcu = aDataBlock.getParentProcess().getPamControlledUnit(); l.setToolTipText("Module: " + pcu.getUnitName()); @@ -117,7 +116,7 @@ public class StorageOptionsDialog extends PamDialog { addComponent(mainPanel, cb = new JCheckBox(), c); // cb.setVisible(hasBinaryStore); cb.setEnabled(hasBinaryStore && binaryStore != null); - if (hasBinaryStore == false) { + if (!hasBinaryStore) { cb.setToolTipText("Binary storage is not available for this data block"); } if (hasBinaryStore) { @@ -129,7 +128,7 @@ public class StorageOptionsDialog extends PamDialog { addComponent(mainPanel, cb = new JCheckBox(), c); // cb.setVisible(hasDatabase); cb.setEnabled(hasDatabase && database != null); - if (hasDatabase == false) { + if (!hasDatabase) { cb.setToolTipText("Database storage is not available for this data block"); } if (hasDatabase) { @@ -154,7 +153,7 @@ public class StorageOptionsDialog extends PamDialog { for (int i = 0; i < usedDataBlocks.size(); i++) { storeDatabase = dbCheckBoxes.get(i).isSelected(); storeBinary = bsCheckBoxes.get(i).isSelected(); - if (storeDatabase == false && storeBinary == false) { + if (!storeDatabase && !storeBinary) { errors++; } storageParameters.setStorageOptions(usedDataBlocks.get(i), storeDatabase, storeBinary); diff --git a/src/PamController/XMLTest.java b/src/PamController/XMLTest.java index 4a7afbf1..62d0a444 100644 --- a/src/PamController/XMLTest.java +++ b/src/PamController/XMLTest.java @@ -15,7 +15,6 @@ import javax.xml.transform.stream.StreamResult; import org.w3c.dom.Document; import org.w3c.dom.Element; - //import com.sun.org.apache.xerces.internal.dom.DocumentImpl; //import com.sun.org.apache.xerces.internal.parsers.SAXParser; //import com.sun.org.apache.xml.internal.serialize.OutputFormat; diff --git a/src/PamDetection/AbstractLocalisation.java b/src/PamDetection/AbstractLocalisation.java index 95d9db06..73cd921c 100644 --- a/src/PamDetection/AbstractLocalisation.java +++ b/src/PamDetection/AbstractLocalisation.java @@ -1,7 +1,5 @@ package PamDetection; -import pamMaths.PamQuaternion; -import pamMaths.PamVector; import Array.ArrayManager; import GPS.GpsData; import Jama.Matrix; @@ -10,6 +8,8 @@ import PamUtils.LatLong; import PamUtils.PamUtils; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; +import pamMaths.PamQuaternion; +import pamMaths.PamVector; /** * Class for localisation information. diff --git a/src/PamDetection/AcousticSQLLogging.java b/src/PamDetection/AcousticSQLLogging.java index 02935a9b..c21dbf1b 100644 --- a/src/PamDetection/AcousticSQLLogging.java +++ b/src/PamDetection/AcousticSQLLogging.java @@ -1,14 +1,12 @@ package PamDetection; import java.sql.Types; -import java.util.ArrayList; import java.util.List; -import annotation.DataAnnotationType; -import annotation.handler.AnnotationHandler; -import annotationMark.MarkDataUnit; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; +import annotation.DataAnnotationType; +import annotation.handler.AnnotationHandler; import generalDatabase.PamTableDefinition; import generalDatabase.PamTableItem; import generalDatabase.SQLLogging; diff --git a/src/PamDetection/DetectionMatchModel.java b/src/PamDetection/DetectionMatchModel.java index b569469b..071d1d23 100644 --- a/src/PamDetection/DetectionMatchModel.java +++ b/src/PamDetection/DetectionMatchModel.java @@ -1,6 +1,7 @@ package PamDetection; import java.util.ArrayList; + import PamguardMVC.PamDataUnit; public interface DetectionMatchModel { diff --git a/src/PamDetection/LocContents.java b/src/PamDetection/LocContents.java index 4c952100..63910007 100644 --- a/src/PamDetection/LocContents.java +++ b/src/PamDetection/LocContents.java @@ -134,6 +134,7 @@ public class LocContents implements LocalisationInfo { * * @param locContents a set of flags specifying which data are available within this localisation object. */ + @Override public void setLocContent(int locContents) { this.locContents = locContents; } @@ -142,6 +143,7 @@ public class LocContents implements LocalisationInfo { * The integer specifying which flags are present in the loclaisation. * @return bitmap of localisation contents. */ + @Override public int getLocContent( ) { return locContents; } @@ -150,6 +152,7 @@ public class LocContents implements LocalisationInfo { * * @param flagsToAdd localisation flags to add to existing flags. */ + @Override public void addLocContent(int flagsToAdd) { locContents |= flagsToAdd; } @@ -159,6 +162,7 @@ public class LocContents implements LocalisationInfo { * @param flagsToRemove bitmap of localisation flags to remove. * @return new or remaining localisation content flags. */ + @Override public int removeLocContent(int flagsToRemove) { locContents &= (~flagsToRemove); return locContents; @@ -169,6 +173,7 @@ public class LocContents implements LocalisationInfo { * @param requiredContent specified content * @return true if specified content exists, false otherwise. */ + @Override public boolean hasLocContent(int requiredContent) { return ((requiredContent & locContents) >= requiredContent); } diff --git a/src/PamModel/AboutPluginDisplay.java b/src/PamModel/AboutPluginDisplay.java index 7c5af779..69e06af8 100644 --- a/src/PamModel/AboutPluginDisplay.java +++ b/src/PamModel/AboutPluginDisplay.java @@ -1,18 +1,15 @@ package PamModel; -import java.awt.BorderLayout; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextArea; +import javax.swing.ScrollPaneConstants; import javax.swing.border.EmptyBorder; import PamView.dialog.PamDialog; @@ -91,7 +88,7 @@ public class AboutPluginDisplay extends PamDialog { aboutText.setRows(10); aboutText.setLineWrap(true); aboutText.setWrapStyleWord(true); - scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); p.add(scrollPane,c); setDialogComponent(p); diff --git a/src/PamModel/CommonPluginInterface.java b/src/PamModel/CommonPluginInterface.java index fe6eac47..da34a0ec 100644 --- a/src/PamModel/CommonPluginInterface.java +++ b/src/PamModel/CommonPluginInterface.java @@ -20,10 +20,6 @@ */ package PamModel; -import java.io.File; - -import fftManager.FFTDataUnit; - /** * Interface for PAMGuard plugins. *

diff --git a/src/PamModel/DependencyManager.java b/src/PamModel/DependencyManager.java index ca27a110..262c9f62 100644 --- a/src/PamModel/DependencyManager.java +++ b/src/PamModel/DependencyManager.java @@ -58,7 +58,7 @@ public class DependencyManager { PamControlledUnit dependency = findDependency(pamDependency); // System.out.println("HereA 2"); - if (dependency != null || create == false) return dependency; + if (dependency != null || !create) return dependency; /* * No data block of the correct type / data name exists, so diff --git a/src/PamModel/ImportExport.java b/src/PamModel/ImportExport.java index 1d24aa88..4a798790 100644 --- a/src/PamModel/ImportExport.java +++ b/src/PamModel/ImportExport.java @@ -4,7 +4,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; @@ -16,7 +15,6 @@ import javax.swing.JFileChooser; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; -import PamController.settings.output.xml.PamguardXMLReader; import PamController.settings.output.xml.PamguardXMLWriter; import PamController.settings.output.xml.XMLImportData; import PamController.settings.output.xml.XMLSettingsSwing; diff --git a/src/PamModel/PamModel.java b/src/PamModel/PamModel.java index 732b0623..2f816d5a 100644 --- a/src/PamModel/PamModel.java +++ b/src/PamModel/PamModel.java @@ -36,20 +36,6 @@ import javax.swing.JFrame; import Acquisition.DaqSystemInterface; import Array.ArraySidePanelControl; -import clickDetector.ClickDetection; -import dataMap.DataMapControl; -import detectiongrouplocaliser.DetectionGroupControl; -import effortmonitor.EffortControl; -import whistlesAndMoans.AbstractWhistleDataUnit; -import fftManager.FFTDataUnit; -import fftManager.PamFFTControl; -import group3dlocaliser.Group3DLocaliserControl; -import meygenturbine.MeygenTurbine; -import printscreen.PrintScreenControl; -import ravendata.RavenControl; -import rockBlock.RockBlockControl; -import tethys.TethysControl; -import turbineops.TurbineOperationControl; import GPS.GpsDataUnit; import NMEA.NMEADataUnit; import PamController.PamControlledUnitSettings; @@ -59,6 +45,7 @@ import PamController.PamGUIManager; import PamController.PamSettingManager; import PamController.PamSettings; import PamDetection.RawDataUnit; +import PamUtils.FileFinder; import PamView.dialog.warn.WarnOnce; import PamguardMVC.PamDataBlock; import analogarraysensor.ArraySensorControl; @@ -67,7 +54,20 @@ import beamformer.continuous.BeamFormerControl; import bearinglocaliser.BearingLocaliserControl; import binaryFileStorage.SecondaryBinaryStore; import cepstrum.CepstrumControl; -import PamUtils.FileFinder; +import clickDetector.ClickDetection; +import dataMap.DataMapControl; +import detectiongrouplocaliser.DetectionGroupControl; +import effortmonitor.EffortControl; +import fftManager.FFTDataUnit; +import fftManager.PamFFTControl; +import group3dlocaliser.Group3DLocaliserControl; +import meygenturbine.MeygenTurbine; +import printscreen.PrintScreenControl; +import ravendata.RavenControl; +import rockBlock.RockBlockControl; +import tethys.TethysControl; +import turbineops.TurbineOperationControl; +import whistlesAndMoans.AbstractWhistleDataUnit; /** * @author Doug Gillespie @@ -227,7 +227,7 @@ final public class PamModel implements PamSettings { mi.setModulesMenuGroup(mapsGroup); mi.setToolTipText("Interprets NMEA data to extract GPS data"); mi.setMinNumber(0); - if (isViewer == false) { + if (!isViewer) { mi.addDependency(new PamDependency(NMEADataUnit.class, "NMEA.NMEAControl")); mi.setMaxNumber(1); } @@ -319,14 +319,14 @@ final public class PamModel implements PamSettings { mi = PamModuleInfo.registerControlledUnit(SecondaryBinaryStore.class.getName(), SecondaryBinaryStore.unitType); mi.setModulesMenuGroup(utilitiesGroup); mi.setToolTipText("Additional binary data from 2nd, 3rd, etc. moorings."); - mi.setHidden(isViewer == false || SMRUEnable.isEnable() == false); + mi.setHidden(!isViewer || !SMRUEnable.isEnable()); // if (isSMRU) { mi = PamModuleInfo.registerControlledUnit("networkTransfer.send.NetworkSender", "Network Sender"); mi.setModulesMenuGroup(utilitiesGroup); mi.setToolTipText("Sends PAMGuard data over a network to other computers"); - mi.setHidden(SMRUEnable.isEnable() == false); + mi.setHidden(!SMRUEnable.isEnable()); // mi = PamModuleInfo.registerControlledUnit("serialPortLogger.SerialLogger", "Serial Port Logger"); @@ -342,7 +342,7 @@ final public class PamModel implements PamSettings { mi.setToolTipText("Receives PAMGuard data sent over the network from the Network Sender module"); mi.setMaxNumber(1); mi.setMinNumber(pamController.getRunMode() == PamController.RUN_NETWORKRECEIVER ? 1 : 0); - mi.setHidden(SMRUEnable.isEnable() == false); + mi.setHidden(!SMRUEnable.isEnable()); } // mi = PamModuleInfo.registerControlledUnit("decimus.summarystring.DStrControl", "Decimus Summary Strings"); @@ -398,7 +398,7 @@ final public class PamModel implements PamSettings { mi = PamModuleInfo.registerControlledUnit(TurbineOperationControl.class.getName(), TurbineOperationControl.unitType); mi.setModulesMenuGroup(utilitiesGroup); - mi.setHidden(SMRUEnable.isEnable() == false); + mi.setHidden(!SMRUEnable.isEnable()); } mi = PamModuleInfo.registerControlledUnit("alarm.AlarmControl", "Alarm"); @@ -413,7 +413,7 @@ final public class PamModel implements PamSettings { mi = PamModuleInfo.registerControlledUnit("quickAnnotation.QuickAnnotationModule", "Quick Spectrogram Annotation"); mi.setToolTipText("Manual marking on the spectrogram display using user-defined 'quick' annotations"); mi.setModulesMenuGroup(utilitiesGroup); - mi.setHidden(SMRUEnable.isEnable() == false); + mi.setHidden(!SMRUEnable.isEnable()); // now releagate to a plugin module. // mi = PamModuleInfo.registerControlledUnit(ALFAControl.class.getName(), "Master Controller"); @@ -435,13 +435,13 @@ final public class PamModel implements PamSettings { mi = PamModuleInfo.registerControlledUnit(RockBlockControl.class.getName(), "Short Burst Data Service Communication"); mi.setToolTipText("Communication with the Iridium SBD service via a RockBlock+ unit"); mi.setModulesMenuGroup(utilitiesGroup); - mi.setHidden(SMRUEnable.isEnable() == false); + mi.setHidden(!SMRUEnable.isEnable()); mi = PamModuleInfo.registerControlledUnit(MeygenTurbine.class.getName(), MeygenTurbine.unitType); mi.setToolTipText("Show turbine location on map"); mi.setModulesMenuGroup(utilitiesGroup); - mi.setHidden(SMRUEnable.isEnable() == false); + mi.setHidden(!SMRUEnable.isEnable()); mi.setMaxNumber(1); @@ -469,12 +469,12 @@ final public class PamModel implements PamSettings { mi.setModulesMenuGroup(utilitiesGroup); mi.setMaxNumber(1); //mi.addGUICompatabilityFlag(PamGUIManager.FX); //has FX enabled GUI. - mi.setHidden(SMRUEnable.isEnable() == false); + mi.setHidden(!SMRUEnable.isEnable()); mi = PamModuleInfo.registerControlledUnit(RavenControl.class.getName(), RavenControl.defaultName); mi.setToolTipText("Import data from Raven selection tables"); mi.setModulesMenuGroup(utilitiesGroup); - mi.setHidden(SMRUEnable.isEnable() == false); + mi.setHidden(!SMRUEnable.isEnable()); } @@ -507,24 +507,24 @@ final public class PamModel implements PamSettings { mi = PamModuleInfo.registerControlledUnit("IMU.IMUControl", "IMU Measurement"); mi.setModulesMenuGroup(sensorsGroup); mi.setToolTipText("Reads IMU data (heading, pitch and roll) from file or instrument"); - mi.setHidden(SMRUEnable.isEnable() == false); + mi.setHidden(!SMRUEnable.isEnable()); // mi.setHidden(SMRUEnable.isEnable() == false); mi = PamModuleInfo.registerControlledUnit("d3.D3Control", "D3 Sensor Data"); mi.setModulesMenuGroup(sensorsGroup); mi.setToolTipText("Display sensor data from D3 recorders / DTags, etc"); - mi.setHidden(SMRUEnable.isEnable() == false); + mi.setHidden(!SMRUEnable.isEnable()); mi = PamModuleInfo.registerControlledUnit("soundtrap.STToolsControl", "SoundTrap Detector Import"); mi.setModulesMenuGroup(sensorsGroup); mi.setToolTipText("Tools for import of SoundTrap detector data"); - mi.setHidden(isViewer == false); + mi.setHidden(!isViewer); mi.setMaxNumber(1); mi = PamModuleInfo.registerControlledUnit("cpod.CPODControl2", "CPOD Detector Import"); mi.setModulesMenuGroup(sensorsGroup); mi.setToolTipText("Imports CPOD data"); - mi.setHidden(SMRUEnable.isEnable() == false); + mi.setHidden(!SMRUEnable.isEnable()); mi.addGUICompatabilityFlag(PamGUIManager.FX); //has FX enabled GUI. /* @@ -650,7 +650,7 @@ final public class PamModel implements PamSettings { mi.addDependency(new PamDependency(RawDataUnit.class, "Acquisition.AcquisitionControl")); mi.setToolTipText("Measure noise relative to animal hearing threshold"); mi.setModulesMenuGroup(processingGroup); - mi.setHidden(SMRUEnable.isEnable() == false); + mi.setHidden(!SMRUEnable.isEnable()); mi = PamModuleInfo.registerControlledUnit("noiseOneBand.OneBandControl", "Filtered Noise Measurement"); mi.addDependency(new PamDependency(RawDataUnit.class, "Acquisition.AcquisitionControl")); @@ -1335,7 +1335,7 @@ final public class PamModel implements PamSettings { //URLClassLoader cl = new URLClassLoader(new URL[]{classFile.toURI().toURL()}); // mi = PamModuleInfo.registerControlledUnit(pf.getClassName(), pf.getDescription(),cl); mi = PamModuleInfo.registerControlledUnit(pf.getClassName(), pf.getDescription(),classLoader); - if (isAllowedMode(pf) == false) { + if (!isAllowedMode(pf)) { mi.setHidden(true); System.out.println(" Warning: " + pf.getDefaultName()+" cannot run in this mode. hiding module."); } @@ -1469,7 +1469,8 @@ final public class PamModel implements PamSettings { super(urls, parent); } - public void addURL(URL url) { + @Override + public void addURL(URL url) { super.addURL(url); } } diff --git a/src/PamModel/PamModelSettings.java b/src/PamModel/PamModelSettings.java index 667747b8..5758f7eb 100644 --- a/src/PamModel/PamModelSettings.java +++ b/src/PamModel/PamModelSettings.java @@ -56,7 +56,7 @@ public class PamModelSettings implements Cloneable, Serializable, ManagedParamet * settings file). After that, the user can set to zero * if they want to. */ - if (oldJitterParam == false) { + if (!oldJitterParam) { threadingJitterMillis = 1000; oldJitterParam = true; } diff --git a/src/PamModel/PamModuleInfo.java b/src/PamModel/PamModuleInfo.java index 36d97309..a374f554 100644 --- a/src/PamModel/PamModuleInfo.java +++ b/src/PamModel/PamModuleInfo.java @@ -13,11 +13,9 @@ import javax.swing.JOptionPane; import PamController.PamConfiguration; import PamController.PamControlledUnit; import PamController.PamController; -import PamController.PamControllerInterface; import PamView.MenuItemEnabler; import PamView.dialog.warn.WarnOnce; import dataModelFX.connectionNodes.ModuleIconFactory.ModuleIcon; -import javafx.stage.Stage; /** * Holds information about available PAMGUARD modules. @@ -205,6 +203,7 @@ public class PamModuleInfo implements PamDependent{ this.moduleInfo = moduleInfo; } + @Override public void actionPerformed(ActionEvent e) { // first check dependencies to see if everything required // by this module actually exists @@ -345,7 +344,7 @@ public class PamModuleInfo implements PamDependent{ menuItem.setToolTipText(mi.toolTipText); } - if (mi.canCreate() == false) { + if (!mi.canCreate()) { //continue; menuItem.setEnabled(false); } @@ -382,7 +381,7 @@ public class PamModuleInfo implements PamDependent{ continue; } if (mi != null) { - if (mi.canRemove() == false) continue; + if (!mi.canRemove()) continue; } menuItem = new JMenuItem(pamControlledUnit.getUnitName()); menuItem.addActionListener(new RemoveModuleMenuAction(pamControlledUnit)); @@ -411,6 +410,7 @@ public class PamModuleInfo implements PamDependent{ this.pamControlledUnit = pamControlledUnit; } + @Override public void actionPerformed(ActionEvent e) { int ans = JOptionPane.showConfirmDialog(pamControlledUnit.getGuiFrame(), "Do you really want to remove the module " @@ -503,6 +503,7 @@ public class PamModuleInfo implements PamDependent{ /* (non-Javadoc) * @see PamModel.PamDependent#addDependancy(PamModel.PamDependency) */ + @Override public void addDependency(PamDependency dependancy) { pamDependency = dependancy; @@ -512,6 +513,7 @@ public class PamModuleInfo implements PamDependent{ /* (non-Javadoc) * @see PamModel.PamDependent#getDependency() */ + @Override public PamDependency getDependency() { return pamDependency; @@ -521,6 +523,7 @@ public class PamModuleInfo implements PamDependent{ /* (non-Javadoc) * @see PamModel.PamDependent#getDependentUserName() */ + @Override public String getDependentUserName() { return this.description; } diff --git a/src/PamModel/PamPluginInterface.java b/src/PamModel/PamPluginInterface.java index 13539613..f9a46ec1 100644 --- a/src/PamModel/PamPluginInterface.java +++ b/src/PamModel/PamPluginInterface.java @@ -20,10 +20,6 @@ */ package PamModel; -import java.io.File; - -import fftManager.FFTDataUnit; - /** * Interface for PAMGuard plugins. *

diff --git a/src/PamModel/ThreadingDialog.java b/src/PamModel/ThreadingDialog.java index 862e4059..abfb9908 100644 --- a/src/PamModel/ThreadingDialog.java +++ b/src/PamModel/ThreadingDialog.java @@ -13,6 +13,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextArea; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; import PamView.dialog.PamDialog; @@ -77,7 +78,7 @@ public class ThreadingDialog extends PamDialog { gcPanel.add(enableGC = new JCheckBox("Run additional garbage collection"), c); c.gridwidth = 1; c.gridy++; - gcPanel.add(new JLabel("Interval ", JLabel.RIGHT), c); + gcPanel.add(new JLabel("Interval ", SwingConstants.RIGHT), c); c.gridx++; gcPanel.add(gcInterval = new JTextField(5), c); c.gridx++; diff --git a/src/PamUtils/CheckStorageFolder.java b/src/PamUtils/CheckStorageFolder.java index 89e0b602..e12445e3 100644 --- a/src/PamUtils/CheckStorageFolder.java +++ b/src/PamUtils/CheckStorageFolder.java @@ -34,7 +34,7 @@ public class CheckStorageFolder { moduleName, JOptionPane.WARNING_MESSAGE); return false; } - else if (file.exists() == false & autoCreate) { + else if (!file.exists() & autoCreate) { int ans = JOptionPane.showOptionDialog(null, "Folder " + pathName + " does not exist. \nWould you like to create it ?", moduleName, @@ -45,7 +45,7 @@ public class CheckStorageFolder { } if (ans == JOptionPane.YES_OPTION) { try { - if (file.mkdirs() == false) { + if (!file.mkdirs()) { return checkPath(pathName, false); } FileFunctions.setNonIndexingBit(file); diff --git a/src/PamUtils/DiskSpaceFormat.java b/src/PamUtils/DiskSpaceFormat.java index 6c7f8467..27edb917 100644 --- a/src/PamUtils/DiskSpaceFormat.java +++ b/src/PamUtils/DiskSpaceFormat.java @@ -1,7 +1,6 @@ package PamUtils; import java.io.File; -import java.text.NumberFormat; /** * Functions to get and display disk space in sensible units. @@ -35,10 +34,10 @@ public class DiskSpaceFormat { } try { File fPath = new File(path); - if (fPath.exists() == false) { + if (!fPath.exists()) { fPath = fPath.getParentFile(); } - if (fPath.exists() == false) { + if (!fPath.exists()) { return null; } return fPath.getFreeSpace(); diff --git a/src/PamUtils/FileFunctions.java b/src/PamUtils/FileFunctions.java index 739a7a92..1e722ef9 100644 --- a/src/PamUtils/FileFunctions.java +++ b/src/PamUtils/FileFunctions.java @@ -4,7 +4,9 @@ import java.io.File; import java.io.IOException; import com.sun.jna.platform.win32.Kernel32; +import com.sun.jna.platform.win32.WinBase; import com.sun.jna.platform.win32.WinDef.DWORD; +import com.sun.jna.platform.win32.WinNT; /** * Functions connected with storing data files. @@ -30,9 +32,9 @@ public class FileFunctions { folder = new File(base); } if (autoCreate) { - if (folder.exists() == false) { + if (!folder.exists()) { folder.mkdirs(); - if (folder.exists() == false) { + if (!folder.exists()) { return null; } } @@ -49,9 +51,9 @@ public class FileFunctions { */ public static File createNonIndexedFolder(String path) { File folder = new File(path); - if (folder.exists() == false) { + if (!folder.exists()) { folder.mkdirs(); - if (folder.exists() == false) { + if (!folder.exists()) { return null; } } @@ -84,7 +86,7 @@ public class FileFunctions { boolean success = false; try { int theAttrib = FileFunctions.getAttributes(file); - DWORD attribWithSetBit = new DWORD (theAttrib | Kernel32.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED); + DWORD attribWithSetBit = new DWORD (theAttrib | WinNT.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED); FileFunctions.setAttributes(file, attribWithSetBit); success = true; } catch (Exception e) { @@ -102,7 +104,7 @@ public class FileFunctions { private static int getAttributes(File file) throws Exception { try { int attrib = Kernel32.INSTANCE.GetFileAttributes(pathString(file)); - if (attrib == Kernel32.INVALID_FILE_ATTRIBUTES) { + if (attrib == WinBase.INVALID_FILE_ATTRIBUTES) { throw new IOException("Unable to read file attributes of " + file); } return attrib; @@ -118,7 +120,7 @@ public class FileFunctions { } public static boolean isNotIndexed(File file) throws Exception { - return (getAttributes(file) & Kernel32.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED) != 0; + return (getAttributes(file) & WinNT.FILE_ATTRIBUTE_NOT_CONTENT_INDEXED) != 0; } } diff --git a/src/PamUtils/FileList.java b/src/PamUtils/FileList.java index 7297ac76..cbbaa02f 100644 --- a/src/PamUtils/FileList.java +++ b/src/PamUtils/FileList.java @@ -44,7 +44,7 @@ public class FileList { return null; } File rootFolder = new File(folderName); - if (rootFolder.exists() == false) { + if (!rootFolder.exists()) { return null; } fileList = new ArrayList(); diff --git a/src/PamUtils/FolderZipper.java b/src/PamUtils/FolderZipper.java index f3ca00dc..96595cf2 100644 --- a/src/PamUtils/FolderZipper.java +++ b/src/PamUtils/FolderZipper.java @@ -1,10 +1,10 @@ package PamUtils; import java.io.File; -import java.util.zip.ZipOutputStream; -import java.io.FileOutputStream; import java.io.FileInputStream; +import java.io.FileOutputStream; import java.util.zip.ZipEntry; +import java.util.zip.ZipOutputStream; //example by pitchoun from http://www.theserverside.com/discussions/thread.tss?thread_id=34906 //FolderZipper provide a static method to zip a folder. /** diff --git a/src/PamUtils/LatLong.java b/src/PamUtils/LatLong.java index 6d465ee6..6e520b30 100644 --- a/src/PamUtils/LatLong.java +++ b/src/PamUtils/LatLong.java @@ -14,8 +14,8 @@ import java.text.NumberFormat; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; +import PamModel.parametermanager.PrivatePamParameterData; import PamguardMVC.PamConstants; import net.sf.geographiclib.Geodesic; import net.sf.geographiclib.PolygonArea; @@ -731,7 +731,7 @@ public class LatLong implements Serializable, Cloneable, Transferable, PamCoordi // DataFlavor[] a = clipboard.getContents(null).getTransferDataFlavors(); boolean ans = clipboard.getContents(null).isDataFlavorSupported(LatLong.getDataFlavor()); - if (ans == false) { + if (!ans) { return null; } diff --git a/src/PamUtils/LatLongDialog.java b/src/PamUtils/LatLongDialog.java index 4b4befa5..cc2a30c1 100644 --- a/src/PamUtils/LatLongDialog.java +++ b/src/PamUtils/LatLongDialog.java @@ -9,7 +9,6 @@ import java.awt.event.ActionListener; import javax.swing.BoxLayout; import javax.swing.ButtonGroup; -import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.border.TitledBorder; @@ -87,6 +86,7 @@ public class LatLongDialog extends PamDialog implements ActionListener { /* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ + @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == decimalMinutes) { diff --git a/src/PamUtils/LatLongDialogStrip.java b/src/PamUtils/LatLongDialogStrip.java index c0b5d53e..0450d26b 100644 --- a/src/PamUtils/LatLongDialogStrip.java +++ b/src/PamUtils/LatLongDialogStrip.java @@ -11,7 +11,6 @@ import java.awt.event.KeyListener; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; -import javax.swing.JTextField; import javax.swing.border.TitledBorder; import PamView.dialog.PamDialog; @@ -153,6 +152,7 @@ public class LatLongDialogStrip extends JPanel implements KeyListener, ActionLis /* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ + @Override public void actionPerformed(ActionEvent e) { newTypedValues(null); @@ -161,6 +161,7 @@ public class LatLongDialogStrip extends JPanel implements KeyListener, ActionLis /* (non-Javadoc) * @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent) */ + @Override public void keyPressed(KeyEvent e) { newTypedValues(e); @@ -169,6 +170,7 @@ public class LatLongDialogStrip extends JPanel implements KeyListener, ActionLis /* (non-Javadoc) * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent) */ + @Override public void keyReleased(KeyEvent e) { newTypedValues(e); @@ -177,6 +179,7 @@ public class LatLongDialogStrip extends JPanel implements KeyListener, ActionLis /* (non-Javadoc) * @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent) */ + @Override public void keyTyped(KeyEvent e) { newTypedValues(e); @@ -234,12 +237,12 @@ public class LatLongDialogStrip extends JPanel implements KeyListener, ActionLis nsew.setSelectedIndex(1); } double deg = LatLong.getSignedDegrees(value); - if (degrees.isVisible() == false || !hiddenOnly) degrees.setText(String.format("%d", (int)Math.abs(deg))); - if (minutes.isVisible() == false || !hiddenOnly) minutes.setText(String.format("%d", LatLong.getIntegerMinutes(value))); - if (decminutes.isVisible() == false || !hiddenOnly) decminutes.setText(String.format("%3.5f", LatLong.getDecimalMinutes(value))); - if (seconds.isVisible() == false || !hiddenOnly) seconds.setText(String.format("%3.5f", LatLong.getSeconds(value))); - if (nsew.isVisible() == false || !hiddenOnly) nsew.setSelectedIndex(deg >= 0 ? 0 : 1); - if (decimal.isVisible() == false || !hiddenOnly) decimal.setText(String.format("%.8f", value)); + if (!degrees.isVisible() || !hiddenOnly) degrees.setText(String.format("%d", (int)Math.abs(deg))); + if (!minutes.isVisible() || !hiddenOnly) minutes.setText(String.format("%d", LatLong.getIntegerMinutes(value))); + if (!decminutes.isVisible() || !hiddenOnly) decminutes.setText(String.format("%3.5f", LatLong.getDecimalMinutes(value))); + if (!seconds.isVisible() || !hiddenOnly) seconds.setText(String.format("%3.5f", LatLong.getSeconds(value))); + if (!nsew.isVisible() || !hiddenOnly) nsew.setSelectedIndex(deg >= 0 ? 0 : 1); + if (!decimal.isVisible() || !hiddenOnly) decimal.setText(String.format("%.8f", value)); sayFormattedValue(value); } diff --git a/src/PamUtils/LatLongEditableDialogStrip.java b/src/PamUtils/LatLongEditableDialogStrip.java index bcaeaff9..3f9a1742 100644 --- a/src/PamUtils/LatLongEditableDialogStrip.java +++ b/src/PamUtils/LatLongEditableDialogStrip.java @@ -1,6 +1,5 @@ package PamUtils; -import java.awt.Component; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Window; @@ -15,6 +14,7 @@ import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; import Array.ArrayManager; @@ -49,7 +49,7 @@ public class LatLongEditableDialogStrip implements PamDialogPanel { c.gridx = 0; c.gridy = 0; c.gridwidth = 1; - PamDialog.addComponent(mainPanel, new JLabel("Latitude: ", JLabel.RIGHT), c); + PamDialog.addComponent(mainPanel, new JLabel("Latitude: ", SwingConstants.RIGHT), c); c.gridx ++; c.gridwidth = 2; PamDialog.addComponent(mainPanel, latitude = new JTextField(12), c); @@ -67,7 +67,7 @@ public class LatLongEditableDialogStrip implements PamDialogPanel { c.gridx = 0; c.gridy++; c.gridwidth = 1; - PamDialog.addComponent(mainPanel, new JLabel("Longitude: ", JLabel.RIGHT), c); + PamDialog.addComponent(mainPanel, new JLabel("Longitude: ", SwingConstants.RIGHT), c); c.gridx ++; c.gridwidth = 2; PamDialog.addComponent(mainPanel, longitude = new JTextField(12), c); diff --git a/src/PamUtils/PamAudioFileFilter.java b/src/PamUtils/PamAudioFileFilter.java index e1f20a95..138689b7 100644 --- a/src/PamUtils/PamAudioFileFilter.java +++ b/src/PamUtils/PamAudioFileFilter.java @@ -1,7 +1,5 @@ package PamUtils; -import PamUtils.PamFileFilter; - public class PamAudioFileFilter extends PamFileFilter { public PamAudioFileFilter() { diff --git a/src/PamUtils/PamCalendar.java b/src/PamUtils/PamCalendar.java index 428130d0..2e36a8c0 100644 --- a/src/PamUtils/PamCalendar.java +++ b/src/PamUtils/PamCalendar.java @@ -25,7 +25,6 @@ import java.text.ParseException; import java.text.SimpleDateFormat; import java.time.LocalDateTime; import java.time.ZoneOffset; -import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.Locale; @@ -33,7 +32,6 @@ import java.util.TimeZone; import PamController.PamController; import PamUtils.time.CalendarControl; -import binaryFileStorage.BinaryStore; /** diff --git a/src/PamUtils/PamFileFilter.java b/src/PamUtils/PamFileFilter.java index 4ad318f5..047dec0f 100644 --- a/src/PamUtils/PamFileFilter.java +++ b/src/PamUtils/PamFileFilter.java @@ -111,7 +111,7 @@ public class PamFileFilter extends javax.swing.filechooser.FileFilter implements } String fEnd = getExtension(f); if (fEnd != null && fEnd.equals(end)) return f; - if (fEnd != null && fEnd.length() > 1 && forceEnd == false) return f; + if (fEnd != null && fEnd.length() > 1 && !forceEnd) return f; // either there is no end, or it's the wrong type. String newName = f.getAbsolutePath(); if (fEnd != null) { // remove it ! diff --git a/src/PamUtils/PamSort.java b/src/PamUtils/PamSort.java index 542adbef..6c48f272 100644 --- a/src/PamUtils/PamSort.java +++ b/src/PamUtils/PamSort.java @@ -1,9 +1,5 @@ package PamUtils; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.RandomAccess; import java.util.Vector; @@ -33,7 +29,7 @@ public class PamSort { theOther = list.get(p2); if (theOther.compareTo(theOne) < 0) { break; - }; + } list.set(pos, theOther); } list.set(pos, theOne); diff --git a/src/PamUtils/PlatformInfo.java b/src/PamUtils/PlatformInfo.java index 6557e9fd..8794b23c 100644 --- a/src/PamUtils/PlatformInfo.java +++ b/src/PamUtils/PlatformInfo.java @@ -9,7 +9,7 @@ public class PlatformInfo { // http://javablog.co.uk/2007/05/19/making-jni-cross-platform/ // CJB 2009-06-10 - public enum OSType {WINDOWS, MACOSX, LINUX, UNSUPPORTED}; + public enum OSType {WINDOWS, MACOSX, LINUX, UNSUPPORTED} public static OSType calculateOS() { String osName = System.getProperty("os.name").toLowerCase(); @@ -27,7 +27,7 @@ public class PlatformInfo { return OSType.UNSUPPORTED; } - public enum ARCHType {X86, X86_64,UNSUPPORTED}; + public enum ARCHType {X86, X86_64,UNSUPPORTED} public static ARCHType calculateArch() { //For now only going to worry about shared libraries for diff --git a/src/PamUtils/SelectFolder.java b/src/PamUtils/SelectFolder.java index 45588708..3e9cdd0c 100644 --- a/src/PamUtils/SelectFolder.java +++ b/src/PamUtils/SelectFolder.java @@ -22,8 +22,6 @@ package PamUtils; import java.awt.BorderLayout; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; @@ -35,11 +33,8 @@ import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; -import javax.swing.border.TitledBorder; import PamController.PamFolders; -import PamView.dialog.PamDialog; -import PamView.dialog.PamGridBagContraints; /** * Makes a dialog panel for selecting a folder @@ -118,11 +113,13 @@ public class SelectFolder { setVisibleControls(); } class BrowseButton implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { browseDirectories(); } } class SubFolders implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { notifyChangeListeners(); } @@ -197,17 +194,17 @@ public class SelectFolder { String folder = folderName.getText(); File f = new File(folder); if (checkPath) { - if (f.exists() == false) { + if (!f.exists()) { if (JOptionPane.showConfirmDialog(folderPanel, "The directory " + folder + " does not exist " + "do you want to create it ?", "Select Directory", JOptionPane.YES_NO_CANCEL_OPTION) == JOptionPane.YES_OPTION) { - if (f.mkdirs() == false) { + if (!f.mkdirs()) { // print a warning message JOptionPane.showMessageDialog(folderPanel, "The folder " + folder + " could not be created", "Error", JOptionPane.ERROR_MESSAGE); } } } - if (f.exists() == false) return null; + if (!f.exists()) return null; FileFunctions.setNonIndexingBit(f); } return folder; diff --git a/src/PamUtils/Splash.java b/src/PamUtils/Splash.java index e5994524..f3d54db7 100644 --- a/src/PamUtils/Splash.java +++ b/src/PamUtils/Splash.java @@ -26,13 +26,13 @@ import java.awt.Dimension; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; +import java.awt.Rectangle; +import java.awt.SplashScreen; import java.awt.Toolkit; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; -import java.awt.SplashScreen; -import java.awt.Rectangle; import java.io.File; import java.io.IOException; import java.net.URL; @@ -107,6 +107,7 @@ public class Splash extends JWindow implements Runnable { } + @Override public void run() { //let's see if we have a JVM SplashScreen already displayed @@ -236,6 +237,7 @@ public class Splash extends JWindow implements Runnable { } final Runnable closeSplashRunnable = new Runnable() { + @Override public void run() { try { setVisible(false); @@ -250,6 +252,7 @@ public class Splash extends JWindow implements Runnable { final int pauseTimeout = displayDuration; // Cast to final Runnable displayDurationRunnable = new Runnable() { + @Override public void run() { try { Thread.sleep(pauseTimeout); diff --git a/src/PamUtils/SystemTiming.java b/src/PamUtils/SystemTiming.java index d577de6e..bc04b4ee 100644 --- a/src/PamUtils/SystemTiming.java +++ b/src/PamUtils/SystemTiming.java @@ -84,29 +84,29 @@ public class SystemTiming { * */ public static long getProcessCPUTime () { - if (loadTried == false) { + if (!loadTried) { load(); } - if (loadOK == false) return 0; + if (!loadOK) return 0; return sysGetProcessCPUTime(); } public static boolean setSystemTime(long timeMilliseconds) { - if (loadTried == false) { + if (!loadTried) { load(); } - if (loadOK == false) return false; + if (!loadOK) return false; Calendar c = Calendar.getInstance(); c.setTimeInMillis(timeMilliseconds); return setSystemTime(c); } public static boolean setSystemTime(Calendar c) { - if (loadTried == false) { + if (!loadTried) { load(); } - if (loadOK == false) return false; + if (!loadOK) return false; c.setTimeZone(TimeZone.getTimeZone("GMT")); return sysSetSystemTime(c.get(Calendar.YEAR), c.get(Calendar.MONTH), c.get(Calendar.DATE), c.get(Calendar.HOUR_OF_DAY), c.get(Calendar.MINUTE), c.get(Calendar.SECOND), c.get(Calendar.MILLISECOND)); diff --git a/src/PamUtils/TimedObservable.java b/src/PamUtils/TimedObservable.java index 39482251..7dd7d4c4 100644 --- a/src/PamUtils/TimedObservable.java +++ b/src/PamUtils/TimedObservable.java @@ -23,6 +23,7 @@ public class TimedObservable extends Observable { class ObserverTimerAction implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { notifyObservers(); } @@ -59,7 +60,7 @@ public class TimedObservable extends Observable { super.notifyObservers(); } else { - if (t.isRunning() == false) { + if (!t.isRunning()) { t.start(); } } diff --git a/src/PamUtils/TxtFileUtils.java b/src/PamUtils/TxtFileUtils.java index d0a80d06..12a3c25f 100644 --- a/src/PamUtils/TxtFileUtils.java +++ b/src/PamUtils/TxtFileUtils.java @@ -6,8 +6,6 @@ import java.io.File; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; -import java.math.BigDecimal; -import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.ArrayList; import java.util.Collection; @@ -246,7 +244,7 @@ public class TxtFileUtils { data.add(dat); } - if (isNaN==true && !nanOk) return null; + if (isNaN && !nanOk) return null; else return data; } diff --git a/src/PamUtils/XMLUtils.java b/src/PamUtils/XMLUtils.java index acccde94..cd535b35 100644 --- a/src/PamUtils/XMLUtils.java +++ b/src/PamUtils/XMLUtils.java @@ -170,7 +170,7 @@ public class XMLUtils { * @return document */ public static Document createDocument(File xmlFile) { - if (xmlFile == null || xmlFile.exists() == false) { + if (xmlFile == null || !xmlFile.exists()) { return null; } DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); diff --git a/src/PamUtils/ZipUtility.java b/src/PamUtils/ZipUtility.java index 4ca4a987..9e7d1642 100644 --- a/src/PamUtils/ZipUtility.java +++ b/src/PamUtils/ZipUtility.java @@ -7,7 +7,6 @@ import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Enumeration; -import java.util.zip.CRC32; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; import java.util.zip.ZipOutputStream; diff --git a/src/PamView/AnnotationsPopup.java b/src/PamView/AnnotationsPopup.java index b3f053a2..b63bedb3 100644 --- a/src/PamView/AnnotationsPopup.java +++ b/src/PamView/AnnotationsPopup.java @@ -11,8 +11,8 @@ import javax.swing.JPanel; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; -import PamguardMVC.ProcessAnnotation; import PamguardMVC.PamDataBlock; +import PamguardMVC.ProcessAnnotation; public class AnnotationsPopup extends PamDialog { diff --git a/src/PamView/BasicKeyItem.java b/src/PamView/BasicKeyItem.java index 55746022..272a6244 100644 --- a/src/PamView/BasicKeyItem.java +++ b/src/PamView/BasicKeyItem.java @@ -22,7 +22,7 @@ public class BasicKeyItem implements PamKeyItem { } public void addIcon(Icon icon, String text) { - if (setupArrays(true) == false) return; + if (!setupArrays(true)) return; icons.add(icon); texts.add(text); } @@ -32,7 +32,7 @@ public class BasicKeyItem implements PamKeyItem { } public void addIcon(Component component, String text) { - if (setupArrays(false) == false) return; + if (!setupArrays(false)) return; components.add(component); texts.add(text); } @@ -60,6 +60,7 @@ public class BasicKeyItem implements PamKeyItem { return true; } + @Override public Component getIcon(int keyType, int nComponent) { if (texts == null) return null; if (nComponent >= 0 && nComponent < texts.size()) { @@ -73,10 +74,12 @@ public class BasicKeyItem implements PamKeyItem { return null; } + @Override public int getNumItems(int keyType) { return texts.size(); } + @Override public String getText(int keyType, int nComponent) { if (nComponent >= 0 && nComponent < texts.size()) { return texts.get(nComponent); diff --git a/src/PamView/ClipboardCopier.java b/src/PamView/ClipboardCopier.java index 1008fbdf..e44924fa 100644 --- a/src/PamView/ClipboardCopier.java +++ b/src/PamView/ClipboardCopier.java @@ -217,6 +217,7 @@ public class ClipboardCopier implements ClipboardOwner, Transferable, Printable * @author Doug Gillespie */ class CopyToClipboard implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { copyToClipBoard(); } @@ -251,6 +252,7 @@ public class ClipboardCopier implements ClipboardOwner, Transferable, Printable * @author Doug Gillespie */ class PrintAction implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { printComponent(); } diff --git a/src/PamView/ColourComboBox.java b/src/PamView/ColourComboBox.java index dcd95f67..c2510399 100644 --- a/src/PamView/ColourComboBox.java +++ b/src/PamView/ColourComboBox.java @@ -1,14 +1,22 @@ package PamView; -import java.awt.*; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Graphics2D; import java.awt.event.ActionListener; import java.awt.image.BufferedImage; +import javax.swing.BorderFactory; +import javax.swing.ImageIcon; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.ListCellRenderer; + import PamView.ColourArray.ColourArrayType; import PamView.panel.PamPanel; -import javax.swing.*; - @SuppressWarnings("serial") public class ColourComboBox extends PamPanel { @@ -153,6 +161,7 @@ public class ColourComboBox extends PamPanel { * to the selected value and returns the label, set up * to display the text and image. */ + @Override public Component getListCellRendererComponent( JList list, Object value, diff --git a/src/PamView/ColourScheme.java b/src/PamView/ColourScheme.java index ffa787b8..fe264bac 100644 --- a/src/PamView/ColourScheme.java +++ b/src/PamView/ColourScheme.java @@ -7,7 +7,6 @@ import java.util.Hashtable; import javax.swing.JButton; import javax.swing.JPanel; -import javax.swing.border.TitledBorder; import PamView.PamColors.PamColor; @@ -105,7 +104,7 @@ public class ColourScheme implements Serializable, Cloneable { * @return colour index (1 - 12) */ public int getWhaleColourIndex(int iCol) { - if (colsChecked == false) { + if (!colsChecked) { checkAllColours(); colsChecked = true; } @@ -130,7 +129,7 @@ public class ColourScheme implements Serializable, Cloneable { * @return Colour */ public Color getChannelColour(int iCol) { - if (colsChecked == false) { + if (!colsChecked) { checkAllColours(); colsChecked = true; } diff --git a/src/PamView/DBTextArea.java b/src/PamView/DBTextArea.java index ce2ba444..bfdf591c 100644 --- a/src/PamView/DBTextArea.java +++ b/src/PamView/DBTextArea.java @@ -49,10 +49,13 @@ public class DBTextArea { } class CommentListener implements KeyListener { + @Override public void keyPressed(KeyEvent e) { } + @Override public void keyReleased(KeyEvent e) { } + @Override public void keyTyped(KeyEvent e) { checkCommentLength(); } diff --git a/src/PamView/GeneralProjector.java b/src/PamView/GeneralProjector.java index 5329d10c..bae9c10c 100644 --- a/src/PamView/GeneralProjector.java +++ b/src/PamView/GeneralProjector.java @@ -34,6 +34,7 @@ import java.util.Collections; import java.util.Iterator; import java.util.LinkedList; import java.util.List; + import javax.swing.JComponent; import javax.swing.Timer; import javax.swing.ToolTipManager; @@ -99,7 +100,7 @@ public abstract class GeneralProjector { } - }; + } static public enum ParameterUnits { SECONDS ("s"), HZ ("Hz"), DB ("dB"), RAW ("raw"), DECIMALDEGREES ("\u00B0"), METERS ("m"), @@ -127,7 +128,7 @@ public abstract class GeneralProjector { // // } // } - }; + } static public final int NPARAMETERS = 3; @@ -303,27 +304,32 @@ public abstract class GeneralProjector { timer = new Timer(10,this); } + @Override public void mouseExited(MouseEvent e) { hideHoverItem(); timer.stop(); } + @Override public void mouseMoved(MouseEvent e) { mousePoint = e.getPoint(); hideHoverItem(); timer.restart(); } + @Override public void mousePressed(MouseEvent e) { } public void mouseWheelMoved(MouseWheelEvent e) { } + @Override public void mouseEntered(MouseEvent e) { timer.start(); } + @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == timer) { showHoverItem(); @@ -343,16 +349,19 @@ public abstract class GeneralProjector { timer.restart(); } + @Override public void mouseClicked(MouseEvent e) { // TODO Auto-generated method stub } + @Override public void mouseReleased(MouseEvent e) { // TODO Auto-generated method stub } + @Override public void mouseDragged(MouseEvent e) { // TODO Auto-generated method stub diff --git a/src/PamView/GuiFrameManager.java b/src/PamView/GuiFrameManager.java index b49da8d7..ecca89cd 100644 --- a/src/PamView/GuiFrameManager.java +++ b/src/PamView/GuiFrameManager.java @@ -190,7 +190,7 @@ public class GuiFrameManager implements PamSettings, PAMControllerGUI { makeFrameList(); int iFrame = 0; while (true) { - if (frameExists(iFrame) == false) { + if (!frameExists(iFrame)) { return iFrame; } iFrame++; @@ -382,6 +382,7 @@ public class GuiFrameManager implements PamSettings, PAMControllerGUI { } + @Override public void addControlledUnit(PamControlledUnit controlledUnit) { for (int i = 0; i < pamViewList.size(); i++) { pamViewList.get(i).addControlledUnit(controlledUnit); @@ -395,6 +396,7 @@ public class GuiFrameManager implements PamSettings, PAMControllerGUI { } } + @Override public void addView(PamViewInterface newView) { if (pamViewList == null) { pamViewList = new ArrayList(); @@ -409,6 +411,7 @@ public class GuiFrameManager implements PamSettings, PAMControllerGUI { pamViewList.remove(oldView); } + @Override public void showControlledUnit(PamControlledUnit unit) { for (int i = 0; i < pamViewList.size(); i++) { pamViewList.get(i).showControlledUnit(unit); @@ -427,14 +430,15 @@ public class GuiFrameManager implements PamSettings, PAMControllerGUI { } } + @Override public void notifyModelChanged(int changeType) { for (int i = 0; i < pamViewList.size(); i++) { pamViewList.get(i).modelChanged(changeType); } - if (changeType == PamController.INITIALIZATION_COMPLETE) { + if (changeType == PamControllerInterface.INITIALIZATION_COMPLETE) { intialiseFrames(); } - if (changeType==PamController.ADD_CONTROLLEDUNIT) { + if (changeType==PamControllerInterface.ADD_CONTROLLEDUNIT) { if (this.getFrame(0)!=null) this.getFrame(0).revalidate(); } if (changeType==PamControllerInterface.REMOVE_CONTROLLEDUNIT) { @@ -461,6 +465,7 @@ public class GuiFrameManager implements PamSettings, PAMControllerGUI { } + @Override public void destroyModel() { for (int i = 0; i < pamViewList.size(); i++) { pamViewList.get(i).modelChanged(PamControllerInterface.DESTROY_EVERYTHING); @@ -503,6 +508,7 @@ public class GuiFrameManager implements PamSettings, PAMControllerGUI { return true; } + @Override public void enableGUIControl(boolean enable) { for (int i = 0; i < pamViewList.size(); i++) { // pamViewList.get(i).enableGUIControl(enable); @@ -648,7 +654,7 @@ public class GuiFrameManager implements PamSettings, PAMControllerGUI { continue; } frame.setLocation(loc, loc); - frame.setState(JFrame.NORMAL); + frame.setState(Frame.NORMAL); frame.setVisible(true); loc += 20; } diff --git a/src/PamView/HidingSidePanel.java b/src/PamView/HidingSidePanel.java index 022e8a03..d47719cf 100644 --- a/src/PamView/HidingSidePanel.java +++ b/src/PamView/HidingSidePanel.java @@ -1,7 +1,6 @@ package PamView; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.Component; import java.awt.Dimension; import java.awt.Insets; @@ -14,7 +13,6 @@ import javax.swing.BoxLayout; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JComponent; -import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.ScrollPaneConstants; diff --git a/src/PamView/HoverData.java b/src/PamView/HoverData.java index 0feec624..1b33a6fb 100644 --- a/src/PamView/HoverData.java +++ b/src/PamView/HoverData.java @@ -31,7 +31,7 @@ public class HoverData { } public HoverData(Coordinate3d c, PamDataUnit pamDataUnit, int iSide, int subPlotNumber) { - this.setCoordinate3D(c);; + this.setCoordinate3D(c); this.pamDataUnit = pamDataUnit; this.iSide = iSide; this.subPlotNumber = subPlotNumber; diff --git a/src/PamView/ImportLoadBar.java b/src/PamView/ImportLoadBar.java index f06ef88e..d38a7ff9 100644 --- a/src/PamView/ImportLoadBar.java +++ b/src/PamView/ImportLoadBar.java @@ -59,13 +59,14 @@ public class ImportLoadBar extends PamDialog { textUpdate.setText(string); } + @Override public JButton getCancelButton( ){ return super.getCancelButton(); } @Override public void setVisible(boolean visible) { - if (visible == false) { + if (!visible) { closeLater(); } else { diff --git a/src/PamView/JFontChooser.java b/src/PamView/JFontChooser.java index 5d037495..4bab2233 100644 --- a/src/PamView/JFontChooser.java +++ b/src/PamView/JFontChooser.java @@ -8,7 +8,6 @@ import java.awt.Font; import java.awt.Frame; import java.awt.GraphicsEnvironment; import java.awt.GridLayout; -import java.awt.Label; import java.awt.event.ActionEvent; import java.awt.event.FocusAdapter; import java.awt.event.FocusEvent; @@ -33,6 +32,8 @@ import javax.swing.JScrollPane; import javax.swing.JTextField; import javax.swing.KeyStroke; import javax.swing.ListSelectionModel; +import javax.swing.ScrollPaneConstants; +import javax.swing.SwingConstants; import javax.swing.SwingUtilities; import javax.swing.border.Border; import javax.swing.event.DocumentEvent; @@ -413,6 +414,7 @@ public class JFontChooser extends JComponent JDialog dialog = createDialog(parent); dialog.addWindowListener(new WindowAdapter() { + @Override public void windowClosing(WindowEvent e) { dialogResultValue = CANCEL_OPTION; @@ -435,9 +437,10 @@ public class JFontChooser extends JComponent this.textComponent = textComponent; } + @Override public void valueChanged(ListSelectionEvent e) { - if (e.getValueIsAdjusting() == false) + if (!e.getValueIsAdjusting()) { JList list = (JList) e.getSource(); String selectedValue = (String) list.getSelectedValue(); @@ -464,11 +467,13 @@ public class JFontChooser extends JComponent this.textComponent = textComponent; } + @Override public void focusGained(FocusEvent e) { textComponent.selectAll(); } + @Override public void focusLost(FocusEvent e) { textComponent.select(0, 0); @@ -485,6 +490,7 @@ public class JFontChooser extends JComponent this.targetList = list; } + @Override public void keyPressed(KeyEvent e) { int i = targetList.getSelectedIndex(); @@ -522,16 +528,19 @@ public class JFontChooser extends JComponent this.targetList = targetList; } + @Override public void insertUpdate(DocumentEvent e) { update(e); } + @Override public void removeUpdate(DocumentEvent e) { update(e); } + @Override public void changedUpdate(DocumentEvent e) { update(e); @@ -579,6 +588,7 @@ public class JFontChooser extends JComponent this.index = index; } + @Override public void run() { targetList.setSelectedIndex(this.index); @@ -599,6 +609,7 @@ public class JFontChooser extends JComponent putValue(Action.NAME, (ACTION_NAME)); } + @Override public void actionPerformed(ActionEvent e) { dialogResultValue = OK_OPTION; @@ -619,6 +630,7 @@ public class JFontChooser extends JComponent putValue(Action.NAME, (ACTION_NAME)); } + @Override public void actionPerformed(ActionEvent e) { dialogResultValue = CANCEL_OPTION; @@ -681,7 +693,7 @@ public class JFontChooser extends JComponent JScrollPane scrollPane = new JScrollPane(getFontFamilyList()); scrollPane.getVerticalScrollBar().setFocusable(false); - scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); JPanel p = new JPanel(); p.setLayout(new BorderLayout()); @@ -689,8 +701,8 @@ public class JFontChooser extends JComponent p.add(scrollPane, BorderLayout.CENTER); JLabel label = new JLabel(("Font Name")); - label.setHorizontalAlignment(JLabel.LEFT); - label.setHorizontalTextPosition(JLabel.LEFT); + label.setHorizontalAlignment(SwingConstants.LEFT); + label.setHorizontalTextPosition(SwingConstants.LEFT); label.setLabelFor(getFontFamilyTextField()); label.setDisplayedMnemonic('F'); @@ -712,7 +724,7 @@ public class JFontChooser extends JComponent JScrollPane scrollPane = new JScrollPane(getFontStyleList()); scrollPane.getVerticalScrollBar().setFocusable(false); - scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); JPanel p = new JPanel(); p.setLayout(new BorderLayout()); @@ -720,8 +732,8 @@ public class JFontChooser extends JComponent p.add(scrollPane, BorderLayout.CENTER); JLabel label = new JLabel(("Font Style")); - label.setHorizontalAlignment(JLabel.LEFT); - label.setHorizontalTextPosition(JLabel.LEFT); + label.setHorizontalAlignment(SwingConstants.LEFT); + label.setHorizontalTextPosition(SwingConstants.LEFT); label.setLabelFor(getFontStyleTextField()); label.setDisplayedMnemonic('Y'); @@ -742,7 +754,7 @@ public class JFontChooser extends JComponent JScrollPane scrollPane = new JScrollPane(getFontSizeList()); scrollPane.getVerticalScrollBar().setFocusable(false); - scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); + scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); JPanel p = new JPanel(); p.setLayout(new BorderLayout()); @@ -750,8 +762,8 @@ public class JFontChooser extends JComponent p.add(scrollPane, BorderLayout.CENTER); JLabel label = new JLabel(("Font Size")); - label.setHorizontalAlignment(JLabel.LEFT); - label.setHorizontalTextPosition(JLabel.LEFT); + label.setHorizontalAlignment(SwingConstants.LEFT); + label.setHorizontalTextPosition(SwingConstants.LEFT); label.setLabelFor(getFontSizeTextField()); label.setDisplayedMnemonic('S'); diff --git a/src/PamView/ObserverListPopup.java b/src/PamView/ObserverListPopup.java index 50175972..64e1b237 100644 --- a/src/PamView/ObserverListPopup.java +++ b/src/PamView/ObserverListPopup.java @@ -8,7 +8,6 @@ import java.awt.Insets; import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.List; import javax.swing.JButton; import javax.swing.JDialog; @@ -121,6 +120,7 @@ public class ObserverListPopup extends JDialog implements ActionListener { panel.add(p); } + @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == closeButton) { setVisible(false); @@ -128,6 +128,7 @@ public class ObserverListPopup extends JDialog implements ActionListener { } Timer t = new Timer(1000, new ActionListener() { + @Override public void actionPerformed(ActionEvent evt) { for (int i = 0; i < Math.min(dataBlock.countObservers(), cpuLabels.length); i++) { cpuLabels[i].setText(String.format("%.1f%%", dataBlock.getCPUPercent(i))); diff --git a/src/PamView/PamAWTUtils.java b/src/PamView/PamAWTUtils.java index fbefad34..0c76dca4 100644 --- a/src/PamView/PamAWTUtils.java +++ b/src/PamView/PamAWTUtils.java @@ -3,16 +3,12 @@ package PamView; import java.awt.Component; import java.awt.Container; import java.awt.Shape; -import java.awt.geom.AffineTransform; import java.awt.geom.Line2D; import java.awt.geom.PathIterator; import java.awt.geom.Point2D; import java.util.ArrayList; -import java.util.Map; -import java.util.WeakHashMap; import javax.swing.JComponent; -import javax.swing.JPanel; /** * Useful functions for swing. diff --git a/src/PamView/PamColors.java b/src/PamView/PamColors.java index 4b4c3e52..e95d7823 100644 --- a/src/PamView/PamColors.java +++ b/src/PamView/PamColors.java @@ -26,7 +26,6 @@ import java.awt.Container; import java.awt.Font; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.awt.image.ColorModel; import java.io.Serializable; import java.util.Scanner; @@ -35,7 +34,6 @@ import javax.swing.JCheckBoxMenuItem; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuItem; -import javax.swing.JPanel; import javax.swing.SwingUtilities; import PamController.PamControlledUnitSettings; @@ -44,7 +42,6 @@ import PamController.PamControllerInterface; import PamController.PamGUIManager; import PamController.PamSettingManager; import PamController.PamSettings; -import PamModel.SMRUEnable; /** @@ -64,7 +61,7 @@ public class PamColors implements PamSettings { public static enum PamColor { PlOTWINDOW, BORDER, PLAIN, AXIS, GRID, MAP, WARNINGBORDER, BACKGROUND_ALPHA, HIGHLIGHT_ALPHA, HIGHLIGHT, GPSTRACK, LATLINE, LONLINE, TITLEBORDER, BUTTONFACE - }; + } static private PamColors singleInstance; @@ -211,7 +208,7 @@ public class PamColors implements PamSettings { } public void notifyModelChanged(int changeType) { - if (PamController.getInstance().isInitializationComplete() == false) { + if (!PamController.getInstance().isInitializationComplete()) { return; } switch (changeType) { @@ -397,22 +394,27 @@ public class PamColors implements PamSettings { return boldFont; } + @Override public Serializable getSettingsReference() { return colorSettings; } + @Override public long getSettingsVersion() { return ColorSettings.serialVersionUID; } + @Override public String getUnitName() { return "Pam Color Manager"; } + @Override public String getUnitType() { return "Pam Color Manager"; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { ColorSettings newSettings = (ColorSettings) pamControlledUnitSettings.getSettings(); this.colorSettings = newSettings.clone(); diff --git a/src/PamView/PamControlledGUISwing.java b/src/PamView/PamControlledGUISwing.java index ed8c1975..e4793dc8 100644 --- a/src/PamView/PamControlledGUISwing.java +++ b/src/PamView/PamControlledGUISwing.java @@ -203,7 +203,8 @@ public class PamControlledGUISwing extends PamControlledUnitGUI { return pamView.getGuiFrame(); } else { - return PamController.getInstance().getMainFrame(); + PamController.getInstance(); + return PamController.getMainFrame(); } } diff --git a/src/PamView/PamDetectionOverlayGraphics.java b/src/PamView/PamDetectionOverlayGraphics.java index 86418683..d90fb37e 100644 --- a/src/PamView/PamDetectionOverlayGraphics.java +++ b/src/PamView/PamDetectionOverlayGraphics.java @@ -1,6 +1,5 @@ package PamView; -import java.awt.AlphaComposite; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; @@ -10,14 +9,12 @@ import java.awt.Point; import java.awt.Rectangle; import java.awt.Stroke; import java.awt.Window; -import java.awt.geom.Ellipse2D; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; -import pamMaths.PamVector; import Acquisition.AcquisitionProcess; import Array.ArrayManager; import Array.HydrophoneLocator; @@ -40,6 +37,7 @@ import PamView.symbol.StandardSymbolChooser; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import Spectrogram.SpectrogramProjector; +import pamMaths.PamVector; public class PamDetectionOverlayGraphics extends PanelOverlayDraw { @@ -133,6 +131,7 @@ public class PamDetectionOverlayGraphics extends PanelOverlayDraw { * For simplicity I've broken it up into the three main display types * currently existing in Pamguard. */ + @Override public boolean canDraw(GeneralProjector generalProjector) { return canDraw(generalProjector.getParameterTypes(), generalProjector.getParameterUnits()); } @@ -147,6 +146,7 @@ public class PamDetectionOverlayGraphics extends PanelOverlayDraw { * @param parameterUnits parameter units. * @return true if the data can be (probably) drawn using this projector. */ + @Override public boolean canDraw(ParameterType[] parameterTypes, ParameterUnits[] parameterUnits) { /* @@ -228,6 +228,7 @@ public class PamDetectionOverlayGraphics extends PanelOverlayDraw { * Gets information for making up a key on various displays. * PamKeyItem is not yet implemented. */ + @Override public PamKeyItem createKeyItem(GeneralProjector generalProjector, int keyType) { return new PanelOverlayKeyItem(this); } @@ -238,9 +239,10 @@ public class PamDetectionOverlayGraphics extends PanelOverlayDraw { * of reading this code and for overriding the various functions.

* If display types are added to PAMGUARD, these functions will need to be added to. */ + @Override public Rectangle drawDataUnit(Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector) { - if (canDraw(generalProjector) == false) return null; + if (!canDraw(generalProjector)) return null; Graphics2D g2d = (Graphics2D) g; Stroke oldStroke = null; pamSymbol = getPamSymbol(pamDataUnit, generalProjector); @@ -695,7 +697,7 @@ public class PamDetectionOverlayGraphics extends PanelOverlayDraw { protected Rectangle drawOnSpectrogram(Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector) { // draw a rectangle with time and frequency bounds of detection. // spectrogram projector is now updated to use Hz instead of bins. - if (isDetectionData == false) return null; + if (!isDetectionData) return null; PamDataUnit pamDetection = pamDataUnit; // originally cast pamDataUnit to PamDetection class @@ -737,10 +739,10 @@ public class PamDetectionOverlayGraphics extends PanelOverlayDraw { protected Rectangle drawAmplitudeOnRadar(Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector) { - if (isDetectionData == false) return null; + if (!isDetectionData) return null; PamDataUnit pamDetection = pamDataUnit; // originally cast pamDataUnit to PamDetection class AbstractLocalisation localisation = pamDataUnit.getLocalisation(); - if (localisation == null || localisation.hasLocContent(LocContents.HAS_BEARING) == false) return null; + if (localisation == null || !localisation.hasLocContent(LocContents.HAS_BEARING)) return null; /* * Try to get the new bearing information first, then if that fails, get * the old one. @@ -818,7 +820,7 @@ public class PamDetectionOverlayGraphics extends PanelOverlayDraw { protected Rectangle drawRangeOnRadar(Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector) { AbstractLocalisation localisation = pamDataUnit.getLocalisation(); - if (localisation == null || localisation.hasLocContent(LocContents.HAS_BEARING | LocContents.HAS_RANGE) == false) return null; + if (localisation == null || !localisation.hasLocContent(LocContents.HAS_BEARING | LocContents.HAS_RANGE)) return null; int nLocs = localisation.getAmbiguityCount(); double bearing, range; Rectangle r = null, newR = null; @@ -893,7 +895,7 @@ public class PamDetectionOverlayGraphics extends PanelOverlayDraw { AbstractLocalisation localisation = pamDataUnit.getLocalisation(); if (localisation == null || - localisation.hasLocContent(LocContents.HAS_BEARING) == false) return null; + !localisation.hasLocContent(LocContents.HAS_BEARING)) return null; double bearing, slantAngle; ProjectorDrawingOptions drawOptions = generalProjector.getProjectorDrawingOptions(); Rectangle r = null, newR; @@ -953,6 +955,7 @@ public class PamDetectionOverlayGraphics extends PanelOverlayDraw { * @param iSide left or right (0 or 1 I think, might be -1 or +1 though !) * @return tooltip content consisting of text and / or an image. */ + @Override public String getHoverText(GeneralProjector generalProjector, PamDataUnit dataUnit, int iSide) { BufferedImage im = getHoverImage(generalProjector, dataUnit, iSide); // String hoverText = getHoverTextWithoutWrap(generalProjector, dataUnit, iSide); @@ -978,7 +981,7 @@ public class PamDetectionOverlayGraphics extends PanelOverlayDraw { e.printStackTrace(); } } - if (hoverText != null && hoverText.length() > 0 && hoverText.startsWith("") == false) { + if (hoverText != null && hoverText.length() > 0 && !hoverText.startsWith("")) { return "" + hoverText + ""; } else { @@ -1086,6 +1089,7 @@ public class PamDetectionOverlayGraphics extends PanelOverlayDraw { * set symbol for the overlay, but can be overridden if a detector has * some complicated way of using different symbols for different dataUnits. */ + @Override public PamSymbol getPamSymbol(PamDataUnit pamDataUnit, GeneralProjector projector) { PamSymbolChooser symbolChooser = projector.getPamSymbolChooser(); if (symbolChooser == null) { diff --git a/src/PamView/PamGui.java b/src/PamView/PamGui.java index bdfae2ee..01f35324 100644 --- a/src/PamView/PamGui.java +++ b/src/PamView/PamGui.java @@ -23,13 +23,13 @@ package PamView; import java.awt.BorderLayout; import java.awt.Component; import java.awt.Container; -import java.awt.DefaultKeyboardFocusManager; import java.awt.Desktop; import java.awt.Dimension; import java.awt.Font; import java.awt.Frame; import java.awt.HeadlessException; import java.awt.KeyEventDispatcher; +import java.awt.KeyboardFocusManager; import java.awt.Point; import java.awt.Rectangle; import java.awt.Window; @@ -38,11 +38,11 @@ import java.awt.event.ActionListener; import java.awt.event.ComponentAdapter; import java.awt.event.ComponentEvent; import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; +import java.io.File; import java.io.IOException; import java.io.Serializable; import java.net.MalformedURLException; @@ -73,10 +73,6 @@ import javax.swing.event.MenuEvent; import javax.swing.event.MenuListener; import Acquisition.DaqSystemInterface; -import annotation.tasks.AnnotationManager; -import metadata.MetaDataContol; -import performanceTests.PerformanceDialog; -import tipOfTheDay.TipOfTheDayManager; import Array.ArrayManager; //import Logging.LogDataObserver; import PamController.PamControlledUnit; @@ -87,12 +83,11 @@ import PamController.PamSettingManager; import PamController.PamSettings; import PamController.PamguardVersionInfo; import PamController.settings.SettingsImport; +import PamModel.AboutPluginDisplay; import PamModel.CommonPluginInterface; import PamModel.PamModel; import PamModel.PamModuleInfo; import PamModel.PamPluginInterface; -import PamModel.AboutPluginDisplay; -import PamModel.SMRUEnable; import PamUtils.PamCalendar; import PamUtils.Splash; import PamUtils.time.CalendarControl; @@ -102,8 +97,10 @@ import PamView.panel.PamBorderPanel; import PamView.panel.PamTabbedPane; import PamView.paneloverlay.overlaymark.MarkRelationships; import PamguardMVC.datakeeper.DataKeeper; - -import java.io.File; +import annotation.tasks.AnnotationManager; +import metadata.MetaDataContol; +import performanceTests.PerformanceDialog; +import tipOfTheDay.TipOfTheDayManager; /** * @author Doug Gillespie * @@ -241,7 +238,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { // some weird stuff going down whereby the screen position is // given as -8 from the corner where it really it. this can return // false and then push the display onto a different monitor, so alow for this. - if (posOK == false) { + if (!posOK) { topCorner.x += 10; topCorner.y += 10; posOK = ScreenSize.isPointOnScreen(topCorner); @@ -283,7 +280,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { public MainFrame(String title) throws HeadlessException { super(title); - DefaultKeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this); + KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(this); noTipTimer = new Timer(6000, new ActionListener() { @Override public void actionPerformed(ActionEvent e) { @@ -386,6 +383,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { } + @Override public void addControlledUnit(PamControlledUnit unit) { if (unit.getFrameNumber() != this.getFrameNumber()) { return; @@ -423,6 +421,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { return "Right click for more options"; } + @Override public void removeControlledUnit(PamControlledUnit unit) { unit.setPamView(null); if (unit.getTabPanel() != null) mainTab.remove(unit.getTabPanel().getPanel()); @@ -443,6 +442,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { class tabListener implements ChangeListener { + @Override public void stateChanged(ChangeEvent e) { if (initializationComplete) { guiParameters.selectedTab = mainTab.getSelectedIndex(); @@ -480,7 +480,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { */ public void ShowTabSpecificSettings() { - if (initializationComplete == false) return; + if (!initializationComplete) return; //System.out.println("Index: "+mainTab.getSelectedIndex()); //System.out.println("Placement: "+ mainTab.getTabPlacement()); @@ -644,7 +644,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { menuItem.addActionListener(new menuShowObjectDiagram()); fileMenu.add(menuItem); - if (isViewer == false) { + if (!isViewer) { fileMenu.add(DataKeeper.getInstance().getSwingMenuItem(frame)); } @@ -967,7 +967,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { public void menuCanceled(MenuEvent e) { } - }; + } class StorageOptions implements ActionListener { private JFrame parentFrame; @@ -977,6 +977,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { PamController.getInstance().storageOptions(parentFrame); } @@ -990,6 +991,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { PamController.getInstance().exportData(parentFrame); } @@ -1001,6 +1003,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { super(); this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent ev){ PamController.getInstance().exportGeneralXMLSettings(parentFrame, PamCalendar.getTimeInMillis()); } @@ -1013,30 +1016,35 @@ public class PamGui extends PamView implements WindowListener, PamSettings { // // } class MenuDataSave implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ PamController.getInstance().saveViewerData(); } } class menuSave implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ PamSettingManager.getInstance().saveSettings(frame); } } class menuSaveAs implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ PamSettingManager.getInstance().saveSettingsAs(frame); } } class menuSaveAsXML implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ // PamSettingManager.getInstance().saveSettingsAsXML(frame); } } class menuLoadSettings implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ // PamSettingManager.getInstance().loadSettingsFrom(frame); /** @@ -1054,16 +1062,19 @@ public class PamGui extends PamView implements WindowListener, PamSettings { * */ class menuImportSettings implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ PamSettingManager.getInstance().importSettings(frame); } } class menuExportSettings implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ PamSettingManager.getInstance().exportSettings(frame); } } class TestMenuHelpPG implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ PamHelp.getInstance().displayHelp(); //DatabaseController.getInstance(). @@ -1071,6 +1082,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { } class TipMenu implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ TipOfTheDayManager.getInstance().showTip(getGuiFrame(), null); } @@ -1083,6 +1095,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { * 9/18/2010 */ class OpenFolder implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ // PrintStream newStream = null; // /* @@ -1142,6 +1155,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { } class ToggleLogFile implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ String logFile = pamguard.Pamguard.getLogFileName(); if (logFile == null) { @@ -1159,6 +1173,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { class ScalingFactorManager implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ PamSettingManager.getInstance().scalingFactorDialog(frame); } @@ -1167,6 +1182,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { class PerformanceTests implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ PerformanceDialog.showDialog(getGuiFrame()); } @@ -1180,12 +1196,14 @@ public class PamGui extends PamView implements WindowListener, PamSettings { // } class menuModuleOrder implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ pamControllerInterface.orderModules(frame); } } class menuArray implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ ArrayManager.getArrayManager().showArrayDialog(getGuiFrame()); } @@ -1199,6 +1217,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { this.menu=menu; } + @Override public void mouseClicked(MouseEvent e) { menu.setPopupMenuVisible(false); ArrayManager.getArrayManager().showArrayDialog(getGuiFrame()); @@ -1207,34 +1226,40 @@ public class PamGui extends PamView implements WindowListener, PamSettings { } class importArray implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ ArrayManager.getArrayManager().showHydrophoneImportDialog(getGuiFrame()); } } class importStreamer implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ ArrayManager.getArrayManager().showStreamerImportDialog(getGuiFrame()); } } class menuShowObjectList implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ PamObjectList.ShowObjectList(getGuiFrame()); } } class menuShowObjectDiagram implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ PamObjectViewer.Show(getGuiFrame(), pamController.getPamConfiguration()); } } class menuOpenLogFile implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ PamObjectList.ShowObjectList(getGuiFrame()); } } class menuExit implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ /* * Really should stop Pam first ! @@ -1247,6 +1272,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { } class menuExitNoSave implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ prepareToClose(false); @@ -1282,12 +1308,14 @@ public class PamGui extends PamView implements WindowListener, PamSettings { } class ClearHiddenWarnings implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ WarnOnce.clearHiddenList(getGuiFrame()); } } class menuPamStart implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ pamControllerInterface.manualStart(); @@ -1305,18 +1333,21 @@ public class PamGui extends PamView implements WindowListener, PamSettings { // } class menuPamStop implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ pamControllerInterface.manualStop(); // enableLoggingMenu(); } } class MenuMultiThreading implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ pamControllerInterface.modelSettings(frame); // enableLoggingMenu(); } } class CreateWatchDog implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ PamController.getInstance().createWatchDog(); } @@ -1396,6 +1427,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { } class menuAbout implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ new Splash(30000, PamController.getInstance().getRunMode()); } @@ -1408,6 +1440,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { * */ class menuPlugin implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ // figure out which plugin was selected. The plugin default name was saved as the action command @@ -1433,6 +1466,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { } class menuCoreHelp implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ //System.out.println("PamGui: launch core pamguard help here"); } @@ -1444,6 +1478,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { super(); this.webAddr = webAddr; } + @Override public void actionPerformed(ActionEvent ev){ URL url = null; String fullAddr = "http://" + webAddr; @@ -1473,6 +1508,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { /* (non-Javadoc) * @see PamView.PamViewInterface#PamEnded() */ + @Override public void pamEnded() { enableMenus(); @@ -1482,6 +1518,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { /* (non-Javadoc) * @see PamView.PamViewInterface#PamStarted() */ + @Override public void pamStarted() { enableMenus(); @@ -1492,6 +1529,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { /* (non-Javadoc) * @see PamView.PamViewInterface#ModelChanged() */ + @Override public void modelChanged(int changeType) { switch (changeType) { case PamControllerInterface.INITIALIZATION_COMPLETE: @@ -1677,6 +1715,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { // PamSettingManager.getInstance().SaveSettings(); } + @Override public void windowClosed(WindowEvent e) { // PamSettingManager.getInstance().SaveSettings(); @@ -1724,7 +1763,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { PamController pamController = PamController.getInstance(); - if (pamController.canClose() == false) { + if (!pamController.canClose()) { return false; } @@ -1851,6 +1890,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { /* (non-Javadoc) * @see PamController.PamSettings#getSettingsReference() */ + @Override public Serializable getSettingsReference() { return guiParameters; } @@ -1858,6 +1898,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { /* (non-Javadoc) * @see PamController.PamSettings#getSettingsVersion() */ + @Override public long getSettingsVersion() { return GuiParameters.serialVersionUID; } @@ -1865,6 +1906,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { /* (non-Javadoc) * @see PamController.PamSettings#getUnitName() */ + @Override public String getUnitName() { if (getFrameNumber() == 0) { return "PamGUI"; @@ -1877,6 +1919,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { /* (non-Javadoc) * @see PamController.PamSettings#getUnitType() */ + @Override public String getUnitType() { return "PamGUI"; } @@ -1884,6 +1927,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { /* (non-Javadoc) * @see PamController.PamSettings#restoreSettings(PamController.PamControlledUnitSettings) */ + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { guiParameters = ((GuiParameters) pamControlledUnitSettings.getSettings()).clone(); return true; @@ -1949,7 +1993,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { normalLocation = guiFrame.getLocation(); normalSize = guiFrame.getSize(); // guiFrame.setAlwaysOnTop(true); - guiFrame.setExtendedState(JFrame.MAXIMIZED_BOTH); + guiFrame.setExtendedState(Frame.MAXIMIZED_BOTH); // guiFrame.setVisible(false); // guiFrame.setUndecorated(true); // guiFrame.setVisible(true); @@ -1968,7 +2012,7 @@ public class PamGui extends PamView implements WindowListener, PamSettings { // guiFrame.setSize(normalSize); } guiFrame.setAlwaysOnTop(false); - guiFrame.setExtendedState(JFrame.NORMAL); + guiFrame.setExtendedState(Frame.NORMAL); // guiFrame.setUndecorated(false); } diff --git a/src/PamView/PamList.java b/src/PamView/PamList.java index f4e25009..911b3487 100644 --- a/src/PamView/PamList.java +++ b/src/PamView/PamList.java @@ -3,9 +3,7 @@ package PamView; import java.awt.Color; import javax.swing.JList; -import javax.swing.JTextArea; import javax.swing.ListModel; -import javax.swing.text.Document; import PamView.PamColors.PamColor; diff --git a/src/PamView/PamLoadBar.java b/src/PamView/PamLoadBar.java index 9f3c3cd5..5b9b007f 100644 --- a/src/PamView/PamLoadBar.java +++ b/src/PamView/PamLoadBar.java @@ -1,12 +1,8 @@ package PamView; import java.awt.BorderLayout; -import java.awt.Dialog; import java.awt.Dimension; -import java.awt.Window; -import javax.swing.BoxLayout; -import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JProgressBar; import javax.swing.border.TitledBorder; diff --git a/src/PamView/PamObjectList.java b/src/PamView/PamObjectList.java index 25b01a9f..69ab51e6 100644 --- a/src/PamView/PamObjectList.java +++ b/src/PamView/PamObjectList.java @@ -30,7 +30,6 @@ import java.awt.event.MouseEvent; import java.awt.event.WindowEvent; import java.awt.event.WindowListener; import java.util.ArrayList; -import java.util.List; import javax.swing.JFrame; import javax.swing.JPanel; @@ -41,8 +40,8 @@ import javax.swing.table.AbstractTableModel; import PamController.PamController; import PamUtils.PamCalendar; -import PamView.tables.SwingTableColumnWidths; import PamView.dialog.PamDialog; +import PamView.tables.SwingTableColumnWidths; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObserver; @@ -81,7 +80,7 @@ public class PamObjectList extends PamDialog implements WindowListener { } private PamObjectList(PamController pamController) { - super(pamController.getMainFrame(), "PAMGuard Object List", false); + super(PamController.getMainFrame(), "PAMGuard Object List", false); mainPanel = new JPanel(new GridLayout(1, 0)); mainPanel.setOpaque(true); @@ -173,14 +172,17 @@ public class PamObjectList extends PamDialog implements WindowListener { return columnNames[column]; } + @Override public synchronized int getRowCount() { return PamController.getInstance().getDataBlocks().size(); } + @Override public synchronized int getColumnCount() { return columnNames.length; } + @Override public synchronized Object getValueAt(int row, int col) { /* * need to find the right process by going through and seeing which @@ -247,6 +249,7 @@ public class PamObjectList extends PamDialog implements WindowListener { } class TimerListener implements ActionListener { + @Override public void actionPerformed(ActionEvent ev) { tableData.fireTableDataChanged(); } @@ -320,30 +323,37 @@ public class PamObjectList extends PamDialog implements WindowListener { /** * Implementation of WindowListener */ + @Override public void windowActivated(WindowEvent e) { } + @Override public void windowClosing(WindowEvent e) { timer.stop(); } + @Override public void windowOpened(WindowEvent e) { timer.start(); } + @Override public void windowIconified(WindowEvent e) { } + @Override public void windowDeiconified(WindowEvent e) { } + @Override public void windowDeactivated(WindowEvent e) { // PamSettingManager.getInstance().SaveSettings(); } + @Override public void windowClosed(WindowEvent e) { // PamSettingManager.getInstance().SaveSettings(); diff --git a/src/PamView/PamObjectViewer.java b/src/PamView/PamObjectViewer.java index 17525076..962995f3 100644 --- a/src/PamView/PamObjectViewer.java +++ b/src/PamView/PamObjectViewer.java @@ -86,7 +86,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, PopupListener popupListener; - JMenuItem printMenuItem, layoutMenuItem;; + JMenuItem printMenuItem, layoutMenuItem; boolean doneLayout; @@ -202,7 +202,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, for (int iUnit = 0; iUnit < pamConfiguration.getNumControlledUnits(); iUnit++) { pamControlledUnit = pamConfiguration.getControlledUnit(iUnit); if (pamControlledUnit.getNumPamProcesses() == 0 - && pamObjectViewerSettings.showProcesslessModules == false) { + && !pamObjectViewerSettings.showProcesslessModules) { continue; } pamControllerView = new PamControllerView(pamControlledUnit); @@ -227,7 +227,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, } int maxColums = controllerList.size() + 2; - ; + int[] columnWidths = new int[maxColums]; int[] columnBottoms = new int[maxColums]; @@ -488,7 +488,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, } } super.setVisible(b); - if (doneLayout == false) { + if (!doneLayout) { layoutDiagram(); } } @@ -500,6 +500,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, * java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent * ) */ + @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == closeButton) { setVisible(false); @@ -920,7 +921,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, Component c = findComponent(processNum, blockNum); pt.y = this.getY() + getYOffset(); pt.y += c.getY(); - if (dataModifier == false) { + if (!dataModifier) { pt.y += c.getHeight() / 2; } else { @@ -947,7 +948,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, Component c = findComponent(dataBlock); pt.y = this.getY() + getYOffset(); pt.y += c.getY(); - if (dataModifier == false) { + if (!dataModifier) { pt.y += c.getHeight() / 2; } else { @@ -1204,6 +1205,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, } Timer blockTimer = new Timer(1000, new ActionListener() { + @Override public void actionPerformed(ActionEvent evt) { // fill in the CPU usage for (int i = 0; i < processThings.size(); i++) { @@ -1375,6 +1377,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, } Timer blockTimer = new Timer(1000, new ActionListener() { + @Override public void actionPerformed(ActionEvent evt) { // fill in the CPU usage cpuTime.setText(String.format("%3.1f%%", pamProcess.getCpuPercent())); @@ -1410,6 +1413,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, this.pamDataBlock = pamDataBlock; } + @Override public void actionPerformed(ActionEvent e) { JButton b = (JButton) e.getSource(); JPopupMenu menu = new JPopupMenu(); @@ -1437,6 +1441,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, this.b = b; } + @Override public void actionPerformed(ActionEvent e) { ObserverListPopup.show(objectFrame, b.getLocationOnScreen(), pamDataBlock); @@ -1452,6 +1457,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, this.b = b; } + @Override public void actionPerformed(ActionEvent e) { new AnnotationsPopup(objectFrame, b.getLocationOnScreen(), pamDataBlock); @@ -1520,6 +1526,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, } class RemoveAction implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { // check user really wants to do that ... int ans = JOptionPane.showConfirmDialog(objectFrame, @@ -1541,6 +1548,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { // check user really wants to do that ... String newName = NewModuleDialog.showDialog(parentFrame, @@ -1606,6 +1614,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, * @seejava.awt.event.ComponentListener#componentHidden(java.awt.event. * ComponentEvent) */ + @Override public void componentHidden(ComponentEvent e) { } @@ -1617,6 +1626,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, * java.awt.event.ComponentListener#componentMoved(java.awt.event.ComponentEvent * ) */ + @Override public void componentMoved(ComponentEvent e) { checkLayoutSize(); layoutPanel.repaint(); @@ -1628,6 +1638,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, * @seejava.awt.event.ComponentListener#componentResized(java.awt.event. * ComponentEvent) */ + @Override public void componentResized(ComponentEvent e) { } @@ -1638,6 +1649,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, * java.awt.event.ComponentListener#componentShown(java.awt.event.ComponentEvent * ) */ + @Override public void componentShown(ComponentEvent e) { } @@ -1686,6 +1698,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, } class setViewByController implements ActionListener { + @Override public void actionPerformed(ActionEvent ev) { if (pamObjectViewerSettings.viewStyle != PamObjectViewerSettings.VIEWBYCONTROLLER) { pamObjectViewerSettings.viewStyle = PamObjectViewerSettings.VIEWBYCONTROLLER; @@ -1696,6 +1709,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, } class setViewByProcess implements ActionListener { + @Override public void actionPerformed(ActionEvent ev) { if (pamObjectViewerSettings.viewStyle != PamObjectViewerSettings.VIEWBYPROCESS) { pamObjectViewerSettings.viewStyle = PamObjectViewerSettings.VIEWBYPROCESS; @@ -1706,6 +1720,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, } class ShowProcesslessModules implements ActionListener { + @Override public void actionPerformed(ActionEvent ev) { pamObjectViewerSettings.showProcesslessModules = !pamObjectViewerSettings.showProcesslessModules; showProcesslessModules @@ -1715,6 +1730,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, } class menuModuleOrder implements ActionListener { + @Override public void actionPerformed(ActionEvent ev) { if (PamController.getInstance().orderModules( getObjectViewer(null).objectFrame)) { @@ -1748,6 +1764,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, * * @see PamView.PamViewInterface#ModelChanged() */ + @Override public void modelChanged(int changeType) { // if (changeType == PamControllerInterface.CHANGED_PROCESS_SETTINGS) // if (true) return; @@ -1783,6 +1800,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, * * @see PamView.PamViewInterface#PamEnded() */ + @Override public void pamEnded() { } @@ -1792,27 +1810,33 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, * * @see PamView.PamViewInterface#PamStarted() */ + @Override public void pamStarted() { } + @Override public Serializable getSettingsReference() { pamObjectViewerSettings.frameRectangle = objectFrame.getBounds(); return pamObjectViewerSettings; } + @Override public long getSettingsVersion() { return PamObjectViewerSettings.serialVersionUID; } + @Override public String getUnitName() { return "ObjectViewer"; } + @Override public String getUnitType() { return "ObjectViewer"; } + @Override public boolean restoreSettings( PamControlledUnitSettings pamControlledUnitSettings) { pamObjectViewerSettings = (PamObjectViewerSettings) pamControlledUnitSettings @@ -1823,11 +1847,13 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, return true; } + @Override public void addControlledUnit(PamControlledUnit unit) { // TODO Auto-generated method stub } + @Override public void removeControlledUnit(PamControlledUnit unit) { // TODO Auto-generated method stub // could potentially uswe this function to remove module graphics more @@ -1835,6 +1861,7 @@ public class PamObjectViewer implements PamViewInterface, ComponentListener, // redrawing the whole model view ? } + @Override public void showControlledUnit(PamControlledUnit unit) { // TODO Auto-generated method stub diff --git a/src/PamView/PamOldSymbolManager.java b/src/PamView/PamOldSymbolManager.java index 08e7859a..7f255ab4 100644 --- a/src/PamView/PamOldSymbolManager.java +++ b/src/PamView/PamOldSymbolManager.java @@ -8,6 +8,7 @@ import java.util.ArrayList; import javax.swing.JMenu; import javax.swing.JMenuItem; + import PamController.PamControlledUnitSettings; import PamController.PamController; import PamController.PamControllerInterface; @@ -66,7 +67,7 @@ public class PamOldSymbolManager implements PamSettings, Serializable { * class with the symbol to be managed */ public void addManagesSymbol(ManagedSymbol managedSymbol) { - if (managedSymbols.contains(managedSymbol) == false) { + if (!managedSymbols.contains(managedSymbol)) { managedSymbols.add(managedSymbol); if (oldSettings != null) { @@ -95,13 +96,13 @@ public class PamOldSymbolManager implements PamSettings, Serializable { * @param managedSymbol */ public void updateManagedSymbol(ManagedSymbol managedSymbol) { - if (managedSymbols.contains(managedSymbol) == false) { + if (!managedSymbols.contains(managedSymbol)) { return; } if (oldSettings != null) { for (int i = 0; i < oldSettings.size(); i++) { - if (i < usedOldSettings.length && usedOldSettings[i] == false) + if (i < usedOldSettings.length && !usedOldSettings[i]) continue; if (managedSymbol.getSymbolInfo().getDescription().equals( oldSettings.get(i).getDescription())) { @@ -183,6 +184,7 @@ public class PamOldSymbolManager implements PamSettings, Serializable { this.managedSymbol = managedSymbol; } + @Override public void actionPerformed(ActionEvent arg0) { changeSymbol(guiFrame, managedSymbol); @@ -208,6 +210,7 @@ public class PamOldSymbolManager implements PamSettings, Serializable { } } + @Override public Serializable getSettingsReference() { ArrayList s = new ArrayList(); @@ -221,18 +224,22 @@ public class PamOldSymbolManager implements PamSettings, Serializable { return s; } + @Override public long getSettingsVersion() { return SymbolSettingsStoreUnit.serialVersionUID; } + @Override public String getUnitName() { return "PamSymbolManager"; } + @Override public String getUnitType() { return "PamSymbolManager"; } + @Override public boolean restoreSettings( PamControlledUnitSettings pamControlledUnitSettings) { try { diff --git a/src/PamView/PamPanelTiler.java b/src/PamView/PamPanelTiler.java index 1ef078c4..c3d0317a 100644 --- a/src/PamView/PamPanelTiler.java +++ b/src/PamView/PamPanelTiler.java @@ -131,24 +131,28 @@ public class PamPanelTiler { } private class Tile implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { tile(); } } private class TileHorizontal implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { tileHorizontal(); } } private class TileVertical implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { tileVertical(); } } private class Cascade implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { cascade(); } diff --git a/src/PamView/PamStatusBar.java b/src/PamView/PamStatusBar.java index 89303587..bb45fc32 100644 --- a/src/PamView/PamStatusBar.java +++ b/src/PamView/PamStatusBar.java @@ -1,7 +1,6 @@ package PamView; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.Component; import java.awt.FlowLayout; import java.awt.event.ActionEvent; @@ -12,8 +11,6 @@ import javax.swing.Timer; import javax.swing.border.EmptyBorder; import PamController.memory.PamMemory; -import PamView.PamColors.PamColor; -import PamView.dialog.PamLabel; import PamView.dialog.PamTextDisplay; import PamView.panel.PamPanel; diff --git a/src/PamView/PamSymbol.java b/src/PamView/PamSymbol.java index 2a4f4061..ace15ae9 100644 --- a/src/PamView/PamSymbol.java +++ b/src/PamView/PamSymbol.java @@ -587,6 +587,7 @@ public class PamSymbol extends PamSymbolBase implements Serializable, Icon, Clon * * @return an int specifying the fixed width of the icon. */ + @Override public int getIconWidth() { int iconWidth = 0; if ((iconStyle & ICON_STYLE_SYMBOL) != 0) { @@ -603,6 +604,7 @@ public class PamSymbol extends PamSymbolBase implements Serializable, Icon, Clon * * @return an int specifying the fixed height of the icon. */ + @Override public int getIconHeight() { if ((iconStyle & ICON_STYLE_SYMBOL) != 0) { return 16; @@ -613,10 +615,12 @@ public class PamSymbol extends PamSymbolBase implements Serializable, Icon, Clon // return 16; } + @Override public boolean isFill() { return getSymbolData().fill; } + @Override public void setFill(boolean fill) { getSymbolData().fill = fill; } diff --git a/src/PamView/PamSymbolDialog.java b/src/PamView/PamSymbolDialog.java index 8adddc2a..32e98e89 100644 --- a/src/PamView/PamSymbolDialog.java +++ b/src/PamView/PamSymbolDialog.java @@ -240,6 +240,7 @@ public class PamSymbolDialog extends PamDialog implements ActionListener { * (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ + @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == symbolButton) { @@ -315,6 +316,7 @@ public class PamSymbolDialog extends PamDialog implements ActionListener { * */ class ColorListener implements ChangeListener { + @Override public void stateChanged(ChangeEvent e) { if (givenSymbol == null) { return; @@ -332,6 +334,7 @@ public class PamSymbolDialog extends PamDialog implements ActionListener { * */ class ThickListener implements ChangeListener { + @Override public void stateChanged(ChangeEvent e) { if (givenSymbol == null) { return; @@ -351,6 +354,7 @@ public class PamSymbolDialog extends PamDialog implements ActionListener { } class WidthListener implements ChangeListener { + @Override public void stateChanged(ChangeEvent e) { int width = 8; String s = new String(symbolWidth.getValue().toString()); @@ -367,6 +371,7 @@ public class PamSymbolDialog extends PamDialog implements ActionListener { } class HeightListener implements ChangeListener { + @Override public void stateChanged(ChangeEvent e) { int height = 8; String s = new String(symbolHeight.getValue().toString()); diff --git a/src/PamView/PamSymbolSelector.java b/src/PamView/PamSymbolSelector.java index 6eb42390..0b915801 100644 --- a/src/PamView/PamSymbolSelector.java +++ b/src/PamView/PamSymbolSelector.java @@ -2,7 +2,6 @@ package PamView; import java.awt.BorderLayout; import java.awt.Dimension; -import java.awt.Frame; import java.awt.Graphics; import java.awt.Point; import java.awt.Window; @@ -78,6 +77,7 @@ public class PamSymbolSelector extends JPanel { } + @Override public void actionPerformed(ActionEvent e) { PamSymbol newSymbol = PamSymbolDialog.show(guiFrame, currentSymbol); diff --git a/src/PamView/PamTable.java b/src/PamView/PamTable.java index 5f0db341..f1251c9b 100644 --- a/src/PamView/PamTable.java +++ b/src/PamView/PamTable.java @@ -5,7 +5,6 @@ import java.util.Vector; import javax.swing.JTable; import javax.swing.ListSelectionModel; -import javax.swing.border.LineBorder; import javax.swing.table.JTableHeader; import javax.swing.table.TableColumnModel; import javax.swing.table.TableModel; diff --git a/src/PamView/PamView.java b/src/PamView/PamView.java index bcd6e259..79d26ec5 100644 --- a/src/PamView/PamView.java +++ b/src/PamView/PamView.java @@ -66,6 +66,7 @@ abstract public class PamView implements PamViewInterface { * tells the view to show the main display panel of a pamControlledUnit * @param pamControlledUnit */ + @Override abstract public void showControlledUnit(PamControlledUnit pamControlledUnit); abstract public void renameControlledUnit(PamControlledUnit pamControlledUnit); @@ -73,6 +74,7 @@ abstract public class PamView implements PamViewInterface { abstract public String getViewName(); + @Override public int getFrameNumber() { return frameNumber; } diff --git a/src/PamView/PanelOverlayKeyItem.java b/src/PamView/PanelOverlayKeyItem.java index 9c743836..cf21fdb0 100644 --- a/src/PamView/PanelOverlayKeyItem.java +++ b/src/PamView/PanelOverlayKeyItem.java @@ -13,6 +13,7 @@ public class PanelOverlayKeyItem implements PamKeyItem { this.pamDetectionOverlayGraphics = pamDetectionOverlayGraphics; } + @Override public Component getIcon(int keyType, int nComponent) { PamSymbol pamSymbol = pamDetectionOverlayGraphics.getDefaultSymbol(); if (pamSymbol == null) { @@ -21,10 +22,12 @@ public class PanelOverlayKeyItem implements PamKeyItem { return new IconPanel(pamSymbol); } + @Override public int getNumItems(int keyType) { return 1; } + @Override public String getText(int keyType, int nComponent) { return pamDetectionOverlayGraphics.getParentDataBlock().getDataName(); diff --git a/src/PamView/ScreenSize.java b/src/PamView/ScreenSize.java index 4b4d905b..b4bf640f 100644 --- a/src/PamView/ScreenSize.java +++ b/src/PamView/ScreenSize.java @@ -5,14 +5,8 @@ import java.awt.GraphicsDevice; import java.awt.GraphicsEnvironment; import java.awt.Point; import java.awt.Rectangle; -import java.util.List; - -import javax.swing.SwingUtilities; - -import com.sun.glass.ui.Screen; import PamController.PamGUIManager; -import javafx.scene.layout.Pane; /** * Class to launch a thread which will get the screen size @@ -110,7 +104,7 @@ public class ScreenSize { */ public static boolean forceBoundToScreen(Rectangle bounds) { try { - if (isPointOnScreen(bounds.getLocation()) == false) { + if (!isPointOnScreen(bounds.getLocation())) { bounds.x = bounds.y = 0; return true; } diff --git a/src/PamView/SymbolKeyItem.java b/src/PamView/SymbolKeyItem.java index 4aa6d5f7..4c06bc82 100644 --- a/src/PamView/SymbolKeyItem.java +++ b/src/PamView/SymbolKeyItem.java @@ -16,6 +16,7 @@ public class SymbolKeyItem implements PamKeyItem { this.text = text; } + @Override public Component getIcon(int keyType, int nComponent) { // JPanel p = new JPanel(); // p.setPreferredSize(new Dimension(pamSymbol.getIconWidth(), pamSymbol.getIconHeight())); @@ -24,10 +25,12 @@ public class SymbolKeyItem implements PamKeyItem { return new IconPanel(pamSymbol); } + @Override public int getNumItems(int keyType) { return 1; } + @Override public String getText(int keyType, int nComponent) { // TODO Auto-generated method stub return text; diff --git a/src/PamView/TextKeyItem.java b/src/PamView/TextKeyItem.java index 5c1b5984..6ad9c5ff 100644 --- a/src/PamView/TextKeyItem.java +++ b/src/PamView/TextKeyItem.java @@ -19,16 +19,19 @@ public class TextKeyItem implements PamKeyItem { this.text = text; } + @Override public Component getIcon(int keyType, int nComponent) { // TODO Auto-generated method stub return null; } + @Override public int getNumItems(int keyType) { // TODO Auto-generated method stub return 1; } + @Override public String getText(int keyType, int nComponent) { return text; } diff --git a/src/PamView/TopToolBar.java b/src/PamView/TopToolBar.java index d245c78c..deeb4d88 100644 --- a/src/PamView/TopToolBar.java +++ b/src/PamView/TopToolBar.java @@ -7,22 +7,15 @@ import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JLabel; import javax.swing.JPanel; -import javax.swing.JToolBar; import javax.swing.Timer; import org.kordamp.ikonli.materialdesign2.MaterialDesignP; import org.kordamp.ikonli.materialdesign2.MaterialDesignR; import org.kordamp.ikonli.swing.FontIcon; -import warnings.PamWarning; -import warnings.SingleLineWarningDisplay; -import warnings.WarningDisplay; -import warnings.WarningLabel; -import warnings.WarningSystem; import PamController.PamControlledUnit; import PamController.PamController; import PamUtils.PamCalendar; @@ -30,6 +23,7 @@ import PamView.PamColors.PamColor; import PamView.component.PamSettingsIconButton; import PamView.dialog.PamLabel; import PamView.panel.PamPanel; +import warnings.SingleLineWarningDisplay; public class TopToolBar extends PamToolBar implements ColorManaged { @@ -105,6 +99,7 @@ public class TopToolBar extends PamToolBar implements ColorManaged { Timer barTimer = new Timer(500, new ActionListener() { + @Override public void actionPerformed(ActionEvent evt) { tellTime(); } diff --git a/src/PamView/ViewTimesDialog.java b/src/PamView/ViewTimesDialog.java index a86631d5..392ccbc5 100644 --- a/src/PamView/ViewTimesDialog.java +++ b/src/PamView/ViewTimesDialog.java @@ -259,6 +259,7 @@ public class ViewTimesDialog extends PamDialog { } class UseAnalTimeListener implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { enableControls(); } diff --git a/src/PamguardMVC/ChannelIterator.java b/src/PamguardMVC/ChannelIterator.java index 0d545de7..4e6c2e08 100644 --- a/src/PamguardMVC/ChannelIterator.java +++ b/src/PamguardMVC/ChannelIterator.java @@ -2,9 +2,6 @@ package PamguardMVC; import java.util.ListIterator; -import Array.StreamerDataUnit; -import Array.streamerOrigin.StaticOriginMethod; - /** * An iterator that has a bit more functionality than a basic iterator.
* It's main enhancement is to use a channel map match to PamDataUnits, so that it only returns diff --git a/src/PamguardMVC/DataBlock2D.java b/src/PamguardMVC/DataBlock2D.java index 89eb0ec9..2e016893 100644 --- a/src/PamguardMVC/DataBlock2D.java +++ b/src/PamguardMVC/DataBlock2D.java @@ -43,6 +43,7 @@ abstract public class DataBlock2D extends AcousticDat */ abstract public DataTypeInfo getScaleInfo(); + @Override public Element getDataBlockXML(Document doc) { Element el = super.getDataBlockXML(doc); DataTypeInfo dti = getScaleInfo(); diff --git a/src/PamguardMVC/DataUnitFinder.java b/src/PamguardMVC/DataUnitFinder.java index 1ae05f20..27f810be 100644 --- a/src/PamguardMVC/DataUnitFinder.java +++ b/src/PamguardMVC/DataUnitFinder.java @@ -85,7 +85,7 @@ public class DataUnitFinder { int loops = 0; while (li.hasNext()) { lastUnit = li.next(); - if (li.hasNext() == false) { + if (!li.hasNext()) { setupList(); loops++; if (loops > 1) { diff --git a/src/PamguardMVC/LastDataUnitStore.java b/src/PamguardMVC/LastDataUnitStore.java index ae907cbf..d4f5fc25 100644 --- a/src/PamguardMVC/LastDataUnitStore.java +++ b/src/PamguardMVC/LastDataUnitStore.java @@ -1,6 +1,5 @@ package PamguardMVC; -import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; diff --git a/src/PamguardMVC/PamDataBlock.java b/src/PamguardMVC/PamDataBlock.java index 9a19073f..97236384 100644 --- a/src/PamguardMVC/PamDataBlock.java +++ b/src/PamguardMVC/PamDataBlock.java @@ -20,10 +20,6 @@ */ package PamguardMVC; -import generalDatabase.SQLLogging; -import generalDatabase.external.crossreference.CrossReference; -import jsonStorage.JSONObjectDataSource; - import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -40,6 +36,7 @@ import java.util.Vector; import javax.swing.JLabel; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; +import javax.swing.SwingConstants; import javax.swing.Timer; import javax.swing.border.EmptyBorder; @@ -50,29 +47,12 @@ import org.w3c.dom.Element; import Acquisition.AcquisitionControl; import Acquisition.AcquisitionProcess; import Localiser.LocalisationAlgorithm; -import pamScrollSystem.ViewLoadObserver; -import tethys.TethysControl; -import tethys.pamdata.AutoTethysProvider; -import tethys.pamdata.TethysDataProvider; -import tethys.species.DataBlockSpeciesManager; -import dataGram.DatagramProvider; -import dataMap.BespokeDataMapGraphic; -import dataMap.OfflineDataMap; -import effort.EffortProvider; -import effort.binary.DataMapEffortProvider; -import annotation.DataAnnotationType; -import annotation.handler.AnnotationHandler; -import binaryFileStorage.BinaryDataSource; -import binaryFileStorage.BinaryOfflineDataMap; -import binaryFileStorage.BinaryStore; -import binaryFileStorage.SecondaryBinaryStore; import PamController.OfflineDataStore; import PamController.PamControlledUnit; import PamController.PamController; import PamController.PamControllerInterface; import PamDetection.LocContents; import PamDetection.LocalisationInfo; -import PamDetection.PamDetection; import PamUtils.PamCalendar; import PamUtils.PamUtils; import PamView.symbol.PamSymbolManager; @@ -83,7 +63,6 @@ import PamguardMVC.dataOffline.OfflineDataLoading; import PamguardMVC.dataSelector.DataSelectParams; import PamguardMVC.dataSelector.DataSelector; import PamguardMVC.dataSelector.DataSelectorCreator; -import PamguardMVC.dataSelector.DataSelectorSettings; import PamguardMVC.dataSelector.NullDataSelectorCreator; import PamguardMVC.datamenus.DataMenuParent; import PamguardMVC.nanotime.NanoTimeCalculator; @@ -92,6 +71,24 @@ import PamguardMVC.toad.TOADCalculator; import PamguardMVC.uid.DataBlockUIDHandler; import SoundRecorder.RecorderControl; import SoundRecorder.trigger.RecorderTrigger; +import annotation.DataAnnotationType; +import annotation.handler.AnnotationHandler; +import binaryFileStorage.BinaryDataSource; +import binaryFileStorage.BinaryOfflineDataMap; +import binaryFileStorage.BinaryStore; +import binaryFileStorage.SecondaryBinaryStore; +import dataGram.DatagramProvider; +import dataMap.BespokeDataMapGraphic; +import dataMap.OfflineDataMap; +import effort.EffortProvider; +import effort.binary.DataMapEffortProvider; +import generalDatabase.SQLLogging; +import generalDatabase.external.crossreference.CrossReference; +import jsonStorage.JSONObjectDataSource; +import pamScrollSystem.ViewLoadObserver; +import tethys.TethysControl; +import tethys.pamdata.TethysDataProvider; +import tethys.species.DataBlockSpeciesManager; /** * @@ -483,6 +480,7 @@ public class PamDataBlock extends PamObservable { } Timer removeTimer = new Timer(500, new ActionListener() { + @Override public void actionPerformed(ActionEvent evt) { int n; if (shouldDelete()) { @@ -1080,7 +1078,7 @@ public class PamDataBlock extends PamObservable { * load progress. */ public boolean loadViewerData(OfflineDataLoadInfo offlineDataLoadInfo, ViewLoadObserver loadObserver) { - if (PamController.getInstance().isInitializationComplete() == false) { + if (!PamController.getInstance().isInitializationComplete()) { System.err.printf("Not loading %s since initialisation not yet complete\n", getDataName()); return false; } @@ -1092,7 +1090,7 @@ public class PamDataBlock extends PamObservable { saveViewerData(); - if (needViewerDataLoad(offlineDataLoadInfo) == false) { + if (!needViewerDataLoad(offlineDataLoadInfo)) { return true; } @@ -1291,7 +1289,7 @@ public class PamDataBlock extends PamObservable { if (offlineDataLoading.isCurrentOfflineLoadKeep()) { pamDataUnits.add(pamDataUnit); } - if (shouldBinary && getBinaryDataSource() != null && !isOffline && pamDataUnit.isEmbryonic() == false) { + if (shouldBinary && getBinaryDataSource() != null && !isOffline && !pamDataUnit.isEmbryonic()) { getBinaryDataSource().saveData(pamDataUnit); } } @@ -1365,7 +1363,7 @@ public class PamDataBlock extends PamObservable { public void updatePamData(Tunit pamDataUnit, long updateTimeMillis) { pamDataUnit.updateDataUnit(updateTimeMillis); setChanged(); - if (!isOffline && pamDataUnit.isEmbryonic() == false) { + if (!isOffline && !pamDataUnit.isEmbryonic()) { /* * Save it if it't not been saved already or we're saving updates. * Detectors can keep a dataunit in an embryonic state and add them to the @@ -1435,7 +1433,7 @@ public class PamDataBlock extends PamObservable { // Debug.out.println("Removing data unit " + aDataUnit); // } boolean rem = pamDataUnits.remove(aDataUnit); - if (rem == false) { + if (!rem) { return false; } if (isOffline) { @@ -1985,7 +1983,7 @@ public class PamDataBlock extends PamObservable { long difference; ListIterator listIterator = getListIterator(ITERATOR_END); - if (listIterator.hasPrevious() == false) { + if (!listIterator.hasPrevious()) { return null; } unit = listIterator.previous(); @@ -2031,7 +2029,7 @@ public class PamDataBlock extends PamObservable { long difference; ListIterator listIterator = getListIterator(ITERATOR_END); - if (listIterator.hasPrevious() == false) { + if (!listIterator.hasPrevious()) { return null; } unit = listIterator.previous(); @@ -3071,10 +3069,10 @@ public class PamDataBlock extends PamObservable { case PamControllerInterface.HYDROPHONE_ARRAY_CHANGED: clearDataOrigins(); break; - case PamController.INITIALIZATION_COMPLETE: + case PamControllerInterface.INITIALIZATION_COMPLETE: effortProvider = autoEffortProvider(); break; - case PamController.ADD_CONTROLLEDUNIT: + case PamControllerInterface.ADD_CONTROLLEDUNIT: if (PamController.getInstance().isInitializationComplete()) { effortProvider = autoEffortProvider(); } @@ -4266,7 +4264,7 @@ public class PamDataBlock extends PamObservable { lab = String.format(" %s ...", getDataName()); } JLabel label; - popMenu.add(label = new JLabel(lab, JLabel.CENTER)); + popMenu.add(label = new JLabel(lab, SwingConstants.CENTER)); label.setBorder(new EmptyBorder(3, 6, 0, 0)); for (JMenuItem menuItem : menuItems) { popMenu.add(menuItem); @@ -4305,7 +4303,7 @@ public class PamDataBlock extends PamObservable { if (superDet == null) { continue; } - if (uniqueSuperDets.contains(superDet) == false) { + if (!uniqueSuperDets.contains(superDet)) { uniqueSuperDets.add(superDet); } } diff --git a/src/PamguardMVC/PamDataUnit.java b/src/PamguardMVC/PamDataUnit.java index 966fd857..1e305978 100644 --- a/src/PamguardMVC/PamDataUnit.java +++ b/src/PamguardMVC/PamDataUnit.java @@ -22,38 +22,31 @@ package PamguardMVC; import java.awt.Point; import java.util.ArrayList; -import java.util.Collections; import java.util.List; import java.util.ListIterator; import java.util.Vector; import javax.swing.JPopupMenu; -import pamMaths.PamVector; -import annotation.DataAnnotation; -import annotation.DataAnnotationType; -import binaryFileStorage.DataUnitFileInformation; -import clickDetector.offlineFuncs.OfflineEventDataUnit; import Acquisition.AcquisitionControl; -import Acquisition.AcquisitionParameters; import Acquisition.AcquisitionProcess; import Array.ArrayManager; -import Array.HydrophoneLocator; -import Array.PamArray; import Array.SnapshotGeometry; import GPS.GpsData; import GPS.GpsDataUnit; import PamController.PamController; import PamDetection.AbstractLocalisation; import PamUtils.FrequencyFormat; -import PamUtils.LatLong; import PamUtils.PamCalendar; -import PamUtils.PamSort; import PamUtils.PamUtils; import PamUtils.time.CalendarControl; import PamguardMVC.datamenus.DataMenuParent; -import PamguardMVC.superdet.SubdetectionInfo; import PamguardMVC.superdet.SuperDetection; +import annotation.DataAnnotation; +import annotation.DataAnnotationType; +import binaryFileStorage.DataUnitFileInformation; +import clickDetector.offlineFuncs.OfflineEventDataUnit; +import pamMaths.PamVector; /** * @author Doug Gillespie @@ -903,7 +896,7 @@ abstract public class PamDataUnit str += String.format("%s %s %s

", PamCalendar.formatDate(basicData.getTimeMilliseconds(), true), PamCalendar.formatTime(basicData.getTimeMilliseconds(), 3, true), CalendarControl.getInstance().getTZCode(true)); - if (CalendarControl.getInstance().isUTC() == false) { + if (!CalendarControl.getInstance().isUTC()) { str += String.format("%s %s %s

", PamCalendar.formatDate(basicData.getTimeMilliseconds(), false), PamCalendar.formatTime(basicData.getTimeMilliseconds(), 3, false), "UTC"); @@ -1229,7 +1222,7 @@ abstract public class PamDataUnit iter.remove(); } } - if (superDetections.contains(superDetection) == false) { + if (!superDetections.contains(superDetection)) { superDetections.add(superDetection); } if (parentDataBlock != null && PamController.getInstance().getRunMode() != PamController.RUN_PAMVIEW) { @@ -1259,7 +1252,7 @@ abstract public class PamDataUnit * @return super detection or null */ public SuperDetection getSuperDetection(Class superClass, boolean includeSubClasses) { - if (includeSubClasses == false) { + if (!includeSubClasses) { return getSuperDetection(superClass); } synchronized (superDetectionSyncronisation) { diff --git a/src/PamguardMVC/PamDataUnitIterator.java b/src/PamguardMVC/PamDataUnitIterator.java index e901512c..3df6c624 100644 --- a/src/PamguardMVC/PamDataUnitIterator.java +++ b/src/PamguardMVC/PamDataUnitIterator.java @@ -73,11 +73,13 @@ public abstract class PamDataUnitIterator implements List /** * Return the next PamDataUnit, or null if there is no 'next' PamDataUnit */ + @Override abstract public E next(); /** * Return the previous PamDataUnit, or null if there is no 'previous' PamDataUnit */ + @Override abstract public E previous(); diff --git a/src/PamguardMVC/PamInstantProcess.java b/src/PamguardMVC/PamInstantProcess.java index 14b15462..0587e066 100644 --- a/src/PamguardMVC/PamInstantProcess.java +++ b/src/PamguardMVC/PamInstantProcess.java @@ -3,7 +3,6 @@ package PamguardMVC; import PamController.PamControlledUnit; import PamController.PamController; import PamController.PamControllerInterface; -import PamModel.PamModel; /** * Similar to PAMProcess, but always subscribes itself to upstream diff --git a/src/PamguardMVC/PamObservable.java b/src/PamguardMVC/PamObservable.java index 62ba95d9..8851fad9 100644 --- a/src/PamguardMVC/PamObservable.java +++ b/src/PamguardMVC/PamObservable.java @@ -22,23 +22,22 @@ package PamguardMVC; import java.awt.Graphics; import java.awt.Rectangle; -import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.lang.management.ManagementFactory; import java.lang.management.ThreadMXBean; import java.util.ArrayList; import java.util.List; + import javax.swing.Timer; import PamModel.PamModel; import PamModel.PamProfiler; -import PamUtils.SystemTiming; import PamView.GeneralProjector; -import PamView.PamKeyItem; -import PamView.PanelOverlayDraw; import PamView.GeneralProjector.ParameterType; import PamView.GeneralProjector.ParameterUnits; +import PamView.PamKeyItem; +import PamView.PanelOverlayDraw; /** * @author Doug Gillespie @@ -105,7 +104,7 @@ public class PamObservable {//extends PanelOverlayDraw { public void addObserver(PamObserver o) { // check each observer only observes once. synchronized (pamObservers) { - if (pamObservers.contains(o) == false) { + if (!pamObservers.contains(o)) { pamObservers.add(o); if (cpuUsage == null || cpuUsage.length < countObservers()) { cpuUsage = new long[countObservers()]; @@ -123,7 +122,7 @@ public class PamObservable {//extends PanelOverlayDraw { public void addInstantObserver(PamObserver o) { // check each observer only observes once. synchronized (pamObservers) { - if (instantObservers.contains(o) == false) { + if (!instantObservers.contains(o)) { instantObservers.add(o); if (cpuUsage == null || cpuUsage.length < countObservers()) { cpuUsage = new long[countObservers()]; @@ -135,7 +134,7 @@ public class PamObservable {//extends PanelOverlayDraw { public void addObserver(PamObserver observer, boolean reThread) { // reThread = false; - if (reThread == false) { + if (!reThread) { addObserver(observer); return; } @@ -195,7 +194,7 @@ public class PamObservable {//extends PanelOverlayDraw { if (pamObserver.getClass() == ThreadedObserver.class) { threadedObserver = (ThreadedObserver) pamObserver; waitingUnits += threadedObserver.getInterThreadListSize(); - if (threadedObserver.isEmptyRead() == false) { + if (!threadedObserver.isEmptyRead()) { waitingUnits++; } } @@ -378,9 +377,9 @@ public class PamObservable {//extends PanelOverlayDraw { // perhaps running in a diagnostic mode. // - long cpuStart = tmxb.getThreadCpuTime(threadId);; + long cpuStart = tmxb.getThreadCpuTime(threadId); getPamObserver(i).addData(this, o); - long cpuEnd = tmxb.getThreadCpuTime(threadId);; + long cpuEnd = tmxb.getThreadCpuTime(threadId); cpuUsage[i] += (cpuEnd - cpuStart); } clearchanged(); @@ -409,6 +408,7 @@ public class PamObservable {//extends PanelOverlayDraw { } private Timer cpuTimer = new Timer(4321, new ActionListener() { + @Override public void actionPerformed(ActionEvent evt) { long now = System.currentTimeMillis(); if (cpuUsage == null) return; diff --git a/src/PamguardMVC/PamProcess.java b/src/PamguardMVC/PamProcess.java index 7aafca1f..f57cf7b4 100644 --- a/src/PamguardMVC/PamProcess.java +++ b/src/PamguardMVC/PamProcess.java @@ -36,9 +36,8 @@ import java.awt.event.ActionListener; import java.lang.management.ManagementFactory; import java.lang.management.ThreadMXBean; import java.util.ArrayList; -import javax.swing.Timer; -import networkTransfer.receive.BuoyStatusDataUnit; +import javax.swing.Timer; import PamController.PamControlledUnit; import PamController.PamController; @@ -48,6 +47,7 @@ import PamModel.PamModel; import PamModel.PamProfiler; import PamUtils.PamCalendar; import PamguardMVC.dataOffline.OfflineDataLoadInfo; +import networkTransfer.receive.BuoyStatusDataUnit; /** * @author Doug Gillespie @@ -364,6 +364,7 @@ abstract public class PamProcess implements PamObserver, ProcessAnnotator { return processName; } + @Override public String getObserverName() { return "Process: " + getProcessName(); } @@ -373,6 +374,7 @@ abstract public class PamProcess implements PamObserver, ProcessAnnotator { * * @see PamguardMVC.PamObserver#SetSampleRate(float, boolean) */ + @Override public void setSampleRate(float sampleRate, boolean notify) { // notify all output data blocks that there is a new sample rate this.sampleRate = sampleRate; @@ -464,6 +466,7 @@ abstract public class PamProcess implements PamObserver, ProcessAnnotator { return (long) (millis * sampleRate / 1000); } + @Override public void noteNewSettings() { for (int i = 0; i < outputDataBlocks.size(); i++) { outputDataBlocks.get(i).noteNewSettings(); @@ -632,7 +635,7 @@ abstract public class PamProcess implements PamObserver, ProcessAnnotator { * Reference to a PamDataBlock */ public void addOutputDataBlock(PamDataBlock outputDataBlock) { - if (outputDataBlocks.contains(outputDataBlock) == false){ + if (!outputDataBlocks.contains(outputDataBlock)){ outputDataBlocks.add(outputDataBlock); PamController.getInstance().notifyModelChanged(PamControllerInterface.ADD_DATABLOCK); } @@ -761,6 +764,7 @@ abstract public class PamProcess implements PamObserver, ProcessAnnotator { } Timer t = new Timer(1000, new ActionListener() { + @Override public void actionPerformed(ActionEvent evt) { long now = System.currentTimeMillis(); if (lastCPUCheckTime == now) return; @@ -789,6 +793,7 @@ abstract public class PamProcess implements PamObserver, ProcessAnnotator { } + @Override public void updateData(PamObservable o, PamDataUnit arg) { } @@ -836,6 +841,7 @@ abstract public class PamProcess implements PamObserver, ProcessAnnotator { * Called when a PamDataBlock observed by this PamProcess is * removed. */ + @Override public void removeObservable(PamObservable observable) { // TODO Auto-generated method stub // called when the source data block has been removed. @@ -941,7 +947,7 @@ abstract public class PamProcess implements PamObserver, ProcessAnnotator { int errors = 0; int nDB = getNumOutputDataBlocks(); for (int i = 0; i < nDB; i++) { - if (getOutputDataBlock(i).waitForThreadedObservers(maxWait) == false) { + if (!getOutputDataBlock(i).waitForThreadedObservers(maxWait)) { errors++; } } diff --git a/src/PamguardMVC/PamRawDataBlock.java b/src/PamguardMVC/PamRawDataBlock.java index cab14b71..4ee0c1bf 100644 --- a/src/PamguardMVC/PamRawDataBlock.java +++ b/src/PamguardMVC/PamRawDataBlock.java @@ -34,7 +34,6 @@ import Acquisition.RawDataBinaryDataSource; import PamController.PamController; import PamDetection.RawDataUnit; import PamUtils.PamUtils; -import dataMap.OfflineDataMap; import effort.EffortProvider; /** @@ -150,6 +149,7 @@ public class PamRawDataBlock extends AcousticDataBlock { /** * Reset data integrity checking counters. */ + @Override public void reset() { prevChannelSample = new long[PamConstants.MAX_CHANNELS]; summaryTotals = new double[PamConstants.MAX_CHANNELS]; @@ -206,7 +206,7 @@ public class PamRawDataBlock extends AcousticDataBlock { * @throws RawDataUnavailableException */ synchronized public RawDataUnit[] getAvailableSamples(long startMillis, long durationMillis, int channelMap, boolean offlineLoad) throws RawDataUnavailableException { - if (hasDataSamples(startMillis, durationMillis) == false) { + if (!hasDataSamples(startMillis, durationMillis)) { if (offlineLoad && PamController.getInstance().getRunMode() == PamController.RUN_PAMVIEW) { // try to load some data ! @@ -340,7 +340,7 @@ public class PamRawDataBlock extends AcousticDataBlock { firstSample, lastSample, startSample, duration); } dataUnit = getLastUnit(); - if (hasLastSample(dataUnit, startSample+duration, channelMap) == false) { + if (!hasLastSample(dataUnit, startSample+duration, channelMap)) { throw new RawDataUnavailableException(this, RawDataUnavailableException.DATA_NOT_ARRIVED, firstSample, lastSample, startSample, duration); } @@ -436,7 +436,7 @@ public class PamRawDataBlock extends AcousticDataBlock { // break; // } //// } - if (foundStart == false) { + if (!foundStart) { return false; } // if (blockNo < 0) { @@ -509,7 +509,7 @@ public class PamRawDataBlock extends AcousticDataBlock { * if we get here, then we still need more data, but there * may not be any, so may have to bail out. */ - if (rawIterator.hasNext() == false) { + if (!rawIterator.hasNext()) { return false; } unit = rawIterator.next(); diff --git a/src/PamguardMVC/RawDataDisplay.java b/src/PamguardMVC/RawDataDisplay.java index 3175130f..905c009d 100644 --- a/src/PamguardMVC/RawDataDisplay.java +++ b/src/PamguardMVC/RawDataDisplay.java @@ -57,6 +57,7 @@ public class RawDataDisplay implements DisplayPanelProvider { * A name that can be used when constructing options * menus, etc. */ + @Override public String getDisplayPanelName() { return rawDataBlock.getDataName(); } @@ -66,6 +67,7 @@ public class RawDataDisplay implements DisplayPanelProvider { * Each provider may create any number of display panels for * different parts of the Pamguard display */ + @Override public DisplayPanel createDisplayPanel(DisplayPanelContainer displayPanelContainer) { return new RawDisplayPanel(this, displayPanelContainer); } @@ -102,6 +104,7 @@ public class RawDataDisplay implements DisplayPanelProvider { return this; } + @Override public String getObserverName() { return "Plug in BT display panel"; } @@ -134,6 +137,7 @@ public class RawDataDisplay implements DisplayPanelProvider { /** * Implementation of PamObserver */ + @Override public long getRequiredDataHistory(PamObservable o, Object arg) { return 1000; // is this really necessary ! } @@ -141,6 +145,7 @@ public class RawDataDisplay implements DisplayPanelProvider { /** * Implementation of PamObserver */ + @Override public void noteNewSettings() { // TODO Auto-generated method stub @@ -149,6 +154,7 @@ public class RawDataDisplay implements DisplayPanelProvider { /** * Implementation of PamObserver */ + @Override public void removeObservable(PamObservable o) { // TODO Auto-generated method stub @@ -158,6 +164,7 @@ public class RawDataDisplay implements DisplayPanelProvider { * Implementation of PamObserver */ float sampleRate; + @Override public void setSampleRate(float sampleRate, boolean notify) { this.sampleRate = sampleRate; } @@ -189,6 +196,7 @@ public class RawDataDisplay implements DisplayPanelProvider { private double[] scrollRemainder = new double[PamConstants.MAX_CHANNELS]; + @Override public void addData(PamObservable o, PamDataUnit dataUnit) { RawDataUnit rawDataUnit = (RawDataUnit) dataUnit; @@ -350,22 +358,27 @@ public class RawDataDisplay implements DisplayPanelProvider { /** * Implementation of PamSettings */ + @Override public Serializable getSettingsReference() { return waveOptions; } + @Override public long getSettingsVersion() { return RawDataDisplayOptions.serialVersionUID; } + @Override public String getUnitName() { return displayPanelProvider.getDisplayPanelName(); } + @Override public String getUnitType() { return "waveform panel"; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { waveOptions = (RawDataDisplayOptions) pamControlledUnitSettings.getSettings(); checkMenuItem(); @@ -374,9 +387,10 @@ public class RawDataDisplay implements DisplayPanelProvider { class OptionsListener implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { waveOptions.autoScale = (!waveOptions.autoScale); - if (waveOptions.autoScale == false) { + if (!waveOptions.autoScale) { scale = 1; setAxisRange(1); } @@ -386,6 +400,7 @@ public class RawDataDisplay implements DisplayPanelProvider { } class ZoomInListener implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { scale = scale*2; setAxisRange(1./scale); @@ -394,6 +409,7 @@ public class RawDataDisplay implements DisplayPanelProvider { } class ZoomOutListener implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { scale = scale/2; setAxisRange(1./scale); diff --git a/src/PamguardMVC/RawDataTransforms.java b/src/PamguardMVC/RawDataTransforms.java index 2c7380b3..b4a8a14c 100644 --- a/src/PamguardMVC/RawDataTransforms.java +++ b/src/PamguardMVC/RawDataTransforms.java @@ -4,7 +4,6 @@ import java.util.Arrays; import PamUtils.PamUtils; import PamUtils.complex.ComplexArray; -import Spectrogram.WindowFunction; import clickDetector.ClickDetection; import clipgenerator.ClipSpectrogram; import fftFilter.FFTFilter; @@ -461,7 +460,7 @@ public class RawDataTransforms { */ public double[] getAnalyticWaveform(int iChan, boolean filtered, FFTFilterParams fftFilterParams) { synchronized (synchObject) { - if (filtered == false || fftFilterParams == null) { + if (!filtered || fftFilterParams == null) { return getAnalyticWaveform(iChan); } else { diff --git a/src/PamguardMVC/SequenceIterator.java b/src/PamguardMVC/SequenceIterator.java index 5bd62f9b..f27fb752 100644 --- a/src/PamguardMVC/SequenceIterator.java +++ b/src/PamguardMVC/SequenceIterator.java @@ -2,9 +2,6 @@ package PamguardMVC; import java.util.ListIterator; -import Array.StreamerDataUnit; -import Array.streamerOrigin.StaticOriginMethod; - /** * An iterator that has a bit more functionality than a basic iterator.
* It's main enhancement is to use a channel map match to PamDataUnits, so that it only returns diff --git a/src/PamguardMVC/ThreadedObserver.java b/src/PamguardMVC/ThreadedObserver.java index 1e73c30a..9f663616 100644 --- a/src/PamguardMVC/ThreadedObserver.java +++ b/src/PamguardMVC/ThreadedObserver.java @@ -10,7 +10,6 @@ import Acquisition.DaqSystem; import PamController.PamController; import PamModel.PamModel; import PamUtils.PamCalendar; -import PamguardMVC.debug.Debug; /** * This is a decorator class for PamObservers which intercepts any @@ -81,7 +80,7 @@ public class ThreadedObserver implements PamObserver { AcquisitionControl daqCtrl = (AcquisitionControl) PamController.getInstance().findControlledUnit(AcquisitionControl.unitType); if (daqCtrl != null) { DaqSystem daqSystem = daqCtrl.findDaqSystem(null); - if (daqSystem != null && daqSystem.isRealTime() == false) { + if (daqSystem != null && !daqSystem.isRealTime()) { defJitter = 2; } } @@ -548,7 +547,7 @@ public class ThreadedObserver implements PamObserver { public void dumpBufferStatus(String message, boolean sayEmpties) { int n = toDoList.size(); - if (sayEmpties == false && n == 0) { + if (!sayEmpties && n == 0) { return; } String name = singleThreadObserver.getObserverName(); diff --git a/src/RightWhaleEdgeDetector/RWEBinaryDataSource.java b/src/RightWhaleEdgeDetector/RWEBinaryDataSource.java index 3b7546c2..23b65c48 100644 --- a/src/RightWhaleEdgeDetector/RWEBinaryDataSource.java +++ b/src/RightWhaleEdgeDetector/RWEBinaryDataSource.java @@ -7,14 +7,12 @@ import java.io.DataOutputStream; import java.io.File; import java.io.IOException; -import PamguardMVC.DataUnitBaseData; import PamguardMVC.PamDataUnit; import binaryFileStorage.BinaryDataSource; import binaryFileStorage.BinaryHeader; import binaryFileStorage.BinaryObjectData; import binaryFileStorage.ModuleFooter; import binaryFileStorage.ModuleHeader; -import binaryFileStorage.PackedBinaryObject; public class RWEBinaryDataSource extends BinaryDataSource { diff --git a/src/RightWhaleEdgeDetector/RWEControl.java b/src/RightWhaleEdgeDetector/RWEControl.java index 39f4d3bb..ddebb2c8 100644 --- a/src/RightWhaleEdgeDetector/RWEControl.java +++ b/src/RightWhaleEdgeDetector/RWEControl.java @@ -18,8 +18,6 @@ import PamView.GroupedSourceParameters; import PamView.dialog.GroupedSourcePanel; import PamguardMVC.PamDataBlock; import PamguardMVC.ProcessAnnotation; -import RightWhaleEdgeDetector.graphics.RWEDataPlotProviderFX; -import dataPlotsFX.data.TDDataProviderRegisterFX; /** * Exact implementation of the 2003 Right Whale detector I developed when I was diff --git a/src/RightWhaleEdgeDetector/RWEDataBlock.java b/src/RightWhaleEdgeDetector/RWEDataBlock.java index 90c9a616..cddaace0 100644 --- a/src/RightWhaleEdgeDetector/RWEDataBlock.java +++ b/src/RightWhaleEdgeDetector/RWEDataBlock.java @@ -4,7 +4,6 @@ import PamView.GroupedDataSource; import PamView.GroupedSourceParameters; import PamguardMVC.DataAutomation; import PamguardMVC.DataAutomationInfo; -import PamguardMVC.PamProcess; import PamguardMVC.dataOffline.OfflineDataLoadInfo; import PamguardMVC.dataSelector.DataSelectorCreator; import RightWhaleEdgeDetector.datasel.RWDataSelCreator; diff --git a/src/RightWhaleEdgeDetector/RWEDialog.java b/src/RightWhaleEdgeDetector/RWEDialog.java index 0aaabc52..daceddd7 100644 --- a/src/RightWhaleEdgeDetector/RWEDialog.java +++ b/src/RightWhaleEdgeDetector/RWEDialog.java @@ -13,16 +13,10 @@ import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; -import KernelSmoothing.KernelSmoothingProcess; -import PamController.PamController; -import fftManager.FFTDataUnit; -import spectrogramNoiseReduction.SpecNoiseMethod; -import spectrogramNoiseReduction.kernelSmoothing.KernelSmoothing; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; import PamView.dialog.SourcePanel; -import PamguardMVC.PamDataBlock; -import PamguardMVC.ProcessAnnotation; +import fftManager.FFTDataUnit; public class RWEDialog extends PamDialog { diff --git a/src/RightWhaleEdgeDetector/RWEOverlayGraphics.java b/src/RightWhaleEdgeDetector/RWEOverlayGraphics.java index f090f681..a0ff374e 100644 --- a/src/RightWhaleEdgeDetector/RWEOverlayGraphics.java +++ b/src/RightWhaleEdgeDetector/RWEOverlayGraphics.java @@ -5,9 +5,6 @@ import java.awt.Graphics; import java.awt.Rectangle; import java.awt.geom.Point2D; -import javax.activation.DataSource; - -import PamUtils.Coordinate3d; import PamView.GeneralProjector; import PamView.PamColors; import PamView.PamDetectionOverlayGraphics; diff --git a/src/RightWhaleEdgeDetector/RWEProcess.java b/src/RightWhaleEdgeDetector/RWEProcess.java index 7d8fe023..71b592a0 100644 --- a/src/RightWhaleEdgeDetector/RWEProcess.java +++ b/src/RightWhaleEdgeDetector/RWEProcess.java @@ -5,26 +5,12 @@ import java.util.Hashtable; import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import java.util.ListIterator; import Localiser.algorithms.Correlations; import Localiser.algorithms.timeDelayLocalisers.bearingLoc.BearingLocaliser; import Localiser.algorithms.timeDelayLocalisers.bearingLoc.BearingLocaliserSelector; -import annotation.calcs.snr.SNRAnnotationType; -import autecPhones.AutecGraphics; -import dataPlotsFX.data.TDDataProviderRegisterFX; -import fftManager.Complex; -import fftManager.FFTDataBlock; -import fftManager.FFTDataUnit; -import networkTransfer.receive.BuoyStatusDataUnit; -import spectrogramNoiseReduction.kernelSmoothing.KernelSmoothing; -import whistlesAndMoans.WhistleBearingInfo; import PamController.PamController; -import PamDetection.AbstractLocalisation; import PamDetection.LocContents; -import PamDetection.LocalisationInfo; -import PamUtils.LatLong; -import PamUtils.PamCalendar; import PamUtils.PamUtils; import PamUtils.complex.ComplexArray; import PamView.symbol.StandardSymbolManager; @@ -33,9 +19,15 @@ import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; -import PamguardMVC.debug.Debug; import RightWhaleEdgeDetector.graphics.RWEDataPlotProviderFX; import RightWhaleEdgeDetector.graphics.RWESymbolManager; +import annotation.calcs.snr.SNRAnnotationType; +import dataPlotsFX.data.TDDataProviderRegisterFX; +import fftManager.FFTDataBlock; +import fftManager.FFTDataUnit; +import networkTransfer.receive.BuoyStatusDataUnit; +import spectrogramNoiseReduction.kernelSmoothing.KernelSmoothing; +import whistlesAndMoans.WhistleBearingInfo; public class RWEProcess extends PamProcess { diff --git a/src/RightWhaleEdgeDetector/RWESQLLogging.java b/src/RightWhaleEdgeDetector/RWESQLLogging.java index 76e9f841..af394d4a 100644 --- a/src/RightWhaleEdgeDetector/RWESQLLogging.java +++ b/src/RightWhaleEdgeDetector/RWESQLLogging.java @@ -8,7 +8,6 @@ import PamUtils.PamUtils; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import generalDatabase.EmptyTableDefinition; -import generalDatabase.PamTableDefinition; import generalDatabase.PamTableItem; import generalDatabase.SQLTypes; diff --git a/src/SoundRecorder/PamAudioFileStorage.java b/src/SoundRecorder/PamAudioFileStorage.java index ca3bb037..3fb94881 100644 --- a/src/SoundRecorder/PamAudioFileStorage.java +++ b/src/SoundRecorder/PamAudioFileStorage.java @@ -6,17 +6,17 @@ import java.io.PipedInputStream; import java.io.PipedOutputStream; import javax.sound.sampled.AudioFileFormat; +import javax.sound.sampled.AudioFileFormat.Type; import javax.sound.sampled.AudioFormat; +import javax.sound.sampled.AudioFormat.Encoding; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; -import javax.sound.sampled.AudioFormat.Encoding; +import PamUtils.FileFunctions; +import PamUtils.PamCalendar; import warnings.PamWarning; import warnings.WarningSystem; import wavFiles.ByteConverter; -import wavFiles.WavFile; -import PamUtils.FileFunctions; -import PamUtils.PamCalendar; /** * Implementation of RecorderStorage specific to audio files. @@ -65,10 +65,12 @@ public class PamAudioFileStorage implements RecorderStorage { audioWriteWarning = new PamWarning(recorderControl.getUnitName(), "Audio Write problem", 2); } + @Override public String getFileName() { return fileName; } + @Override synchronized public boolean addData(long dataTimeMillis, double[][] newData) { if (newData == null || newData.length != audioFormat.getChannels()) return false; if (fileName == null) { @@ -108,6 +110,7 @@ public class PamAudioFileStorage implements RecorderStorage { * (non-Javadoc) * @see SoundRecorder.RecorderStorage#closeStorage() */ + @Override synchronized public boolean closeStorage() { /* * The exact order things happen in here is quite important. No more samples will be added @@ -195,6 +198,7 @@ public class PamAudioFileStorage implements RecorderStorage { * This is one end of a pair of PipedInput and PipedOutput Streams. This thread * writes data into the other end of the pipe as it arrives. */ + @Override synchronized public boolean openStorage(AudioFileFormat.Type fileType, long recordingStart, float sampleRate, int nChannels, int bitDepth) { @@ -205,7 +209,7 @@ public class PamAudioFileStorage implements RecorderStorage { this.nChannels = nChannels; this.bitDepth = bitDepth; - boolean isBigendian = (fileType != audioFileType.WAVE); + boolean isBigendian = (fileType != Type.WAVE); audioFormat = new AudioFormat(sampleRate, bitDepth, nChannels, true, isBigendian); @@ -267,6 +271,7 @@ public class PamAudioFileStorage implements RecorderStorage { */ class WriteThread implements Runnable { + @Override public void run() { writeData(); } diff --git a/src/SoundRecorder/RecorderButton.java b/src/SoundRecorder/RecorderButton.java index 6b64bef2..bc0bed8f 100644 --- a/src/SoundRecorder/RecorderButton.java +++ b/src/SoundRecorder/RecorderButton.java @@ -43,7 +43,7 @@ public class RecorderButton extends PamButton { @Override public void setBackground(Color bg) { setOpaque(true); - if (pressed == false) { + if (!pressed) { super.setBackground(PamColors.getInstance().getColor(PamColor.BUTTONFACE)); super.setForeground(PamColors.getInstance().getColor(PamColor.AXIS)); } diff --git a/src/SoundRecorder/RecorderControl.java b/src/SoundRecorder/RecorderControl.java index 0bc2ff72..5fdb5444 100644 --- a/src/SoundRecorder/RecorderControl.java +++ b/src/SoundRecorder/RecorderControl.java @@ -10,13 +10,9 @@ import java.util.Calendar; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioFileFormat.Type; -import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.Timer; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - import Acquisition.FolderInputSystem; import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; @@ -161,6 +157,7 @@ public class RecorderControl extends PamControlledUnit implements PamSettings { * that triggers all sorts of things. */ Timer recorderTimer = new Timer(500, new ActionListener() { + @Override public void actionPerformed(ActionEvent evt) { recorderTabPanel.timerActions(); @@ -362,6 +359,7 @@ public class RecorderControl extends PamControlledUnit implements PamSettings { this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { recordSettingsDialog(parentFrame); } @@ -420,6 +418,7 @@ public class RecorderControl extends PamControlledUnit implements PamSettings { } } + @Override public Serializable getSettingsReference() { // if (recorderTriggers.size() > 0) { // for (int i = recorderTriggers.size()-1; i >= 0; i--) { @@ -430,10 +429,12 @@ public class RecorderControl extends PamControlledUnit implements PamSettings { return recorderSettings; } + @Override public long getSettingsVersion() { return RecorderSettings.serialVersionUID; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { recorderSettings = ((RecorderSettings) pamControlledUnitSettings.getSettings()).clone(); /* @@ -522,9 +523,9 @@ public class RecorderControl extends PamControlledUnit implements PamSettings { RecorderTriggerData rtData = recorderSettings.findTriggerData(recorderTrigger); boolean enabled = rtData.isEnabled(); - if (enabled == false) return; + if (!enabled) return; - if (recorderTrigger.triggerDataUnit(dataUnit, rtData) == false) { + if (!recorderTrigger.triggerDataUnit(dataUnit, rtData)) { return; } /* @@ -532,7 +533,7 @@ public class RecorderControl extends PamControlledUnit implements PamSettings { * decide whether or not to go ahead with the recording. */ // find out that the recorder can actually record at the moment - if (shouldEnableRecording() == false) return; + if (!shouldEnableRecording()) return; TriggerDecisionMaker tdm = rtData.getDecisionMaker(); @@ -650,7 +651,7 @@ public class RecorderControl extends PamControlledUnit implements PamSettings { return "Unspecified output folder for sound recorder"; } File path = new File(parts[1].trim()); - if (path.exists() == false) { + if (!path.exists()) { path.mkdirs(); } if (path.isDirectory()) { diff --git a/src/SoundRecorder/RecorderLogger.java b/src/SoundRecorder/RecorderLogger.java index 154a48d6..034cb240 100644 --- a/src/SoundRecorder/RecorderLogger.java +++ b/src/SoundRecorder/RecorderLogger.java @@ -1,17 +1,15 @@ package SoundRecorder; -import generalDatabase.PamTableDefinition; -import generalDatabase.PamTableItem; -import generalDatabase.SQLLogging; -import generalDatabase.SQLTypes; - import java.io.File; import java.sql.Types; -import PamUtils.PamCalendar; import PamUtils.PamUtils; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; +import generalDatabase.PamTableDefinition; +import generalDatabase.PamTableItem; +import generalDatabase.SQLLogging; +import generalDatabase.SQLTypes; public class RecorderLogger extends SQLLogging { diff --git a/src/SoundRecorder/RecorderProcess.java b/src/SoundRecorder/RecorderProcess.java index 82a87fa1..76983d57 100644 --- a/src/SoundRecorder/RecorderProcess.java +++ b/src/SoundRecorder/RecorderProcess.java @@ -5,8 +5,6 @@ import java.util.ListIterator; import javax.sound.sampled.AudioFileFormat; - - import PamController.PamController; import PamDetection.RawDataUnit; import PamUtils.CheckStorageFolder; @@ -17,7 +15,6 @@ import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; import PamguardMVC.PamRawDataBlock; -import SoundRecorder.trigger.RecorderTriggerData; /** * Process raw audio data prior to storage. Raw data blocks diff --git a/src/SoundRecorder/RecorderSettings.java b/src/SoundRecorder/RecorderSettings.java index 4fcd6eec..4b73df3a 100644 --- a/src/SoundRecorder/RecorderSettings.java +++ b/src/SoundRecorder/RecorderSettings.java @@ -5,6 +5,7 @@ import java.io.IOException; import java.io.Serializable; import java.lang.reflect.Field; import java.util.ArrayList; + import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioSystem; @@ -15,8 +16,8 @@ import PamModel.parametermanager.FieldNotFoundException; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterData; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; +import PamModel.parametermanager.PrivatePamParameterData; import PamUtils.PamUtils; import PamguardMVC.PamRawDataBlock; import SoundRecorder.trigger.RecorderTrigger; @@ -212,7 +213,7 @@ public class RecorderSettings implements Serializable, Cloneable, ManagedParamet } } for (int i = present.length - 1; i >= 0; i--) { - if (present[i] == false) { + if (!present[i]) { recorderTriggerDatas.remove(i); } } @@ -252,7 +253,7 @@ public class RecorderSettings implements Serializable, Cloneable, ManagedParamet public double getLongestHistory() { double t = 0; for (RecorderTriggerData td:recorderTriggerDatas) { - if (td.isEnabled() == false) { + if (!td.isEnabled()) { continue; } t = Math.max(t, td.getSecondsBeforeTrigger()); @@ -337,7 +338,7 @@ public class RecorderSettings implements Serializable, Cloneable, ManagedParamet // check to see if it's in a read only folder of any kind. File outFolder = new File(folderName); - if (outFolder.exists() && outFolder.canWrite() == false) { + if (outFolder.exists() && !outFolder.canWrite()) { return true; } diff --git a/src/SoundRecorder/RecorderSettingsDialog.java b/src/SoundRecorder/RecorderSettingsDialog.java index 9b982ed1..191509e9 100644 --- a/src/SoundRecorder/RecorderSettingsDialog.java +++ b/src/SoundRecorder/RecorderSettingsDialog.java @@ -1,14 +1,12 @@ package SoundRecorder; import java.awt.BorderLayout; -import java.awt.FlowLayout; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.lang.model.SourceVersion; import javax.sound.sampled.AudioFileFormat; import javax.sound.sampled.AudioSystem; import javax.swing.BoxLayout; @@ -24,7 +22,6 @@ import javax.swing.border.TitledBorder; import Acquisition.AcquisitionProcess; import Acquisition.DaqSystem; -import Acquisition.pamAudio.PamAudioSystem; import PamController.PamController; import PamDetection.RawDataUnit; import PamModel.SMRUEnable; @@ -145,13 +142,13 @@ public class RecorderSettingsDialog extends PamDialog { @Override public boolean getParams() { recorderSettings.rawDataSource = sourcePanel.getSourceName(); - if (recorderSettings.rawDataSource == null) return showWarning("No raw data source");; - if (bufferPanel.getParams() == false) return showWarning("Error in buffer settings");; + if (recorderSettings.rawDataSource == null) return showWarning("No raw data source"); + if (!bufferPanel.getParams()) return showWarning("Error in buffer settings"); recorderSettings.outputFolder = selectFolder.getFolderName(true); recorderSettings.datedSubFolders = selectFolder.isIncludeSubFolders(); - if (outputFormat.getParams() == false) return showWarning("Error in output format settings"); - if (fileLengthPanel.getParams() == false) return showWarning("Error in file length settings"); - if (autoPanel.getParams() == false) return false; + if (!outputFormat.getParams()) return showWarning("Error in output format settings"); + if (!fileLengthPanel.getParams()) return showWarning("Error in file length settings"); + if (!autoPanel.getParams()) return false; return checkBitDepth(); } diff --git a/src/SoundRecorder/RecorderSidePanel.java b/src/SoundRecorder/RecorderSidePanel.java index 80896950..de08ef25 100644 --- a/src/SoundRecorder/RecorderSidePanel.java +++ b/src/SoundRecorder/RecorderSidePanel.java @@ -8,14 +8,12 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.File; -import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.border.TitledBorder; import PamView.PamSidePanel; import PamView.dialog.PamButton; -import PamView.dialog.PamLabel; import PamView.dialog.ScrollingPamLabel; import PamView.panel.PamBorder; import PamView.panel.PamBorderPanel; @@ -42,6 +40,7 @@ public class RecorderSidePanel implements PamSidePanel , RecorderView { } + @Override public JComponent getPanel() { return sidePanel; } @@ -96,25 +95,30 @@ public class RecorderSidePanel implements PamSidePanel , RecorderView { } } + @Override public void newData(PamDataBlock dataBlock, PamDataUnit dataUnit) { // TODO Auto-generated method stub } + @Override public void enableRecording(boolean enable) { buttonAuto.setEnabled(enable); buttonStart.setEnabled(enable); buttonStartBuffered.setEnabled(enable); } + @Override public void enableRecordingControl(boolean enable) { } + @Override public void newParams() { // TODO Auto-generated method stub } + @Override public void setButtonStates(int pressedButton) { buttonOff.setSelected(pressedButton == BUTTON_OFF); buttonAuto.setSelected(pressedButton == BUTTON_AUTO); @@ -129,12 +133,14 @@ public class RecorderSidePanel implements PamSidePanel , RecorderView { MainButtonListener(int buttonCommand) { this.buttonCommand = buttonCommand; } + @Override public void actionPerformed(ActionEvent e) { recorderControl.buttonCommand(buttonCommand); } } + @Override public void sayStatus(String status) { String str = "File Error"; switch (recorderControl.getRecorderStatus()) { @@ -158,6 +164,7 @@ public class RecorderSidePanel implements PamSidePanel , RecorderView { recordStatus.setText(str); } + @Override public void rename(String newName) { titledBorder.setTitle(newName); sidePanel.repaint(); diff --git a/src/SoundRecorder/RecorderTabPanel.java b/src/SoundRecorder/RecorderTabPanel.java index 799684aa..3765c9d5 100644 --- a/src/SoundRecorder/RecorderTabPanel.java +++ b/src/SoundRecorder/RecorderTabPanel.java @@ -16,9 +16,7 @@ import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.io.File; import java.io.IOException; -import java.util.ArrayList; -import javax.swing.BoxLayout; import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JCheckBox; @@ -37,8 +35,8 @@ import PamDetection.RawDataUnit; import PamUtils.PamCalendar; import PamUtils.PamUtils; import PamView.ColorManaged; -import PamView.PamTabPanel; import PamView.PamColors.PamColor; +import PamView.PamTabPanel; import PamView.dialog.PamButton; import PamView.dialog.PamCheckBox; import PamView.dialog.PamDialog; @@ -84,15 +82,18 @@ public class RecorderTabPanel implements PamTabPanel, RecorderView { recorderPanel = new RecorderPanel(); } + @Override public JMenu createMenu(Frame parentFrame) { return null; } + @Override public JComponent getPanel() { return recorderPanel; } + @Override public JToolBar getToolBar() { return null; } @@ -100,6 +101,7 @@ public class RecorderTabPanel implements PamTabPanel, RecorderView { /* (non-Javadoc) * @see SoundRecorder.RecorderView#newParams() */ + @Override public void newParams() { enableBuffer.setSelected(recorderControl.recorderSettings.enableBuffer); bufferContent.setMaximum(Math.max(1, recorderControl.recorderSettings.bufferLength)); @@ -107,6 +109,7 @@ public class RecorderTabPanel implements PamTabPanel, RecorderView { bufferLength.setText(String.format(" %d s", recorderControl.recorderSettings.bufferLength)); } + @Override public void enableRecording(boolean enable) { buttonAuto.setEnabled(enable); buttonStart.setEnabled(enable); @@ -114,6 +117,7 @@ public class RecorderTabPanel implements PamTabPanel, RecorderView { } + @Override public void enableRecordingControl(boolean enable) { for (int i = 0; i < enableChannel.length; i++) { if (enableChannel[i] != null) { @@ -123,6 +127,7 @@ public class RecorderTabPanel implements PamTabPanel, RecorderView { buttonSettings.setEnabled(enable); } + @Override public void sayStatus(String status) { recordStatus.setText(status); long fileBytes = recorderControl.recorderStorage.getFileSizeBytes(); @@ -154,7 +159,7 @@ public class RecorderTabPanel implements PamTabPanel, RecorderView { checkBuffer(); } private void checkBuffer() { - if (recorderControl.recorderSettings.enableBuffer == false) { + if (!recorderControl.recorderSettings.enableBuffer) { bufferContent.setValue(0); } else { @@ -178,6 +183,7 @@ public class RecorderTabPanel implements PamTabPanel, RecorderView { /* (non-Javadoc) * @see SoundRecorder.RecorderView#newData(PamguardMVC.PamDataBlock, PamguardMVC.PamDataUnit) */ + @Override public void newData(PamDataBlock dataBlock, PamDataUnit dataUnit) { RawDataUnit rawDataUnit = (RawDataUnit) dataUnit; @@ -189,6 +195,7 @@ public class RecorderTabPanel implements PamTabPanel, RecorderView { levelsPanel.showLevel(PamUtils.getSingleChannel(rawDataUnit.getChannelBitmap()), logAmplitude); } + @Override public void setButtonStates(int pressedButton) { buttonOff.setSelected(pressedButton == BUTTON_OFF); buttonAuto.setSelected(pressedButton == BUTTON_AUTO); @@ -336,12 +343,14 @@ public class RecorderTabPanel implements PamTabPanel, RecorderView { MainButtonListener(int buttonCommand) { this.buttonCommand = buttonCommand; } + @Override public void actionPerformed(ActionEvent e) { recorderControl.buttonCommand(buttonCommand); } } class SettingsButtonListener implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { recorderControl.recordSettingsDialog(recorderControl.getGuiFrame()); } @@ -349,6 +358,7 @@ public class RecorderTabPanel implements PamTabPanel, RecorderView { } class BufferButtonListener implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { recorderControl.recorderSettings.enableBuffer = enableBuffer.isSelected(); } @@ -428,6 +438,7 @@ public class RecorderTabPanel implements PamTabPanel, RecorderView { public BarEnableListener(int barId) { this.barId = barId; } + @Override public void actionPerformed(ActionEvent e) { recorderControl.recorderSettings.setChannelBitmap(barId, enableChannel[barId].isSelected()); // recorderControl.recorderSettings.channelBitmap = @@ -560,7 +571,7 @@ public class RecorderTabPanel implements PamTabPanel, RecorderView { RecorderTriggerData rtd; TriggerCheckBox cb; JButton button; - for (RecorderTrigger rt:recorderControl.recorderTriggers) { + for (RecorderTrigger rt:RecorderControl.recorderTriggers) { rtd = recorderControl.recorderSettings.findTriggerData(rt); diff --git a/src/SoundRecorder/WavFileStorage.java b/src/SoundRecorder/WavFileStorage.java index 8bfb9f79..26eeebb5 100644 --- a/src/SoundRecorder/WavFileStorage.java +++ b/src/SoundRecorder/WavFileStorage.java @@ -2,14 +2,11 @@ package SoundRecorder; import java.io.File; -import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioFileFormat.Type; -import javax.sound.sampled.AudioFormat.Encoding; +import javax.sound.sampled.AudioFormat; import PamUtils.FileFunctions; import PamUtils.PamCalendar; -import wavFiles.ByteConverter; -import wavFiles.WavFile; import wavFiles.WavFileWriter; /** @@ -43,7 +40,7 @@ public class WavFileStorage implements RecorderStorage { // this.bitDepth = bitDepth; // this.fileType = fileType; - boolean isBigendian = (fileType != audioFileType.WAVE); + boolean isBigendian = (fileType != Type.WAVE); audioFormat = new AudioFormat(sampleRate, bitDepth, nChannels, true, isBigendian); diff --git a/src/Spectrogram/ColourRangeSlider.java b/src/Spectrogram/ColourRangeSlider.java index 61b48400..37a9c2ac 100644 --- a/src/Spectrogram/ColourRangeSlider.java +++ b/src/Spectrogram/ColourRangeSlider.java @@ -1,6 +1,6 @@ package Spectrogram; -import javax.swing.JSlider; +import javax.swing.SwingConstants; import PamView.ColourArray; import PamView.ColourArray.ColourArrayType; @@ -19,11 +19,11 @@ public class ColourRangeSlider extends PamRangeSlider { private static final long serialVersionUID = 1L; public ColourRangeSlider(){ - super(JSlider.VERTICAL); + super(SwingConstants.VERTICAL); } public ColourRangeSlider(int min, int max){ - super(min, max,JSlider.VERTICAL); + super(min, max,SwingConstants.VERTICAL); } public ColourRangeSlider(int min, int max, int orientation){ diff --git a/src/Spectrogram/ColourRangeSliderUI.java b/src/Spectrogram/ColourRangeSliderUI.java index 884db474..d89cd09e 100644 --- a/src/Spectrogram/ColourRangeSliderUI.java +++ b/src/Spectrogram/ColourRangeSliderUI.java @@ -8,7 +8,7 @@ import java.awt.geom.AffineTransform; import java.awt.image.BufferedImage; import java.awt.image.WritableRaster; -import javax.swing.JSlider; +import javax.swing.SwingConstants; import PamView.ColourArray; import PamView.ColourArray.ColourArrayType; @@ -77,7 +77,7 @@ public class ColourRangeSliderUI extends PamRangeSliderUI { private void createColourMapImage(){ - if (b.getOrientation() == JSlider.VERTICAL) { + if (b.getOrientation() == SwingConstants.VERTICAL) { // now make a standard amplitude image if (colourArray != null && colourArray.length > 0) { @@ -134,7 +134,7 @@ public class ColourRangeSliderUI extends PamRangeSliderUI { int cx; - if (b.getOrientation() == JSlider.VERTICAL) { + if (b.getOrientation() == SwingConstants.VERTICAL) { // Determine position of selected range by moving from the middle // of one thumb to the other. diff --git a/src/Spectrogram/ScalePanel.java b/src/Spectrogram/ScalePanel.java index b26f06a9..83a4b172 100644 --- a/src/Spectrogram/ScalePanel.java +++ b/src/Spectrogram/ScalePanel.java @@ -69,6 +69,7 @@ public class ScalePanel extends JPanel { // this.get Timer t = new Timer(100, new ActionListener() { + @Override public void actionPerformed(ActionEvent evt) { // paintImmediately(getBounds()); diff --git a/src/Spectrogram/SpectrogramDisplay.java b/src/Spectrogram/SpectrogramDisplay.java index b2cf689b..947cc61e 100644 --- a/src/Spectrogram/SpectrogramDisplay.java +++ b/src/Spectrogram/SpectrogramDisplay.java @@ -69,20 +69,6 @@ import javax.swing.event.AncestorListener; import javax.swing.event.InternalFrameEvent; import javax.swing.event.InternalFrameListener; -import pamScrollSystem.AbstractPamScroller; -import pamScrollSystem.AbstractPamScrollerAWT; -import pamScrollSystem.PamScrollObserver; -import pamScrollSystem.PamScroller; -import pamScrollSystem.PamScrollerData; -import pamScrollSystem.RangeSpinner; -import pamScrollSystem.RangeSpinnerListener; -import pamScrollSystem.jumping.ScrollJumper; -import pamguard.GlobalArguments; -import soundPlayback.PlaybackControl; -import soundPlayback.PlaybackProgressMonitor; -import userDisplay.UserDisplayControl; -import userDisplay.UserDisplayFrame; -import userDisplay.UserFramePlots; import Acquisition.AcquisitionProcess; import Layout.DisplayPanel; import Layout.DisplayPanelContainer; @@ -97,18 +83,17 @@ import PamController.PamSettingManager; import PamController.PamSettings; import PamDetection.RawDataUnit; import PamUtils.Coordinate3d; -import PamUtils.FrequencyFormat; import PamUtils.PamCalendar; import PamUtils.PamUtils; import PamUtils.SIUnitFormat; import PamUtils.complex.ComplexArray; import PamView.ClipboardCopier; import PamView.ColourArray; -import PamView.GeneralProjector; import PamView.ColourArray.ColourArrayType; -import PamView.dialog.PamLabel; +import PamView.GeneralProjector; import PamView.PamColors; import PamView.PamView; +import PamView.dialog.PamLabel; import PamView.hidingpanel.HidingDialogPanel; import PamView.panel.CornerLayout; import PamView.panel.CornerLayoutContraint; @@ -118,11 +103,11 @@ import PamView.paneloverlay.overlaymark.ExtMouseAdapter; import PamView.paneloverlay.overlaymark.MarkRelationships; import PamView.paneloverlay.overlaymark.MarkRelationshipsData; import PamView.paneloverlay.overlaymark.OverlayMark; +import PamView.paneloverlay.overlaymark.OverlayMark.OverlayMarkType; import PamView.paneloverlay.overlaymark.OverlayMarkObserver; import PamView.paneloverlay.overlaymark.OverlayMarkObservers; import PamView.paneloverlay.overlaymark.OverlayMarkProviders; import PamView.paneloverlay.overlaymark.OverlayMarker; -import PamView.paneloverlay.overlaymark.OverlayMark.OverlayMarkType; import PamguardMVC.LoadObserver; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; @@ -138,6 +123,19 @@ import dataPlotsFX.data.DataTypeInfo; import fftManager.FFTDataBlock; import fftManager.FFTDataUnit; import ltsa.LtsaDataBlock; +import pamScrollSystem.AbstractPamScroller; +import pamScrollSystem.AbstractPamScrollerAWT; +import pamScrollSystem.PamScrollObserver; +import pamScrollSystem.PamScroller; +import pamScrollSystem.PamScrollerData; +import pamScrollSystem.RangeSpinner; +import pamScrollSystem.RangeSpinnerListener; +import pamguard.GlobalArguments; +import soundPlayback.PlaybackControl; +import soundPlayback.PlaybackProgressMonitor; +import userDisplay.UserDisplayControl; +import userDisplay.UserDisplayFrame; +import userDisplay.UserFramePlots; public class SpectrogramDisplay extends UserFramePlots implements PamObserver, LoadObserver, InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSettings { @@ -277,7 +275,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett PamSettingManager.getInstance().registerSettings(this); // always need to register, even if we're using old parameters // } boolean isBatch = GlobalArguments.getParam("-batch") != null; - if (spectrogramParameters == null && isBatch == false) { + if (spectrogramParameters == null && !isBatch) { this.spectrogramParameters = new SpectrogramParameters(); PamView view = userDisplayControl.getPamView(); if (view != null) { @@ -465,7 +463,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett public void setParams(SpectrogramParameters newParameters, boolean fullLayout) { - if (PamController.getInstance().isInitializationComplete() == false) { + if (!PamController.getInstance().isInitializationComplete()) { return; } @@ -898,6 +896,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett } + @Override public void setSampleRate(float sampleRate, boolean notify) { // System.out.println("samplerate " + sampleRate); this.sampleRate = sampleRate; @@ -968,6 +967,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett * * @see SpectrogramMarkObserver */ + @Override public long getRequiredDataHistory(PamObservable o, Object arg) { // WTF was this line of code doing here ? This is what's been messing up @@ -1013,6 +1013,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett return Math.min(history, maxSecs*1000); } + @Override public String getObserverName() { return "Spectrogam Display"; } @@ -1083,7 +1084,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett if (!viewerMode) { spectrogramProjector.setOffset(newData.getTimeMilliseconds(), spectrogramPanels[panelNumber].imagePos); } - if (spectrogramPanels[panelNumber].getSize().equals(panelSize) == false) { + if (!spectrogramPanels[panelNumber].getSize().equals(panelSize)) { panelSize = spectrogramPanels[panelNumber].getSize(); // createOverlay(panelSize.width, panelSize.height); } @@ -1117,16 +1118,19 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett private class SettingsAction implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { spectrogramDisplay.setSettings(); } } private class MenuCancelPlayback implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { PlaybackControl.getViewerPlayback().stopViewerPlayback(); } } private class MenuPlayAll implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { long startMillis = viewerScroller.getValueMillis(); long endMillis = startMillis + viewerScroller.getVisibleAmount(); @@ -1141,6 +1145,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett this.channel = channel; } + @Override public void actionPerformed(ActionEvent e) { long startMillis = viewerScroller.getValueMillis(); long endMillis = startMillis + viewerScroller.getVisibleAmount(); @@ -1158,6 +1163,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett this.startMillis = startMillis; } + @Override public void actionPerformed(ActionEvent e) { long dispStartMillis = viewerScroller.getValueMillis(); long endMillis = dispStartMillis + viewerScroller.getVisibleAmount(); @@ -1395,7 +1401,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett return; } long s = viewerScroller.getValueMillis(); - long e = s + (long) (spectrogramParameters.displayLength * 1100.) + 2000;; + long e = s + (long) (spectrogramParameters.displayLength * 1100.) + 2000; requestFFTData(s, e); } @@ -1499,7 +1505,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett @Override public void paintComponent(Graphics g) { // super.paint(g); - if (isShowing() == false) return; + if (!isShowing()) return; Rectangle b = g.getClipBounds(); g.setColor(getBackground()); g.fillRect(b.x, b.y, b.width, b.height); @@ -1554,7 +1560,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett * Try to work out the relative positions of this panel * and each of the spectrogram panels. */ - if (spectrogramPanels[i].isShowing() == false) return; + if (!spectrogramPanels[i].isShowing()) return; Point panelScreenLoc = null; try { panelScreenLoc = spectrogramPanels[i].getLocationOnScreen(); @@ -1611,7 +1617,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett if ((axis = dp.getWestAxis()) != null) { // need to work out where the hell the // window is relative to this one... - if (dp.getInnerPanel().isShowing() == false) { + if (!dp.getInnerPanel().isShowing()) { return; } dpLoc = dp.getInnerPanel().getLocationOnScreen(); @@ -2160,7 +2166,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett obs = true; } } - if (obs == false) { + if (!obs) { dataBlock.deleteObserver(this); } } @@ -2258,7 +2264,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett } lastDataSample = dataUnit.getStartSample(); - if (spectrogramParameters.timeScaleFixed == false) { + if (!spectrogramParameters.timeScaleFixed) { int newWidth = getSpectrogramImageWidth(); if (newWidth != specImage.getWidth()) { createAllImages(); @@ -2356,7 +2362,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett return; } } - if (viewerMode == false && spectrogramParameters.wrapDisplay) { + if (!viewerMode && spectrogramParameters.wrapDisplay) { for (int i = 0; i < len; i++) { writableRaster.setPixel(newPos, i, overlayColour); } @@ -2549,7 +2555,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett public void repaint(){ super.repaint(); if (spectrogramPlotPanel!=null) spectrogramPlotPanel.repaintSidePanel(); - }; + } @Override public void repaint(long time){ @@ -2558,7 +2564,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett spectrogramPlotPanel.repaint(time); spectrogramPlotPanel.repaintSidePanel(); } - }; + } /** * @return the viewedDataBlocks @@ -2611,7 +2617,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett panelSize = newSize; } - if (spectrogramParameters.timeScaleFixed == false) { + if (!spectrogramParameters.timeScaleFixed) { if (getSpectrogramImageWidth() != specImage.getWidth()) { createAllImages(); } @@ -2634,7 +2640,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett * If we have a frozenImage object, it means that the user is drawing a box in the spectrogram. So don't try to update everything, * just use the image and draw the box */ - if (frozenImage != null && viewerMode == false) { + if (frozenImage != null && !viewerMode) { // System.out.println("Drawing frozen image..."); // imageToDraw = frozenImage; g2d.drawImage(frozenImage, 0, 0, getWidth(), getHeight(), 0, 0, frozenImage.getWidth(), frozenImage.getHeight(), this); @@ -2863,7 +2869,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett } } - if (shouldDrawMarkLabel==false) + if (!shouldDrawMarkLabel) return; Rectangle2D bounds = getBounds(); @@ -2948,7 +2954,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett // decide whether or not to display the data unit based on the current time, unless we have frozen the // image. In that case, base the decision on the frozen time long timeToUse = currentTimeMilliseconds; - if (frozenImage != null && viewerMode == false) { + if (frozenImage != null && !viewerMode) { timeToUse = frozenTimeMilliseconds; } @@ -3043,6 +3049,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett return detectorMenu; } + @Override public long getRequiredDataHistory(PamObservable o, Object arg) { return SpectrogramDisplay.this.getRequiredDataHistory(o, arg); // long history = (long) getXDuration(); @@ -3057,15 +3064,18 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett // return history + 1000; } + @Override public String getObserverName() { return "Spectrogram display panel"; } + @Override public void noteNewSettings() { //System.out.println("New spectrogram panel settings"); // setParams(spectrogramParameters); } + @Override public void setSampleRate(float sampleRate, boolean notify) { // System.out.println("New spectrogram panel sampleRate"); } @@ -3075,6 +3085,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett spectrogramDisplay.masterClockUpdate(milliSeconds, sampleNumber); } + @Override public void addData(PamObservable obs, PamDataUnit newData) { //for (int i = 0; i < spectrogramPanel.length; i++) { @@ -3210,6 +3221,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett // } // } + @Override public void removeObservable(PamObservable o) { // TODO Auto-generated method stub @@ -3450,7 +3462,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett // System.out.println("Pressed button = " + e.getButton()); currentMousePoint = mouseDownPoint = e.getPoint(); freezeImages(spectrogramPanel); - if (fireMouseDownEvents(spectrogramPanel, e, mouseDownPoint) == false) { + if (!fireMouseDownEvents(spectrogramPanel, e, mouseDownPoint)) { super.mousePressed(e); } } @@ -3462,9 +3474,9 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett boolean events = fireMouseUpEvents(spectrogramPanel, e, mouseDownPoint, e.getPoint()); unFreezeImages(); // spectrogramPanel.frozenImage = null; - if (events == false) { + if (!events) { super.mouseReleased(e); - }; + } currentMousePoint = mouseDownPoint = null; mousePressedButton = MouseEvent.NOBUTTON; // if (viewerMode) { @@ -3485,9 +3497,9 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett for (int i = 0; i < spectrogramPanels.length; i++) { spectrogramPanels[i].repaint(); } - if (fireMouseDragEvents(spectrogramPanel, e, mouseDownPoint, e.getPoint()) == false) { + if (!fireMouseDragEvents(spectrogramPanel, e, mouseDownPoint, e.getPoint())) { super.mouseDragged(e); - }; + } } @@ -3499,16 +3511,19 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett class SplitPaneListener implements AncestorListener { + @Override public void ancestorAdded(AncestorEvent event) { // spectrogramAxis.repaint(); repaintAll(); } + @Override public void ancestorMoved(AncestorEvent event) { // spectrogramAxis.repaint(); repaintAll(); } + @Override public void ancestorRemoved(AncestorEvent event) { // spectrogramAxis.repaint(); repaintAll(); @@ -3516,6 +3531,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett } + @Override public SpectrogramParameters getSpectrogramParameters() { if (getFrame() != null) { spectrogramParameters.boundingRectangle = getFrame().getBounds(); @@ -3637,12 +3653,14 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett } } + @Override public void noteNewSettings() { setParams(spectrogramParameters, true); subscribeDataBlocks(); } + @Override public void removeObservable(PamObservable o) { // TODO Auto-generated method stub @@ -3744,6 +3762,7 @@ InternalFrameListener, DisplayPanelContainer, SpectrogramParametersUser, PamSett return spectrogramParameters.displayLength * 1000.; } + @Override public void panelNotify(int noteType) { switch (noteType) { case DRAW_BORDER: diff --git a/src/Spectrogram/SpectrogramDisplayComponent.java b/src/Spectrogram/SpectrogramDisplayComponent.java index ac07551d..3b091f38 100644 --- a/src/Spectrogram/SpectrogramDisplayComponent.java +++ b/src/Spectrogram/SpectrogramDisplayComponent.java @@ -3,7 +3,6 @@ package Spectrogram; import java.awt.Component; import Layout.PamGraphLayout; -import userDisplay.UserDisplayComponent; import userDisplay.UserDisplayComponentAdapter; import userDisplay.UserDisplayControl; diff --git a/src/Spectrogram/SpectrogramHidingPanel.java b/src/Spectrogram/SpectrogramHidingPanel.java index 0ec9bc0a..4c12394d 100644 --- a/src/Spectrogram/SpectrogramHidingPanel.java +++ b/src/Spectrogram/SpectrogramHidingPanel.java @@ -2,12 +2,8 @@ package Spectrogram; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Component; import java.awt.Dimension; import java.awt.Graphics; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; import java.awt.Rectangle; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -16,31 +12,24 @@ import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JComponent; -import javax.swing.JLabel; import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.KeyStroke; +import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import fftManager.FFTDataBlock; import Layout.PamAxis; import Layout.PamAxisPanel; -import PamController.PamController; -import PamController.soundMedium.GlobalMedium; import PamView.ColourArray; import PamView.ColourArray.ColourArrayType; -import PamView.PamColors.PamColor; -import PamView.dialog.PamDialog; -import PamView.dialog.PamGridBagContraints; import PamView.ColourComboBox; import PamView.PamColors; +import PamView.PamColors.PamColor; import PamView.hidingpanel.HidingDialog; import PamView.hidingpanel.HidingDialogChangeListener; import PamView.hidingpanel.HidingDialogComponent; -import PamView.hidingpanel.HidingPanel; import PamView.panel.PamPanel; import PamView.sliders.PamRangeSlider; +import fftManager.FFTDataBlock; @@ -351,7 +340,7 @@ public class SpectrogramHidingPanel extends HidingDialogComponent { FrequencyPanel(int min, int max) { super(); setLayout(new BorderLayout()); - add(pamRangeSlider=new PamRangeSlider(0,sliderRange,PamRangeSlider.VERTICAL), BorderLayout.CENTER); + add(pamRangeSlider=new PamRangeSlider(0,sliderRange,SwingConstants.VERTICAL), BorderLayout.CENTER); pamRangeSlider.addChangeListener(new FrequencyRangeListener()); pamRangeSlider.setTrackDragging(true); pamRangeSlider.setThumbSizes(15); diff --git a/src/Spectrogram/SpectrogramMarkConverter.java b/src/Spectrogram/SpectrogramMarkConverter.java index b88fde4b..9ae1dd5b 100644 --- a/src/Spectrogram/SpectrogramMarkConverter.java +++ b/src/Spectrogram/SpectrogramMarkConverter.java @@ -1,12 +1,9 @@ package Spectrogram; import java.awt.event.MouseEvent; -import java.util.ArrayList; -import javax.swing.JMenuItem; import javax.swing.JPopupMenu; -import PamUtils.PamCalendar; import PamUtils.PamCoordinate; import PamUtils.PamUtils; import PamView.GeneralProjector.ParameterType; diff --git a/src/Spectrogram/SpectrogramMarkObserver.java b/src/Spectrogram/SpectrogramMarkObserver.java index 351fde53..cdd1a22c 100644 --- a/src/Spectrogram/SpectrogramMarkObserver.java +++ b/src/Spectrogram/SpectrogramMarkObserver.java @@ -2,7 +2,6 @@ package Spectrogram; import java.awt.event.MouseEvent; -import PamguardMVC.PamDataBlock; import dataPlotsFX.layout.TDGraphFX; /** diff --git a/src/Spectrogram/SpectrogramMarkObservers.java b/src/Spectrogram/SpectrogramMarkObservers.java index 221fbd60..6592dd94 100644 --- a/src/Spectrogram/SpectrogramMarkObservers.java +++ b/src/Spectrogram/SpectrogramMarkObservers.java @@ -43,7 +43,7 @@ public class SpectrogramMarkObservers { ArrayList list = OverlayMarkObservers.singleInstance().getMarkObservers(); for (int i = 0; i < list.size(); i++) { OverlayMarkObserver obs = list.get(i); - if (SpectrogramMarkConverter.class.isAssignableFrom(obs.getClass()) == false) { + if (!SpectrogramMarkConverter.class.isAssignableFrom(obs.getClass())) { continue; } SpectrogramMarkConverter smc = (SpectrogramMarkConverter) obs; diff --git a/src/Spectrogram/SpectrogramMarkProcess.java b/src/Spectrogram/SpectrogramMarkProcess.java index 068bc5a3..5b65265a 100644 --- a/src/Spectrogram/SpectrogramMarkProcess.java +++ b/src/Spectrogram/SpectrogramMarkProcess.java @@ -2,11 +2,11 @@ package Spectrogram; import java.awt.event.MouseEvent; -import fftManager.FFTDataBlock; -import fftManager.FFTDataUnit; import PamController.PamControlledUnit; import PamguardMVC.PamProcess; import dataPlotsFX.layout.TDGraphFX; +import fftManager.FFTDataBlock; +import fftManager.FFTDataUnit; /** * Standard process for any PamControlled unit observing marks made manually @@ -82,6 +82,7 @@ abstract public class SpectrogramMarkProcess extends PamProcess implements Spect *may be interleaved. * */ + @Override public boolean spectrogramNotification(SpectrogramDisplay display, MouseEvent mouseEvent, int downUp, int channel, long startMilliseconds, long duration, double f1, double f2, TDGraphFX tdDisplay) { @@ -119,6 +120,7 @@ abstract public class SpectrogramMarkProcess extends PamProcess implements Spect return false; } + @Override public String getMarkObserverName() { return getProcessName(); } diff --git a/src/Spectrogram/SpectrogramParameters.java b/src/Spectrogram/SpectrogramParameters.java index 48c9a4ae..f6cb27bd 100644 --- a/src/Spectrogram/SpectrogramParameters.java +++ b/src/Spectrogram/SpectrogramParameters.java @@ -28,12 +28,11 @@ import Array.ArrayManager; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PrivatePamParameterData; -import userDisplay.UserFrameParameters; - import PamView.ColourArray.ColourArrayType; import PamView.paneloverlay.OverlayDataInfo; import PamguardMVC.PamConstants; import PamguardMVC.PamDataBlock; +import userDisplay.UserFrameParameters; /** * These are the parameter settings for a single diff --git a/src/Spectrogram/SpectrogramParamsDialog.java b/src/Spectrogram/SpectrogramParamsDialog.java index af98d4c3..419bb335 100644 --- a/src/Spectrogram/SpectrogramParamsDialog.java +++ b/src/Spectrogram/SpectrogramParamsDialog.java @@ -41,17 +41,13 @@ import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTabbedPane; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; -import fftManager.FFTDataBlock; -import fftManager.FFTDataUnit; -import noiseMonitor.ResolutionPanel; -import warnings.WarningSystem; import Layout.DisplayPanelProvider; import Layout.DisplayProviderList; import PamController.PamController; -import PamController.soundMedium.GlobalMedium; import PamUtils.PamUtils; import PamView.ColourArray; import PamView.ColourArray.ColourArrayType; @@ -65,6 +61,9 @@ import PamguardMVC.PamConstants; import PamguardMVC.PamDataBlock; import PamguardMVC.PamProcess; import Spectrogram.SpectrogramDisplay.SpectrogramPanel; +import fftManager.FFTDataBlock; +import fftManager.FFTDataUnit; +import noiseMonitor.ResolutionPanel; public class SpectrogramParamsDialog extends PamDialog implements ActionListener { @@ -236,6 +235,7 @@ public class SpectrogramParamsDialog extends PamDialog implements ActionListener } + @Override public void actionPerformed(ActionEvent e) { if (e.getSource() == pixs) { @@ -310,7 +310,7 @@ public class SpectrogramParamsDialog extends PamDialog implements ActionListener // addComponent(bot, sourceData, constraints); constraints.gridy = 1; constraints.gridwidth = 1; - addComponent(chanPanel, new JLabel(" Number of Panels ", JLabel.RIGHT), constraints); + addComponent(chanPanel, new JLabel(" Number of Panels ", SwingConstants.RIGHT), constraints); constraints.gridx = 1; constraints.gridwidth = 1; addComponent(chanPanel, nPanels, constraints); @@ -322,7 +322,7 @@ public class SpectrogramParamsDialog extends PamDialog implements ActionListener constraints.gridx = 0; constraints.gridy ++; constraints.gridwidth = 1; - addComponent(chanPanel, panelChannelLabel[i] = new JLabel(" Panel " + i + " channel ", JLabel.RIGHT), constraints); + addComponent(chanPanel, panelChannelLabel[i] = new JLabel(" Panel " + i + " channel ", SwingConstants.RIGHT), constraints); constraints.gridx += constraints.gridwidth; constraints.gridwidth = 1; addComponent(chanPanel, panelChannelList[i] = new JComboBox(), constraints); @@ -416,7 +416,7 @@ public class SpectrogramParamsDialog extends PamDialog implements ActionListener nP = Integer.valueOf(nPanels.getText()); } catch (NumberFormatException Ex) { - nP = 0;; + nP = 0; } if (nP <= 0) { nPanels.setText("1"); @@ -543,8 +543,8 @@ public class SpectrogramParamsDialog extends PamDialog implements ActionListener spectrogramParameters.amplitudeLimits[1])); colourList.setSelectedIndex(spectrogramParameters.getColourMap().ordinal()); - pixs.setSelected(spectrogramParameters.timeScaleFixed == false); - secs.setSelected(spectrogramParameters.timeScaleFixed == true); + pixs.setSelected(!spectrogramParameters.timeScaleFixed); + secs.setSelected(spectrogramParameters.timeScaleFixed); pixsPerSlice.setText(String.format("%d", spectrogramParameters.pixelsPerSlics)); diff --git a/src/Spectrogram/SpectrogramZoomer.java b/src/Spectrogram/SpectrogramZoomer.java index bf7711d3..4122226e 100644 --- a/src/Spectrogram/SpectrogramZoomer.java +++ b/src/Spectrogram/SpectrogramZoomer.java @@ -1,6 +1,7 @@ package Spectrogram; import java.awt.event.MouseEvent; + import PamView.zoomer.ZoomShape; import PamView.zoomer.Zoomable; import Spectrogram.SpectrogramDisplay.SpectrogramPanel; diff --git a/src/Stats/LinFit.java b/src/Stats/LinFit.java index e82d41db..b385b8e7 100644 --- a/src/Stats/LinFit.java +++ b/src/Stats/LinFit.java @@ -114,7 +114,7 @@ public class LinFit { * @return the fit intercept */ public double getA() { - if (doneErrors == false) doErrors(); + if (!doneErrors) doErrors(); return a; } @@ -123,31 +123,31 @@ public class LinFit { * @return the fit gradient */ public double getB() { - if (doneErrors == false) doErrors(); + if (!doneErrors) doErrors(); return b; } public double getChi2() { - if (doneErrors == false) doErrors(); + if (!doneErrors) doErrors(); return chi2; } public double getQ() { - if (doneErrors == false) doErrors(); + if (!doneErrors) doErrors(); return q; } public double getSiga() { - if (doneErrors == false) doErrors(); + if (!doneErrors) doErrors(); return siga; } public double getSigb() { - if (doneErrors == false) doErrors(); + if (!doneErrors) doErrors(); return sigb; } @@ -241,5 +241,5 @@ public class LinFit { return -tmp+Math.log(2.5066282746310005*ser/x); } - double SQR(double f){return f*f;}; + double SQR(double f){return f*f;} } diff --git a/src/Stats/LogRegWeka.java b/src/Stats/LogRegWeka.java index 0082744e..6d59a8f0 100644 --- a/src/Stats/LogRegWeka.java +++ b/src/Stats/LogRegWeka.java @@ -31,7 +31,6 @@ import java.util.Set; import java.util.TreeSet; import PamguardMVC.debug.Debug; -import weka.classifiers.Classifier; import weka.classifiers.functions.Logistic; import weka.core.Attribute; import weka.core.DenseInstance; diff --git a/src/UserInput/UserInputDataUnit.java b/src/UserInput/UserInputDataUnit.java index af961ea9..4b4ac6c5 100644 --- a/src/UserInput/UserInputDataUnit.java +++ b/src/UserInput/UserInputDataUnit.java @@ -21,13 +21,9 @@ package UserInput; -import PamUtils.FrequencyFormat; -import PamUtils.PamCalendar; -import PamUtils.PamUtils; import PamguardMVC.PamDataUnit; import annotation.DataAnnotation; import annotation.DataAnnotationType; -import pamMaths.PamVector; /** * diff --git a/src/UserInput/UserInputLogger.java b/src/UserInput/UserInputLogger.java index 31eb53a8..5c53312b 100644 --- a/src/UserInput/UserInputLogger.java +++ b/src/UserInput/UserInputLogger.java @@ -20,19 +20,16 @@ */ package UserInput; +import java.sql.Types; + +import PamguardMVC.PamDataBlock; +import PamguardMVC.PamDataUnit; import generalDatabase.PamConnection; import generalDatabase.PamTableDefinition; import generalDatabase.PamTableItem; import generalDatabase.SQLLogging; import generalDatabase.SQLTypes; -import java.sql.Connection; -import java.sql.Types; - -import PamUtils.PamCalendar; -import PamguardMVC.PamDataBlock; -import PamguardMVC.PamDataUnit; - /** * * @author David J McLaren diff --git a/src/UserInput/UserInputOverlayGraphics.java b/src/UserInput/UserInputOverlayGraphics.java index b960bd3e..d6d79cd1 100644 --- a/src/UserInput/UserInputOverlayGraphics.java +++ b/src/UserInput/UserInputOverlayGraphics.java @@ -6,11 +6,8 @@ import java.awt.Point; import java.awt.Rectangle; import PamUtils.Coordinate3d; -import PamView.BasicKeyItem; import PamView.GeneralProjector; -import PamView.HoverData; import PamView.PamDetectionOverlayGraphics; -import PamView.PamKeyItem; import PamView.PamSymbol; import PamView.PamSymbolType; import PamguardMVC.PamDataBlock; diff --git a/src/UserInput/UserInputPanel.java b/src/UserInput/UserInputPanel.java index cb147dd1..6982ccf8 100644 --- a/src/UserInput/UserInputPanel.java +++ b/src/UserInput/UserInputPanel.java @@ -45,8 +45,6 @@ import javax.swing.JToolBar; import javax.swing.ScrollPaneConstants; import javax.swing.border.TitledBorder; -import pamScrollSystem.AbstractPamScrollerAWT; -import pamScrollSystem.ScrollPaneAddon; import PamController.PamController; import PamUtils.PamCalendar; import PamView.PamTabPanel; @@ -54,6 +52,8 @@ import PamView.dialog.PamButton; import PamView.dialog.PamTextArea; import PamView.panel.PamBorderPanel; import PamguardMVC.PamDataBlock; +import pamScrollSystem.AbstractPamScrollerAWT; +import pamScrollSystem.ScrollPaneAddon; public class UserInputPanel implements PamTabPanel { @@ -193,11 +193,13 @@ public class UserInputPanel implements PamTabPanel { // submitButton.setText("Submit Comment"); submitButton.addActionListener(new java.awt.event.ActionListener() { + @Override public void actionPerformed(java.awt.event.ActionEvent evt) { submitActionPerformed(evt); } }); clearButton.addActionListener(new java.awt.event.ActionListener() { + @Override public void actionPerformed(java.awt.event.ActionEvent evt) { clearActionPerformed(evt); } @@ -208,6 +210,7 @@ public class UserInputPanel implements PamTabPanel { class TextListener implements KeyListener { + @Override public void keyPressed(KeyEvent e) { //if(e.getKeyText(e.getKeyCode())=="Enter"){ if(e.getKeyCode()==KeyEvent.VK_ENTER){ @@ -215,6 +218,7 @@ public class UserInputPanel implements PamTabPanel { } } + @Override public void keyReleased(KeyEvent e) { // TODO Auto-generated method stub if(e.getKeyCode()==KeyEvent.VK_ENTER){ @@ -224,6 +228,7 @@ public class UserInputPanel implements PamTabPanel { } + @Override public void keyTyped(KeyEvent e) { enableButtons(); @@ -331,17 +336,20 @@ public class UserInputPanel implements PamTabPanel { textInputField.requestFocus(); } + @Override public JMenu createMenu(Frame parentFrame) { // TODO Auto-generated method stub return null; } + @Override public JComponent getPanel() { // TODO Auto-generated method stub setFocusOnTextInput(); return uiPanel; } + @Override public JToolBar getToolBar() { // TODO Auto-generated method stub return null; diff --git a/src/UserInput/UserInputProcess.java b/src/UserInput/UserInputProcess.java index 24835205..51e9ec1f 100644 --- a/src/UserInput/UserInputProcess.java +++ b/src/UserInput/UserInputProcess.java @@ -23,7 +23,7 @@ package UserInput; import java.awt.Color; import PamController.PamController; -import PamView.PamSymbol; +import PamView.PamSymbolBase; import PamView.symbol.StandardSymbolManager; import PamView.symbol.SymbolData; import PamguardMVC.PamDataBlock; @@ -45,7 +45,7 @@ public class UserInputProcess extends PamProcess { "User Input Data", this, 0b1111111111111111))); uiDataBlock.setOverlayDraw(new UserInputOverlayGraphics(uiDataBlock)); uiDataBlock.setPamSymbolManager(new StandardSymbolManager(uiDataBlock, - new SymbolData(PamSymbol.interpretTextCode("v"),20,20,false,Color.red,Color.black), + new SymbolData(PamSymbolBase.interpretTextCode("v"),20,20,false,Color.red,Color.black), true)); uiDataBlock.setChannelMap(0b1111111111111111); uiDataBlock.setNaturalLifetime(3600*24); // natural lifetime 24 hours. diff --git a/src/UserInput/UserInputSidePanel.java b/src/UserInput/UserInputSidePanel.java index 8732b091..02939e6e 100644 --- a/src/UserInput/UserInputSidePanel.java +++ b/src/UserInput/UserInputSidePanel.java @@ -27,18 +27,12 @@ package UserInput; */ import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; import java.awt.Font; -import java.awt.GridBagLayout; -import java.awt.GridLayout; import java.awt.event.KeyEvent; import java.awt.event.KeyListener; import javax.swing.BoxLayout; import javax.swing.JComponent; -import javax.swing.JTextArea; -import javax.swing.JTextField; import javax.swing.border.TitledBorder; import PamUtils.PamCalendar; @@ -60,11 +54,13 @@ public class UserInputSidePanel implements PamSidePanel{ sidePanel = new SidePanel(); } + @Override public JComponent getPanel() { // TODO Auto-generated method stub return sidePanel; } + @Override public void rename(String newName) { // TODO Auto-generated method stub @@ -99,12 +95,14 @@ public class UserInputSidePanel implements PamSidePanel{ class TextListener implements KeyListener { + @Override public void keyPressed(KeyEvent e) { if(e.getKeyCode()==KeyEvent.VK_ENTER){ submitText(); } } + @Override public void keyReleased(KeyEvent e) { if(e.getKeyCode()==KeyEvent.VK_ENTER){ textInputField.setText(null); @@ -113,6 +111,7 @@ public class UserInputSidePanel implements PamSidePanel{ } + @Override public void keyTyped(KeyEvent e) { } diff --git a/src/alarm/AlarmControl.java b/src/alarm/AlarmControl.java index 83f2dd8c..c7947878 100644 --- a/src/alarm/AlarmControl.java +++ b/src/alarm/AlarmControl.java @@ -1,6 +1,5 @@ package alarm; -import java.awt.Component; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -10,24 +9,24 @@ import java.util.ArrayList; import javax.swing.JMenu; import javax.swing.JMenuItem; -import offlineProcessing.OLProcessDialog; -import offlineProcessing.OfflineTaskGroup; +import PamController.PamControlledUnit; +import PamController.PamControlledUnitSettings; +import PamController.PamController; +import PamController.PamControllerInterface; +import PamController.PamSettingManager; +import PamController.PamSettings; +import PamView.PamSidePanel; //import alarm.actions.ActionSendEmail; import alarm.actions.AlarmAction; import alarm.actions.email.SendEmailAction; import alarm.actions.serial.AlarmSerialAction; import alarm.actions.sound.PlaySound; -import alarm.actions.tast.TastAction; import alarm.actions.udp.AlarmUDPAction; +import offlineProcessing.OLProcessDialog; +import offlineProcessing.OfflineTaskGroup; import userDisplay.UserDisplayComponent; import userDisplay.UserDisplayControl; import userDisplay.UserDisplayProvider; -import PamController.PamControlledUnit; -import PamController.PamControlledUnitSettings; -import PamController.PamController; -import PamController.PamSettingManager; -import PamController.PamSettings; -import PamView.PamSidePanel; public class AlarmControl extends PamControlledUnit implements PamSettings { @@ -131,7 +130,7 @@ public class AlarmControl extends PamControlledUnit implements PamSettings { public void notifyModelChanged(int changeType) { super.notifyModelChanged(changeType); switch (changeType) { - case PamController.INITIALIZATION_COMPLETE: + case PamControllerInterface.INITIALIZATION_COMPLETE: setupAlarm(); break; } @@ -155,7 +154,7 @@ public class AlarmControl extends PamControlledUnit implements PamSettings { boolean[] enabledActions = alarmParameters.getEnabledActions(); int nAct = Math.min(alarmActions.size(), enabledActions.length); for (int i = 0; i < nAct; i++) { - if (enabledActions[i] == false) { + if (!enabledActions[i]) { continue; } alarmActions.get(i).prepareAction(); @@ -167,7 +166,7 @@ public class AlarmControl extends PamControlledUnit implements PamSettings { boolean[] enabledActions = alarmParameters.getEnabledActions(); int nAct = Math.min(alarmActions.size(), enabledActions.length); for (int i = 0; i < nAct; i++) { - if (enabledActions[i] == false) { + if (!enabledActions[i]) { continue; } alarmActions.get(i).actOnAlarm(alarmDataUnit); diff --git a/src/alarm/AlarmDataSource.java b/src/alarm/AlarmDataSource.java index d34a19fe..7bb76179 100644 --- a/src/alarm/AlarmDataSource.java +++ b/src/alarm/AlarmDataSource.java @@ -1,9 +1,5 @@ package alarm; -import java.awt.Window; - -import PamguardMVC.PamDataUnit; - public interface AlarmDataSource { /** diff --git a/src/alarm/AlarmDialog.java b/src/alarm/AlarmDialog.java index c32231d7..8f9a4f9d 100644 --- a/src/alarm/AlarmDialog.java +++ b/src/alarm/AlarmDialog.java @@ -14,18 +14,17 @@ import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; -import javax.swing.JScrollBar; -import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; -import alarm.actions.AlarmAction; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; import PamView.dialog.SourcePanel; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; +import alarm.actions.AlarmAction; public class AlarmDialog extends PamDialog { @@ -73,7 +72,7 @@ public class AlarmDialog extends PamDialog { JPanel southPanel = new JPanel(new GridBagLayout()); southPanel.setBorder(new TitledBorder("Alarm Count")); c = new PamGridBagContraints(); - addComponent(southPanel, new JLabel("Count Type ", JLabel.RIGHT), c); + addComponent(southPanel, new JLabel("Count Type ", SwingConstants.RIGHT), c); c.gridx++; c.gridwidth = 3; addComponent(southPanel, countType = new JComboBox(), c); @@ -84,25 +83,25 @@ public class AlarmDialog extends PamDialog { c.gridwidth = 1; c.gridx = 0; c.gridy++; - addComponent(southPanel, new JLabel("Count Time ", JLabel.RIGHT), c); + addComponent(southPanel, new JLabel("Count Time ", SwingConstants.RIGHT), c); c.gridx++; addComponent(southPanel, alarmTime = new JTextField(5), c); c.gridx++; - addComponent(southPanel, new JLabel(" (s) ", JLabel.RIGHT), c); + addComponent(southPanel, new JLabel(" (s) ", SwingConstants.RIGHT), c); for (int i = 0; i < AlarmParameters.COUNT_LEVELS; i++) { c.gridx = 0; c.gridy++; - addComponent(southPanel, new JLabel(AlarmParameters.levelNames[i] + " Count ", JLabel.RIGHT), c); + addComponent(southPanel, new JLabel(AlarmParameters.levelNames[i] + " Count ", SwingConstants.RIGHT), c); c.gridx++; addComponent(southPanel, alarmCount[i] = new JTextField(5), c); } c.gridy++; c.gridx = 0; - addComponent(southPanel, new JLabel("Minimum gap ", JLabel.RIGHT), c); + addComponent(southPanel, new JLabel("Minimum gap ", SwingConstants.RIGHT), c); c.gridx++; addComponent(southPanel, alarmInterval = new JTextField(5), c); c.gridx++; - addComponent(southPanel, new JLabel(" (s) ", JLabel.RIGHT), c); + addComponent(southPanel, new JLabel(" (s) ", SwingConstants.RIGHT), c); configPanel.add(BorderLayout.SOUTH, southPanel); JPanel actionsPanel = new JPanel(new GridBagLayout()); @@ -137,11 +136,11 @@ public class AlarmDialog extends PamDialog { dataPanel.setBorder(new TitledBorder("Data")); dataPanel.setLayout(new GridBagLayout()); c = new PamGridBagContraints(); - dataPanel.add(new JLabel("Data hold time ", JLabel.RIGHT), c); + dataPanel.add(new JLabel("Data hold time ", SwingConstants.RIGHT), c); c.gridx++; dataPanel.add(holdTime = new JTextField(5), c); c.gridx++; - dataPanel.add(new JLabel(" seconds ", JLabel.LEFT), c); + dataPanel.add(new JLabel(" seconds ", SwingConstants.LEFT), c); actionsOuterPanel.add(dataPanel); holdTime.setToolTipText("Time to hold alarm data in memory before deleting"); @@ -230,7 +229,7 @@ public class AlarmDialog extends PamDialog { private void enableControls() { AlarmCounter ac = findAlarmCounter(); boolean isSingles = countType.getSelectedIndex() == AlarmParameters.COUNT_SINGLES; - if (ac == null || ac.hasOptions() == false) { + if (ac == null || !ac.hasOptions()) { settingsButton.setEnabled(false); } else { diff --git a/src/alarm/AlarmDisplayTable.java b/src/alarm/AlarmDisplayTable.java index dc79fba7..9ba890aa 100644 --- a/src/alarm/AlarmDisplayTable.java +++ b/src/alarm/AlarmDisplayTable.java @@ -6,20 +6,17 @@ import java.awt.Component; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JScrollPane; -import javax.swing.JTable; +import javax.swing.ScrollPaneConstants; import javax.swing.table.AbstractTableModel; -import userDisplay.UserDisplayComponent; -import userDisplay.UserDisplayComponentAdapter; import PamUtils.PamCalendar; import PamView.PamTable; import PamView.tables.SwingTableColumnWidths; -import PamView.tables.TableColumnWidthData; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; -import PamguardMVC.PamObserver; import PamguardMVC.PamObserverAdapter; +import userDisplay.UserDisplayComponentAdapter; public class AlarmDisplayTable extends UserDisplayComponentAdapter { @@ -44,7 +41,7 @@ public class AlarmDisplayTable extends UserDisplayComponentAdapter { JPanel tablePanel = new JPanel(new BorderLayout()); JScrollPane scrollPane = new JScrollPane(alarmTable, - JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); tablePanel.add(BorderLayout.CENTER, scrollPane); alarmPanel.add(BorderLayout.CENTER, tablePanel); diff --git a/src/alarm/AlarmLogging.java b/src/alarm/AlarmLogging.java index fdcd109d..4d7c1e4e 100644 --- a/src/alarm/AlarmLogging.java +++ b/src/alarm/AlarmLogging.java @@ -87,7 +87,7 @@ public class AlarmLogging extends SQLLogging { @Override public synchronized boolean reLogData(PamConnection con, PamDataUnit dataUnit) { AlarmDataUnit adu = (AlarmDataUnit) dataUnit; - if (adu.isActive() == false) { + if (!adu.isActive()) { return logData(con, dataUnit); } else { diff --git a/src/alarm/AlarmOfflineTask.java b/src/alarm/AlarmOfflineTask.java index 47aa8c06..704bdccf 100644 --- a/src/alarm/AlarmOfflineTask.java +++ b/src/alarm/AlarmOfflineTask.java @@ -1,10 +1,8 @@ package alarm; import java.awt.Frame; -import java.awt.Window; import PamguardMVC.PamDataUnit; - import dataMap.OfflineDataMapPoint; import offlineProcessing.OfflineTask; diff --git a/src/alarm/AlarmParameters.java b/src/alarm/AlarmParameters.java index 0694adfc..3e2c52f3 100644 --- a/src/alarm/AlarmParameters.java +++ b/src/alarm/AlarmParameters.java @@ -47,7 +47,7 @@ public class AlarmParameters implements Serializable, Cloneable, ManagedParamete if (np.triggerCounts == null || np.triggerCounts.length != COUNT_LEVELS) { np.triggerCounts = new double[COUNT_LEVELS]; } - if (np.hadHold == false) { + if (!np.hadHold) { np.setHoldSeconds(3600); np.hadHold = true; } diff --git a/src/alarm/AlarmProcess.java b/src/alarm/AlarmProcess.java index a8e3ee36..e9cc0bb6 100644 --- a/src/alarm/AlarmProcess.java +++ b/src/alarm/AlarmProcess.java @@ -2,15 +2,12 @@ package alarm; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.Collections; import java.util.LinkedList; import java.util.List; import java.util.ListIterator; import javax.swing.Timer; -import Acquisition.AcquisitionControl; -import PamController.PamControlledUnit; import PamController.PamController; import PamUtils.PamCalendar; import PamguardMVC.PamDataBlock; @@ -59,7 +56,7 @@ public class AlarmProcess extends PamProcess { // } // // still return true if we're not actually running yet. // if (PamController.getInstance().) - return hasMasterClockData == false; + return !hasMasterClockData; } @Override diff --git a/src/alarm/AlarmSidePanel.java b/src/alarm/AlarmSidePanel.java index 9627b7ad..2735b38f 100644 --- a/src/alarm/AlarmSidePanel.java +++ b/src/alarm/AlarmSidePanel.java @@ -8,8 +8,8 @@ import javax.swing.JProgressBar; import javax.swing.border.TitledBorder; import PamView.PamColors; -import PamView.PamSidePanel; import PamView.PamColors.PamColor; +import PamView.PamSidePanel; import PamView.dialog.PamLabel; import PamView.panel.PamPanel; diff --git a/src/amplifier/AmpControl.java b/src/amplifier/AmpControl.java index d10eb4c8..2f931247 100644 --- a/src/amplifier/AmpControl.java +++ b/src/amplifier/AmpControl.java @@ -29,14 +29,17 @@ public class AmpControl extends PamControlledUnit implements PamSettings { PamSettingManager.getInstance().registerSettings(this); } + @Override public Serializable getSettingsReference() { return ampParameters; } + @Override public long getSettingsVersion() { return AmpParameters.serialVersionUID; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { ampParameters = ((AmpParameters) pamControlledUnitSettings.getSettings()).clone(); return true; @@ -61,6 +64,7 @@ public class AmpControl extends PamControlledUnit implements PamSettings { this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { AmpParameters newParams = AmpDialog.showDialog(parentFrame, ampParameters, ampControl); diff --git a/src/analogarraysensor/AnalogArraySensorDataBlock.java b/src/analogarraysensor/AnalogArraySensorDataBlock.java index 1c581319..9bbcc309 100644 --- a/src/analogarraysensor/AnalogArraySensorDataBlock.java +++ b/src/analogarraysensor/AnalogArraySensorDataBlock.java @@ -2,7 +2,6 @@ package analogarraysensor; import Array.sensors.ArraySensorFieldType; import PamguardMVC.PamDataBlock; -import PamguardMVC.PamProcess; public class AnalogArraySensorDataBlock extends PamDataBlock implements Array.sensors.ArraySensorDataBlock{ diff --git a/src/analogarraysensor/ArraySensorControl.java b/src/analogarraysensor/ArraySensorControl.java index c5707892..fa7b5f78 100644 --- a/src/analogarraysensor/ArraySensorControl.java +++ b/src/analogarraysensor/ArraySensorControl.java @@ -10,7 +10,6 @@ import javax.swing.JMenuItem; import Array.ArrayManager; import Array.PamArray; -import Array.Streamer; import Array.sensors.ArrayDisplayParameters; import Array.sensors.ArrayDisplayParamsProvider; import Array.sensors.swing.ArrayDisplayParamsDialog; @@ -20,7 +19,6 @@ import PamController.PamSettingManager; import PamController.PamSettings; import PamController.StorageOptions; import PamController.StorageParameters.StoreChoice; -import PamView.dialog.warn.WarnOnce; import analogarraysensor.swing.AnalogSensorDialog; import analoginput.AnalogDevicesManager; import analoginput.AnalogSensorUser; diff --git a/src/analogarraysensor/ArraySensorProcess.java b/src/analogarraysensor/ArraySensorProcess.java index df909217..fce78b2e 100644 --- a/src/analogarraysensor/ArraySensorProcess.java +++ b/src/analogarraysensor/ArraySensorProcess.java @@ -5,6 +5,7 @@ import Array.ArrayManager; import Array.PamArray; import Array.Streamer; import PamController.PamController; +import PamController.PamControllerInterface; import PamUtils.PamCalendar; import PamUtils.PamUtils; import PamguardMVC.PamProcess; @@ -144,7 +145,7 @@ public class ArraySensorProcess extends PamProcess { @Override public void notifyModelChanged(int changeType) { super.notifyModelChanged(changeType); - if (changeType == PamController.INITIALIZATION_COMPLETE) { + if (changeType == PamControllerInterface.INITIALIZATION_COMPLETE) { startSystem(); } } diff --git a/src/analoginput/AnalogDevicesManager.java b/src/analoginput/AnalogDevicesManager.java index a7f2d5d2..3f2b04e4 100644 --- a/src/analoginput/AnalogDevicesManager.java +++ b/src/analoginput/AnalogDevicesManager.java @@ -3,9 +3,6 @@ package analoginput; import java.io.Serializable; import java.util.ArrayList; -import javax.swing.JComponent; -import javax.swing.JFrame; - import PamController.PamControlledUnitSettings; import PamController.PamSettingManager; import PamController.PamSettings; @@ -14,7 +11,6 @@ import PamView.dialog.PamDialog; import PamView.dialog.PamDialogPanel; import analoginput.brainboxes.BrainBoxDevices; import analoginput.measurementcomputing.MCCAnalogDevices; -import analoginput.swing.AnalogDiagnosticsDisplay; import analoginput.swing.AnalogDiagnosticsDisplayProvider; import analoginput.swing.AnalogDialogPanel; import userDisplay.UserDisplayControl; diff --git a/src/analoginput/AnalogRangeData.java b/src/analoginput/AnalogRangeData.java index 7a7d7109..e3f327bd 100644 --- a/src/analoginput/AnalogRangeData.java +++ b/src/analoginput/AnalogRangeData.java @@ -10,7 +10,7 @@ public class AnalogRangeData implements Serializable, Cloneable, Comparable { } protected void setNextLogTime(AngleLoggingParameters angleLoggingParameters, long thisTime) { - if (angleLoggingParameters.timedRandom == false) { + if (!angleLoggingParameters.timedRandom) { nextLogTime = thisTime + (long) (1000 * angleLoggingParameters.logInterval); } else { diff --git a/src/angleMeasurement/AngleLoggingDialogPanel.java b/src/angleMeasurement/AngleLoggingDialogPanel.java index 73660d50..318e6a8e 100644 --- a/src/angleMeasurement/AngleLoggingDialogPanel.java +++ b/src/angleMeasurement/AngleLoggingDialogPanel.java @@ -91,8 +91,8 @@ public class AngleLoggingDialogPanel { logHeld.setSelected(this.angleLoggingParameters.logAngles == AngleLoggingParameters.LOG_HELD); logTimed.setSelected(this.angleLoggingParameters.logAngles == AngleLoggingParameters.LOG_TIMED); logTime.setText(String.format("%.1f", this.angleLoggingParameters.logInterval)); - timedEven.setSelected(this.angleLoggingParameters.timedRandom == false); - timedRandom.setSelected(this.angleLoggingParameters.timedRandom == true); + timedEven.setSelected(!this.angleLoggingParameters.timedRandom); + timedRandom.setSelected(this.angleLoggingParameters.timedRandom); enableControls(); } @@ -139,6 +139,7 @@ public class AngleLoggingDialogPanel { private class ButtonListeer implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { enableControls(); } diff --git a/src/angleMeasurement/AngleMeasurement.java b/src/angleMeasurement/AngleMeasurement.java index b61df359..78dc8689 100644 --- a/src/angleMeasurement/AngleMeasurement.java +++ b/src/angleMeasurement/AngleMeasurement.java @@ -55,10 +55,12 @@ public abstract class AngleMeasurement implements PamSettings{ this.name = name; } + @Override public String getUnitName() { return name; } + @Override public String getUnitType() { return "AngleMeasurement"; } @@ -73,12 +75,12 @@ public abstract class AngleMeasurement implements PamSettings{ } public void addMeasurementListener(AngleMeasurementListener angleMeasurementListener) { - if (measurementListeners.contains(angleMeasurementListener) == false) { + if (!measurementListeners.contains(angleMeasurementListener)) { measurementListeners.add(angleMeasurementListener); } } public void removeMeasurementListener(AngleMeasurementListener angleMeasurementListener) { - if (measurementListeners.contains(angleMeasurementListener) == false) { + if (!measurementListeners.contains(angleMeasurementListener)) { measurementListeners.remove(angleMeasurementListener); } } diff --git a/src/angleMeasurement/AngleProcess.java b/src/angleMeasurement/AngleProcess.java index 3bc08017..56fc11d0 100644 --- a/src/angleMeasurement/AngleProcess.java +++ b/src/angleMeasurement/AngleProcess.java @@ -23,6 +23,7 @@ public class AngleProcess extends PamProcess implements AngleMeasurementListener angleControl.angleMeasurement.addMeasurementListener(this); } + @Override public void newAngle(Double rawAngle, Double calibratedAngle, Double correctedAngle) { lastDataUnit = new AngleDataUnit(PamCalendar.getTimeInMillis(), rawAngle, calibratedAngle, correctedAngle); diff --git a/src/angleMeasurement/AngleSidePanel.java b/src/angleMeasurement/AngleSidePanel.java index 558325b6..9d712236 100644 --- a/src/angleMeasurement/AngleSidePanel.java +++ b/src/angleMeasurement/AngleSidePanel.java @@ -63,15 +63,18 @@ public class AngleSidePanel implements PamSidePanel { } } + @Override public JComponent getPanel() { return outerPanel; } + @Override public void rename(String newName) { titledBorder.setTitle(newName); } class HoldButton implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { angleControl.holdButton(); } diff --git a/src/angleMeasurement/FluxgateWorldAngles.java b/src/angleMeasurement/FluxgateWorldAngles.java index 31ced6fb..94466d8b 100644 --- a/src/angleMeasurement/FluxgateWorldAngles.java +++ b/src/angleMeasurement/FluxgateWorldAngles.java @@ -4,11 +4,11 @@ import java.awt.Frame; import java.io.IOException; import java.io.Serializable; +import PamController.PamControlledUnitSettings; +import PamUtils.PamUtils; import serialComms.jserialcomm.PJSerialComm; import serialComms.jserialcomm.PJSerialException; import serialComms.jserialcomm.PJSerialLineListener; -import PamController.PamControlledUnitSettings; -import PamUtils.PamUtils; /** * Read out a Fluxgate World 3030 shaft encoder. @@ -84,14 +84,17 @@ public class FluxgateWorldAngles extends AngleMeasurement { return false; } + @Override public Serializable getSettingsReference() { return fluxgateWorldParameters; } + @Override public long getSettingsVersion() { return FluxgateWorldParameters.serialVersionUID; } + @Override public boolean restoreSettings( PamControlledUnitSettings pamControlledUnitSettings) { fluxgateWorldParameters = ((FluxgateWorldParameters) pamControlledUnitSettings.getSettings()).clone(); diff --git a/src/angleMeasurement/FluxgateWorldDialog.java b/src/angleMeasurement/FluxgateWorldDialog.java index 6c19e26b..3b40f791 100644 --- a/src/angleMeasurement/FluxgateWorldDialog.java +++ b/src/angleMeasurement/FluxgateWorldDialog.java @@ -18,9 +18,9 @@ import javax.swing.JTextField; import javax.swing.Timer; import javax.swing.border.TitledBorder; -import serialComms.SerialPortPanel; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; +import serialComms.SerialPortPanel; public class FluxgateWorldDialog extends PamDialog implements AngleMeasurementListener { @@ -202,9 +202,10 @@ public class FluxgateWorldDialog extends PamDialog implements AngleMeasurementLi class PortAction implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { - if (getParams() == false) { + if (!getParams()) { return; } @@ -217,6 +218,7 @@ public class FluxgateWorldDialog extends PamDialog implements AngleMeasurementLi class ClearOffset implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { fluxgateWorldParameters.angleOffset = 0; fluxgateWorldAngles.setFluxgateWorldParameters(fluxgateWorldParameters.clone()); @@ -225,6 +227,7 @@ public class FluxgateWorldDialog extends PamDialog implements AngleMeasurementLi class SetOffset implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { Double angle = fluxgateWorldAngles.getCalibratedAngle(); Double geoReference = getGeoReferenceAngle(); @@ -237,6 +240,7 @@ public class FluxgateWorldDialog extends PamDialog implements AngleMeasurementLi class InvertAngles implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { if (getParams()) { fluxgateWorldAngles.setFluxgateWorldParameters(fluxgateWorldParameters.clone()); @@ -246,6 +250,7 @@ public class FluxgateWorldDialog extends PamDialog implements AngleMeasurementLi } Double latestRawAngle; + @Override public void newAngle(Double rawAngle, Double calibratedAngle, Double correctedAngle) { latestRawAngle = rawAngle; diff --git a/src/angleVetoes/AngleVetoDialog.java b/src/angleVetoes/AngleVetoDialog.java index 61a2dae1..6d96d6af 100644 --- a/src/angleVetoes/AngleVetoDialog.java +++ b/src/angleVetoes/AngleVetoDialog.java @@ -3,6 +3,7 @@ package angleVetoes; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; + import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; diff --git a/src/angleVetoes/AngleVetoDisplay.java b/src/angleVetoes/AngleVetoDisplay.java index f1d7f137..e0002295 100644 --- a/src/angleVetoes/AngleVetoDisplay.java +++ b/src/angleVetoes/AngleVetoDisplay.java @@ -15,13 +15,13 @@ import javax.swing.JProgressBar; import javax.swing.SwingConstants; import javax.swing.Timer; -import pamMaths.HistogramDisplay; -import pamMaths.HistogramGraphicsLayer; -import pamMaths.PamHistogram; import Layout.PamAxis; import PamUtils.PamCalendar; import PamView.dialog.PamLabel; import PamView.panel.PamBorderPanel; +import pamMaths.HistogramDisplay; +import pamMaths.HistogramGraphicsLayer; +import pamMaths.PamHistogram; /** * Dispaly for angle veto. Shows a histogram of angles @@ -117,6 +117,7 @@ public class AngleVetoDisplay { class GraphicsUnderlayer implements HistogramGraphicsLayer { Color vetoColor = new Color(255, 215, 215); + @Override public void paintLayer(Graphics g) { Rectangle r = g.getClipBounds(); PamAxis southAxis = histogramDisplay.getSouthAxis(); @@ -146,6 +147,7 @@ public class AngleVetoDisplay { class HalfLifeTimer implements ActionListener { private boolean first = true; private long lastTime = 0; + @Override public void actionPerformed(ActionEvent e) { long now = PamCalendar.getTimeInMillis(); long delay = now - lastTime; diff --git a/src/angleVetoes/AngleVetoes.java b/src/angleVetoes/AngleVetoes.java index b0126f67..928d5731 100644 --- a/src/angleVetoes/AngleVetoes.java +++ b/src/angleVetoes/AngleVetoes.java @@ -44,22 +44,27 @@ public class AngleVetoes extends Object implements PamSettings { PamSettingManager.getInstance().registerSettings(this); } + @Override public Serializable getSettingsReference() { return angleVetoParameters; } + @Override public long getSettingsVersion() { return AngleVetoParameters.serialVersionUID; } + @Override public String getUnitName() { return pamControlledUnit.getUnitName(); } + @Override public String getUnitType() { return "Detector Vetoes"; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { angleVetoParameters = ((AngleVetoParameters) pamControlledUnitSettings.getSettings()).clone(); return (angleVetoParameters != null); @@ -91,6 +96,7 @@ public class AngleVetoes extends Object implements PamSettings { this.frame = frame; } + @Override public void actionPerformed(ActionEvent e) { getNewSettings(frame); } @@ -132,6 +138,7 @@ public class AngleVetoes extends Object implements PamSettings { this.frame = frame; } + @Override public void actionPerformed(ActionEvent e) { displayAction(frame); } @@ -195,7 +202,7 @@ public class AngleVetoes extends Object implements PamSettings { int count = angleVetoParameters.getVetoCount(); boolean pass = true; for (int i = 0; i < count; i++) { - if (passVeto(i, angle) == false) { + if (!passVeto(i, angle)) { pass = false; break; } diff --git a/src/angleVetoes/AngleVetoesDialog.java b/src/angleVetoes/AngleVetoesDialog.java index 429cb5d6..d1e8fcdf 100644 --- a/src/angleVetoes/AngleVetoesDialog.java +++ b/src/angleVetoes/AngleVetoesDialog.java @@ -107,6 +107,7 @@ public class AngleVetoesDialog extends PamDialog { } class AddButton implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { AngleVeto newVeto = AngleVetoDialog.showDialog((Frame)getOwner(), null); if (newVeto != null) { @@ -116,6 +117,7 @@ public class AngleVetoesDialog extends PamDialog { } } class EditButton implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { int row = list.getSelectedRow(); if (row >= 0 && row < angleVetoParameters.getVetoCount()) { @@ -129,6 +131,7 @@ public class AngleVetoesDialog extends PamDialog { } } class DeleteButton implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { int row = list.getSelectedRow(); if (row >= 0 && row < angleVetoParameters.getVetoCount()) { @@ -147,10 +150,12 @@ public class AngleVetoesDialog extends PamDialog { return columnNames[column]; } + @Override public int getColumnCount() { return columnNames.length; } + @Override public int getRowCount() { if (angleVetoParameters == null) { return 0; @@ -158,6 +163,7 @@ public class AngleVetoesDialog extends PamDialog { return angleVetoParameters.getVetoCount(); } + @Override public Object getValueAt(int rowIndex, int columnIndex) { AngleVeto angleVeto = angleVetoParameters.getVeto(rowIndex); if (angleVeto == null) { diff --git a/src/annotation/AnnotationList.java b/src/annotation/AnnotationList.java index b8b03dd0..e58ab952 100644 --- a/src/annotation/AnnotationList.java +++ b/src/annotation/AnnotationList.java @@ -3,7 +3,6 @@ package annotation; import java.util.ArrayList; import java.util.Enumeration; import java.util.Hashtable; -import java.util.List; import PamView.dialog.warn.WarnOnce; import PamguardMVC.PamDataBlock; diff --git a/src/annotation/DataAnnotationType.java b/src/annotation/DataAnnotationType.java index 64affe7c..e212e73b 100644 --- a/src/annotation/DataAnnotationType.java +++ b/src/annotation/DataAnnotationType.java @@ -1,8 +1,5 @@ package annotation; -import generalDatabase.SQLLoggingAddon; - -import PamView.symbol.AnnotationSymbolChooser; import PamView.symbol.PamSymbolChooser; import PamView.symbol.modifier.SymbolModifier; import PamguardMVC.PamDataBlock; @@ -10,8 +7,8 @@ import PamguardMVC.PamDataUnit; import PamguardMVC.dataSelector.DataSelector; import annotation.binary.AnnotationBinaryHandler; import annotation.dataselect.AnnotationDataSelCreator; -import annotation.dataselect.AnnotationDataSelector; import annotation.handler.AnnotationOptions; +import generalDatabase.SQLLoggingAddon; /** * Something that can tell us a little more about diff --git a/src/annotationMark/MarkAnnotationDialog.java b/src/annotationMark/MarkAnnotationDialog.java index cd701a3a..1bf59941 100644 --- a/src/annotationMark/MarkAnnotationDialog.java +++ b/src/annotationMark/MarkAnnotationDialog.java @@ -11,17 +11,18 @@ import java.util.List; import javax.swing.BoxLayout; import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; -import annotation.AnnotationDialogPanel; -import annotation.DataAnnotationType; -import annotation.handler.AnnotationHandler; import PamUtils.FrequencyFormat; import PamUtils.PamCalendar; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; import PamView.dialog.PamTextDisplay; import PamguardMVC.PamDataBlock; +import annotation.AnnotationDialogPanel; +import annotation.DataAnnotationType; +import annotation.handler.AnnotationHandler; public class MarkAnnotationDialog extends PamDialog { @@ -44,22 +45,22 @@ public class MarkAnnotationDialog extends PamDialog { acousticPanel.setBorder(new TitledBorder("Info")); GridBagConstraints c = new PamGridBagContraints(); - acousticPanel.add(new JLabel("Start ", JLabel.RIGHT), c); + acousticPanel.add(new JLabel("Start ", SwingConstants.RIGHT), c); c.gridx++; c.gridwidth = 2; acousticPanel.add(startTime = new PamTextDisplay(20), c); c.gridx = 0; c.gridy++; c.gridwidth = 1; - acousticPanel.add(new JLabel("Duration ", JLabel.RIGHT), c); + acousticPanel.add(new JLabel("Duration ", SwingConstants.RIGHT), c); c.gridx++; acousticPanel.add(duration = new PamTextDisplay(6), c); c.gridx++; - acousticPanel.add(new JLabel(" s", JLabel.LEFT), c); + acousticPanel.add(new JLabel(" s", SwingConstants.LEFT), c); c.gridx = 0; c.gridy++; c.gridwidth = 1; - acousticPanel.add(new JLabel("Frequency ", JLabel.RIGHT), c); + acousticPanel.add(new JLabel("Frequency ", SwingConstants.RIGHT), c); c.gridx++; c.gridwidth = 2; acousticPanel.add(fRange = new PamTextDisplay(20), c); diff --git a/src/annotationMark/MarkDataBlock.java b/src/annotationMark/MarkDataBlock.java index 996b6d63..15c22288 100644 --- a/src/annotationMark/MarkDataBlock.java +++ b/src/annotationMark/MarkDataBlock.java @@ -1,8 +1,5 @@ package annotationMark; -import pamScrollSystem.ViewLoadObserver; -import annotation.DataAnnotationType; -import annotation.calcs.snr.SNRAnnotationType; import PamguardMVC.PamDataBlock; import PamguardMVC.PamProcess; diff --git a/src/annotationMark/MarkModule.java b/src/annotationMark/MarkModule.java index 44bfb696..e050e2c4 100644 --- a/src/annotationMark/MarkModule.java +++ b/src/annotationMark/MarkModule.java @@ -1,8 +1,8 @@ package annotationMark; -import generalDatabase.SQLLoggingAddon; import annotation.DataAnnotationType; import annotation.handler.AnnotationHandler; +import generalDatabase.SQLLoggingAddon; public abstract class MarkModule extends PamController.PamControlledUnit { diff --git a/src/annotationMark/MarkOverlayDraw.java b/src/annotationMark/MarkOverlayDraw.java index d0ad8ece..344e948c 100644 --- a/src/annotationMark/MarkOverlayDraw.java +++ b/src/annotationMark/MarkOverlayDraw.java @@ -9,16 +9,12 @@ import java.awt.Window; import PamUtils.Coordinate3d; import PamView.GeneralProjector; -import PamView.ManagedSymbol; -import PamView.ManagedSymbolInfo; +import PamView.GeneralProjector.ParameterType; +import PamView.GeneralProjector.ParameterUnits; import PamView.PamDetectionOverlayGraphics; import PamView.PamKeyItem; import PamView.PamSymbol; -import PamView.PamOldSymbolManager; import PamView.PamSymbolType; -import PamView.PanelOverlayDraw; -import PamView.GeneralProjector.ParameterType; -import PamView.GeneralProjector.ParameterUnits; import PamView.symbol.SymbolData; import PamguardMVC.PamDataUnit; @@ -108,6 +104,7 @@ public class MarkOverlayDraw extends PamDetectionOverlayGraphics { return super.showOptions(parentWindow, generalProjector); } + @Override public PamSymbol getDefaultSymbol() { return new PamSymbol(defaultSymbolData); } diff --git a/src/annotationMark/MarkProcess.java b/src/annotationMark/MarkProcess.java index 82947140..043d082e 100644 --- a/src/annotationMark/MarkProcess.java +++ b/src/annotationMark/MarkProcess.java @@ -1,10 +1,7 @@ package annotationMark; -import PamController.PamControlledUnit; import PamView.symbol.StandardSymbolManager; -import PamguardMVC.PamDataBlock; import PamguardMVC.PamProcess; -import annotationMark.fx.MarkDataPlotInfo; import annotationMark.fx.MarkPlotProviderFX; import dataPlotsFX.data.TDDataProviderRegisterFX; import dataPlotsFX.data.generic.GenericDataPlotProvider; diff --git a/src/asiojni/ASIOFilePlaybackSystem.java b/src/asiojni/ASIOFilePlaybackSystem.java index f0c270d7..17b12045 100644 --- a/src/asiojni/ASIOFilePlaybackSystem.java +++ b/src/asiojni/ASIOFilePlaybackSystem.java @@ -1,7 +1,5 @@ package asiojni; -import java.nio.ByteBuffer; -import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; @@ -9,7 +7,6 @@ import java.util.Set; import com.synthbot.jasiohost.AsioChannel; import com.synthbot.jasiohost.AsioDriver; import com.synthbot.jasiohost.AsioDriverListener; -import com.synthbot.jasiohost.AsioDriverState; import com.synthbot.jasiohost.AsioException; import com.synthbot.jasiohost.AsioSampleType; diff --git a/src/asiojni/ASIOPlaybackSystem.java b/src/asiojni/ASIOPlaybackSystem.java index d086d5e5..73b8f607 100644 --- a/src/asiojni/ASIOPlaybackSystem.java +++ b/src/asiojni/ASIOPlaybackSystem.java @@ -1,12 +1,12 @@ package asiojni; +import PamDetection.RawDataUnit; +import PamUtils.PamUtils; +import PamguardMVC.PamConstants; import soundPlayback.PlaybackControl; import soundPlayback.PlaybackParameters; import soundPlayback.PlaybackSystem; import soundPlayback.fx.PlaybackSettingsPane; -import PamDetection.RawDataUnit; -import PamUtils.PamUtils; -import PamguardMVC.PamConstants; public class ASIOPlaybackSystem extends PlaybackSystem { diff --git a/src/asiojni/ASIOSoundSystem.java b/src/asiojni/ASIOSoundSystem.java index 8f37c38b..f05a91f3 100644 --- a/src/asiojni/ASIOSoundSystem.java +++ b/src/asiojni/ASIOSoundSystem.java @@ -5,7 +5,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.Serializable; import java.util.ArrayList; -import java.util.List; import java.util.Vector; import javax.sound.sampled.AudioFormat; @@ -15,12 +14,10 @@ import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.border.TitledBorder; -import soundPlayback.PlaybackControl; -import soundPlayback.PlaybackSystem; import Acquisition.AcquisitionControl; import Acquisition.AcquisitionDialog; -import Acquisition.DaqSystem; import Acquisition.AudioDataQueue; +import Acquisition.DaqSystem; import Acquisition.SoundCardParameters; import PamController.PamControlledUnitSettings; import PamController.PamSettingManager; @@ -28,6 +25,8 @@ import PamController.PamSettings; import PamDetection.RawDataUnit; import PamUtils.PamCalendar; import PamguardMVC.PamConstants; +import soundPlayback.PlaybackControl; +import soundPlayback.PlaybackSystem; /** * Everything and everything to do with controlling and reading ASIO @@ -298,6 +297,7 @@ public class ASIOSoundSystem extends DaqSystem implements PamSettings { JButton asioControl = new JButton("Control"); asioControl.addActionListener(new ActionListener() { int trials = 0; + @Override public void actionPerformed(ActionEvent evt) { asioJniInterface.asioDriverSettings.displayAsioDriverSettings(); @@ -414,22 +414,27 @@ public class ASIOSoundSystem extends DaqSystem implements PamSettings { // return PARAMETER_UNKNOWN; // } + @Override public Serializable getSettingsReference() { return soundCardParameters; } + @Override public long getSettingsVersion() { return SoundCardParameters.serialVersionUID; } + @Override public String getUnitName() { return acquisitionControl.getUnitName(); } + @Override public String getUnitType() { return "ASIO Sound System"; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { // if (PamSettingManager.getInstance().isSettingsUnit(this, pamControlledUnitSettings)) { try { @@ -478,6 +483,7 @@ public class ASIOSoundSystem extends DaqSystem implements PamSettings { } class CaptureThreadAsio implements Runnable { + @Override public void run() { asioJniInterface.createChannelBuffers(); diff --git a/src/asiojni/AsioDriverInfos.java b/src/asiojni/AsioDriverInfos.java index 91603dae..677bac3c 100644 --- a/src/asiojni/AsioDriverInfos.java +++ b/src/asiojni/AsioDriverInfos.java @@ -60,7 +60,7 @@ public class AsioDriverInfos { long tic = System.currentTimeMillis(); boolean firstHz = true; for(int j = 0;j binaryStore.binaryStoreSettings.getMaxSizeMegas()) { reOpen(PamCalendar.getTimeInMillis(), System.currentTimeMillis(), BinaryFooter.END_FILETOOBIG); } @@ -561,7 +558,7 @@ public class BinaryOutputStream { // dataOutputStream.writeInt(baseData.getChannelBitmap()); // } // else { - baseData.writeBaseData(outputStream, binaryStore.getCurrentFileFormat()); + baseData.writeBaseData(outputStream, BinaryStore.getCurrentFileFormat()); // } outputStream.writeInt(dataLength); outputStream.write(data, 0, objectLength); @@ -619,7 +616,7 @@ public class BinaryOutputStream { } writeModuleFooter(opStream, moduleFooterData); - footer.writeFooter(opStream, binaryStore.getCurrentFileFormat()); + footer.writeFooter(opStream, BinaryStore.getCurrentFileFormat()); try { opStream.close(); @@ -652,7 +649,7 @@ public class BinaryOutputStream { if (dataOutputStream == null || footer == null) { return false; } - return footer.writeFooter(dataOutputStream, binaryStore.getCurrentFileFormat()); + return footer.writeFooter(dataOutputStream, BinaryStore.getCurrentFileFormat()); } /** diff --git a/src/binaryFileStorage/BinaryStorageDialogPanel.java b/src/binaryFileStorage/BinaryStorageDialogPanel.java index 7c053fa1..104d90b8 100644 --- a/src/binaryFileStorage/BinaryStorageDialogPanel.java +++ b/src/binaryFileStorage/BinaryStorageDialogPanel.java @@ -12,6 +12,7 @@ import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; import PamController.PamController; @@ -56,7 +57,7 @@ public class BinaryStorageDialogPanel { PamDialog.addComponent(q, dateSubFolders = new JCheckBox("Store data in sub folders by date"), c); c.gridy++; c.gridx = 0; - q.add(new JLabel("Noise background storage location", JLabel.RIGHT), c); + q.add(new JLabel("Noise background storage location", SwingConstants.RIGHT), c); c.gridx++; c.gridwidth = 3; q.add(noiseStoreType = new NoiseComboBox(), c); @@ -78,11 +79,11 @@ public class BinaryStorageDialogPanel { if (allowChannelOffsets) { c.gridx = 0; c.gridy++; - q.add(new JLabel("Offset channel bitmaps by ", JLabel.RIGHT), c); + q.add(new JLabel("Offset channel bitmaps by ", SwingConstants.RIGHT), c); c.gridx++; q.add(channelOffset = new JTextField(6), c); c.gridx++; - q.add(new JLabel(" channels", JLabel.LEFT), c); + q.add(new JLabel(" channels", SwingConstants.LEFT), c); channelOffset.setToolTipText("Used when combinging data from multiple recorders in viewer mode"); } noiseStoreType.addItem(NoiseStoreType.PGDF); diff --git a/src/binaryFileStorage/BinaryStore.java b/src/binaryFileStorage/BinaryStore.java index 67151c22..5bf157a5 100644 --- a/src/binaryFileStorage/BinaryStore.java +++ b/src/binaryFileStorage/BinaryStore.java @@ -16,30 +16,16 @@ import java.util.List; import java.util.ListIterator; import java.util.TimerTask; import java.util.Vector; + import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.SwingWorker; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import pamScrollSystem.ViewLoadObserver; -import pamViewFX.pamTask.PamTaskUpdate; -import pamguard.GlobalArguments; - -//import com.mysql.jdbc.NdbLoadBalanceExceptionChecker; - -import dataGram.Datagram; -import dataGram.DatagramManager; -import dataMap.OfflineDataMap; -import dataMap.OfflineDataMapPoint; import PamController.AWTScheduler; -import PamController.DataInputStore; import PamController.DataIntegrityChecker; import PamController.DataOutputStore; -import PamController.OfflineDataStore; import PamController.PamControlledUnit; import PamController.PamControlledUnitGUI; import PamController.PamControlledUnitSettings; @@ -78,6 +64,16 @@ import binaryFileStorage.backup.BinaryBackupStream; import binaryFileStorage.checker.BinaryIntegrityChecker; import binaryFileStorage.layoutFX.BinaryStoreGUIFX; +//import com.mysql.jdbc.NdbLoadBalanceExceptionChecker; + +import dataGram.Datagram; +import dataGram.DatagramManager; +import dataMap.OfflineDataMap; +import dataMap.OfflineDataMapPoint; +import pamScrollSystem.ViewLoadObserver; +import pamViewFX.pamTask.PamTaskUpdate; +import pamguard.GlobalArguments; + /** * The binary store will work very much like the database in that it * monitors the output of data streams and when data is added to them @@ -353,7 +349,7 @@ PamSettingsSource, DataOutputStore { for (int d = 0; d < nDataBlocks; d++) { pamDataBlock = pp.getOutputDataBlock(d); if (pamDataBlock.getBinaryDataSource() != null ) { - if (binaryStore == false || + if (!binaryStore || (pamDataBlock.getBinaryDataSource().isDoBinaryStore() && pamDataBlock.getShouldBinary(null))) { streamingDataBlocks.add(pamDataBlock); } @@ -400,7 +396,7 @@ PamSettingsSource, DataOutputStore { // now check that that folder exists. File folder = FileFunctions.createNonIndexedFolder(folderName); - if (folder == null || folder.exists() == false) { + if (folder == null || !folder.exists()) { return null; } } @@ -1189,7 +1185,7 @@ PamSettingsSource, DataOutputStore { } PamDataBlock parentStream = findDataStream(bhf.binaryHeader, streams); if (parentStream == null) { - if (lastFailedStream == null || lastFailedStream.equals(bhf.binaryHeader.getModuleName()) == false) { + if (lastFailedStream == null || !lastFailedStream.equals(bhf.binaryHeader.getModuleName())) { System.out.println(String.format("No internal data stream for %s %s %s", bhf.binaryHeader.getModuleType(), bhf.binaryHeader.getModuleName(), bhf.binaryHeader.getStreamName())); @@ -1387,7 +1383,7 @@ PamSettingsSource, DataOutputStore { // String newPath = filePath.substring(0, pathLen-4) + indexFileType; File newFile = makeIndexFile(dataFile); if (checkExists) { - if (newFile.exists() == false) { + if (!newFile.exists()) { return null; } } @@ -1407,7 +1403,7 @@ PamSettingsSource, DataOutputStore { // String newPath = filePath.substring(0, pathLen-4) + indexFileType; File newFile = swapFileType(dataFile, noiseFileType); if (checkExists) { - if (newFile.exists() == false) { + if (!newFile.exists()) { return null; } } @@ -1470,6 +1466,7 @@ PamSettingsSource, DataOutputStore { * @param dmp * @param dataBlock */ + @Override public boolean rewriteIndexFile(PamDataBlock dataBlock, OfflineDataMapPoint offlineDataMapPoint) { BinaryOfflineDataMapPoint dmp = (BinaryOfflineDataMapPoint) offlineDataMapPoint; String fileName = dmp.getBinaryFile(this).getAbsolutePath(); @@ -1592,7 +1589,7 @@ PamSettingsSource, DataOutputStore { BinaryDataSink dataSink = new DataLoadSink(); for (int i = 0; i < mapPoints.size(); i++) { // System.out.println(mapPoints.get(i).getBinaryFile().getPath()); - if (loadData(dataBlock, mapPoints.get(i), offlineDataLoadInfo.getStartMillis(), offlineDataLoadInfo.getEndMillis(), dataSink) == false) { + if (!loadData(dataBlock, mapPoints.get(i), offlineDataLoadInfo.getStartMillis(), offlineDataLoadInfo.getEndMillis(), dataSink)) { break; } } @@ -1624,7 +1621,7 @@ PamSettingsSource, DataOutputStore { if (mapPoint.getBinaryFile(this).getAbsolutePath().contains("Click_Detector_Click_Detector_Clicks_20180823_100006.pgdf")) { System.out.println("Load file"); } - if (inputStream.openFile(mapPoint.getBinaryFile(this)) == false) { + if (!inputStream.openFile(mapPoint.getBinaryFile(this))) { return false; } BinaryDataSource binarySource = dataBlock.getBinaryDataSource(); @@ -1724,9 +1721,9 @@ PamSettingsSource, DataOutputStore { unpackAnnotationData(bh.getHeaderFormat(), createdUnit, binaryObjectData, dataSink); - if (dataSink.newDataUnit(binaryObjectData, dataBlock, createdUnit) == false) { + if (!dataSink.newDataUnit(binaryObjectData, dataBlock, createdUnit)) { return false; - }; + } } } } @@ -1855,7 +1852,7 @@ PamSettingsSource, DataOutputStore { public boolean saveData(PamDataBlock pamDataBlock) { ArrayList changedFileList = createChangedFileList(pamDataBlock); for (int i = 0; i < changedFileList.size(); i++) { - if (saveData(changedFileList.get(i), pamDataBlock) == false) { + if (!saveData(changedFileList.get(i), pamDataBlock)) { return false; } } @@ -1889,12 +1886,12 @@ PamSettingsSource, DataOutputStore { int inputFormat = CURRENT_FORMAT; int outputFormat = CURRENT_FORMAT; - if (outputStream.openPGDFFile(tempFile) == false) { + if (!outputStream.openPGDFFile(tempFile)) { return reportError("Unable to open temp output file for rewriting " + tempFile.getAbsolutePath()); } - if (inputStream.openFile(file) == false) { + if (!inputStream.openFile(file)) { return reportError("Unable to open data file for rewriting " + file.getAbsolutePath()); } @@ -1970,7 +1967,7 @@ PamSettingsSource, DataOutputStore { time+=t2-t1; if (aDataUnit != null) { //System.out.println("BinaryStore: aDataUnit: Datablock: "+PamUtils.getSingleChannel(((ClickDetection) aDataUnit).getChannelBitmap())); - long t11=System.currentTimeMillis();; + long t11=System.currentTimeMillis(); binarySource.saveData(aDataUnit); aDataUnit.getDataUnitFileInformation().setNeedsUpdate(false); long t12=System.currentTimeMillis(); @@ -2042,8 +2039,8 @@ PamSettingsSource, DataOutputStore { " to " + file.getAbsolutePath()); e.printStackTrace(); } - if (renamedNew == false) { - if (deletedOld == false) { + if (!renamedNew) { + if (!deletedOld) { reportError("Unable to delete " + file.getAbsolutePath()); } return reportError(String.format("Unable to rename %s to %s", @@ -2309,7 +2306,7 @@ PamSettingsSource, DataOutputStore { * to be restored in the binary file. Need to more explicityly set the fileInfo needs * update flag when a data unit has changes to the extent that it needs a re-save. */ - if (fileInfo.isNeedsUpdate() == false/* && aDataUnit.getUpdateCount() == 0*/) { + if (!fileInfo.isNeedsUpdate()) { continue; } aFile = fileInfo.getFile(); @@ -2411,6 +2408,7 @@ PamSettingsSource, DataOutputStore { /** * @return the datagramManager */ + @Override public DatagramManager getDatagramManager() { return datagramManager; } @@ -2427,7 +2425,7 @@ PamSettingsSource, DataOutputStore { public BinaryFooter rebuildFileFooter(File file) { BinaryInputStream inputStream = new BinaryInputStream(this, null); - if (inputStream.openFile(file) == false) { + if (!inputStream.openFile(file)) { return null; } @@ -2502,6 +2500,7 @@ PamSettingsSource, DataOutputStore { * @param flag. The GUI type flag defined in PAMGuiManager. * @return the GUI for the PamControlledUnit unit. */ + @Override public PamControlledUnitGUI getGUI(int flag) { if (flag==PamGUIManager.FX) { if (binaryStoreGUIFX ==null) { @@ -2524,7 +2523,7 @@ PamSettingsSource, DataOutputStore { if (PamController.getInstance().getPamStatus() == PamController.PAM_IDLE) { storeState = true; } - if (storeState == false || binaryStoreSettings.getStoreLocation() == null) { + if (!storeState || binaryStoreSettings.getStoreLocation() == null) { ModuleStatus moduleStatus = new ModuleStatus(ModuleStatus.STATUS_ERROR, "No binary storage folder"); moduleStatus.setRemedialAction(new QuickRemedialAction(this, "Select binary storage folder", new BinaryStorageOptions((JFrame) getGuiFrame()))); @@ -2595,6 +2594,7 @@ PamSettingsSource, DataOutputStore { return state; } + @Override public String getDataLocation() { return binaryStoreSettings.getStoreLocation(); } diff --git a/src/binaryFileStorage/BinaryStoreDeleter.java b/src/binaryFileStorage/BinaryStoreDeleter.java index 13401e04..973aec00 100644 --- a/src/binaryFileStorage/BinaryStoreDeleter.java +++ b/src/binaryFileStorage/BinaryStoreDeleter.java @@ -150,7 +150,7 @@ public class BinaryStoreDeleter { catch (IOException e) { headOk = false; } - if (headOk == false || binaryHead.getDataDate() >= timeMillis) { + if (!headOk || binaryHead.getDataDate() >= timeMillis) { boolean deleteOk = deleteFileSet(dataFile); return deleteOk ? FILE_DELETED : FILE_DELETE_ERROR; } @@ -192,7 +192,7 @@ public class BinaryStoreDeleter { System.out.printf("Partial delete of file %s from %s\n", dataFile.getAbsoluteFile(), PamCalendar.formatDBDateTime(timeMillis)); try { BinaryInputStream inputStream = new BinaryInputStream(binaryStore, aBlock); - if (inputStream.openFile(dataFile) == false) { + if (!inputStream.openFile(dataFile)) { return false; } @@ -282,8 +282,8 @@ public class BinaryStoreDeleter { " to " + dataFile.getAbsolutePath()); e.printStackTrace(); } - if (renamedNew == false) { - if (deletedOld == false) { + if (!renamedNew) { + if (!deletedOld) { binaryStore.reportError("Unable to delete " + dataFile.getAbsolutePath()); } return binaryStore.reportError(String.format("Unable to rename %s to %s", diff --git a/src/binaryFileStorage/BinaryStoreProcess.java b/src/binaryFileStorage/BinaryStoreProcess.java index d95be814..d83e3dd3 100644 --- a/src/binaryFileStorage/BinaryStoreProcess.java +++ b/src/binaryFileStorage/BinaryStoreProcess.java @@ -56,7 +56,7 @@ public class BinaryStoreProcess extends PamProcess { } public void checkFileTimer() { - boolean needTimer = PamCalendar.isSoundFile() == false; + boolean needTimer = !PamCalendar.isSoundFile(); if (needTimer) { startTimer(); } diff --git a/src/binaryFileStorage/BinaryStoreSettings.java b/src/binaryFileStorage/BinaryStoreSettings.java index 78c42e99..8bc2d15d 100644 --- a/src/binaryFileStorage/BinaryStoreSettings.java +++ b/src/binaryFileStorage/BinaryStoreSettings.java @@ -52,7 +52,7 @@ public class BinaryStoreSettings implements Serializable, Cloneable, ManagedPara if (storeLocation == null || other.storeLocation == null) { return true; } - if (storeLocation.equals(other.storeLocation) == false) { + if (!storeLocation.equals(other.storeLocation)) { return true; } if (datedSubFolders != other.datedSubFolders) { diff --git a/src/binaryFileStorage/BinaryStoreStatusFuncs.java b/src/binaryFileStorage/BinaryStoreStatusFuncs.java index c19447b2..465bb740 100644 --- a/src/binaryFileStorage/BinaryStoreStatusFuncs.java +++ b/src/binaryFileStorage/BinaryStoreStatusFuncs.java @@ -142,9 +142,9 @@ public class BinaryStoreStatusFuncs { BinaryInputStream inputStream = new BinaryInputStream(binaryStore, null); try { // need to work through the file now. - if (inputStream.openFile(aFile) == false) { + if (!inputStream.openFile(aFile)) { return null; - }; + } BinaryObjectData binaryObjectData; BinaryHeader bh = inputStream.readHeader(); if (bh==null) { @@ -251,7 +251,7 @@ public class BinaryStoreStatusFuncs { return StoreStatus.STATUS_MISSING; } File currfolder = new File(currDir); - if (currfolder.exists() == false) { + if (!currfolder.exists()) { return StoreStatus.STATUS_MISSING; } // look for files in the folder. diff --git a/src/binaryFileStorage/DataMapSerialiser.java b/src/binaryFileStorage/DataMapSerialiser.java index f6822c5c..915a080a 100644 --- a/src/binaryFileStorage/DataMapSerialiser.java +++ b/src/binaryFileStorage/DataMapSerialiser.java @@ -7,7 +7,6 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; -import java.io.InvalidClassException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.OutputStream; @@ -16,9 +15,8 @@ import java.util.Collections; import java.util.List; import java.util.ListIterator; -import dataMap.OfflineDataMap; -import PamController.OfflineDataStore; import PamguardMVC.PamDataBlock; +import dataMap.OfflineDataMap; public class DataMapSerialiser { @@ -153,7 +151,7 @@ public class DataMapSerialiser { while (it.hasPrevious()) { aPoint = it.previous(); file = aPoint.getBinaryFile(binaryStore); - if (file == null || file.exists() == false) { + if (file == null || !file.exists()) { it.remove(); nRemovals ++; } diff --git a/src/binaryFileStorage/ModuleFooter.java b/src/binaryFileStorage/ModuleFooter.java index 38bd1807..adcb582a 100644 --- a/src/binaryFileStorage/ModuleFooter.java +++ b/src/binaryFileStorage/ModuleFooter.java @@ -1,7 +1,5 @@ package binaryFileStorage; -import java.io.DataOutputStream; -import java.io.IOException; import java.io.Serializable; /** diff --git a/src/cepstrum/CepstrumControl.java b/src/cepstrum/CepstrumControl.java index e7a2d322..b315187e 100644 --- a/src/cepstrum/CepstrumControl.java +++ b/src/cepstrum/CepstrumControl.java @@ -9,7 +9,7 @@ import javax.swing.JMenuItem; import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; -import PamController.PamController; +import PamController.PamControllerInterface; import PamController.PamSettingManager; import PamController.PamSettings; @@ -82,7 +82,7 @@ public class CepstrumControl extends PamControlledUnit implements PamSettings { @Override public void notifyModelChanged(int changeType) { super.notifyModelChanged(changeType); - if (changeType == PamController.INITIALIZATION_COMPLETE) { + if (changeType == PamControllerInterface.INITIALIZATION_COMPLETE) { cepstrumProcess.prepareProcess(); } } diff --git a/src/classifier/AbstractWekaClassifier.java b/src/classifier/AbstractWekaClassifier.java index c3b4b6a1..b43bb384 100644 --- a/src/classifier/AbstractWekaClassifier.java +++ b/src/classifier/AbstractWekaClassifier.java @@ -4,17 +4,16 @@ import java.awt.Window; import java.util.ArrayList; import java.util.Enumeration; +import Jama.Matrix; import weka.core.Attribute; import weka.core.DenseInstance; import weka.core.FastVector; import weka.core.Instance; import weka.core.Instances; -import Jama.Matrix; - abstract public class AbstractWekaClassifier extends Classifier { - private weka.classifiers.AbstractClassifier wekaClassifier;; + private weka.classifiers.AbstractClassifier wekaClassifier; private Instances data; // private Enumeration wekaOptions; @@ -109,7 +108,7 @@ abstract public class AbstractWekaClassifier extends Classifier { @Override public boolean setClassifierParams(ClassifierParams classifierParams) { - if (WekaClassifierParams.class.isAssignableFrom(classifierParams.getClass()) == false) { + if (!WekaClassifierParams.class.isAssignableFrom(classifierParams.getClass())) { return false; } WekaClassifierParams wp = (WekaClassifierParams) classifierParams; diff --git a/src/classifier/Classifier.java b/src/classifier/Classifier.java index b0dc0f23..01372768 100644 --- a/src/classifier/Classifier.java +++ b/src/classifier/Classifier.java @@ -27,7 +27,7 @@ abstract public class Classifier { * @author Doug Gillespie * */ - public enum ProbabilityType {UNAVAILABLE, ABSOLUTE, NORMALISED}; + public enum ProbabilityType {UNAVAILABLE, ABSOLUTE, NORMALISED} /** * Minimum acceptance probability.

diff --git a/src/classifier/WekaOptionsDialog.java b/src/classifier/WekaOptionsDialog.java index 9ed46f94..3294b9c5 100644 --- a/src/classifier/WekaOptionsDialog.java +++ b/src/classifier/WekaOptionsDialog.java @@ -18,10 +18,10 @@ import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; -import weka.core.Option; import PamView.PamGui; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; +import weka.core.Option; public class WekaOptionsDialog extends PamDialog { diff --git a/src/clickDetector/BTAmplitudeSelector.java b/src/clickDetector/BTAmplitudeSelector.java index eb7c1b7e..62d652ec 100644 --- a/src/clickDetector/BTAmplitudeSelector.java +++ b/src/clickDetector/BTAmplitudeSelector.java @@ -122,7 +122,7 @@ public class BTAmplitudeSelector implements PamDialogPanel { @Override public void paintLayer(Graphics g) { BTDisplayParameters btDisplayParameters = btDisplay.getBtDisplayParameters(); - if (btDisplayParameters.amplitudeSelect == false) { + if (!btDisplayParameters.amplitudeSelect) { return; } axMin = allHistogram.getScaleMinVal(); @@ -148,7 +148,7 @@ public class BTAmplitudeSelector implements PamDialogPanel { private boolean canDrag = false; @Override public void mouseDragged(MouseEvent mouseEvent) { - if (canDrag == false) { + if (!canDrag) { return; } // work out a new value based on the current mouse position @@ -174,7 +174,7 @@ public class BTAmplitudeSelector implements PamDialogPanel { return false; } BTDisplayParameters btDisplayParameters = btDisplay.getBtDisplayParameters(); - if (btDisplayParameters.amplitudeSelect == false) { + if (!btDisplayParameters.amplitudeSelect) { return false; } double dx = (dataSelector.getParams().minimumAmplitude - histoOverLayer.axMin) / @@ -242,6 +242,7 @@ public class BTAmplitudeSelector implements PamDialogPanel { } } class AmplitudeListener implements ActionListener { + @Override public void actionPerformed(ActionEvent arg0) { // System.out.println("Amplitude Listener activated: " + arg0.toString()); updateBTParams(); diff --git a/src/clickDetector/BTDisplayParameters.java b/src/clickDetector/BTDisplayParameters.java index 925f0b74..3ff0feb2 100644 --- a/src/clickDetector/BTDisplayParameters.java +++ b/src/clickDetector/BTDisplayParameters.java @@ -1,13 +1,10 @@ package clickDetector; import java.io.Serializable; -import java.lang.reflect.Field; -import java.util.Arrays; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet.ParameterSetType; -import PamModel.parametermanager.PrivatePamParameterData; import clickDetector.tdPlots.ClickSymbolOptions; public class BTDisplayParameters implements Serializable, Cloneable, ManagedParameters { diff --git a/src/clickDetector/BasicClickIdParameters.java b/src/clickDetector/BasicClickIdParameters.java index 6cc5925c..37b79f9f 100644 --- a/src/clickDetector/BasicClickIdParameters.java +++ b/src/clickDetector/BasicClickIdParameters.java @@ -70,7 +70,7 @@ public class BasicClickIdParameters implements Serializable, Cloneable, ManagedP used = true; break; } - if (used == false) { + if (!used) { return id; } } diff --git a/src/clickDetector/ClickAlarm.java b/src/clickDetector/ClickAlarm.java index 515945ab..ec32b7f6 100644 --- a/src/clickDetector/ClickAlarm.java +++ b/src/clickDetector/ClickAlarm.java @@ -27,6 +27,7 @@ import java.io.File; import java.io.Serializable; import java.lang.reflect.Field; import java.net.URL; + import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.Clip; @@ -204,7 +205,8 @@ public class ClickAlarm implements Comparable, Serializable, Cloneab return name; } - public int compareTo(ClickAlarm alarm) { + @Override + public int compareTo(ClickAlarm alarm) { return name.compareTo(alarm.getName()); } diff --git a/src/clickDetector/ClickAlarmManager.java b/src/clickDetector/ClickAlarmManager.java index d4572cf6..ff45463d 100644 --- a/src/clickDetector/ClickAlarmManager.java +++ b/src/clickDetector/ClickAlarmManager.java @@ -23,16 +23,15 @@ package clickDetector; +import java.io.File; + +import javax.sound.sampled.Clip; + import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; import clickDetector.ClickClassifiers.ClickTypeCommonParams; -import java.io.File; -import java.net.URL; -import javax.sound.sampled.AudioInputStream; -import javax.sound.sampled.AudioSystem; -import javax.sound.sampled.Clip; /** * diff --git a/src/clickDetector/ClickBTDisplay.java b/src/clickDetector/ClickBTDisplay.java index eaa05353..40319b6f 100644 --- a/src/clickDetector/ClickBTDisplay.java +++ b/src/clickDetector/ClickBTDisplay.java @@ -64,19 +64,6 @@ import javax.swing.border.EmptyBorder; import javax.swing.event.InternalFrameAdapter; import javax.swing.event.InternalFrameEvent; -import binaryFileStorage.DataUnitFileInformation; -import pamMaths.PamQuaternion; -import pamMaths.PamVector; -import pamScrollSystem.AbstractPamScroller; -import pamScrollSystem.AbstractPamScrollerAWT; -import pamScrollSystem.PamScrollObserver; -import pamScrollSystem.PamScroller; -import pamScrollSystem.RangeSpinner; -import pamScrollSystem.RangeSpinnerListener; -import soundPlayback.PlaybackControl; -import soundPlayback.PlaybackDataServer; -import soundPlayback.PlaybackProgressMonitor; -import soundtrap.STClickControl; import Array.ArrayManager; import GPS.GpsData; import Layout.PamAxis; @@ -94,11 +81,11 @@ import PamView.ColorManaged; import PamView.CtrlKeyManager; import PamView.GeneralProjector; import PamView.PamColors; +import PamView.PamColors.PamColor; import PamView.PamKeyItem; import PamView.PamSymbol; import PamView.PamSymbolType; import PamView.TextKeyItem; -import PamView.PamColors.PamColor; import PamView.dialog.GroupedSourcePanel; import PamView.dialog.PamCheckBox; import PamView.dialog.PamLabel; @@ -119,6 +106,7 @@ import PamguardMVC.PamObserver; import PamguardMVC.dataSelector.DataSelectDialog; import PamguardMVC.dataSelector.DataSelector; import PamguardMVC.superdet.SuperDetection; +import binaryFileStorage.DataUnitFileInformation; import clickDetector.ClickClassifiers.ClickIdInformation; import clickDetector.ClickClassifiers.ClickIdentifier; import clickDetector.alarm.ClickAlarmParameters; @@ -127,6 +115,17 @@ import clickDetector.dialogs.ClickDisplayDialog; import clickDetector.offlineFuncs.OfflineEventDataBlock; import clickDetector.offlineFuncs.OfflineEventDataUnit; import clickDetector.tdPlots.ClickDetSymbolChooser; +import pamMaths.PamVector; +import pamScrollSystem.AbstractPamScroller; +import pamScrollSystem.AbstractPamScrollerAWT; +import pamScrollSystem.PamScrollObserver; +import pamScrollSystem.PamScroller; +import pamScrollSystem.RangeSpinner; +import pamScrollSystem.RangeSpinnerListener; +import soundPlayback.PlaybackControl; +import soundPlayback.PlaybackDataServer; +import soundPlayback.PlaybackProgressMonitor; +import soundtrap.STClickControl; /** * This is the main bearing time display for the click detector. @@ -338,6 +337,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett } + @Override public long getRequiredDataHistory(PamObservable o, Object arg) { if (o == clickControl.getClickDataBlock()) { return hScrollBar.getMaximumMillis()-hScrollBar.getMinimumMillis(); @@ -423,7 +423,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett // btPlot.drawClick(btPlot.getImageGraphics(), clickDataUnit, null); // btPlot.repaint(minPaintTime); } - if (followCheckBox.isSelected() == true) { + if (followCheckBox.isSelected()) { selectedClick = null; } @@ -562,6 +562,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett } } + @Override public String getObserverName() { return "click detector bearing time display"; } @@ -583,6 +584,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett btAxis.makeAxis(); } + @Override public void setSampleRate(float sampleRate, boolean notify) { this.sampleRate = sampleRate; setScales(); @@ -825,7 +827,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett } public void setSelected() { - if (checkNoZoom() == true) { + if (checkNoZoom()) { setupScrollBar(currentStart, currentRange); } } @@ -2030,6 +2032,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett this.whaleId = whaleId; } + @Override public void actionPerformed(ActionEvent arg0) { if (popupClick == null) return; @@ -2220,7 +2223,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett xAxis.drawAxis(g, insets.left, insets.top, insets.left + rp.width, insets.top); - if (btDisplayParameters.trackedClickMarkers && isViewer == false) { + if (btDisplayParameters.trackedClickMarkers && !isViewer) { drawTrackedClickMarkers(g); } @@ -2242,7 +2245,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett /** * paint information about click excluded due to amplitude selection */ - if (btDisplayParameters.amplitudeSelect == false) { + if (!btDisplayParameters.amplitudeSelect) { return; } ClickDataSelector clickDataSelector = getClickDataSelector(); @@ -2307,6 +2310,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett public class FollowBoxListener implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { clickDisplayManager.setBAutoScroll(followCheckBox.isSelected()); hScrollManager.setupScrollBar(hScrollBar.getMaximumMillis()); @@ -2695,7 +2699,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett @Override public void mouseClicked(MouseEvent e) { - if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1 && isViewer == false) { + if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1 && !isViewer) { showPopupMenu(e); } } @@ -2754,16 +2758,17 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett */ private boolean pamguardPopupTrigger(MouseEvent e) { boolean ctrl = e.isControlDown(); - if (PamController.getInstance().getPamStatus() == PamController.PAM_RUNNING && ctrl == false) { + if (PamController.getInstance().getPamStatus() == PamController.PAM_RUNNING && !ctrl) { return false; } - if (e.isPopupTrigger() == false && e.getButton()==MouseEvent.BUTTON1) { + if (!e.isPopupTrigger() && e.getButton()==MouseEvent.BUTTON1) { return false; } return true; } class ShowKeyAction implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { btDisplayParameters.showKey = !btDisplayParameters.showKey; btPlot.createKey(); @@ -2790,6 +2795,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett class SettingsMenuAction implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { BTDisplayParameters newParameters = @@ -2915,6 +2921,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett this.axesType = axesType; } + @Override public void actionPerformed(ActionEvent e) { setVScale(axesType); } @@ -2936,6 +2943,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett this.groupSelection = groupSelection; } + @Override public void actionPerformed(ActionEvent e) { setDisplayChannels(groupSelection); @@ -3064,6 +3072,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett return PamColor.PlOTWINDOW; } + @Override public Graphics getGraphics(){ Graphics g=super.getGraphics(); return g; @@ -3164,7 +3173,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett // g.setColor(Color.BLUE); // g.fillRect(0, 0, 30, 30); - if (hasData == false) { + if (!hasData) { g.setColor(PamColors.getInstance().getColor(PamColor.AXIS)); g.setFont(PamColors.getInstance().getBoldFont()); Graphics2D g2d = (Graphics2D) g; @@ -3187,7 +3196,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett Graphics2D g2d = (Graphics2D) g; g2d.setStroke(new BasicStroke()); - if (isViewer == false) { + if (!isViewer) { paintClicks(g, clipRectangle); if (selectedClick != null) { drawClick(g, selectedClick, clipRectangle, true); @@ -3198,7 +3207,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett // need to be always plotting the next / prev' click so that // ici can be calculated on the fly if necessary. - if (redrawClicks==true || dougsBufferedImage == null) { + if (redrawClicks || dougsBufferedImage == null) { createBufferedImage(clipRectangle, getBackground()); } @@ -3406,7 +3415,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett } public void createKey() { - if (btDisplayParameters.showKey == false) { + if (!btDisplayParameters.showKey) { this.setKeyPanel(null); return; } @@ -3426,7 +3435,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett ClickAlarmParameters selectParams = getClickDataSelector().getParams(); // if (btDisplayParameters.getShowSpecies(0)) { if (selectParams.onlineAutoEvents | selectParams.onlineManualEvents) { - keyPanel.add(symbolChooser.getDefaultSymbol(true).makeKeyItem("Unidentified species")); + keyPanel.add(ClickDetSymbolChooser.getDefaultSymbol(true).makeKeyItem("Unidentified species")); } // System.out.println("Create key now " + PamCalendar.formatDateTime(System.currentTimeMillis())); @@ -3486,7 +3495,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett unit = clickIterator.previous(); // if (unit.getTimeMilliseconds() < displayStartMillis - 1000) // break; - if (shouldPlot(unit) == false) continue; + if (!shouldPlot(unit)) continue; pt = clickXYPos(unit); if ((dist = ((pt.x - x) * (pt.x - x) + (pt.y - y) * (pt.y - y))) <= closest) { closest = dist; @@ -3539,7 +3548,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett // } if (btDisplayParameters.VScale == BTDisplayParameters.DISPLAY_ICI) { // if (btDisplayParameters.showUnassignedICI == false && click.getICI() < 0) return false; - if (btDisplayParameters.showUnassignedICI == false && click.getSuperDetectionsCount() <= 0) return false; + if (!btDisplayParameters.showUnassignedICI && click.getSuperDetectionsCount() <= 0) return false; // otherwise may be ok, since will estimate all ici's on teh fly. } // if (btDisplayParameters.amplitudeSelect && click.getAmplitudeDB() < btDisplayParameters.minAmplitude) { @@ -3653,6 +3662,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett } } + @Override public void removeObservable(PamObservable o) { // TODO Auto-generated method stub @@ -3679,22 +3689,27 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett repaintBoth(); } + @Override public Serializable getSettingsReference() { return btDisplayParameters; } + @Override public long getSettingsVersion() { return BTDisplayParameters.serialVersionUID; } + @Override public String getUnitName() { return clickControl.getUnitName() + "_BTDisplay_" + displayNumber; } + @Override public String getUnitType() { return "Click Detector Bearing Time Display"; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { this.btDisplayParameters = ((BTDisplayParameters) pamControlledUnitSettings .getSettings()).clone(); @@ -3789,7 +3804,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett ClickDetection click; while (clickIterator.hasNext()) { click = clickIterator.next(); - if (shouldPlot(click) == false || clickInMarkedArea(click) == false) { + if (!shouldPlot(click) || !clickInMarkedArea(click)) { continue; } return click; @@ -3803,7 +3818,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett ClickDetection click; while (clickIterator.hasPrevious()) { click = clickIterator.previous(); - if (shouldPlot(click) == false || clickInMarkedArea(click) == false) { + if (!shouldPlot(click) || !clickInMarkedArea(click)) { continue; } return click; @@ -3821,7 +3836,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett return true; } Point clickPoint = clickXYPos(click); - if (shouldPlot(click) == false) { + if (!shouldPlot(click)) { return false; } return zoomer.isInMark(btPlot, clickPoint); @@ -3849,7 +3864,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett ClickDetection click; while (clickIterator.hasNext()) { click = clickIterator.next(); - if (shouldPlot(click) == false || clickInMarkedArea(click) == false) { + if (!shouldPlot(click) || !clickInMarkedArea(click)) { continue; } markedClicks.add(click); @@ -4093,10 +4108,10 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett } boolean wantClick(ClickDetection click) { - if (shouldPlot(click) == false) { + if (!shouldPlot(click)) { return false; } - if (clickInMarkedArea(click) == false) { + if (!clickInMarkedArea(click)) { return false; } if (offlineEvent != null) { @@ -4111,7 +4126,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett ClickDetection click; while (clickIterator.hasNext()) { click = clickIterator.next(); - if (wantClick(click) == false){ + if (!wantClick(click)){ continue; } if (click.getTimeMilliseconds() < startMillis) { @@ -4126,7 +4141,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett ClickDetection click; while (clickIterator.hasNext()) { click = clickIterator.next(); - if (wantClick(click) == false){ + if (!wantClick(click)){ continue; } return click; @@ -4167,7 +4182,7 @@ public class ClickBTDisplay extends ClickDisplay implements PamObserver, PamSett if (amplitudeSelectorLabel == null) { return; } - if (btDisplayParameters.amplitudeSelect == false) { + if (!btDisplayParameters.amplitudeSelect) { amplitudeSelectorLabel.setText(""); } else { diff --git a/src/clickDetector/ClickBinaryDataSource.java b/src/clickDetector/ClickBinaryDataSource.java index b9294cbd..cdc36584 100644 --- a/src/clickDetector/ClickBinaryDataSource.java +++ b/src/clickDetector/ClickBinaryDataSource.java @@ -7,14 +7,11 @@ import java.io.DataOutputStream; import java.io.File; import java.io.IOException; -import clickDetector.ClickDetector.ChannelGroupDetector; -import dataMap.DataMapDrawing; import Acquisition.AcquisitionProcess; import Array.ArrayManager; import Localiser.algorithms.timeDelayLocalisers.bearingLoc.BearingLocaliser; import Localiser.algorithms.timeDelayLocalisers.bearingLoc.BearingLocaliserSelector; import Localiser.algorithms.timeDelayLocalisers.bearingLoc.OldAngleConverter; -import PamUtils.PamCalendar; import PamUtils.PamUtils; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; @@ -23,7 +20,8 @@ import binaryFileStorage.BinaryHeader; import binaryFileStorage.BinaryObjectData; import binaryFileStorage.ModuleFooter; import binaryFileStorage.ModuleHeader; -import binaryFileStorage.PackedBinaryObject; +import clickDetector.ClickDetector.ChannelGroupDetector; +import dataMap.DataMapDrawing; /** * Class for storing clicks to binary store. @@ -183,7 +181,7 @@ public class ClickBinaryDataSource extends BinaryDataSource { @Override public ModuleHeader sinkModuleHeader(BinaryObjectData binaryObjectData, BinaryHeader bh) { ClickBinaryModuleHeader mh = new ClickBinaryModuleHeader(binaryObjectData.getVersionNumber()); - if (mh.createHeader(binaryObjectData, bh) == false) { + if (!mh.createHeader(binaryObjectData, bh)) { return null; } return mh; @@ -193,7 +191,7 @@ public class ClickBinaryDataSource extends BinaryDataSource { public ModuleFooter sinkModuleFooter(BinaryObjectData binaryObjectData, BinaryHeader bh, ModuleHeader mh) { ClickBinaryModuleFooter mf = new ClickBinaryModuleFooter(clickDetector); - if (mf.createFooter(binaryObjectData, bh, mh) == false) { + if (!mf.createFooter(binaryObjectData, bh, mh)) { return null; } return mf; diff --git a/src/clickDetector/ClickBinaryModuleFooter.java b/src/clickDetector/ClickBinaryModuleFooter.java index f24ed53c..878ce65f 100644 --- a/src/clickDetector/ClickBinaryModuleFooter.java +++ b/src/clickDetector/ClickBinaryModuleFooter.java @@ -7,16 +7,16 @@ import java.io.DataOutputStream; import java.io.IOException; import java.lang.reflect.Field; -import clickDetector.ClickClassifiers.ClickTypeProvider; import PamController.PamController; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; +import PamModel.parametermanager.PrivatePamParameterData; import binaryFileStorage.BinaryHeader; import binaryFileStorage.BinaryObjectData; import binaryFileStorage.ModuleFooter; import binaryFileStorage.ModuleHeader; +import clickDetector.ClickClassifiers.ClickTypeProvider; public class ClickBinaryModuleFooter extends ModuleFooter implements ManagedParameters { diff --git a/src/clickDetector/ClickControl.java b/src/clickDetector/ClickControl.java index ddb8fdc1..c9602101 100644 --- a/src/clickDetector/ClickControl.java +++ b/src/clickDetector/ClickControl.java @@ -33,14 +33,6 @@ import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import rocca.RoccaControl; -import soundPlayback.PlaybackControl; -import targetMotionOld.TargetMotionLocaliser; -import tethys.localization.LocalizationCreator; -import binaryFileStorage.BinaryStore; import Filters.FilterDialog; import Filters.FilterParams; import Localiser.LocalisationAlgorithm; @@ -69,6 +61,7 @@ import PamguardMVC.PamRawDataBlock; import PamguardMVC.debug.Debug; import alarm.AlarmCounterProvider; import angleVetoes.AngleVetoes; +import binaryFileStorage.BinaryStore; import clickDetector.ClickClassifiers.ClickClassifierManager; import clickDetector.ClickClassifiers.ClickClassifyDialog; import clickDetector.ClickClassifiers.ClickIdentifier; @@ -100,7 +93,10 @@ import dataPlotsFX.data.TDDataProviderRegisterFX; import detectionPlotFX.data.DDPlotRegister; import detectionPlotFX.rawDDPlot.ClickDDPlotProvider; import fftManager.fftorganiser.FFTDataOrganiser; -import offlineProcessing.OfflineTaskGroup; +import rocca.RoccaControl; +import soundPlayback.PlaybackControl; +import targetMotionOld.TargetMotionLocaliser; +import tethys.localization.LocalizationCreator; /** * Main Controller for click detection. @@ -500,6 +496,7 @@ public class ClickControl extends PamControlledUnit implements PamSettings, Loca pf = parentFrame; } + @Override public void actionPerformed(ActionEvent ev) { ClickParameters newParameters = ClickParamsDialog.showDialog(pf, clickControl, clickParameters); if (newParameters != null) { @@ -520,6 +517,7 @@ public class ClickControl extends PamControlledUnit implements PamSettings, Loca pf = parentFrame; } + @Override public void actionPerformed(ActionEvent ev) { ClickLocParams newLocParameters = ClickLocalisationDialog.showDialog(clickControl, pf, clickControl.clickTrainDetector.getDetectionGroupLocaliser()); @@ -614,6 +612,7 @@ public class ClickControl extends PamControlledUnit implements PamSettings, Loca public MenuPreFilter(Frame parentFrame) { pf = parentFrame; } + @Override public void actionPerformed(ActionEvent ev) { FilterParams newParams = FilterDialog.showDialog(pf, clickParameters.preFilter, getClickDetector() @@ -632,6 +631,7 @@ public class ClickControl extends PamControlledUnit implements PamSettings, Loca public MenuTriggerFilter(Frame parentFrame) { pf = parentFrame; } + @Override public void actionPerformed(ActionEvent ev) { FilterParams newParams = FilterDialog.showDialog(pf, clickParameters.triggerFilter, getClickDetector() @@ -650,6 +650,7 @@ public class ClickControl extends PamControlledUnit implements PamSettings, Loca public MenuClickTrainId(Frame parentFrame) { pf = parentFrame; } + @Override public void actionPerformed(ActionEvent ev) { ClickTrainIdParams newParams; if ((newParams = ClickTrainIdDialog.showDialog(pf, clickTrainDetector.getClickTrainIdParameters())) != null) { @@ -666,6 +667,7 @@ public class ClickControl extends PamControlledUnit implements PamSettings, Loca public MenuClickClassification(Frame parentFrame) { pf = parentFrame; } + @Override public void actionPerformed(ActionEvent ev) { classificationDialog(pf); } @@ -702,6 +704,7 @@ public class ClickControl extends PamControlledUnit implements PamSettings, Loca public MenuStorageOptions(Frame parentFrame) { pf = parentFrame; } + @Override public void actionPerformed(ActionEvent ev) { ClickParameters newParams; if ((newParams = ClickStorageOptionsDialog.showDialog(pf, clickParameters)) != null) { @@ -718,6 +721,7 @@ public class ClickControl extends PamControlledUnit implements PamSettings, Loca public MenuAlarm(Frame parentFrame) { pf = parentFrame; } + @Override public void actionPerformed(ActionEvent ev) { ClickParameters newParams; if ((newParams = ClickAlarmDialog.showDialog(pf, clickParameters)) @@ -743,6 +747,7 @@ public class ClickControl extends PamControlledUnit implements PamSettings, Loca this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent ev) { batchConvertClicks(parentFrame); } @@ -755,6 +760,7 @@ public class ClickControl extends PamControlledUnit implements PamSettings, Loca this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent ev) { batchConvertClickDatabase(parentFrame); } @@ -846,14 +852,17 @@ public class ClickControl extends PamControlledUnit implements PamSettings, Loca return super.canClose(); } + @Override public long getSettingsVersion() { return ClickParameters.serialVersionUID; } + @Override public Serializable getSettingsReference() { return clickParameters; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { this.clickParameters = ((ClickParameters) pamControlledUnitSettings.getSettings()).clone(); if (clickParameters.createRCFile) { @@ -1263,6 +1272,7 @@ public class ClickControl extends PamControlledUnit implements PamSettings, Loca * @param flag. The GUI type flag defined in PAMGuiManager. * @return the GUI for the PamControlledUnit unit. */ + @Override public PamControlledUnitGUI getGUI(int flag) { if (flag==PamGUIManager.FX) { if (clickGUIFX ==null) { diff --git a/src/clickDetector/ClickDataBlock.java b/src/clickDetector/ClickDataBlock.java index 6f878835..63040533 100644 --- a/src/clickDetector/ClickDataBlock.java +++ b/src/clickDetector/ClickDataBlock.java @@ -3,26 +3,6 @@ package clickDetector; import java.util.ListIterator; import Localiser.LocalisationAlgorithm; -import pamScrollSystem.ViewLoadObserver; -import tethys.TethysControl; -import tethys.pamdata.TethysDataProvider; -import tethys.species.DataBlockSpeciesManager; -//import staticLocaliser.StaticLocaliserControl; -//import staticLocaliser.StaticLocaliserProvider; -//import staticLocaliser.panels.AbstractLocaliserControl; -//import staticLocaliser.panels.ClickLocaliserControl; -import alarm.AlarmCounterProvider; -import alarm.AlarmDataSource; -import binaryFileStorage.BinaryStore; -import clickDetector.ClickClassifiers.ClickBlockSpeciesManager; -import clickDetector.dataSelector.ClickDataSelectCreator; -import clickDetector.offlineFuncs.OfflineClickLogging; -import clickDetector.tethys.ClickTethysDataProvider; -import clickDetector.toad.ClickTOADCalculator; -import dataMap.OfflineDataMap; -import fftManager.fftorganiser.FFTDataOrganiser; -import fftManager.fftorganiser.OrganisedFFTData; -import generalDatabase.SQLLogging; import PamController.PamController; import PamController.PamControllerInterface; import PamDetection.LocContents; @@ -39,6 +19,26 @@ import PamguardMVC.PamProcess; import PamguardMVC.dataOffline.OfflineDataLoadInfo; import PamguardMVC.dataSelector.DataSelectorCreator; import PamguardMVC.toad.TOADCalculator; +//import staticLocaliser.StaticLocaliserControl; +//import staticLocaliser.StaticLocaliserProvider; +//import staticLocaliser.panels.AbstractLocaliserControl; +//import staticLocaliser.panels.ClickLocaliserControl; +import alarm.AlarmCounterProvider; +import alarm.AlarmDataSource; +import binaryFileStorage.BinaryStore; +import clickDetector.ClickClassifiers.ClickBlockSpeciesManager; +import clickDetector.dataSelector.ClickDataSelectCreator; +import clickDetector.offlineFuncs.OfflineClickLogging; +import clickDetector.tethys.ClickTethysDataProvider; +import clickDetector.toad.ClickTOADCalculator; +import dataMap.OfflineDataMap; +import fftManager.fftorganiser.FFTDataOrganiser; +import fftManager.fftorganiser.OrganisedFFTData; +import generalDatabase.SQLLogging; +import pamScrollSystem.ViewLoadObserver; +import tethys.TethysControl; +import tethys.pamdata.TethysDataProvider; +import tethys.species.DataBlockSpeciesManager; public class ClickDataBlock extends AcousticDataBlock implements AlarmDataSource, GroupedDataSource, OrganisedFFTData, FFTDataHolderBlock { @@ -218,7 +218,7 @@ public class ClickDataBlock extends AcousticDataBlock implement ListIterator iter = getListIterator(n-50); while (iter.hasPrevious()) { click = iter.previous(); - if (click.hasComplexSpectrum() == false) { + if (!click.hasComplexSpectrum()) { break; // probably no need to go further down the list } click.freeClickMemory(); diff --git a/src/clickDetector/ClickDetection.java b/src/clickDetector/ClickDetection.java index 6913973e..60e3cdbe 100644 --- a/src/clickDetector/ClickDetection.java +++ b/src/clickDetector/ClickDetection.java @@ -4,14 +4,8 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import pamMaths.PamVector; -import clickDetector.ClickClassifiers.basic.BasicClickIdentifier; -import clickDetector.ClickClassifiers.basicSweep.ZeroCrossingStats; -import clickDetector.offlineFuncs.OfflineEventDataUnit; -import clickDetector.ClickDetector.ChannelGroupDetector; import Acquisition.AcquisitionControl; import Acquisition.AcquisitionProcess; -import Array.ArrayManager; import Array.SnapshotGeometry; import Localiser.algorithms.timeDelayLocalisers.bearingLoc.BearingLocaliser; import PamDetection.LocContents; @@ -26,12 +20,14 @@ import PamguardMVC.PamDataUnit; import PamguardMVC.PamRawDataBlock; import PamguardMVC.RawDataHolder; import PamguardMVC.RawDataTransforms; -import Spectrogram.WindowFunction; -import fftFilter.FFTFilter; +import clickDetector.ClickDetector.ChannelGroupDetector; +import clickDetector.ClickClassifiers.basic.BasicClickIdentifier; +import clickDetector.ClickClassifiers.basicSweep.ZeroCrossingStats; +import clickDetector.offlineFuncs.OfflineEventDataUnit; import fftFilter.FFTFilterParams; -import fftManager.Complex; import fftManager.FFTDataUnit; import fftManager.FastFFT; +import pamMaths.PamVector; /** * Class for Click Detector clicks. @@ -540,7 +536,7 @@ public class ClickDetection extends PamDataUnit implem * @return analystic waveform. */ public synchronized double[] getAnalyticWaveform(int iChan, boolean filtered, FFTFilterParams fftFilterParams) { - if (filtered == false || fftFilterParams == null) { + if (!filtered || fftFilterParams == null) { return getAnalyticWaveform(iChan); } else { @@ -929,7 +925,7 @@ public class ClickDetection extends PamDataUnit implem * @return data filtered or otherwise. */ public double[][] getWaveData(boolean filtered, FFTFilterParams fftFilterParams) { - if (filtered == false || fftFilterParams == null) { + if (!filtered || fftFilterParams == null) { return getWaveData(); } else { @@ -944,7 +940,7 @@ public class ClickDetection extends PamDataUnit implem * @return data filtered or otherwise. */ public double[] getWaveData(int channelIndex, boolean filtered, FFTFilterParams fftFilterParams) { - if (filtered == false || fftFilterParams == null) { + if (!filtered || fftFilterParams == null) { return getWaveData(channelIndex); } else { @@ -970,6 +966,7 @@ public class ClickDetection extends PamDataUnit implem * @return waveform data for all channels. Convert from compressed (int16) data * if necessary. */ + @Override public synchronized double[][] getWaveData() { if (waveData != null) { return waveData; diff --git a/src/clickDetector/ClickDetector.java b/src/clickDetector/ClickDetector.java index b0f45cef..3ce20376 100644 --- a/src/clickDetector/ClickDetector.java +++ b/src/clickDetector/ClickDetector.java @@ -21,23 +21,11 @@ package clickDetector; -import networkTransfer.receive.BuoyStatusDataUnit; -import clickDetector.ClickClassifiers.ClickIdInformation; -import clickDetector.ClickClassifiers.ClickIdentifier; -import clickDetector.echoDetection.EchoDetectionSystem; -import clickDetector.echoDetection.EchoDetector; -import clickDetector.offlineFuncs.ClickBearingTask; -import clickDetector.offlineFuncs.ClickDelayTask; -import clickDetector.offlineFuncs.OfflineEventDataBlock; -import clickDetector.offlineFuncs.OfflineEventLogging; -import clickDetector.tdPlots.ClickDetSymbolManager; -import clickDetector.tdPlots.ClickEventSymbolManager; -import signal.Hilbert; -import targetMotionOld.TargetMotionLocaliser; -import targetMotionOld.TargetMotionSQLLogging; +import java.util.ArrayList; +import java.util.Arrays; + import Acquisition.AcquisitionControl; import Acquisition.AcquisitionProcess; -import Acquisition.FileInputSystem; import Filters.Filter; import Filters.FilterMethod; import Filters.FilterType; @@ -64,24 +52,33 @@ import PamguardMVC.PamConstants; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; -import PamguardMVC.PamObserver; import PamguardMVC.PamObserverAdapter; import PamguardMVC.PamProcess; import PamguardMVC.PamRawDataBlock; import PamguardMVC.RawDataUnavailableException; -import PamguardMVC.debug.Debug; +import clickDetector.ClickClassifiers.ClickIdInformation; +import clickDetector.ClickClassifiers.ClickIdentifier; import clickDetector.ClickClassifiers.ClickTypeCommonParams; import clickDetector.ClickClassifiers.annotation.ClickClassificationType; import clickDetector.ClickClassifiers.annotation.ClickClassifierAnnotation; import clickDetector.background.ClickBackgroundDataUnit; import clickDetector.background.ClickBackgroundManager; import clickDetector.basicalgorithm.TriggerBackgroundHandler; +import clickDetector.echoDetection.EchoDetectionSystem; +import clickDetector.echoDetection.EchoDetector; +import clickDetector.offlineFuncs.ClickBearingTask; +import clickDetector.offlineFuncs.ClickDelayTask; +import clickDetector.offlineFuncs.OfflineEventDataBlock; +import clickDetector.offlineFuncs.OfflineEventLogging; +import clickDetector.tdPlots.ClickDetSymbolManager; +import clickDetector.tdPlots.ClickEventSymbolManager; import fftFilter.FFTFilter; import fftFilter.FFTFilterParams; import fftManager.FastFFT; - -import java.util.ArrayList; -import java.util.Arrays; +import networkTransfer.receive.BuoyStatusDataUnit; +import signal.Hilbert; +import targetMotionOld.TargetMotionLocaliser; +import targetMotionOld.TargetMotionSQLLogging; /** * Main click detector process. @@ -97,7 +94,7 @@ public class ClickDetector extends PamProcess { enum ClickStatus { CLICK_ON, CLICK_ENDING, CLICK_OFF - }; + } private ClickDetector THIS; @@ -276,14 +273,14 @@ public class ClickDetector extends PamProcess { clickControl.clickParameters.publishTriggerFunction = true; triggerFunctionDataBlock.setChannelMap(clickControl.clickParameters.getChannelBitmap()); - if (clickControl.clickParameters.publishTriggerFunction && isViewer == false) { + if (clickControl.clickParameters.publishTriggerFunction && !isViewer) { addOutputDataBlock(triggerFunctionDataBlock); } else { removeOutputDatablock(triggerFunctionDataBlock); } trackedClicks = new TrackedClickDataBlock(clickControl, this, 0); trackedClicks.setChannelMap(clickControl.clickParameters.getChannelBitmap()); - if (isViewer == false) { + if (!isViewer) { addOutputDataBlock(trackedClicks); // OfflineClickLogging trackedClickLogging; // trackedClicks.SetLogging(trackedClickLogging = new @@ -1152,7 +1149,7 @@ public class ClickDetector extends PamProcess { newClick.addDataAnnotation( new ClickClassifierAnnotation(clickAnnotationType, idInfo.classifiersPassed)); } - if (wantClick(newClick, idInfo) == false) { + if (!wantClick(newClick, idInfo)) { return false; } } @@ -1210,7 +1207,7 @@ public class ClickDetector extends PamProcess { */ double angle = newClick.getAngle(); // clickControl.angleVetoes.addAngleData(angle); - if (clickControl.angleVetoes.passAllVetoes(angle, true) == false) { + if (!clickControl.angleVetoes.passAllVetoes(angle, true)) { return false; } @@ -1287,7 +1284,7 @@ public class ClickDetector extends PamProcess { if (channelGroupDetectors[i].halfBuiltClicks == null) { continue; } - if (channelGroupDetectors[i].halfBuiltClicks.waitForThreadedObservers(maxWait) == false) { + if (!channelGroupDetectors[i].halfBuiltClicks.waitForThreadedObservers(maxWait)) { errors++; } } @@ -1306,13 +1303,13 @@ public class ClickDetector extends PamProcess { * @return */ public boolean wantClick(ClickDetection click, ClickIdInformation idInfo) { - if (clickControl.clickParameters.classifyOnline == false) { + if (!clickControl.clickParameters.classifyOnline) { return true; } if (click.getClickType() == 0 && clickControl.clickParameters.discardUnclassifiedClicks) { return false; } else { - return (idInfo.discard == false); + return !idInfo.discard; } } diff --git a/src/clickDetector/ClickDisplayManager.java b/src/clickDetector/ClickDisplayManager.java index 2329bb4a..bc60149e 100644 --- a/src/clickDetector/ClickDisplayManager.java +++ b/src/clickDetector/ClickDisplayManager.java @@ -19,8 +19,6 @@ import javax.swing.WindowConstants; import javax.swing.event.InternalFrameEvent; import javax.swing.event.InternalFrameListener; -import clickDetector.offlineFuncs.OfflineEventDataUnit; - import Layout.PamInternalFrame; import PamController.PamControlledUnitSettings; import PamController.PamController; @@ -31,6 +29,7 @@ import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet.ParameterSetType; import PamModel.parametermanager.PrivatePamParameterData; import PamView.MenuItemEnabler; +import clickDetector.offlineFuncs.OfflineEventDataUnit; public class ClickDisplayManager implements PamSettings { @@ -139,6 +138,7 @@ public class ClickDisplayManager implements PamSettings { class CreateMenuAction implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { clickDisplayInfo.createUnit(); @@ -228,34 +228,41 @@ public class ClickDisplayManager implements PamSettings { return getName(); } + @Override public void componentHidden(ComponentEvent e) { // System.out.println("componentHidden"); } + @Override public void componentMoved(ComponentEvent e) { //System.out.println("componentMoved"); } + @Override public void componentResized(ComponentEvent e) { //System.out.println("componentResized"); } + @Override public void componentShown(ComponentEvent e) { //System.out.println("componentShown"); } + @Override public void componentAdded(ContainerEvent e) { // TODO Auto-generated method stub // System.out.println("componentAdded"); } + @Override public void componentRemoved(ContainerEvent e) { // TODO Auto-generated method stub // System.out.println("componentRemoved"); } + @Override public void internalFrameActivated(InternalFrameEvent frameEvent) { JInternalFrame internalFrame = frameEvent.getInternalFrame(); ClickDisplay clickDisplay = (ClickDisplay) ((PamInternalFrame) internalFrame).getFramePlots(); @@ -264,6 +271,7 @@ public class ClickDisplayManager implements PamSettings { clickControl.displayActivated(clickDisplay); } + @Override public void internalFrameClosed(InternalFrameEvent e) { // TODO Auto-generated method stub // System.out.println("internalFrameClosed"); @@ -271,30 +279,35 @@ public class ClickDisplayManager implements PamSettings { } + @Override public void internalFrameClosing(InternalFrameEvent arg0) { // TODO Auto-generated method stub // System.out.println("internalFrameClosing"); } + @Override public void internalFrameDeactivated(InternalFrameEvent arg0) { // TODO Auto-generated method stub // System.out.println("internalFrameDeactivated"); } + @Override public void internalFrameDeiconified(InternalFrameEvent arg0) { // TODO Auto-generated method stub // System.out.println("internalFrameDeiconified"); } + @Override public void internalFrameIconified(InternalFrameEvent arg0) { // TODO Auto-generated method stub // System.out.println("internalFrameIconified"); } + @Override public void internalFrameOpened(InternalFrameEvent arg0) { // TODO Auto-generated method stub // System.out.println("internalFrameOpened"); @@ -405,6 +418,7 @@ public class ClickDisplayManager implements PamSettings { return windowList; } + @Override public Serializable getSettingsReference() { cdmp.countEverything(this); cdmp.saveDisplayLocations(getWindowList()); @@ -426,18 +440,22 @@ public class ClickDisplayManager implements PamSettings { return count; } + @Override public long getSettingsVersion() { return ClickDisplayManagerParameters2.serialVersionUID; } + @Override public String getUnitName() { return clickTabPanelControl.clickControl.getUnitName() + "_Click Display Manager"; } + @Override public String getUnitType() { return "Click Display Manager"; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { try { cdmp = ((ClickDisplayManagerParameters2) pamControlledUnitSettings.getSettings()).clone(); diff --git a/src/clickDetector/ClickDisplayManagerParameters.java b/src/clickDetector/ClickDisplayManagerParameters.java index 313a2d5c..1107c322 100644 --- a/src/clickDetector/ClickDisplayManagerParameters.java +++ b/src/clickDetector/ClickDisplayManagerParameters.java @@ -2,8 +2,6 @@ package clickDetector; import java.io.Serializable; -import PamController.PamController; - public class ClickDisplayManagerParameters implements Cloneable, Serializable { static public final long serialVersionUID = 2; diff --git a/src/clickDetector/ClickDisplayManagerParameters2.java b/src/clickDetector/ClickDisplayManagerParameters2.java index 6bcc110a..7f5da35f 100644 --- a/src/clickDetector/ClickDisplayManagerParameters2.java +++ b/src/clickDetector/ClickDisplayManagerParameters2.java @@ -2,19 +2,16 @@ package clickDetector; import java.awt.Dimension; import java.awt.Point; -import java.awt.Rectangle; import java.io.Serializable; import java.lang.reflect.Field; import java.util.ArrayList; import Layout.PamInternalFrame; -import clickDetector.IDI_Display.IDIHistogramImage; - import PamController.PamController; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; +import PamModel.parametermanager.PrivatePamParameterData; public class ClickDisplayManagerParameters2 implements Cloneable, Serializable, ManagedParameters { @@ -158,7 +155,7 @@ public class ClickDisplayManagerParameters2 implements Cloneable, Serializable, public ClickDisplayManagerParameters2 clone() { try { ClickDisplayManagerParameters2 np = (ClickDisplayManagerParameters2) super.clone(); - if (np.initialised == false) { + if (!np.initialised) { setDefaults(); } return np; diff --git a/src/clickDetector/ClickGroupDataBlock.java b/src/clickDetector/ClickGroupDataBlock.java index d7010172..1e0a7ea9 100644 --- a/src/clickDetector/ClickGroupDataBlock.java +++ b/src/clickDetector/ClickGroupDataBlock.java @@ -1,7 +1,6 @@ package clickDetector; import Localiser.detectionGroupLocaliser.GroupDetection; -import PamView.GeneralProjector; import PamguardMVC.AcousticDataBlock; import PamguardMVC.PamProcess; diff --git a/src/clickDetector/ClickGroupLogging.java b/src/clickDetector/ClickGroupLogging.java index 02a16f3a..2223d3ff 100644 --- a/src/clickDetector/ClickGroupLogging.java +++ b/src/clickDetector/ClickGroupLogging.java @@ -1,17 +1,16 @@ package clickDetector; -import pamMaths.PamVector; -import generalDatabase.PamTableItem; -import generalDatabase.SQLTypes; import Localiser.detectionGroupLocaliser.GroupDetection; import Localiser.detectionGroupLocaliser.GroupLocInfoLogging; -import Localiser.detectionGroupLocaliser.GroupLocalisation; import Localiser.detectionGroupLocaliser.GroupLocResult; -import PamDetection.AbstractLocalisation; +import Localiser.detectionGroupLocaliser.GroupLocalisation; import PamDetection.LocContents; import PamUtils.LatLong; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; +import generalDatabase.PamTableItem; +import generalDatabase.SQLTypes; +import pamMaths.PamVector; public class ClickGroupLogging extends GroupLocInfoLogging { diff --git a/src/clickDetector/ClickLocalisation.java b/src/clickDetector/ClickLocalisation.java index d990f698..17af5c26 100644 --- a/src/clickDetector/ClickLocalisation.java +++ b/src/clickDetector/ClickLocalisation.java @@ -1,9 +1,9 @@ package clickDetector; -import pamMaths.PamVector; import Array.ArrayManager; import PamDetection.AbstractLocalisation; import PamUtils.PamUtils; +import pamMaths.PamVector; public class ClickLocalisation extends AbstractLocalisation { diff --git a/src/clickDetector/ClickLogger.java b/src/clickDetector/ClickLogger.java index cef316c6..f754aba7 100644 --- a/src/clickDetector/ClickLogger.java +++ b/src/clickDetector/ClickLogger.java @@ -30,15 +30,14 @@ package clickDetector; -import generalDatabase.PamDetectionLogging; -import generalDatabase.PamTableItem; -import generalDatabase.SQLLogging; -import generalDatabase.SQLTypes; - import java.sql.Types; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; +import generalDatabase.PamDetectionLogging; +import generalDatabase.PamTableItem; +import generalDatabase.SQLLogging; +import generalDatabase.SQLTypes; /** * Databse logging information for Clicks. diff --git a/src/clickDetector/ClickMapDrawing.java b/src/clickDetector/ClickMapDrawing.java index 2a514432..f9b92ff6 100644 --- a/src/clickDetector/ClickMapDrawing.java +++ b/src/clickDetector/ClickMapDrawing.java @@ -4,21 +4,20 @@ import java.awt.Color; import java.awt.Graphics; import java.util.Iterator; -import binaryFileStorage.BinaryOfflineDataMapPoint; - -import clickDetector.ClickClassifiers.ClickIdentifier; -import clickDetector.ClickClassifiers.ClickTypeProvider; import PamUtils.BubbleSort; import PamView.LineKeyItem; import PamView.PamSymbol; import PamView.panel.KeyPanel; import PamView.symbol.SymbolData; +import binaryFileStorage.BinaryOfflineDataMapPoint; +import clickDetector.ClickClassifiers.ClickIdentifier; +import clickDetector.ClickClassifiers.ClickTypeProvider; import dataMap.DataMapDrawing; +import dataMap.DataStreamPanel.DataGraph; import dataMap.OfflineDataMap; import dataMap.OfflineDataMapPoint; -import javafx.scene.canvas.GraphicsContext; -import dataMap.DataStreamPanel.DataGraph; import dataMap.layoutFX.DataStreamPaneFX.DataGraphFX; +import javafx.scene.canvas.GraphicsContext; /** * Graphics for drawing clikc detections and classification on the data map. diff --git a/src/clickDetector/ClickParameters.java b/src/clickDetector/ClickParameters.java index 118eaf21..98022bda 100644 --- a/src/clickDetector/ClickParameters.java +++ b/src/clickDetector/ClickParameters.java @@ -23,12 +23,9 @@ package clickDetector; import java.io.Serializable; import java.lang.reflect.Field; -import java.lang.reflect.Modifier; +import java.util.ArrayList; +import java.util.Hashtable; -import clickDetector.ClickClassifiers.ClickClassifierManager; -import clickDetector.dialogs.ClickParamsDialog; -import clickDetector.localisation.ClickLocParams; -import fftFilter.FFTFilterParams; import Filters.FilterBand; import Filters.FilterParams; import Filters.FilterType; @@ -37,15 +34,15 @@ import PamModel.parametermanager.FieldNotFoundException; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterData; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; +import PamModel.parametermanager.PrivatePamParameterData; import PamView.GroupedSourceParameters; import PamView.dialog.GroupedSourcePanel; import PamView.paneloverlay.overlaymark.MarkDataSelectorParams; import PamguardMVC.PamConstants; - -import java.util.ArrayList; -import java.util.Hashtable; +import clickDetector.ClickClassifiers.ClickClassifierManager; +import clickDetector.localisation.ClickLocParams; +import fftFilter.FFTFilterParams; public class ClickParameters implements Serializable, Cloneable, ManagedParameters { diff --git a/src/clickDetector/ClickRecorderTrigger.java b/src/clickDetector/ClickRecorderTrigger.java index 02de3fd9..229bb04e 100644 --- a/src/clickDetector/ClickRecorderTrigger.java +++ b/src/clickDetector/ClickRecorderTrigger.java @@ -1,8 +1,5 @@ package clickDetector; -import java.awt.Window; - -import PamguardMVC.PamDataUnit; import SoundRecorder.trigger.RecorderTrigger; import SoundRecorder.trigger.RecorderTriggerData; diff --git a/src/clickDetector/ClickSidePanel.java b/src/clickDetector/ClickSidePanel.java index 40dfb0c7..79ede9f0 100644 --- a/src/clickDetector/ClickSidePanel.java +++ b/src/clickDetector/ClickSidePanel.java @@ -1,11 +1,13 @@ package clickDetector; import java.awt.Color; +import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JTextField; @@ -14,20 +16,13 @@ import javax.swing.border.TitledBorder; import PamUtils.PamCalendar; import PamView.PamColors; -import PamView.PamSidePanel; import PamView.PamColors.PamColor; +import PamView.PamSidePanel; import PamView.dialog.PamLabel; import PamView.panel.PamBorderPanel; import PamguardMVC.PamDataBlock; -import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; -import PamguardMVC.PamObserver; import PamguardMVC.PamObserverAdapter; -import clickDetector.ClickClassifiers.ClickTypeCommonParams; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Insets; -import javax.swing.JButton; public class ClickSidePanel extends PamObserverAdapter implements PamSidePanel { @@ -125,7 +120,8 @@ public class ClickSidePanel extends PamObserverAdapter implements PamSidePanel { * * @param e */ - public void actionPerformed(ActionEvent e) { + @Override + public void actionPerformed(ActionEvent e) { // int[] codeList = clickControl.getClickIdentifier().getCodeList(); // ClickTypeCommonParams commonParams = null; // for (int i=0; i0 && eventSpectrumTemplates !=null) { @@ -535,10 +536,10 @@ public class ClickSpectrum extends ClickDisplay implements PamObserver , PamSett if (logSpectrum == null || clickSpectrumParams.plotCepstrum != lastCepChoice || eventSpectrumTemplatesLog!=null) { double temp; logSpectrum = new double[clickLineData.length][clickLineData[0].length]; - if (eventSpectrum!=null && isViewer==true ){ + if (eventSpectrum!=null && isViewer ){ logEventSpectrum = new double[eventLineData.length][eventLineData[0].length]; } - if (eventSpectrumTemplatesLog!=null && isViewer==true ){ + if (eventSpectrumTemplatesLog!=null && isViewer ){ logTemplateSpectrum = new double[eventSpectrumTemplatesLog.length][]; } maxLogVal = 10*Math.log10(clickLineData[0][0]); @@ -554,7 +555,7 @@ public class ClickSpectrum extends ClickDisplay implements PamObserver , PamSett } //sperated this out and the spectrums can be different lengths. - if (eventLineData!=null && isViewer==true &&clickSpectrumParams.showEventInfo==true){ + if (eventLineData!=null && isViewer &&clickSpectrumParams.showEventInfo){ for (int i = 0; i < eventLineData[iChan].length; i++){ if( i ctdIterator = offlineEventDataBlock.getListIterator(0); while (ctdIterator.hasNext()) { OfflineEventDataUnit nextTrain = ctdIterator.next(); - if (ClickTrainDetection.class.isAssignableFrom(nextTrain.getClass()) == false) { + if (!ClickTrainDetection.class.isAssignableFrom(nextTrain.getClass())) { continue; } aTrain = (ClickTrainDetection) nextTrain; @@ -221,7 +215,7 @@ public class ClickTrainDetector extends PamProcess implements PamSettings { ctdIterator = getClickTrainDataBlock().getListIterator(0); while (ctdIterator.hasNext()) { OfflineEventDataUnit nextTrain = ctdIterator.next(); - if (ClickTrainDetection.class.isAssignableFrom(nextTrain.getClass()) == false) { + if (!ClickTrainDetection.class.isAssignableFrom(nextTrain.getClass())) { continue; } aTrain = (ClickTrainDetection) nextTrain; @@ -245,7 +239,7 @@ public class ClickTrainDetector extends PamProcess implements PamSettings { ctdIterator = newClickTrains.getListIterator(0); while (ctdIterator.hasNext()) { OfflineEventDataUnit nextTrain = ctdIterator.next(); - if (ClickTrainDetection.class.isAssignableFrom(nextTrain.getClass()) == false) { + if (!ClickTrainDetection.class.isAssignableFrom(nextTrain.getClass())) { continue; } aTrain = (ClickTrainDetection) nextTrain; @@ -379,6 +373,7 @@ public class ClickTrainDetector extends PamProcess implements PamSettings { RecorderTriggerData recorderTriggerData = new RecorderTriggerData(clickControl.getUnitName() + " Click Trains", 10, 120); + @Override public RecorderTriggerData getDefaultTriggerData() { return recorderTriggerData; } diff --git a/src/clickDetector/ClickTrainLogger.java b/src/clickDetector/ClickTrainLogger.java index 7373354f..8ec62f57 100644 --- a/src/clickDetector/ClickTrainLogger.java +++ b/src/clickDetector/ClickTrainLogger.java @@ -1,16 +1,14 @@ package clickDetector; +import java.sql.Types; + +import PamguardMVC.PamDataUnit; import generalDatabase.PamConnection; import generalDatabase.PamTableDefinition; import generalDatabase.PamTableItem; import generalDatabase.SQLLogging; import generalDatabase.SQLTypes; -import java.sql.Connection; -import java.sql.Types; - -import PamguardMVC.PamDataUnit; - public class ClickTrainLogger extends SQLLogging { diff --git a/src/clickDetector/ClickTrigger.java b/src/clickDetector/ClickTrigger.java index 771ce188..2fc2e097 100644 --- a/src/clickDetector/ClickTrigger.java +++ b/src/clickDetector/ClickTrigger.java @@ -29,7 +29,6 @@ import java.awt.GridLayout; import java.awt.Insets; import java.awt.Rectangle; -import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.SwingConstants; @@ -112,6 +111,7 @@ public class ClickTrigger extends ClickDisplay implements PamObserver { } + @Override public long getRequiredDataHistory(PamObservable o, Object arg) { return 0; } @@ -121,6 +121,7 @@ public class ClickTrigger extends ClickDisplay implements PamObserver { return this; } + @Override public void addData(PamObservable obs, PamDataUnit newData) { // should get here everytime there is a new raw data unit so update the // appropriate bar. @@ -159,6 +160,7 @@ public class ClickTrigger extends ClickDisplay implements PamObserver { } + @Override public String getObserverName() { return "click detector trigger display"; } @@ -180,6 +182,7 @@ public class ClickTrigger extends ClickDisplay implements PamObserver { triggerPlot.repaint(); } + @Override public void setSampleRate(float sampleRate, boolean notify) { // this.sampleRate = sampleRate; } @@ -372,7 +375,7 @@ public class ClickTrigger extends ClickDisplay implements PamObserver { 0); progressBars[i].setValue(-60); channel = PamUtils.getNthChannel(i, clickControl.clickParameters.getChannelBitmap()); - subPanel.add(BorderLayout.NORTH, new PamLabel(Integer.toString(channel), JLabel.CENTER)); + subPanel.add(BorderLayout.NORTH, new PamLabel(Integer.toString(channel), SwingConstants.CENTER)); subPanel.add(BorderLayout.CENTER, progressBars[i]); barPanel.add(subPanel); // PamColors.getInstance().registerComponent(progressBars[i], PamColor.BORDER); @@ -396,6 +399,7 @@ public class ClickTrigger extends ClickDisplay implements PamObserver { levelMeters.newSettings(); } + @Override public void removeObservable(PamObservable o) { // TODO Auto-generated method stub diff --git a/src/clickDetector/ClickWaveform.java b/src/clickDetector/ClickWaveform.java index 95706258..c9e875af 100644 --- a/src/clickDetector/ClickWaveform.java +++ b/src/clickDetector/ClickWaveform.java @@ -40,10 +40,6 @@ import java.awt.geom.Rectangle2D; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; -import clickDetector.dialogs.WaveDisplayDialog; -import clickDetector.offlineFuncs.OfflineEventDataUnit; -import clickDetector.waveCorrector.WaveCorrector; -import soundtrap.STClickControl; import Layout.PamAxis; import Layout.PamAxisPanel; import PamController.PamController; @@ -55,6 +51,10 @@ import PamView.panel.JBufferedPanel; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamObserver; +import clickDetector.dialogs.WaveDisplayDialog; +import clickDetector.offlineFuncs.OfflineEventDataUnit; +import clickDetector.waveCorrector.WaveCorrector; +import soundtrap.STClickControl; /** * Display which shows the raw click waveform. @@ -414,7 +414,7 @@ public class ClickWaveform extends ClickDisplay implements PamObserver { */ public void paintWaveform(Graphics g, Rectangle clipRect) { - if (isViewer==true){ + if (isViewer){ Graphics2D g2 = (Graphics2D) g; g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); @@ -511,10 +511,12 @@ public class ClickWaveform extends ClickDisplay implements PamObserver { return "Click Waveform Display"; } + @Override public String getObserverName() { return getName(); } + @Override public long getRequiredDataHistory(PamObservable o, Object arg) { return 0; } @@ -524,10 +526,12 @@ public class ClickWaveform extends ClickDisplay implements PamObserver { } + @Override public void removeObservable(PamObservable o) { } + @Override public void setSampleRate(float sampleRate, boolean notify) { setYScale(); } @@ -544,6 +548,7 @@ public class ClickWaveform extends ClickDisplay implements PamObserver { } + @Override public void addData(PamObservable o, PamDataUnit arg) { if (clickDisplayManager.isBAutoScroll() && !isViewer) { @@ -747,7 +752,7 @@ public class ClickWaveform extends ClickDisplay implements PamObserver { Boolean newTimeSet=WaveCorrector.showDialog(frame, clickControl, storedClick, waveMarker.markedChannel, waveMarker.markStartSample, waveMarker.markLength); //if a new time has been set then we need to make changes to other displays - if (newTimeSet==true){ + if (newTimeSet){ //TODO //display changes. //need to update bt display. diff --git a/src/clickDetector/ConcatenatedSpectrogram.java b/src/clickDetector/ConcatenatedSpectrogram.java index ad4ddc95..b36f0da3 100644 --- a/src/clickDetector/ConcatenatedSpectrogram.java +++ b/src/clickDetector/ConcatenatedSpectrogram.java @@ -1,6 +1,5 @@ package clickDetector; -import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Insets; @@ -255,7 +254,7 @@ public class ConcatenatedSpectrogram extends ClickDisplay implements PamSettings if (click == null) { return; } - if (needUpdate(click) == false) { + if (!needUpdate(click)) { return; } SuperDetection event = click.getSuperDetection(0); @@ -288,7 +287,7 @@ public class ConcatenatedSpectrogram extends ClickDisplay implements PamSettings double[][] powerSpectra = new double[nClick][nFreq]; for (int i = 0; i < nClick; i++) { PamDataUnit du = event.getSubDetection(i); - if (du instanceof ClickDetection == false) { + if (!(du instanceof ClickDetection)) { continue; } ClickDetection aClick = (ClickDetection) du; diff --git a/src/clickDetector/IDI_Display.java b/src/clickDetector/IDI_Display.java index 383fdf42..f628afd8 100644 --- a/src/clickDetector/IDI_Display.java +++ b/src/clickDetector/IDI_Display.java @@ -23,26 +23,9 @@ package clickDetector; -import Layout.PamAxis; -import Layout.PamAxisPanel; -import Layout.PamFramePlots; -import PamController.PamControlledUnitSettings; -import PamController.PamSettingManager; -import PamController.PamSettings; -import PamView.ColourArray; -import PamView.PamColors; -import PamView.panel.JBufferedPanel; -import PamView.panel.PamPanel; -import PamguardMVC.PamDataUnit; -import PamguardMVC.PamObservable; -import PamguardMVC.PamObserver; -import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; -import java.awt.FontMetrics; import java.awt.Graphics; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; import java.awt.Image; import java.awt.Insets; import java.awt.Point; @@ -58,7 +41,6 @@ import java.awt.image.FilteredImageSource; import java.awt.image.ImageFilter; import java.awt.image.ImageObserver; import java.awt.image.ReplicateScaleFilter; -import java.awt.image.WritableRaster; import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; @@ -68,14 +50,23 @@ import java.io.Serializable; import java.util.ArrayList; import java.util.Timer; import java.util.TimerTask; -import javax.sound.sampled.Line; + import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; -import javax.swing.JScrollPane; import javax.swing.JSplitPane; import javax.swing.border.EmptyBorder; -import pamMaths.PamHistogram; + +import Layout.PamAxis; +import Layout.PamAxisPanel; +import PamController.PamControlledUnitSettings; +import PamController.PamSettingManager; +import PamController.PamSettings; +import PamView.ColourArray; +import PamView.panel.JBufferedPanel; +import PamguardMVC.PamDataUnit; +import PamguardMVC.PamObservable; +import PamguardMVC.PamObserver; import soundtrap.STClickControl; /** @@ -300,7 +291,8 @@ public class IDI_Display extends ClickDisplay implements PamObserver, PamSetting } /** On new data, add ICI variable to current histogram */ - public void addData(PamObservable o, PamDataUnit arg) { + @Override + public void addData(PamObservable o, PamDataUnit arg) { ClickDetection click = (ClickDetection) arg; double ici = click.getTimeMilliseconds() - prevClickTime; @@ -354,7 +346,8 @@ public class IDI_Display extends ClickDisplay implements PamObserver, PamSetting * Timer task - executes whenever the timer hits the user-specified time bin */ class IDI_DisplayTimer extends TimerTask { - public void run() { + @Override + public void run() { /* troubleshooting - print out ici value */ // System.out.println(" *** Time triggered at " + System.currentTimeMillis()); @@ -531,16 +524,20 @@ public class IDI_Display extends ClickDisplay implements PamObserver, PamSetting r.height - insets.bottom); } - public void componentMoved(ComponentEvent e) { + @Override + public void componentMoved(ComponentEvent e) { idiInnerPanel.revalidate(); } - public void componentResized(ComponentEvent e) { + @Override + public void componentResized(ComponentEvent e) { idiInnerPanel.revalidate(); } - public void componentShown(ComponentEvent e) {} - public void componentHidden(ComponentEvent e) {} + @Override + public void componentShown(ComponentEvent e) {} + @Override + public void componentHidden(ComponentEvent e) {} } /** @@ -1055,23 +1052,28 @@ public class IDI_Display extends ClickDisplay implements PamObserver, PamSetting /* */ /* Serialization Methods */ /* */ - public Serializable getSettingsReference() { + @Override + public Serializable getSettingsReference() { return idiParams; } - public long getSettingsVersion() { + @Override + public long getSettingsVersion() { return IDI_DisplayParams.getSerialVersionUID(); } - public String getUnitName() { + @Override + public String getUnitName() { return getName(); } - public String getUnitType() { + @Override + public String getUnitType() { return getName(); } - public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { + @Override + public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { idiParams = ((IDI_DisplayParams) pamControlledUnitSettings .getSettings()).clone(); return true; diff --git a/src/clickDetector/IDI_DisplayDialog.java b/src/clickDetector/IDI_DisplayDialog.java index 1e46dee5..12602f6e 100644 --- a/src/clickDetector/IDI_DisplayDialog.java +++ b/src/clickDetector/IDI_DisplayDialog.java @@ -2,30 +2,28 @@ package clickDetector; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; +import java.awt.Insets; import java.awt.Point; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; - import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.io.File; + import javax.swing.BoxLayout; +import javax.swing.JButton; import javax.swing.JCheckBox; +import javax.swing.JFileChooser; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.border.TitledBorder; - -import PamView.dialog.PamDialog; -import PamView.dialog.PamGridBagContraints; - -import java.awt.Insets; -import java.awt.event.ItemListener; -import java.io.File; -import javax.swing.JButton; -import javax.swing.JFileChooser; import javax.swing.filechooser.FileFilter; import PamUtils.PamFileChooser; +import PamView.dialog.PamDialog; +import PamView.dialog.PamGridBagContraints; public class IDI_DisplayDialog extends PamDialog implements ItemListener, ActionListener { @@ -296,7 +294,8 @@ public class IDI_DisplayDialog extends PamDialog implements ItemListener, Actio * * @param e */ - public void itemStateChanged(ItemEvent e) { + @Override + public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { outputDirTxt.setEnabled(true); outputDirectoryButton.setEnabled(true); @@ -313,7 +312,8 @@ public class IDI_DisplayDialog extends PamDialog implements ItemListener, Actio * * @param e */ - public void actionPerformed(ActionEvent e) { + @Override + public void actionPerformed(ActionEvent e) { String currFile = outputDirTxt.getText(); JFileChooser fileChooser = new PamFileChooser(); fileChooser.setDialogTitle("Select output file..."); @@ -337,7 +337,8 @@ public class IDI_DisplayDialog extends PamDialog implements ItemListener, Actio */ private class csvFileFilter extends FileFilter { //Accept all directories and csv files. - public boolean accept(File f) { + @Override + public boolean accept(File f) { if (f.isDirectory()) { return true; } @@ -367,7 +368,8 @@ public class IDI_DisplayDialog extends PamDialog implements ItemListener, Actio } //The description of this filter - public String getDescription() { + @Override + public String getDescription() { return "Comma-Separated File (*.csv)"; } } diff --git a/src/clickDetector/NewClickOverlayGraphics.java b/src/clickDetector/NewClickOverlayGraphics.java index 1aefc608..989560cf 100644 --- a/src/clickDetector/NewClickOverlayGraphics.java +++ b/src/clickDetector/NewClickOverlayGraphics.java @@ -9,14 +9,10 @@ import java.awt.Rectangle; import PamUtils.Coordinate3d; import PamView.BasicKeyItem; import PamView.GeneralProjector; -import PamView.HoverData; -import PamView.PamColors; import PamView.PamDetectionOverlayGraphics; import PamView.PamKeyItem; import PamView.PamSymbol; -import PamView.PamOldSymbolManager; import PamView.PamSymbolType; -import PamView.GeneralProjector.ParameterType; import PamView.dialog.IconPanel; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; @@ -243,7 +239,7 @@ public class NewClickOverlayGraphics extends PamDetectionOverlayGraphics { // g.setColor(getLineColour()); // System.out.println("Set line colour to red"); ClickDetection cd = (ClickDetection) pamDetection; - if (shouldDrawOnMap(cd) == false) { + if (!shouldDrawOnMap(cd)) { return null; } // if (cd.getClickType() == 0) { diff --git a/src/clickDetector/NoiseDataBlock.java b/src/clickDetector/NoiseDataBlock.java index 2ba5059b..1bf50878 100644 --- a/src/clickDetector/NoiseDataBlock.java +++ b/src/clickDetector/NoiseDataBlock.java @@ -1,6 +1,5 @@ package clickDetector; -import PamDetection.AbstractLocalisation; import PamDetection.LocContents; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; diff --git a/src/clickDetector/OldClickClass.java b/src/clickDetector/OldClickClass.java index 31d75904..a69a809b 100644 --- a/src/clickDetector/OldClickClass.java +++ b/src/clickDetector/OldClickClass.java @@ -21,10 +21,10 @@ package clickDetector; -import clickDetector.ClickClassifiers.basic.BasicClickIdentifier; import Acquisition.AcquisitionProcess; import Array.ArrayManager; import PamUtils.PamUtils; +import clickDetector.ClickClassifiers.basic.BasicClickIdentifier; import fftManager.Complex; /** diff --git a/src/clickDetector/RainbowFile.java b/src/clickDetector/RainbowFile.java index 263d9030..666a5731 100644 --- a/src/clickDetector/RainbowFile.java +++ b/src/clickDetector/RainbowFile.java @@ -178,6 +178,7 @@ public class RainbowFile implements ClickFileStorage { /** * Open a new rainbowFile for storage. */ + @Override synchronized public boolean openClickStorage(long sampleOffset) { this.sampleOffset = sampleOffset; @@ -191,7 +192,7 @@ public class RainbowFile implements ClickFileStorage { try { AcquisitionProcess sourceProcess = (AcquisitionProcess) clickDetector.getSourceProcess(); Acquisition.DaqSystem daqSystem = sourceProcess.getAcquisitionControl().findDaqSystem(null); - if (daqSystem != null & daqSystem.isRealTime() == false) { + if (daqSystem != null & !daqSystem.isRealTime()) { // assume it's a file name. Acquisition.FileInputSystem fileSystem = (FileInputSystem) daqSystem; soundFile = fileSystem.getCurrentFile(); @@ -227,7 +228,7 @@ public class RainbowFile implements ClickFileStorage { */ public boolean openClickStorage(File oldFile) { sectionDataList.clear(); - if (oldFile.exists() == false) { + if (!oldFile.exists()) { return false; } try { @@ -253,7 +254,7 @@ public class RainbowFile implements ClickFileStorage { rsd.sectionStartTime = fileStartTime; rsd.sectionSamples = fileSamples; rsd.sectionDataPos = file.getFilePointer(); - if (ans == false) { + if (!ans) { break; } else { @@ -263,7 +264,7 @@ public class RainbowFile implements ClickFileStorage { // then cycle through clicks until a next section is met ... filePos = file.getFilePointer(); ans = readClickHeader(click); - if (ans == false) { + if (!ans) { break; } if (click.dataType == HEADER_CLICK) { @@ -285,7 +286,7 @@ public class RainbowFile implements ClickFileStorage { } } - if (ans == false) { + if (!ans) { break; } } @@ -364,6 +365,7 @@ public class RainbowFile implements ClickFileStorage { ".clk"); } + @Override synchronized public void closeClickStorage() { if (file == null) { return; @@ -385,6 +387,7 @@ public class RainbowFile implements ClickFileStorage { return sectionDataList.size(); } + @Override synchronized public boolean writeClickStructures(ClickParameters clickParameters) { if (file == null) { @@ -465,7 +468,7 @@ public class RainbowFile implements ClickFileStorage { for (int i = 0; i < 32; i++) { struct = 1< 0) { - if (readClickStructure(struct, clickParameters) == false) { + if (!readClickStructure(struct, clickParameters)) { JOptionPane.showMessageDialog(null, "Error in Click File", "Incompatible click file format. \n" + "Only use files created with PAMGUARD", JOptionPane.ERROR_MESSAGE); @@ -722,6 +725,7 @@ public class RainbowFile implements ClickFileStorage { return true; } + @Override synchronized public boolean writeClickHeader(ClickDetection click) { if (file == null) { return false; @@ -1635,7 +1639,7 @@ class WAVFILEINFO } DaqSystem daqSystem = daqProcess.getAcquisitionControl().findDaqSystem(null); if (daqSystem == null) return null; - if (daqSystem.isRealTime() == true){ + if (daqSystem.isRealTime()){ return null; } // looks like it's file or file folder. @@ -1653,6 +1657,7 @@ class WAVFILEINFO return fileSystem.getCurrentFile(); } + @Override public String getStorageName() { return fileName; } @@ -1673,7 +1678,7 @@ class WAVFILEINFO String dlgTitle = "Click Detector Rainbow File Storage"; if (file.exists() && file.isDirectory()) { return true; - } else if (file.exists() == false) { + } else if (!file.exists()) { int ans = JOptionPane.showOptionDialog(null, "Folder " + dirName + " does not exist. \nWould you like to create it ?", dlgTitle, @@ -1684,7 +1689,7 @@ class WAVFILEINFO } if (ans == JOptionPane.YES_OPTION) { try { - if (file.mkdirs() == false) { + if (!file.mkdirs()) { return checkStorage(dirName); } FileFunctions.setNonIndexingBit(file); diff --git a/src/clickDetector/TrackedClickDataBlock.java b/src/clickDetector/TrackedClickDataBlock.java index cad2af78..f0db85ad 100644 --- a/src/clickDetector/TrackedClickDataBlock.java +++ b/src/clickDetector/TrackedClickDataBlock.java @@ -1,6 +1,5 @@ package clickDetector; -import PamguardMVC.AcousticDataBlock; import PamguardMVC.PamProcess; public class TrackedClickDataBlock extends ClickDataBlock { diff --git a/src/clickDetector/TrackedClickGroupLogging.java b/src/clickDetector/TrackedClickGroupLogging.java index 90e7af9a..d9c10cb5 100644 --- a/src/clickDetector/TrackedClickGroupLogging.java +++ b/src/clickDetector/TrackedClickGroupLogging.java @@ -1,9 +1,9 @@ package clickDetector; -import generalDatabase.PamTableDefinition; -import generalDatabase.SQLTypes; import PamguardMVC.PamDataUnit; import clickDetector.offlineFuncs.OfflineEventDataUnit; +import generalDatabase.PamTableDefinition; +import generalDatabase.SQLTypes; public class TrackedClickGroupLogging extends ClickGroupLogging { diff --git a/src/clickDetector/TriggerLevelDataUnit.java b/src/clickDetector/TriggerLevelDataUnit.java index 503ae48d..f4248957 100644 --- a/src/clickDetector/TriggerLevelDataUnit.java +++ b/src/clickDetector/TriggerLevelDataUnit.java @@ -1,7 +1,6 @@ package clickDetector; import PamDetection.PamDetection; -import PamguardMVC.AcousticDataUnit; import PamguardMVC.PamDataUnit; public class TriggerLevelDataUnit extends PamDataUnit implements PamDetection { diff --git a/src/clickDetector/WignerPlot.java b/src/clickDetector/WignerPlot.java index eb6c0375..382c0874 100644 --- a/src/clickDetector/WignerPlot.java +++ b/src/clickDetector/WignerPlot.java @@ -14,15 +14,12 @@ import java.awt.event.MouseWheelEvent; import java.awt.image.BufferedImage; import java.awt.image.WritableRaster; import java.io.Serializable; -import java.util.ArrayList; import java.util.Arrays; import javax.swing.JCheckBoxMenuItem; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; -import pamMaths.WignerTransform; -import soundtrap.STClickControl; import Layout.PamAxis; import Layout.PamAxisPanel; import PamController.PamControlledUnitSettings; @@ -32,6 +29,8 @@ import PamUtils.PamUtils; import PamView.ColourArray; import PamView.panel.JBufferedPanel; import clickDetector.ClickDisplayManager.ClickDisplayInfo; +import pamMaths.WignerTransform; +import soundtrap.STClickControl; public class WignerPlot extends ClickDisplay implements PamSettings { diff --git a/src/clickDetector/WignerPlotdialog.java b/src/clickDetector/WignerPlotdialog.java index de5168a1..6be9ddc4 100644 --- a/src/clickDetector/WignerPlotdialog.java +++ b/src/clickDetector/WignerPlotdialog.java @@ -15,10 +15,10 @@ import javax.swing.JSpinner; import javax.swing.JTextField; import javax.swing.border.TitledBorder; -import fftManager.FFTLengthModel; -import fftManager.FFTLengthModeled; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; +import fftManager.FFTLengthModel; +import fftManager.FFTLengthModeled; public class WignerPlotdialog extends PamDialog implements FFTLengthModeled { diff --git a/src/clickDetector/WindowsBuffer.java b/src/clickDetector/WindowsBuffer.java index 938b5f31..8a87df7f 100644 --- a/src/clickDetector/WindowsBuffer.java +++ b/src/clickDetector/WindowsBuffer.java @@ -59,6 +59,7 @@ public class WindowsBuffer implements WriteWinFile { } + @Override public void writeWinInt(int val) throws IOException { writeWinShort(val & 0xFFFF); writeWinShort(val >> 16); @@ -71,6 +72,7 @@ public class WindowsBuffer implements WriteWinFile { return val; } + @Override public void writeWinShort(int val) throws IOException { /* * Write out low byte first @@ -86,6 +88,7 @@ public class WindowsBuffer implements WriteWinFile { return val; } + @Override public void writeByte(int b)throws IOException { writeByte((byte) b); } @@ -99,15 +102,18 @@ public class WindowsBuffer implements WriteWinFile { return bytes[offset++]; } + @Override public void writeWinFloat(float val) throws IOException { // java.lang.Float floatValue = new Float(val); int intValue = Float.floatToIntBits(val); writeWinInt(intValue); } + @Override public void writeWinDouble(double val) throws IOException { long intValue = Double.doubleToLongBits(val); writeWinLong(intValue); } + @Override public void writeWinLong(long longValue) throws IOException { writeWinInt((int) (0xFFFFFFFF & longValue)); writeWinInt((int) (0xFFFFFFFF & (longValue >> 32))); diff --git a/src/clickDetector/WindowsFile.java b/src/clickDetector/WindowsFile.java index 414a10c0..42f59d42 100644 --- a/src/clickDetector/WindowsFile.java +++ b/src/clickDetector/WindowsFile.java @@ -55,6 +55,7 @@ public class WindowsFile extends RandomAccessFile implements WriteWinFile , Read /* (non-Javadoc) * @see clickDetector.WriteWinFile#writeWinInt(int) */ + @Override public void writeWinInt(int val) throws IOException { writeWinShort(val & 0xFFFF); writeWinShort(val >> 16); @@ -64,6 +65,7 @@ public class WindowsFile extends RandomAccessFile implements WriteWinFile , Read /** * Read a Windows 32 bit integer */ + @Override public int readWinInt() throws IOException { int val = readWinShort(); if (val < 0) val+=65536; @@ -75,6 +77,7 @@ public class WindowsFile extends RandomAccessFile implements WriteWinFile , Read /* (non-Javadoc) * @see clickDetector.WriteWinFile#writeWinShort(int) */ + @Override public void writeWinShort(int val) throws IOException { /* * Write out low byte first @@ -83,6 +86,7 @@ public class WindowsFile extends RandomAccessFile implements WriteWinFile , Read writeByte(0xFF & (val >> 8)); } + @Override public int readWinShort() throws IOException { /* * Read the low byte first @@ -113,12 +117,14 @@ public class WindowsFile extends RandomAccessFile implements WriteWinFile , Read /* (non-Javadoc) * @see clickDetector.WriteWinFile#writeWinFloat(float) */ + @Override public void writeWinFloat(float val) throws IOException { // java.lang.Float floatValue = new Float(val); int intValue = Float.floatToIntBits(val); writeWinInt(intValue); } + @Override public float readWinFloat() throws IOException { int val = readWinInt(); return Float.intBitsToFloat(val); @@ -127,11 +133,13 @@ public class WindowsFile extends RandomAccessFile implements WriteWinFile , Read /* (non-Javadoc) * @see clickDetector.WriteWinFile#writeWinDouble(double) */ + @Override public void writeWinDouble(double val) throws IOException { long intValue = Double.doubleToLongBits(val); writeWinLong(intValue); } + @Override public double readWinDouble() throws IOException { long val = readWinLong(); return Double.longBitsToDouble(val); @@ -140,11 +148,13 @@ public class WindowsFile extends RandomAccessFile implements WriteWinFile , Read /* (non-Javadoc) * @see clickDetector.WriteWinFile#writeWinLong(long) */ + @Override public void writeWinLong(long longValue) throws IOException { writeWinInt((int) (0xFFFFFFFF & longValue)); writeWinInt((int) (0xFFFFFFFF & (longValue >> 32))); } + @Override public long readWinLong() throws IOException { long val = readWinInt(); val += readWinInt() << 32; diff --git a/src/clickTrainDetector/CTClassificationProcess.java b/src/clickTrainDetector/CTClassificationProcess.java index 6d3c18c1..856aeade 100644 --- a/src/clickTrainDetector/CTClassificationProcess.java +++ b/src/clickTrainDetector/CTClassificationProcess.java @@ -82,6 +82,7 @@ public class CTClassificationProcess extends PamInstantProcess { } } + @Override public void updateData(PamObservable o, PamDataUnit arg) { Debug.out.println("CTClassificationProcess: update click train classification: " + o + " " + clickTrainControl.getClickTrainDataBlock()); if (o == clickTrainControl.getClickTrainDataBlock()) { diff --git a/src/clickTrainDetector/CTDataUnit.java b/src/clickTrainDetector/CTDataUnit.java index 7048937b..4a384037 100644 --- a/src/clickTrainDetector/CTDataUnit.java +++ b/src/clickTrainDetector/CTDataUnit.java @@ -1,10 +1,8 @@ package clickTrainDetector; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; -import PamUtils.PamArrayUtils; import PamUtils.avrgwaveform.AverageWaveform; import PamguardMVC.AcousticDataUnit; import PamguardMVC.PamDataUnit; diff --git a/src/clickTrainDetector/CTLocalisationProcess.java b/src/clickTrainDetector/CTLocalisationProcess.java index ec0bc46f..fbdfc35e 100644 --- a/src/clickTrainDetector/CTLocalisationProcess.java +++ b/src/clickTrainDetector/CTLocalisationProcess.java @@ -1,18 +1,15 @@ package clickTrainDetector; import PamDetection.LocContents; -import PamUtils.PamCalendar; import PamguardMVC.PamDataUnit; import PamguardMVC.PamInstantProcess; import PamguardMVC.PamObservable; -import PamguardMVC.dataSelector.DataSelector; import PamguardMVC.debug.Debug; import annotation.localise.targetmotion.TMAnnotation; import annotation.localise.targetmotion.TMAnnotationOptions; import annotation.localise.targetmotion.TMAnnotationType; import clickTrainDetector.localisation.CTLocalisation; import clickTrainDetector.localisation.CTMAnntoationType; -import generalDatabase.SQLLogging; /** * Process which, if conditions are met, attempts to localise a click train. diff --git a/src/clickTrainDetector/ClickTrainControl.java b/src/clickTrainDetector/ClickTrainControl.java index e1b86cfe..9c4946c9 100644 --- a/src/clickTrainDetector/ClickTrainControl.java +++ b/src/clickTrainDetector/ClickTrainControl.java @@ -3,6 +3,7 @@ package clickTrainDetector; import java.awt.Frame; import java.io.Serializable; import java.util.ArrayList; + import javax.swing.JMenuItem; import PamController.PamControlledUnit; @@ -20,7 +21,6 @@ import clickTrainDetector.classification.CTClassifier; import clickTrainDetector.classification.CTClassifierManager; import clickTrainDetector.clickTrainAlgorithms.CTAlgorithmInfoManager; import clickTrainDetector.clickTrainAlgorithms.ClickTrainAlgorithm; -import clickTrainDetector.clickTrainAlgorithms.classificationRatio.RatioClickTrainAlgorithm; import clickTrainDetector.clickTrainAlgorithms.mht.MHTClickTrainAlgorithm; import clickTrainDetector.layout.CTFXGUI; import clickTrainDetector.layout.CTSwingGUI; diff --git a/src/clickTrainDetector/ClickTrainDataBlock.java b/src/clickTrainDetector/ClickTrainDataBlock.java index 9c29a9b6..dc02cf75 100644 --- a/src/clickTrainDetector/ClickTrainDataBlock.java +++ b/src/clickTrainDetector/ClickTrainDataBlock.java @@ -1,7 +1,6 @@ package clickTrainDetector; import PamUtils.PamCalendar; -import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamProcess; import PamguardMVC.dataOffline.OfflineDataLoadInfo; @@ -9,7 +8,6 @@ import PamguardMVC.dataSelector.DataSelectorCreator; import PamguardMVC.debug.Debug; import PamguardMVC.superdet.SuperDetDataBlock; import clickTrainDetector.dataselector.CTDataSelectCreator; -import generalDatabase.SuperDetLogging; import pamScrollSystem.ViewLoadObserver; /** diff --git a/src/clickTrainDetector/ClickTrainProcess.java b/src/clickTrainDetector/ClickTrainProcess.java index b3193d10..6a148c23 100644 --- a/src/clickTrainDetector/ClickTrainProcess.java +++ b/src/clickTrainDetector/ClickTrainProcess.java @@ -4,7 +4,6 @@ import PamController.PamController; import PamController.status.ProcessCheck; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; -import PamguardMVC.PamInstantProcess; import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; import clickDetector.ClickDetection; diff --git a/src/clickTrainDetector/IDIInfo.java b/src/clickTrainDetector/IDIInfo.java index da59ebd2..f197998b 100644 --- a/src/clickTrainDetector/IDIInfo.java +++ b/src/clickTrainDetector/IDIInfo.java @@ -34,14 +34,14 @@ public class IDIInfo { */ public int lastNumber = -1; - public IDIInfo() {}; + public IDIInfo() {} public IDIInfo(double medianIDI, double meanIDI, double stdIDI, int nUnits) { this.medianIDI=medianIDI; this.meanIDI=meanIDI; this.stdIDI = stdIDI; this.lastNumber=nUnits; - }; + } public void calcTimeSeriesData(List> dataUnits) { diff --git a/src/clickTrainDetector/TempCTDataUnit.java b/src/clickTrainDetector/TempCTDataUnit.java index 0bf332ad..8b4e59c8 100644 --- a/src/clickTrainDetector/TempCTDataUnit.java +++ b/src/clickTrainDetector/TempCTDataUnit.java @@ -3,8 +3,6 @@ package clickTrainDetector; import java.util.List; import PamguardMVC.PamDataUnit; -import clickTrainDetector.localisation.CTLocalisation; -import detectiongrouplocaliser.DetectionGroupDataUnit; /** * Temporary data unit for unconfirmed click trains. diff --git a/src/clipgenerator/ClipBinaryDataSource.java b/src/clipgenerator/ClipBinaryDataSource.java index 7f1a05fe..c26e3f31 100644 --- a/src/clipgenerator/ClipBinaryDataSource.java +++ b/src/clipgenerator/ClipBinaryDataSource.java @@ -14,7 +14,6 @@ import binaryFileStorage.BinaryHeader; import binaryFileStorage.BinaryObjectData; import binaryFileStorage.ModuleFooter; import binaryFileStorage.ModuleHeader; -import binaryFileStorage.PackedBinaryObject; public class ClipBinaryDataSource extends BinaryDataSource { diff --git a/src/clipgenerator/ClipControl.java b/src/clipgenerator/ClipControl.java index 51cd24fc..5e93f0f5 100644 --- a/src/clipgenerator/ClipControl.java +++ b/src/clipgenerator/ClipControl.java @@ -8,15 +8,7 @@ import java.util.ArrayList; import javax.swing.JMenu; import javax.swing.JMenuItem; -import userDisplay.UserDisplayComponent; -import userDisplay.UserDisplayControl; -import userDisplay.UserDisplayProvider; -import clipgenerator.clipDisplay.ClipDisplayDecorations; -import clipgenerator.clipDisplay.ClipDisplayPanel; -import clipgenerator.clipDisplay.ClipDisplayParent; -import clipgenerator.clipDisplay.ClipDisplayUnit; -import dataPlotsFX.data.TDDataProviderRegisterFX; -import dataPlotsFX.rawClipDataPlot.ClipPlotProviderFX; + import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; import PamController.PamController; @@ -27,6 +19,15 @@ import PamguardMVC.AcousticDataUnit; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import annotation.handler.ManualAnnotationHandler; +import clipgenerator.clipDisplay.ClipDisplayDecorations; +import clipgenerator.clipDisplay.ClipDisplayPanel; +import clipgenerator.clipDisplay.ClipDisplayParent; +import clipgenerator.clipDisplay.ClipDisplayUnit; +import dataPlotsFX.data.TDDataProviderRegisterFX; +import dataPlotsFX.rawClipDataPlot.ClipPlotProviderFX; +import userDisplay.UserDisplayComponent; +import userDisplay.UserDisplayControl; +import userDisplay.UserDisplayProvider; /** * The clip generator is used to generate short sound clips around detections. diff --git a/src/clipgenerator/ClipDataBlock.java b/src/clipgenerator/ClipDataBlock.java index 1987bb77..a5ff0e1e 100644 --- a/src/clipgenerator/ClipDataBlock.java +++ b/src/clipgenerator/ClipDataBlock.java @@ -9,7 +9,6 @@ import java.util.List; import javax.swing.JMenuItem; import PamguardMVC.PamDataUnit; -import PamguardMVC.PamProcess; import PamguardMVC.dataSelector.DataSelector; import PamguardMVC.dataSelector.DataSelectorCreator; import PamguardMVC.datamenus.DataMenuParent; @@ -71,6 +70,7 @@ public class ClipDataBlock extends ClipDisplayDataBlock { return super.getDataSelectCreator(); } + @Override public DataSelector getDataSelector(String selectorName, boolean allowScores, String selectorType) { DataSelector ds = super.getDataSelector(selectorName, allowScores, selectorType); // DataSelector newDS = super.getDataSelector("Randomuiname", allowScores, selectorType); diff --git a/src/clipgenerator/ClipDataUnit.java b/src/clipgenerator/ClipDataUnit.java index 5185cd6e..9a04e083 100644 --- a/src/clipgenerator/ClipDataUnit.java +++ b/src/clipgenerator/ClipDataUnit.java @@ -5,25 +5,22 @@ import java.awt.image.BufferedImage; import java.io.File; import java.util.ListIterator; -import fftManager.Complex; -import fftManager.FastFFT; -import wavFiles.WavFile; -import wavFiles.WavFileReader; -import wavFiles.WavHeader; import Acquisition.AcquisitionProcess; import PamController.PamController; import PamDetection.AbstractLocalisation; import PamDetection.PamDetection; import PamUtils.PamUtils; -import PamguardMVC.AcousticDataUnit; import PamguardMVC.PamConstants; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.RawDataHolder; import PamguardMVC.RawDataTransforms; - import PamguardMVC.superdet.SuperDetection; import Spectrogram.WindowFunction; +import fftManager.Complex; +import fftManager.FastFFT; +import wavFiles.WavFileReader; +import wavFiles.WavHeader; public class ClipDataUnit extends PamDataUnit implements PamDetection, RawDataHolder { @@ -264,12 +261,13 @@ public class ClipDataUnit extends PamDataUnit imple * Get all the wave data into an array. * @return the wave data or null if it can't be found. */ + @Override public double[][] getWaveData() { if (rawData != null) { return rawData; } File wavFileName = findWavFile(); - if (wavFileName == null || wavFileName.exists() == false || wavFileName.isDirectory()) { + if (wavFileName == null || !wavFileName.exists() || wavFileName.isDirectory()) { return null; } WavFileReader wavFile = null; @@ -300,7 +298,7 @@ public class ClipDataUnit extends PamDataUnit imple } File wavFileName = findWavFile(); - if (wavFileName == null || wavFileName.exists() == false) { + if (wavFileName == null || !wavFileName.exists()) { return null; } WavFileReader wavFile = null; @@ -355,7 +353,7 @@ public class ClipDataUnit extends PamDataUnit imple private File findWavFile() { try { - if (offlineFile == null || offlineFile.exists() == false) { + if (offlineFile == null || !offlineFile.exists()) { if (getParentDataBlock() == null) return null; ClipProcess clipProcess = (ClipProcess) getParentDataBlock().getParentProcess(); offlineFile = clipProcess.findClipFile(this); diff --git a/src/clipgenerator/ClipDialog.java b/src/clipgenerator/ClipDialog.java index b5e73a7b..b46f593d 100644 --- a/src/clipgenerator/ClipDialog.java +++ b/src/clipgenerator/ClipDialog.java @@ -7,6 +7,7 @@ import java.awt.GridBagLayout; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; + import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JCheckBox; @@ -82,8 +83,8 @@ public class ClipDialog extends PamDialog { if (clipSettings.dataSourceName == null) { return showWarning("No data source"); } - if (storagePanel.getParams() == false) return showWarning("Error in storage location"); - if (clipPanel.getParams() == false) return showWarning("Error in clip generator settings"); + if (!storagePanel.getParams()) return showWarning("Error in storage location"); + if (!clipPanel.getParams()) return showWarning("Error in clip generator settings"); return true; } diff --git a/src/clipgenerator/ClipDisplayDataBlock.java b/src/clipgenerator/ClipDisplayDataBlock.java index 85da272d..98d3034b 100644 --- a/src/clipgenerator/ClipDisplayDataBlock.java +++ b/src/clipgenerator/ClipDisplayDataBlock.java @@ -1,7 +1,6 @@ package clipgenerator; import PamguardMVC.AcousticDataBlock; -import PamguardMVC.PamDataBlock; import PamguardMVC.PamProcess; /** diff --git a/src/clipgenerator/ClipDisplayDialog.java b/src/clipgenerator/ClipDisplayDialog.java index d07b443b..3a9b1de2 100644 --- a/src/clipgenerator/ClipDisplayDialog.java +++ b/src/clipgenerator/ClipDisplayDialog.java @@ -7,6 +7,7 @@ import java.awt.Window; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; import PamView.dialog.PamDialog; @@ -25,7 +26,7 @@ public class ClipDisplayDialog extends PamDialog { JPanel rangePanel = new JPanel(new GridBagLayout()); rangePanel.setBorder(new TitledBorder("Map bearing lines")); GridBagConstraints c = new PamGridBagContraints(); - rangePanel.add(new JLabel("Clip trigger ", JLabel.RIGHT), c); + rangePanel.add(new JLabel("Clip trigger ", SwingConstants.RIGHT), c); c.gridx++; rangePanel.add(new JLabel("Range (m)")); rangeFields = new JTextField[clipSettings.getNumClipGenerators()]; @@ -33,7 +34,7 @@ public class ClipDisplayDialog extends PamDialog { c.gridx = 0; c.gridy++; ClipGenSetting genSet = clipSettings.getClipGenSetting(i); - rangePanel.add(new JLabel(genSet.dataName, JLabel.RIGHT), c); + rangePanel.add(new JLabel(genSet.dataName, SwingConstants.RIGHT), c); c.gridx++; rangePanel.add(rangeFields[i] = new JTextField(4), c); rangeFields[i].setText(String.format("%3.1f", genSet.mapLineLength)); diff --git a/src/clipgenerator/ClipGenSetting.java b/src/clipgenerator/ClipGenSetting.java index eb0dd0e0..8268c354 100644 --- a/src/clipgenerator/ClipGenSetting.java +++ b/src/clipgenerator/ClipGenSetting.java @@ -102,7 +102,7 @@ public class ClipGenSetting implements Serializable, Cloneable, ManagedParameter try { ClipGenSetting newObj = (ClipGenSetting) super.clone(); // force map line length to 1000m for old objects. - if (newObj.hadMapLine == false) { + if (!newObj.hadMapLine) { newObj.hadMapLine = true; newObj.mapLineLength = 1000.; } diff --git a/src/clipgenerator/ClipGenSettingDialog.java b/src/clipgenerator/ClipGenSettingDialog.java index ac6ec4de..6b059799 100644 --- a/src/clipgenerator/ClipGenSettingDialog.java +++ b/src/clipgenerator/ClipGenSettingDialog.java @@ -18,7 +18,6 @@ import javax.swing.border.TitledBorder; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; -import PamguardMVC.PamDataBlock; public class ClipGenSettingDialog extends PamDialog { diff --git a/src/clipgenerator/ClipOverlayGraphics.java b/src/clipgenerator/ClipOverlayGraphics.java index 88a4f8eb..186f9c06 100644 --- a/src/clipgenerator/ClipOverlayGraphics.java +++ b/src/clipgenerator/ClipOverlayGraphics.java @@ -9,30 +9,21 @@ import java.awt.Rectangle; import java.awt.Stroke; import java.awt.Window; import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.nio.MappedByteBuffer; -import javax.imageio.ImageIO; - -import pamguard.Pamguard; -import fftManager.FFTDataBlock; import PamController.PamController; import PamView.ColourArray; import PamView.GeneralProjector; -import PamView.PamColors; +import PamView.GeneralProjector.ParameterType; import PamView.PamDetectionOverlayGraphics; import PamView.PamKeyItem; import PamView.PamSymbol; import PamView.PamSymbolType; -import PamView.PanelOverlayDraw; -import PamView.GeneralProjector.ParameterType; import PamView.symbol.SymbolData; import PamguardMVC.PamDataUnit; import Spectrogram.DirectDrawProjector; import Spectrogram.SpectrogramDisplay; import Spectrogram.SpectrogramParameters; +import fftManager.FFTDataBlock; public class ClipOverlayGraphics extends PamDetectionOverlayGraphics { diff --git a/src/clipgenerator/ClipProcess.java b/src/clipgenerator/ClipProcess.java index 112281e3..f9d1ba2a 100644 --- a/src/clipgenerator/ClipProcess.java +++ b/src/clipgenerator/ClipProcess.java @@ -9,17 +9,6 @@ import java.util.ListIterator; import javax.sound.sampled.AudioFormat; -import networkTransfer.receive.BuoyStatusDataUnit; -import soundPlayback.ClipPlayback; -import warnings.PamWarning; -import warnings.WarningSystem; -import clipgenerator.clipDisplay.ClipSymbolManager; -import clipgenerator.localisation.ClipDelays; -import clipgenerator.localisation.ClipLocalisation; -import dataPlotsFX.layout.TDGraphFX; -import fftManager.FFTDataBlock; -import wavFiles.Wav16AudioFormat; -import wavFiles.WavFileWriter; import Localiser.algorithms.Correlations; import Localiser.algorithms.timeDelayLocalisers.bearingLoc.BearingLocaliser; import Localiser.algorithms.timeDelayLocalisers.bearingLoc.BearingLocaliserSelector; @@ -37,8 +26,18 @@ import PamguardMVC.PamObserverAdapter; import PamguardMVC.PamRawDataBlock; import PamguardMVC.RawDataUnavailableException; import Spectrogram.SpectrogramDisplay; +import Spectrogram.SpectrogramMarkObserver; import Spectrogram.SpectrogramMarkProcess; import annotation.handler.ManualAnnotationHandler; +import clipgenerator.clipDisplay.ClipSymbolManager; +import clipgenerator.localisation.ClipDelays; +import clipgenerator.localisation.ClipLocalisation; +import dataPlotsFX.layout.TDGraphFX; +import networkTransfer.receive.BuoyStatusDataUnit; +import soundPlayback.ClipPlayback; +import warnings.PamWarning; +import wavFiles.Wav16AudioFormat; +import wavFiles.WavFileWriter; /** * Process for making short clips of audio data. @@ -182,7 +181,7 @@ public class ClipProcess extends SpectrogramMarkProcess { String path = getClipFileFolder(clipDataUnit.getTimeMilliseconds(), true); path += clipDataUnit.fileName; File aFile = new File(path); - if (aFile.exists() == false) { + if (!aFile.exists()) { return null; } return aFile; @@ -203,7 +202,7 @@ public class ClipProcess extends SpectrogramMarkProcess { // now check that that folder exists. File folder = FileFunctions.createNonIndexedFolder(folderName); - if (folder == null || folder.exists() == false) { + if (folder == null || !folder.exists()) { return null; } } @@ -263,7 +262,7 @@ public class ClipProcess extends SpectrogramMarkProcess { /** * Called when a manual mark is made on the spectrogram display. */ - if (downUp == SpectrogramMarkProcess.MOUSE_DOWN) { + if (downUp == SpectrogramMarkObserver.MOUSE_DOWN) { // REMOVE THIS CHECK - ClipGenerator already knows the raw data source, set in the parameters. So it doesn't need to worry about whether the FFT source is actually beamformer data // // do a quick check here of the source. If the fft has sequence numbers, the channels are ambiguous and Rocca can't use it. warn the user and exit // FFTDataBlock source = display.getSourceFFTDataBlock(); @@ -282,7 +281,7 @@ public class ClipProcess extends SpectrogramMarkProcess { specMouseDowntime = startMilliseconds; return false; } - else if (downUp == SpectrogramMarkProcess.MOUSE_DRAG) { + else if (downUp == SpectrogramMarkObserver.MOUSE_DRAG) { return false; } else { @@ -406,7 +405,7 @@ public class ClipProcess extends SpectrogramMarkProcess { clipGenSetting = clipControl.clipSettings.getClipGenSetting(i); - if (clipGenSetting.enable == false) { + if (!clipGenSetting.enable) { continue; } if (i == 0) { diff --git a/src/clipgenerator/ClipSpectrogram.java b/src/clipgenerator/ClipSpectrogram.java index 9c7e9903..ab9b245a 100644 --- a/src/clipgenerator/ClipSpectrogram.java +++ b/src/clipgenerator/ClipSpectrogram.java @@ -6,7 +6,6 @@ import java.util.Arrays; import PamUtils.complex.ComplexArray; import PamguardMVC.PamDataUnit; import Spectrogram.WindowFunction; -import clickDetector.ClickDetection; import fftManager.FastFFT; /** diff --git a/src/clipgenerator/ClipSpectrogramMark.java b/src/clipgenerator/ClipSpectrogramMark.java index 8d036900..65ba4161 100644 --- a/src/clipgenerator/ClipSpectrogramMark.java +++ b/src/clipgenerator/ClipSpectrogramMark.java @@ -1,7 +1,6 @@ package clipgenerator; import PamDetection.PamDetection; -import PamguardMVC.AcousticDataUnit; import PamguardMVC.PamDataUnit; import PamguardMVC.superdet.SuperDetection; diff --git a/src/cpod/CPODBinaryStore.java b/src/cpod/CPODBinaryStore.java index 9cff8285..15a9c3b4 100644 --- a/src/cpod/CPODBinaryStore.java +++ b/src/cpod/CPODBinaryStore.java @@ -9,7 +9,6 @@ import java.io.IOException; import PamguardMVC.DataUnitBaseData; import PamguardMVC.PamDataUnit; -import PamguardMVC.RawDataTransforms; import binaryFileStorage.BinaryDataSource; import binaryFileStorage.BinaryHeader; import binaryFileStorage.BinaryObjectData; @@ -150,7 +149,7 @@ public class CPODBinaryStore extends BinaryDataSource { dos.writeInt(cd.getRawData().length); for (int i=0; i { diff --git a/src/d3/D3SensorInfo.java b/src/d3/D3SensorInfo.java index 65c198e1..4feca13c 100644 --- a/src/d3/D3SensorInfo.java +++ b/src/d3/D3SensorInfo.java @@ -6,10 +6,12 @@ import java.io.IOException; import java.net.URL; import java.util.Arrays; import java.util.List; -import d3.calibration.CalibrationInfo; + import com.opencsv.CSVReader; import com.opencsv.exceptions.CsvException; +import d3.calibration.CalibrationInfo; + /** * Class to hold various types of information about a sensor. * @author Doug Gillespie diff --git a/src/d3/D3XMLFile.java b/src/d3/D3XMLFile.java index ed786c86..31f5f01a 100644 --- a/src/d3/D3XMLFile.java +++ b/src/d3/D3XMLFile.java @@ -60,7 +60,7 @@ public class D3XMLFile { if (end == null) { return null; } - if (end.equalsIgnoreCase("wav") == false && end.equalsIgnoreCase("xml") == false) { + if (!end.equalsIgnoreCase("wav") && !end.equalsIgnoreCase("xml")) { return null; } String xmlFileName = wavFileName.replace(".wav", ".xml"); @@ -70,7 +70,7 @@ public class D3XMLFile { // return null; // } File xmlFile = new File(xmlFileName); - if (xmlFile.exists() == false) { + if (!xmlFile.exists()) { return null; } /* @@ -204,7 +204,7 @@ public class D3XMLFile { } } catch (Exception e) { - System.out.println("Error unpacking device Id: " + fullId);; + System.out.println("Error unpacking device Id: " + fullId); return false; } return true; diff --git a/src/dataGram/Datagram.java b/src/dataGram/Datagram.java index eaafcf3f..d60e8e32 100644 --- a/src/dataGram/Datagram.java +++ b/src/dataGram/Datagram.java @@ -10,7 +10,6 @@ import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet.ParameterSetType; import binaryFileStorage.BinaryTypes; - import dataMap.OfflineDataMapPoint; /** diff --git a/src/dataGram/DatagramDialog.java b/src/dataGram/DatagramDialog.java index 952884ba..0b755c36 100644 --- a/src/dataGram/DatagramDialog.java +++ b/src/dataGram/DatagramDialog.java @@ -7,8 +7,8 @@ import java.awt.Window; import javax.swing.JLabel; import javax.swing.JPanel; -import javax.swing.JTextArea; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; import PamView.dialog.PamDialog; @@ -43,11 +43,11 @@ public class DatagramDialog extends PamDialog { // infoArea.setWrapStyleWord(true); JPanel tPanel = new JPanel(new GridBagLayout()); GridBagConstraints c = new PamGridBagContraints(); - addComponent(tPanel, new JLabel("Datagram bin size ", JLabel.RIGHT), c); + addComponent(tPanel, new JLabel("Datagram bin size ", SwingConstants.RIGHT), c); c.gridx++; addComponent(tPanel, datagramSeconds = new JTextField(5), c); c.gridx++; - addComponent(tPanel, new JLabel(" seconds", JLabel.LEFT), c); + addComponent(tPanel, new JLabel(" seconds", SwingConstants.LEFT), c); mainPanel.add(BorderLayout.CENTER, tPanel); diff --git a/src/dataGram/DatagramManager.java b/src/dataGram/DatagramManager.java index d82f79dd..c684b7a6 100644 --- a/src/dataGram/DatagramManager.java +++ b/src/dataGram/DatagramManager.java @@ -9,18 +9,11 @@ import java.util.ListIterator; import javax.swing.JOptionPane; import javax.swing.SwingWorker; -import javafx.concurrent.Task; -import pamViewFX.pamTask.PamTaskUpdate; -import pamViewFX.pamTask.SimplePamTaskUpdate; -import pamguard.GlobalArguments; -import dataMap.OfflineDataMap; -import dataMap.OfflineDataMapPoint; -import binaryFileStorage.BinaryOfflineDataMap; -import binaryFileStorage.BinaryOfflineDataMapPoint; import PamController.AWTScheduler; import PamController.OfflineDataStore; import PamController.PamControlledUnitSettings; import PamController.PamController; +import PamController.PamControllerInterface; import PamController.PamGUIManager; import PamController.PamSettingManager; import PamController.PamSettings; @@ -28,6 +21,14 @@ import PamView.CancelObserver; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.dataOffline.OfflineDataLoadInfo; +import binaryFileStorage.BinaryOfflineDataMap; +import binaryFileStorage.BinaryOfflineDataMapPoint; +import dataMap.OfflineDataMap; +import dataMap.OfflineDataMapPoint; +import javafx.concurrent.Task; +import pamViewFX.pamTask.PamTaskUpdate; +import pamViewFX.pamTask.SimplePamTaskUpdate; +import pamguard.GlobalArguments; public class DatagramManager { @@ -73,7 +74,7 @@ public class DatagramManager { /** * Check to see if any of the blocks have an existing datagram */ - if (datagramSettings.validDatagramSettings == false && isBatch == false) { + if (!datagramSettings.validDatagramSettings && !isBatch) { /* * this is the first time this has been run, so ask * the user what datagram size they want. @@ -242,7 +243,7 @@ public class DatagramManager { dmp = it.next(); datagram = dmp.getDatagram(); if (datagram == null || datagram.getIntervalSeconds() != datagramSettings.datagramSeconds) { - nToUpdate++;; + nToUpdate++; } } updateProgress(new DatagramProgress(DatagramProgress.STATUS_STARTINGBLOCK, pamDataBlock, nToUpdate)); @@ -359,8 +360,8 @@ public class DatagramManager { @Override protected void done() { //notify datamap that a load has occured - updateProgress(new DatagramProgress(DatagramProgress.STATUS_DONE, 1, 1)); - PamController.getInstance().notifyModelChanged(PamController.DATA_LOAD_COMPLETE); + updateProgress(new DatagramProgress(PamTaskUpdate.STATUS_DONE, 1, 1)); + PamController.getInstance().notifyModelChanged(PamControllerInterface.DATA_LOAD_COMPLETE); } @Override @@ -420,7 +421,7 @@ public class DatagramManager { dmp = it.next(); datagram = dmp.getDatagram(); if (datagram == null || datagram.getIntervalSeconds() != datagramSettings.datagramSeconds) { - nToUpdate++;; + nToUpdate++; } } publish(new DatagramProgress(DatagramProgress.STATUS_STARTINGBLOCK, pamDataBlock, nToUpdate)); @@ -616,7 +617,7 @@ public class DatagramManager { float[] data; while (iterator.hasNext()) { mapPoint = iterator.next(); - if (DatagramPoint.class.isAssignableFrom(mapPoint.getClass()) == false) { + if (!DatagramPoint.class.isAssignableFrom(mapPoint.getClass())) { continue; } datagramPoint = (DatagramPoint) mapPoint; @@ -737,7 +738,7 @@ public class DatagramManager { imageStart = mapPoint.getStartTime(); } imageEnd = mapPoint.getEndTime(); - if (DatagramPoint.class.isAssignableFrom(mapPoint.getClass()) == false) { + if (!DatagramPoint.class.isAssignableFrom(mapPoint.getClass())) { continue; } datagramPoint = (DatagramPoint) mapPoint; @@ -808,7 +809,7 @@ public class DatagramManager { @Override public long getSettingsVersion() { - return datagramSettings.serialVersionUID; + return DatagramSettings.serialVersionUID; } @Override diff --git a/src/dataGram/DatagramProgress.java b/src/dataGram/DatagramProgress.java index 3fedf3b8..f5dcea6f 100644 --- a/src/dataGram/DatagramProgress.java +++ b/src/dataGram/DatagramProgress.java @@ -1,10 +1,10 @@ package dataGram; +import PamguardMVC.PamDataBlock; +import binaryFileStorage.BinaryOfflineDataMapPoint; import dataMap.OfflineDataMapPoint; import javafx.scene.control.ProgressIndicator; import pamViewFX.pamTask.PamTaskUpdate; -import PamguardMVC.PamDataBlock; -import binaryFileStorage.BinaryOfflineDataMapPoint; /** * Progress data on datagram creation diff --git a/src/dataGram/DatagramProgressDialog.java b/src/dataGram/DatagramProgressDialog.java index c1e8103f..19d87794 100644 --- a/src/dataGram/DatagramProgressDialog.java +++ b/src/dataGram/DatagramProgressDialog.java @@ -10,9 +10,9 @@ import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.border.TitledBorder; -import binaryFileStorage.BinaryOfflineDataMapPoint; import PamView.CancelObserver; import PamView.dialog.PamDialog; +import binaryFileStorage.BinaryOfflineDataMapPoint; public class DatagramProgressDialog extends PamDialog { diff --git a/src/dataMap/DataMapControl.java b/src/dataMap/DataMapControl.java index af4de85e..74196677 100644 --- a/src/dataMap/DataMapControl.java +++ b/src/dataMap/DataMapControl.java @@ -7,10 +7,6 @@ import java.util.ArrayList; import javax.swing.SwingUtilities; -import pamScrollSystem.AbstractScrollManager; -import generalDatabase.DBControlUnit; -import binaryFileStorage.BinaryStore; -import dataMap.layoutFX.DataMapGUIFX; import PamController.OfflineDataStore; import PamController.PamControlledUnit; import PamController.PamControlledUnitGUI; @@ -26,6 +22,10 @@ import PamView.PamView; import PamView.WrapperControlledGUISwing; import PamguardMVC.PamConstants; import PamguardMVC.PamDataBlock; +import binaryFileStorage.BinaryStore; +import dataMap.layoutFX.DataMapGUIFX; +import generalDatabase.DBControlUnit; +import pamScrollSystem.AbstractScrollManager; /** * The data map appears only during PAMGUARD viewer mode and is the root of @@ -402,6 +402,7 @@ public class DataMapControl extends PamControlledUnit implements PamSettings { * @param flag. The GUI type flag defined in PAMGuiManager. * @return the GUI for the PamControlledUnit unit. */ + @Override public PamControlledUnitGUI getGUI(int flag) { if (flag==PamGUIManager.FX) { if (dataGramGUIFX ==null) { diff --git a/src/dataMap/DataStreamPanel.java b/src/dataMap/DataStreamPanel.java index 275be1f5..54a5a607 100644 --- a/src/dataMap/DataStreamPanel.java +++ b/src/dataMap/DataStreamPanel.java @@ -2,9 +2,7 @@ package dataMap; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Font; import java.awt.Graphics; -import java.awt.Insets; import java.awt.Polygon; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -23,19 +21,11 @@ import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.SwingConstants; import javax.swing.SwingUtilities; -import javax.swing.border.EmptyBorder; -import dataGram.DatagramImageData; -import dataGram.DatagramManager; -import dataGram.DatagramProvider; -import dataGram.DatagramScaleInformation; -import binaryFileStorage.BinaryOfflineDataMap; -import binaryFileStorage.BinaryStore; import Layout.PamAxis; import PamController.OfflineDataStore; import PamController.PamController; import PamUtils.PamCalendar; -import PamUtils.PamUtils; import PamView.ColourArray; import PamView.PamColors; import PamView.PamColors.PamColor; @@ -45,6 +35,12 @@ import PamView.panel.JPanelWithPamKey; import PamView.panel.KeyPanel; import PamView.panel.PamPanel; import PamguardMVC.PamDataBlock; +import binaryFileStorage.BinaryOfflineDataMap; +import binaryFileStorage.BinaryStore; +import dataGram.DatagramImageData; +import dataGram.DatagramManager; +import dataGram.DatagramProvider; +import dataGram.DatagramScaleInformation; /** * Panelette to go into the main DataPanel to show the data for a single data @@ -157,7 +153,7 @@ public class DataStreamPanel extends JPanel implements DataMapObserver { public void autoHide() { getTotalDatas(); - setGraphVisible(totalDatas > 0 || dataMapControl.isViewer() == false); + setGraphVisible(totalDatas > 0 || !dataMapControl.isViewer()); } protected void sortScales() { @@ -680,7 +676,7 @@ public class DataStreamPanel extends JPanel implements DataMapObserver { } int xStart = getXCoord(dataStart); int xEnd = getXCoord(dataEnd); - if (hasDatagram == false) { + if (!hasDatagram) { g.setColor(Color.MAGENTA); } else { g.setColor(Color.DARK_GRAY); @@ -915,7 +911,7 @@ public class DataStreamPanel extends JPanel implements DataMapObserver { @Override public void actionPerformed(ActionEvent e) { showDatagram = showDatagramMenu.isSelected(); - if (showDatagram == false) { + if (!showDatagram) { showDataCounts = true; } repaintAll(); @@ -926,7 +922,7 @@ public class DataStreamPanel extends JPanel implements DataMapObserver { @Override public void actionPerformed(ActionEvent e) { showDataCounts = showDataCountsMenu.isSelected(); - if (showDataCounts == false) { + if (!showDataCounts) { showDatagram = true; } repaintAll(); @@ -1077,14 +1073,14 @@ public class DataStreamPanel extends JPanel implements DataMapObserver { * @return */ private DatagramScaleInformation findDatagramScaleInfo() { - if (hasDatagram == false) { + if (!hasDatagram) { return null; } DatagramProvider dp = dataBlock.getDatagramProvider(); if (dp == null) { return null; } - if (showDatagram == false) { + if (!showDatagram) { return null; } return dp.getScaleInformation(); diff --git a/src/dataMap/OfflineDataMap.java b/src/dataMap/OfflineDataMap.java index 52282d1e..d9fed3ee 100644 --- a/src/dataMap/OfflineDataMap.java +++ b/src/dataMap/OfflineDataMap.java @@ -8,7 +8,6 @@ import java.util.List; import java.util.ListIterator; import PamController.OfflineDataStore; -import PamUtils.PamCalendar; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; diff --git a/src/dataMap/ScrollingDataPanel.java b/src/dataMap/ScrollingDataPanel.java index 04b42aa8..7f98cbca 100644 --- a/src/dataMap/ScrollingDataPanel.java +++ b/src/dataMap/ScrollingDataPanel.java @@ -13,7 +13,6 @@ import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; import java.util.ArrayList; -import javax.swing.BorderFactory; import javax.swing.BoxLayout; import javax.swing.JPanel; import javax.swing.JScrollBar; @@ -282,7 +281,7 @@ public class ScrollingDataPanel extends PamBorderPanel { DataStreamPanel dsp; for (int i = 0; i < dataStreamPanels.size(); i++) { dsp = dataStreamPanels.get(i); - if (dsp.isGraphVisible() == false) { + if (!dsp.isGraphVisible()) { continue; } thatPt = dsp.getDataGraph().getLocationOnScreen(); diff --git a/src/dataMap/SettingsStrip.java b/src/dataMap/SettingsStrip.java index 45bbbc15..c44bd0be 100644 --- a/src/dataMap/SettingsStrip.java +++ b/src/dataMap/SettingsStrip.java @@ -24,7 +24,6 @@ import PamController.UsedModuleInfo; import PamModel.SMRUEnable; import PamUtils.PamCalendar; import PamView.PamColors; -import PamView.PamGui; import PamView.PamSymbol; import PamView.PamSymbolType; import PamView.dialog.warn.WarnOnce; @@ -225,10 +224,10 @@ public class SettingsStrip extends JPanelWithPamKey { available = false; } have = (pamController.findControlledUnit(moduleClass, aModuleInfo.unitName) != null); - if (available == false) { + if (!available) { str += String.format("

%s (unavailable)", aModuleInfo.unitName); } - else if (have == false) { + else if (!have) { str += String.format("

%s (not present)", aModuleInfo.unitName); } else { diff --git a/src/dataMap/SummaryPanel.java b/src/dataMap/SummaryPanel.java index 5786a331..c48994da 100644 --- a/src/dataMap/SummaryPanel.java +++ b/src/dataMap/SummaryPanel.java @@ -134,7 +134,7 @@ public class SummaryPanel extends HidingDialogComponent { } else { String str = PamCalendar.formatDateTime2(timeMillis, true); - if (CalendarControl.getInstance().isUTC() == false) { + if (!CalendarControl.getInstance().isUTC()) { str += String.format("%s (%s UTC)", CalendarControl.getInstance().getTZCode(true), PamCalendar.formatDateTime2(timeMillis, false)); } cursorPos.setText(str); diff --git a/src/dataModelFX/DataModelConnectPane.java b/src/dataModelFX/DataModelConnectPane.java index a7315723..bf3f02cf 100644 --- a/src/dataModelFX/DataModelConnectPane.java +++ b/src/dataModelFX/DataModelConnectPane.java @@ -12,9 +12,9 @@ import javafx.geometry.Point2D; import javafx.scene.input.DragEvent; import javafx.scene.input.Dragboard; import javafx.scene.input.TransferMode; -import pamViewFX.fxNodes.connectionPane.StandardConnectionNode; import pamViewFX.fxNodes.connectionPane.ConnectionNode; import pamViewFX.fxNodes.connectionPane.ConnectionPane; +import pamViewFX.fxNodes.connectionPane.StandardConnectionNode; /** * Sub class of ConnectionPane to deal with modules being dragged from diff --git a/src/dataModelFX/DataModelModulePane.java b/src/dataModelFX/DataModelModulePane.java index bedd9763..1734a12e 100644 --- a/src/dataModelFX/DataModelModulePane.java +++ b/src/dataModelFX/DataModelModulePane.java @@ -27,8 +27,8 @@ import pamViewFX.fxNodes.PamTilePane; import pamViewFX.fxNodes.PamTitledPane; import pamViewFX.fxNodes.PamVBox; import pamViewFX.fxNodes.connectionPane.structures.ConnectionGroupBody; -import pamViewFX.fxStyles.PamStylesManagerFX; import pamViewFX.fxNodes.connectionPane.structures.ExtensionSocketStructure; +import pamViewFX.fxStyles.PamStylesManagerFX; /** * A pane which shows a list of all the available modules. These can be dragged diff --git a/src/dataModelFX/DataModelPaneFX.java b/src/dataModelFX/DataModelPaneFX.java index 74635850..42b6cda9 100644 --- a/src/dataModelFX/DataModelPaneFX.java +++ b/src/dataModelFX/DataModelPaneFX.java @@ -6,22 +6,6 @@ import java.util.List; import org.controlsfx.glyphfont.Glyph; -import pamViewFX.PamGuiTabFX; -import pamViewFX.fxNodes.PamBorderPane; -import pamViewFX.fxNodes.PamButton; -import pamViewFX.fxNodes.PamSplitPane; -import pamViewFX.fxNodes.connectionPane.ConnectionNode; -import pamViewFX.fxNodes.connectionPane.ConnectionPane; -import pamViewFX.fxNodes.connectionPane.StandardConnectionNode; -import pamViewFX.fxNodes.connectionPane.StandardConnectionPlug; -import pamViewFX.fxNodes.connectionPane.structures.ConnectionGroupStructure; -import pamViewFX.fxNodes.connectionPane.structures.ConnectionStructure; -import pamViewFX.fxStyles.PamStylesManagerFX; -import javafx.beans.property.ObjectProperty; -import javafx.geometry.Orientation; -import javafx.scene.control.SplitPane; -import javafx.scene.layout.Region; -import javafx.scene.paint.Color; import PamController.PamControlledUnit; import PamController.PamController; import PamController.PamControllerInterface; @@ -33,6 +17,21 @@ import dataModelFX.DataModelModulePane.ModuleRectangle; import dataModelFX.DataModelModulePane.StructureRectangle; import dataModelFX.connectionNodes.ConnectionNodeFactory; import dataModelFX.connectionNodes.ModuleConnectionNode; +import javafx.beans.property.ObjectProperty; +import javafx.geometry.Orientation; +import javafx.scene.control.SplitPane; +import javafx.scene.layout.Region; +import javafx.scene.paint.Color; +import pamViewFX.PamGuiTabFX; +import pamViewFX.fxNodes.PamBorderPane; +import pamViewFX.fxNodes.PamButton; +import pamViewFX.fxNodes.PamSplitPane; +import pamViewFX.fxNodes.connectionPane.ConnectionNode; +import pamViewFX.fxNodes.connectionPane.ConnectionPane; +import pamViewFX.fxNodes.connectionPane.StandardConnectionNode; +import pamViewFX.fxNodes.connectionPane.StandardConnectionPlug; +import pamViewFX.fxNodes.connectionPane.structures.ConnectionGroupStructure; +import pamViewFX.fxNodes.connectionPane.structures.ConnectionStructure; /** * The data model pane allows users to change PAMGuard's data model. diff --git a/src/dataModelFX/ModuleNodeParams.java b/src/dataModelFX/ModuleNodeParams.java index db138fc2..b1099655 100644 --- a/src/dataModelFX/ModuleNodeParams.java +++ b/src/dataModelFX/ModuleNodeParams.java @@ -117,6 +117,7 @@ public class ModuleNodeParams extends UsedModuleInfo implements ConnectionNodePa this.connectionNodeType= connectionnoNodeType; } + @Override public PAMConnectionNodeType getNodeType() { return connectionNodeType; } diff --git a/src/dataPlots/HidingControlPanel.java b/src/dataPlots/HidingControlPanel.java index 1d2d23ad..3b97d39e 100644 --- a/src/dataPlots/HidingControlPanel.java +++ b/src/dataPlots/HidingControlPanel.java @@ -12,7 +12,6 @@ import java.util.ArrayList; import javax.swing.JButton; import javax.swing.JCheckBox; -import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JMenu; import javax.swing.JMenuItem; @@ -20,16 +19,15 @@ import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.border.TitledBorder; +import PamView.dialog.PamDialog; +import PamView.hidingpanel.HidingGridBagContraints; +import PamView.panel.PamPanel; import dataPlots.data.TDDataInfo; import dataPlots.data.TDDataProvider; import dataPlots.data.TDDataProviderRegister; import dataPlots.data.TDInfoMonitor; import dataPlots.layout.TDGraph; -import pamScrollSystem.PamScroller; -import PamView.dialog.PamDialog; -import PamView.hidingpanel.HidingDialogComponent; -import PamView.hidingpanel.HidingGridBagContraints; -import PamView.panel.PamPanel; +import pamScrollSystem.AbstractPamScrollerAWT; public class HidingControlPanel extends PamPanel { @@ -79,7 +77,7 @@ public class HidingControlPanel extends PamPanel { c.gridy = 0; graphPanel.add(new JLabel(" Configure graphs: "),c); - vertical.setSelected(tdControl.getTdParameters().orientation == PamScroller.VERTICAL); + vertical.setSelected(tdControl.getTdParameters().orientation == AbstractPamScrollerAWT.VERTICAL); checkGraphButtons(); } @@ -140,7 +138,7 @@ public class HidingControlPanel extends PamPanel { private class Vertical implements ActionListener { @Override public void actionPerformed(ActionEvent arg0) { - tdControl.getTdParameters().orientation = (vertical.isSelected() ? PamScroller.VERTICAL : PamScroller.HORIZONTAL); + tdControl.getTdParameters().orientation = (vertical.isSelected() ? AbstractPamScrollerAWT.VERTICAL : AbstractPamScrollerAWT.HORIZONTAL); tdControl.layoutGraphs(); } } diff --git a/src/dataPlots/TDControl.java b/src/dataPlots/TDControl.java index c05e94db..5484756b 100644 --- a/src/dataPlots/TDControl.java +++ b/src/dataPlots/TDControl.java @@ -8,6 +8,16 @@ import java.util.ArrayList; import javax.swing.JCheckBox; import javax.swing.JLayeredPane; +import PamController.PamControlledUnitSettings; +import PamController.PamController; +import PamController.PamSettingManager; +import PamController.PamSettings; +import PamView.hidingpanel.HidingPanel; +import PamView.panel.CornerLayoutContraint; +import PamguardMVC.PamObservable; +import PamguardMVC.PamObserver; +import PamguardMVC.PamObserverAdapter; +import PamguardMVC.PamRawDataBlock; import dataPlots.layout.GraphParameters; import dataPlots.layout.TDAxes; import dataPlots.layout.TDGraph; @@ -18,17 +28,6 @@ import pamScrollSystem.PamScrollObserver; import pamScrollSystem.PamScroller; import pamScrollSystem.RangeSpinner; import pamScrollSystem.RangeSpinnerListener; -import PamController.PamControlledUnitSettings; -import PamController.PamController; -import PamController.PamSettingManager; -import PamController.PamSettings; -import PamView.hidingpanel.HidingPanel; -import PamView.panel.CornerLayoutContraint; -import PamguardMVC.PamDataUnit; -import PamguardMVC.PamObservable; -import PamguardMVC.PamObserver; -import PamguardMVC.PamObserverAdapter; -import PamguardMVC.PamRawDataBlock; import userDisplay.UserDisplayComponentAdapter; public class TDControl extends UserDisplayComponentAdapter implements PamSettings { @@ -239,7 +238,7 @@ public class TDControl extends UserDisplayComponentAdapter implements PamSetting // return; // } // key - if (pauseButton.isSelected() == false) { + if (!pauseButton.isSelected()) { long oldPos = getTimeScroller().getValueMillis(); // if (Math.abs(scrollPos-oldPos) == 0) return; getTimeScroller().setValueMillis(scrollPos); @@ -279,7 +278,7 @@ public class TDControl extends UserDisplayComponentAdapter implements PamSetting tdAxes.getTimeRangePanel().remove(timeRangeSpinner.getComponent()); } PamScroller scroller = createScroller(); - if (tdParameters.orientation == PamScroller.HORIZONTAL) { + if (tdParameters.orientation == AbstractPamScrollerAWT.HORIZONTAL) { tdAxes.getAxisInnerPanel().add(BorderLayout.SOUTH, scroller.getComponent()); timeScroller.addControl(timeRangeSpinner.getComponent()); } @@ -290,7 +289,7 @@ public class TDControl extends UserDisplayComponentAdapter implements PamSetting // tdAxes.getLayeredPane().add(timeRangeSpinner.getComponent(), c, JLayeredPane.DEFAULT_LAYER); tdAxes.getTimeRangePanel().add(timeRangeSpinner.getComponent()); } - tdAxes.getTimeRangePanel().setVisible(tdParameters.orientation == PamScroller.VERTICAL); + tdAxes.getTimeRangePanel().setVisible(tdParameters.orientation == AbstractPamScrollerAWT.VERTICAL); TDGraphContainer tdGraphContainer = new TDGraphContainer(this); tdAxes.getAxisInnerPanel().add(BorderLayout.CENTER, tdGraphContainer.getGraphContainer()); for (int i = 0; i < graphs.size(); i++) { @@ -330,6 +329,7 @@ public class TDControl extends UserDisplayComponentAdapter implements PamSetting * Show or hide the panel * @param state true = show, false = hide. */ + @Override public void showPanel(boolean state) { // if (graphs.size()>0) System.out.println("Height start: "+graphs.get(0).getGraphPlotPanel(0).getHeight()); super.showPanel(state); diff --git a/src/dataPlotsFX/SimpleSymbolChooserFX.java b/src/dataPlotsFX/SimpleSymbolChooserFX.java index 063416d7..cbd4b794 100644 --- a/src/dataPlotsFX/SimpleSymbolChooserFX.java +++ b/src/dataPlotsFX/SimpleSymbolChooserFX.java @@ -1,13 +1,9 @@ package dataPlotsFX; -import pamViewFX.fxNodes.PamSymbolFX; -import pamViewFX.fxNodes.utilsFX.PamUtilsFX; -import javafx.scene.paint.Color; import PamView.PamSymbolType; -import PamView.symbol.LineData; import PamView.symbol.SymbolData; -import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; +import pamViewFX.fxNodes.PamSymbolFX; public class SimpleSymbolChooserFX implements TDSymbolChooserFX { diff --git a/src/dataPlotsFX/TDControlAWT.java b/src/dataPlotsFX/TDControlAWT.java index e79e87b9..8a975d5e 100644 --- a/src/dataPlotsFX/TDControlAWT.java +++ b/src/dataPlotsFX/TDControlAWT.java @@ -1,6 +1,12 @@ package dataPlotsFX; import java.awt.Component; + +import PamController.PAMStartupEnabler; +import PamController.PamController; +import PamguardMVC.PamObservable; +import PamguardMVC.PamObserverAdapter; +import PamguardMVC.PamRawDataBlock; import dataPlotsFX.layout.TDDisplayFX; import dataPlotsFX.scroller.TDAcousticScroller; import javafx.application.Platform; @@ -13,11 +19,6 @@ import javafx.scene.paint.Color; import pamViewFX.fxStyles.PamStylesManagerFX; import userDisplay.UserDisplayComponent; import userDisplay.UserDisplayControl; -import PamController.PAMStartupEnabler; -import PamController.PamController; -import PamguardMVC.PamObservable; -import PamguardMVC.PamObserverAdapter; -import PamguardMVC.PamRawDataBlock; /** * TDControlFX acts as a wrapper class for a time base display programmed in JavaFX. @@ -215,6 +216,7 @@ public class TDControlAWT extends TDControl implements UserDisplayComponent { * Get the data observer- monitors incoming real time data an updates graphs. * @return data observer */ + @Override public DataObserver getDataObserver() { return dataObserver; } @@ -247,6 +249,7 @@ public class TDControlAWT extends TDControl implements UserDisplayComponent { * In real time mode check if PAMGUARD is paused. * @return true if paused. */ + @Override public boolean isPaused(){ if (PamController.getInstance().getPamStatus()==PamController.PAM_RUNNING) return false; else return true; diff --git a/src/dataPlotsFX/TDControlFX.java b/src/dataPlotsFX/TDControlFX.java index 493b9fe0..a45d0b7f 100644 --- a/src/dataPlotsFX/TDControlFX.java +++ b/src/dataPlotsFX/TDControlFX.java @@ -3,24 +3,24 @@ package dataPlotsFX; import java.io.Serializable; import java.util.ArrayList; -import javafx.application.Platform; -import javafx.scene.layout.Region; -import pamViewFX.fxNodes.internalNode.PamInternalPane; -import userDisplayFX.UserDisplayControlFX; -import userDisplayFX.UserDisplayNodeFX; -import userDisplayFX.UserDisplayNodeParams; -import dataPlotsFX.data.TDDataInfoFX; -import dataPlotsFX.data.TDDataProviderFX; -import dataPlotsFX.data.TDDataProviderRegisterFX; -import dataPlotsFX.layout.TDDisplayFX; -import dataPlotsFX.layout.TDGraphFX; -import detectiongrouplocaliser.DetectionGroupSummary; import PamController.PamController; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamObserverAdapter; import PamguardMVC.PamRawDataBlock; +import dataPlotsFX.data.TDDataInfoFX; +import dataPlotsFX.data.TDDataProviderFX; +import dataPlotsFX.data.TDDataProviderRegisterFX; +import dataPlotsFX.layout.TDDisplayFX; +import dataPlotsFX.layout.TDGraphFX; +import detectiongrouplocaliser.DetectionGroupSummary; +import javafx.application.Platform; +import javafx.scene.layout.Region; +import pamViewFX.fxNodes.internalNode.PamInternalPane; +import userDisplayFX.UserDisplayControlFX; +import userDisplayFX.UserDisplayNodeFX; +import userDisplayFX.UserDisplayNodeParams; /** * @@ -151,6 +151,7 @@ public class TDControlFX extends TDControl implements UserDisplayNodeFX { * Get currently displayed data blocks in the display and set them as the parent * data blocks in the display process. */ + @Override public void dataModelToDisplay() { // // System.out.println("TDControlFX: dataModelToDisplay: " + tdDisplayController.allowProcessNotify); @@ -284,6 +285,7 @@ public class TDControlFX extends TDControl implements UserDisplayNodeFX { * Get the data observer- monitors incoming real time data an updates graphs. * @return data observer */ + @Override public DataObserver getDataObserver() { return dataObserver; } @@ -310,6 +312,7 @@ public class TDControlFX extends TDControl implements UserDisplayNodeFX { * In real time mode check if PAMGUARD is paused. * @return true if paused. */ + @Override public boolean isPaused(){ if (PamController.getInstance().getPamStatus()==PamController.PAM_RUNNING) return false; else return true; @@ -371,6 +374,7 @@ public class TDControlFX extends TDControl implements UserDisplayNodeFX { * information to add to this since it's not kept up to date on the fly. * @return object to serialise. */ + @Override protected Serializable prepareSerialisedSettings() { super.prepareSerialisedSettings(); //prepare the serialised settings. diff --git a/src/dataPlotsFX/TDDisplayController.java b/src/dataPlotsFX/TDDisplayController.java index 193b2efa..f6752f4d 100644 --- a/src/dataPlotsFX/TDDisplayController.java +++ b/src/dataPlotsFX/TDDisplayController.java @@ -1,18 +1,16 @@ package dataPlotsFX; import java.util.ArrayList; -import dataPlotsFX.data.TDDataInfoFX; -import dataPlotsFX.data.TDDataProviderFX; -import dataPlotsFX.data.TDDataProviderRegisterFX; -import detectionPlotFX.data.DDPlotRegister; -import detectionPlotFX.rawDDPlot.ClickDDPlotProvider; -import pamViewFX.PamControlledGUIFX; -import userDisplayFX.UserDisplayControlFX; -import userDisplayFX.UserDisplayNodeFX; + import PamController.PamController; import PamController.PamControllerInterface; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; +import dataPlotsFX.data.TDDataInfoFX; +import dataPlotsFX.data.TDDataProviderFX; +import dataPlotsFX.data.TDDataProviderRegisterFX; +import userDisplayFX.UserDisplayControlFX; +import userDisplayFX.UserDisplayNodeFX; /** * The controller for the TD display. This is only used in the FX GUI where displays diff --git a/src/dataPlotsFX/TDDisplayProviderFX.java b/src/dataPlotsFX/TDDisplayProviderFX.java index 8f231533..0a77b481 100644 --- a/src/dataPlotsFX/TDDisplayProviderFX.java +++ b/src/dataPlotsFX/TDDisplayProviderFX.java @@ -1,7 +1,6 @@ package dataPlotsFX; import PamController.PamController; -import PamModel.SMRUEnable; import userDisplay.UserDisplayComponent; import userDisplay.UserDisplayControl; import userDisplay.UserDisplayProvider; diff --git a/src/dataPlotsFX/TDGraphParametersFX.java b/src/dataPlotsFX/TDGraphParametersFX.java index f009512f..485a1fa8 100644 --- a/src/dataPlotsFX/TDGraphParametersFX.java +++ b/src/dataPlotsFX/TDGraphParametersFX.java @@ -7,15 +7,15 @@ import java.util.Hashtable; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; +import PamModel.parametermanager.PrivatePamParameterData; import PamView.GeneralProjector.ParameterType; import PamView.GeneralProjector.ParameterUnits; -import javafx.scene.paint.Color; import dataPlots.layout.DataListInfo; import dataPlots.layout.GraphParameters; import dataPlotsFX.data.DataTypeInfo; import dataPlotsFX.data.TDScaleInfoData; +import javafx.scene.paint.Color; /** * The settings for an individual graph. @@ -51,7 +51,7 @@ public class TDGraphParametersFX implements Serializable, Cloneable, ManagedPara /** * The current data type to show. */ - public DataTypeInfo currentDataType= new DataTypeInfo(ParameterType.AMPLITUDE, ParameterUnits.DB); ; + public DataTypeInfo currentDataType= new DataTypeInfo(ParameterType.AMPLITUDE, ParameterUnits.DB); /** * Allows TDDataInfo to be created when graph is initialised. Can't just have TDDataInfo here as a whole data block would diff --git a/src/dataPlotsFX/TDManagedSymbolChooserFX.java b/src/dataPlotsFX/TDManagedSymbolChooserFX.java index b522f90e..8cc2a7bc 100644 --- a/src/dataPlotsFX/TDManagedSymbolChooserFX.java +++ b/src/dataPlotsFX/TDManagedSymbolChooserFX.java @@ -2,7 +2,6 @@ package dataPlotsFX; import PamView.symbol.PamSymbolChooser; import PamguardMVC.PamDataUnit; -import clickDetector.tdPlots.ClickSymbolChooser; import dataPlotsFX.clickPlotFX.ClickSymbolChooserFX; import dataPlotsFX.data.TDDataInfoFX; import pamViewFX.fxNodes.PamSymbolFX; diff --git a/src/dataPlotsFX/TDSymbolChooserFX.java b/src/dataPlotsFX/TDSymbolChooserFX.java index 87d9d063..57a53da5 100644 --- a/src/dataPlotsFX/TDSymbolChooserFX.java +++ b/src/dataPlotsFX/TDSymbolChooserFX.java @@ -1,8 +1,7 @@ package dataPlotsFX; -import pamViewFX.fxNodes.PamSymbolFX; import PamguardMVC.PamDataUnit; -import javafx.scene.paint.Color; +import pamViewFX.fxNodes.PamSymbolFX; /** * Interface allowing things getting drawn on the plots to chose their won diff --git a/src/dbht/DbHtControl.java b/src/dbht/DbHtControl.java index 4774e2f9..eb2f67bd 100644 --- a/src/dbht/DbHtControl.java +++ b/src/dbht/DbHtControl.java @@ -10,18 +10,15 @@ import javax.swing.JButton; import javax.swing.JMenuItem; import javax.swing.JPanel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import dbht.offline.DbHtSummaryTask; -import offlineProcessing.DataCopyTask; -import offlineProcessing.OLProcessDialog; -import offlineProcessing.OfflineTaskGroup; import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; import PamController.PamSettingManager; import PamController.PamSettings; import PamView.PamTabPanel; +import dbht.offline.DbHtSummaryTask; +import offlineProcessing.DataCopyTask; +import offlineProcessing.OLProcessDialog; +import offlineProcessing.OfflineTaskGroup; public class DbHtControl extends PamControlledUnit implements PamSettings { diff --git a/src/dbht/DbHtDataBlock.java b/src/dbht/DbHtDataBlock.java index 02ea0854..cf378636 100644 --- a/src/dbht/DbHtDataBlock.java +++ b/src/dbht/DbHtDataBlock.java @@ -1,12 +1,9 @@ package dbht; -import dbht.alarm.DbHtAlarmCounter; -import dbht.alarm.DbHtAlarmProvider; -import alarm.AlarmCounter; +import PamguardMVC.PamDataBlock; import alarm.AlarmCounterProvider; import alarm.AlarmDataSource; -import PamguardMVC.PamDataBlock; -import PamguardMVC.PamProcess; +import dbht.alarm.DbHtAlarmProvider; public class DbHtDataBlock extends PamDataBlock implements AlarmDataSource { diff --git a/src/dbht/DbHtDataSource.java b/src/dbht/DbHtDataSource.java index b6368411..64515425 100644 --- a/src/dbht/DbHtDataSource.java +++ b/src/dbht/DbHtDataSource.java @@ -13,7 +13,6 @@ import binaryFileStorage.BinaryHeader; import binaryFileStorage.BinaryObjectData; import binaryFileStorage.ModuleFooter; import binaryFileStorage.ModuleHeader; -import binaryFileStorage.PackedBinaryObject; public class DbHtDataSource extends BinaryDataSource { diff --git a/src/dbht/DbHtDialog.java b/src/dbht/DbHtDialog.java index 78fbe704..789e168d 100644 --- a/src/dbht/DbHtDialog.java +++ b/src/dbht/DbHtDialog.java @@ -41,9 +41,9 @@ import Layout.PamAxisPanel; import PamDetection.RawDataUnit; import PamUtils.PamFileChooser; import PamUtils.PamFileFilter; +import PamView.PamColors.PamColor; import PamView.PamSymbol; import PamView.PamSymbolType; -import PamView.PamColors.PamColor; import PamView.dialog.PamDialog; import PamView.dialog.PamDialogPanel; import PamView.dialog.PamGridBagContraints; diff --git a/src/dbht/DbHtDisplayDialog.java b/src/dbht/DbHtDisplayDialog.java index 33586568..b7178542 100644 --- a/src/dbht/DbHtDisplayDialog.java +++ b/src/dbht/DbHtDisplayDialog.java @@ -108,7 +108,7 @@ public class DbHtDisplayDialog extends PamDialog { } private void enableControls() { - boolean e = (autoScale.isSelected() == false); + boolean e = !autoScale.isSelected(); minAmp.setEnabled(e); maxAmp.setEnabled(e); if (PamController.getInstance().getRunMode() == PamController.RUN_NETWORKRECEIVER) { diff --git a/src/dbht/DbHtDisplayPanel.java b/src/dbht/DbHtDisplayPanel.java index 58ccafab..d47c447a 100644 --- a/src/dbht/DbHtDisplayPanel.java +++ b/src/dbht/DbHtDisplayPanel.java @@ -17,14 +17,7 @@ import javax.swing.JComponent; import javax.swing.JMenuItem; import javax.swing.JPanel; import javax.swing.JPopupMenu; -import javax.swing.border.BevelBorder; -import pamScrollSystem.AbstractPamScroller; -import pamScrollSystem.AbstractPamScrollerAWT; -import pamScrollSystem.PamScrollObserver; -import pamScrollSystem.PamScroller; -import pamScrollSystem.RangeSpinner; -import pamScrollSystem.RangeSpinnerListener; import Layout.PamAxis; import Layout.PamAxisPanel; import PamController.PamControlledUnitSettings; @@ -46,6 +39,12 @@ import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamObserverAdapter; +import pamScrollSystem.AbstractPamScroller; +import pamScrollSystem.AbstractPamScrollerAWT; +import pamScrollSystem.PamScrollObserver; +import pamScrollSystem.PamScroller; +import pamScrollSystem.RangeSpinner; +import pamScrollSystem.RangeSpinnerListener; /** * Display panel for dBHt data - can be incorporated into a spectrogram * plug in or a stand alone display window. @@ -126,7 +125,7 @@ public class DbHtDisplayPanel { } void newParams() { - if (displayParams.autoScale == false) { + if (!displayParams.autoScale) { axisPanel.ampAxis.setRange(displayParams.minAmplitude, displayParams.maxAmplitude); } for (int i = 0; i < DbHtControl.NMEASURES; i++) { diff --git a/src/dbht/DbHtProcess.java b/src/dbht/DbHtProcess.java index 4d77f442..02b659c3 100644 --- a/src/dbht/DbHtProcess.java +++ b/src/dbht/DbHtProcess.java @@ -1,6 +1,5 @@ package dbht; -import dbht.offline.DbHtDatagramProvider; import Acquisition.AcquisitionProcess; import Filters.FIRArbitraryFilter; import Filters.Filter; @@ -13,6 +12,7 @@ import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; import PamguardMVC.PamRawDataBlock; +import dbht.offline.DbHtDatagramProvider; public class DbHtProcess extends PamProcess { @@ -123,6 +123,7 @@ public class DbHtProcess extends PamProcess { /** * @return the sourceDataBlock */ + @Override public PamRawDataBlock getRawSourceDataBlock() { return rawSourceDataBlock; } diff --git a/src/decimator/DecimatorControl.java b/src/decimator/DecimatorControl.java index 4b09dc29..a70508be 100644 --- a/src/decimator/DecimatorControl.java +++ b/src/decimator/DecimatorControl.java @@ -28,17 +28,8 @@ import java.io.Serializable; import javax.swing.JMenuItem; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import dataGram.DatagramManager; -import dataMap.OfflineDataMapPoint; -import dataMap.filemaps.OfflineFileServer; -import decimator.layoutFX.DecimatorUIFX; -import pamScrollSystem.ViewLoadObserver; import Acquisition.filedate.FileDate; import Acquisition.filedate.StandardFileDate; -import Acquisition.layoutFX.AquisitionGUIFX; import Acquisition.offlineFuncs.OfflineWavFileServer; import PamController.OfflineFileDataStore; import PamController.PamControlledUnit; @@ -49,12 +40,16 @@ import PamController.PamControllerInterface; import PamController.PamGUIManager; import PamController.PamSettingManager; import PamController.PamSettings; -import PamController.fileprocessing.StoreStatus; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamProcess; import PamguardMVC.PamRawDataBlock; import PamguardMVC.dataOffline.OfflineDataLoadInfo; +import dataGram.DatagramManager; +import dataMap.OfflineDataMapPoint; +import dataMap.filemaps.OfflineFileServer; +import decimator.layoutFX.DecimatorUIFX; +import pamScrollSystem.ViewLoadObserver; /** * @author Doug Gillespie @@ -125,6 +120,7 @@ public class DecimatorControl extends PamControlledUnit implements PamSettings, this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { DecimatorParams newParams = DecimatorParamsDialog.showDialog(parentFrame, DecimatorControl.this, decimatorParams); if (newParams != null) { @@ -152,6 +148,7 @@ public class DecimatorControl extends PamControlledUnit implements PamSettings, /* (non-Javadoc) * @see PamController.PamSettings#GetSettingsReference() */ + @Override public Serializable getSettingsReference() { return decimatorParams; } @@ -160,6 +157,7 @@ public class DecimatorControl extends PamControlledUnit implements PamSettings, /* (non-Javadoc) * @see PamController.PamSettings#GetSettingsVersion() */ + @Override public long getSettingsVersion() { return DecimatorParams.serialVersionUID; } @@ -167,6 +165,7 @@ public class DecimatorControl extends PamControlledUnit implements PamSettings, /* (non-Javadoc) * @see PamController.PamSettings#RestoreSettings(PamController.PamControlledUnitSettings) */ + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { decimatorParams = ((DecimatorParams) pamControlledUnitSettings.getSettings()).clone(); diff --git a/src/decimator/DecimatorParamsDialog.java b/src/decimator/DecimatorParamsDialog.java index c8d9aaac..928e6221 100644 --- a/src/decimator/DecimatorParamsDialog.java +++ b/src/decimator/DecimatorParamsDialog.java @@ -6,7 +6,6 @@ import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.util.ArrayList; import javax.swing.BoxLayout; import javax.swing.JButton; @@ -15,6 +14,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; import Filters.FilterBand; @@ -114,7 +114,7 @@ public class DecimatorParamsDialog extends PamDialog { constraints.gridx = 0; constraints.gridwidth = 1; constraints.gridy++; - addComponent(decimatorPanel, new JLabel("Interpolation: ", JLabel.RIGHT), constraints); + addComponent(decimatorPanel, new JLabel("Interpolation: ", SwingConstants.RIGHT), constraints); constraints.gridx += constraints.gridwidth; constraints.gridwidth = 2; addComponent(decimatorPanel, interpolator = new JComboBox(), constraints); diff --git a/src/decimator/DecimatorProcess.java b/src/decimator/DecimatorProcess.java index cf762864..382d04dd 100644 --- a/src/decimator/DecimatorProcess.java +++ b/src/decimator/DecimatorProcess.java @@ -29,19 +29,14 @@ import Filters.FilterMethod; import Filters.FilterType; import PamController.PamController; import PamDetection.RawDataUnit; -import PamUtils.PamCalendar; import PamUtils.PamUtils; import PamguardMVC.PamConstants; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; -import PamguardMVC.PamObserver; import PamguardMVC.PamProcess; import PamguardMVC.PamRawDataBlock; -import PamguardMVC.RequestCancellationObject; import PamguardMVC.dataOffline.OfflineDataLoadInfo; -import clickDetector.ClickDetection; -import clipgenerator.ClipDataUnit; /** * Decimates data - i.e. reduces it's frequency by @@ -333,7 +328,7 @@ public class DecimatorProcess extends PamProcess { * if offline files are not requested, continue to ask up the chain - there may * be data in an upstream process which can still be decimated as normal. */ - if (decimatorControl.getOfflineFileServer().getOfflineFileParameters().enable == false) { + if (!decimatorControl.getOfflineFileServer().getOfflineFileParameters().enable) { return super.getOfflineData(offlineLoadDataInfo); } if (decimatorControl.getOfflineFileServer().loadData(getOutputDataBlock(), offlineLoadDataInfo, null)) { diff --git a/src/decimator/DecimatorWorker.java b/src/decimator/DecimatorWorker.java index 21908a12..573e62d2 100644 --- a/src/decimator/DecimatorWorker.java +++ b/src/decimator/DecimatorWorker.java @@ -11,11 +11,8 @@ import Filters.interpolate.Interpolator; import Filters.interpolate.PolyInterpolator0; import Filters.interpolate.PolyInterpolator1; import Filters.interpolate.PolyInterpolator2; -import Filters.interpolate.SplineInterpolator; import PamDetection.RawDataUnit; -import PamUtils.PamCalendar; import PamUtils.PamUtils; -import PamguardMVC.debug.Debug; /** * Job to run the actual decimation. Separate out from diff --git a/src/depthReadout/DepthControl.java b/src/depthReadout/DepthControl.java index 0809af41..6cbe93cf 100644 --- a/src/depthReadout/DepthControl.java +++ b/src/depthReadout/DepthControl.java @@ -71,6 +71,7 @@ public class DepthControl extends PamControlledUnit implements PamSettings { class TimerListener implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { depthProcess.readDepthData(); @@ -202,6 +203,7 @@ public class DepthControl extends PamControlledUnit implements PamSettings { this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { if (depthSystem != null && depthSystem.canConfigure()) { @@ -213,12 +215,15 @@ public class DepthControl extends PamControlledUnit implements PamSettings { } + @Override public Serializable getSettingsReference() { return depthParameters; } + @Override public long getSettingsVersion() { return DepthParameters.serialVersionUID; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { depthParameters = ((DepthParameters) pamControlledUnitSettings.getSettings()).clone(); return true; diff --git a/src/depthReadout/DepthDataBlock.java b/src/depthReadout/DepthDataBlock.java index 8d13d6cc..5b99fb66 100644 --- a/src/depthReadout/DepthDataBlock.java +++ b/src/depthReadout/DepthDataBlock.java @@ -1,7 +1,5 @@ package depthReadout; -import com.drew.imaging.FileType; - import Array.sensors.ArraySensorDataBlock; import Array.sensors.ArraySensorFieldType; import PamguardMVC.PamDataBlock; diff --git a/src/depthReadout/DepthDialog.java b/src/depthReadout/DepthDialog.java index df7d7203..5a706555 100644 --- a/src/depthReadout/DepthDialog.java +++ b/src/depthReadout/DepthDialog.java @@ -61,6 +61,7 @@ public class DepthDialog extends PamDialog { private class HitEnter implements ActionListener { + @Override public void actionPerformed(ActionEvent arg0) { System.out.println("Hit enter"); } diff --git a/src/depthReadout/DepthProcess.java b/src/depthReadout/DepthProcess.java index c5467d8c..6c748c3a 100644 --- a/src/depthReadout/DepthProcess.java +++ b/src/depthReadout/DepthProcess.java @@ -41,7 +41,7 @@ public class DepthProcess extends PamProcess { double[] rawData = new double[depthControl.depthParameters.nSensors]; double[] depth = new double[depthControl.depthParameters.nSensors]; for (int i = 0; i < depthControl.depthParameters.nSensors; i++) { - if (depthSystem.readSensor(i) == false) { + if (!depthSystem.readSensor(i)) { return false; } rawData[i] = depthSystem.getDepthRawData(i); diff --git a/src/depthReadout/DepthSidePanel.java b/src/depthReadout/DepthSidePanel.java index a058f80e..3081e8fb 100644 --- a/src/depthReadout/DepthSidePanel.java +++ b/src/depthReadout/DepthSidePanel.java @@ -10,7 +10,6 @@ import java.awt.GridBagLayout; import java.awt.Point; import java.util.ListIterator; -import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; @@ -23,15 +22,14 @@ import PamController.PamController; import PamUtils.PamCalendar; import PamView.ColorManaged; import PamView.PamColors; -import PamView.PamSidePanel; import PamView.PamColors.PamColor; +import PamView.PamSidePanel; import PamView.dialog.PamLabel; import PamView.panel.PamBorder; import PamView.panel.PamBorderPanel; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; -import PamguardMVC.PamObserver; import PamguardMVC.PamObserverAdapter; public class DepthSidePanel extends PamObserverAdapter implements PamSidePanel { @@ -60,10 +58,12 @@ public class DepthSidePanel extends PamObserverAdapter implements PamSidePanel { depthControl.getDepthDataBlock().addObserver(this); } + @Override public JComponent getPanel() { return depthPanel; } + @Override public void rename(String newName) { depthPanel.setBorder(new TitledBorder(newName)); @@ -77,14 +77,17 @@ public class DepthSidePanel extends PamObserverAdapter implements PamSidePanel { depthPanel = new DepthPanel(); } + @Override public String getObserverName() { return "Depth Side Panel"; } + @Override public long getRequiredDataHistory(PamObservable o, Object arg) { return panelLifetime * 1000; } + @Override public void addData(PamObservable o, PamDataUnit arg) { DepthDataUnit depthDataUnit = (DepthDataUnit) arg; diff --git a/src/depthReadout/MccDepthParameters.java b/src/depthReadout/MccDepthParameters.java index d027670a..cf6c9698 100644 --- a/src/depthReadout/MccDepthParameters.java +++ b/src/depthReadout/MccDepthParameters.java @@ -7,7 +7,6 @@ import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet.ParameterSetType; import PamModel.parametermanager.PrivatePamParameterData; -import mcc.MccJniInterface; import mcc.mccjna.MCCConstants; public class MccDepthParameters implements Serializable, Cloneable, ManagedParameters { diff --git a/src/depthReadout/MccDepthSystem.java b/src/depthReadout/MccDepthSystem.java index c7e2b4e3..a5a646f0 100644 --- a/src/depthReadout/MccDepthSystem.java +++ b/src/depthReadout/MccDepthSystem.java @@ -3,12 +3,10 @@ package depthReadout; import java.awt.Frame; import java.io.Serializable; -import depthReadout.MccDepthParameters.MccSensorParameters; - import PamController.PamControlledUnitSettings; import PamController.PamSettingManager; import PamController.PamSettings; - +import depthReadout.MccDepthParameters.MccSensorParameters; import mcc.MccJniInterface; import mcc.mccjna.MCCException; import mcc.mccjna.MCCUtils; @@ -110,27 +108,33 @@ public class MccDepthSystem implements DepthSystem , PamSettings { return depth; } + @Override public boolean shouldPoll() { // TODO Auto-generated method stub return false; } + @Override public Serializable getSettingsReference() { return mccDepthParameters; } + @Override public long getSettingsVersion() { return MccDepthParameters.serialVersionUID; } + @Override public String getUnitName() { return "MCC Depth system"; } + @Override public String getUnitType() { return "MCC Depth system"; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { mccDepthParameters = ((MccDepthParameters) pamControlledUnitSettings.getSettings()).clone(); return true; diff --git a/src/depthReadout/MccDialog.java b/src/depthReadout/MccDialog.java index 6134c588..928701b9 100644 --- a/src/depthReadout/MccDialog.java +++ b/src/depthReadout/MccDialog.java @@ -15,21 +15,21 @@ import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; -import depthReadout.MccDepthParameters.MccSensorParameters; - -import mcc.MccJniInterface; -import mcc.mccjna.MCCBoardInfo; -import mcc.mccjna.MCCConstants; -import mcc.mccjna.MCCJNA; -import mcc.mccjna.MCCUtils; import Array.ArrayManager; import Array.PamArray; import PamController.PamController; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; import PamView.dialog.warn.WarnOnce; +import depthReadout.MccDepthParameters.MccSensorParameters; +import mcc.MccJniInterface; +import mcc.mccjna.MCCBoardInfo; +import mcc.mccjna.MCCConstants; +import mcc.mccjna.MCCJNA; +import mcc.mccjna.MCCUtils; public class MccDialog extends PamDialog { @@ -90,10 +90,10 @@ public class MccDialog extends PamDialog { @Override public boolean getParams() { - if (boardPanel.getParams() == false) { + if (!boardPanel.getParams()) { return false; } - if (sensorsPanel.getParams() == false) { + if (!sensorsPanel.getParams()) { return false; } depthControl.depthParameters = depthParameters; @@ -193,7 +193,7 @@ public class MccDialog extends PamDialog { c.gridy++; c.gridx = 0; c.anchor = GridBagConstraints.WEST; - addComponent(this, new JLabel("Streamers ", JLabel.RIGHT), c); + addComponent(this, new JLabel("Streamers ", SwingConstants.RIGHT), c); ArrayManager arrayManager = ArrayManager.getArrayManager(); PamArray array = arrayManager.getCurrentArray(); int nS = array.getNumStreamers(); @@ -419,6 +419,7 @@ public class MccDialog extends PamDialog { } private class HitEnter implements ActionListener { + @Override public void actionPerformed(ActionEvent arg0) { int numSensors; try { diff --git a/src/detectionPlotFX/DetectionDisplayControl.java b/src/detectionPlotFX/DetectionDisplayControl.java index 9e8fcf7b..e7ab7b6a 100644 --- a/src/detectionPlotFX/DetectionDisplayControl.java +++ b/src/detectionPlotFX/DetectionDisplayControl.java @@ -7,7 +7,6 @@ import PamController.PamControllerInterface; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; -import PamguardMVC.PamObserver; import PamguardMVC.PamObserverAdapter; import detectionPlotFX.data.DDDataInfo; import detectionPlotFX.data.DDDataProvider; diff --git a/src/detectionPlotFX/DetectionDisplayControl2.java b/src/detectionPlotFX/DetectionDisplayControl2.java index 419f44ea..ef831eea 100644 --- a/src/detectionPlotFX/DetectionDisplayControl2.java +++ b/src/detectionPlotFX/DetectionDisplayControl2.java @@ -2,7 +2,6 @@ package detectionPlotFX; import java.util.ArrayList; -import PamController.PamController; import PamController.PamControllerInterface; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; @@ -39,7 +38,7 @@ public class DetectionDisplayControl2 extends UserDisplayControlFX { private DetectionDataObserver detectionDataObserver; - private PamInternalPane internalFrame;; + private PamInternalPane internalFrame; public DetectionDisplayControl2(String unitName) { diff --git a/src/detectionPlotFX/DetectionGroupDisplay.java b/src/detectionPlotFX/DetectionGroupDisplay.java index 69289edf..acd46f00 100644 --- a/src/detectionPlotFX/DetectionGroupDisplay.java +++ b/src/detectionPlotFX/DetectionGroupDisplay.java @@ -7,7 +7,6 @@ import java.util.List; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.superdet.SuperDetection; -import atlantafx.base.theme.Styles; import detectionPlotFX.data.DDDataInfo; import detectionPlotFX.data.DDDataProvider; import detectionPlotFX.data.DDPlotRegister; @@ -21,7 +20,6 @@ import javafx.scene.control.Label; import javafx.scene.control.ScrollPane; import javafx.scene.control.ScrollPane.ScrollBarPolicy; import javafx.scene.control.Tab; -import javafx.scene.control.TabPane; import javafx.scene.control.TabPane.TabClosingPolicy; import javafx.scene.layout.BorderPane; import javafx.scene.layout.GridPane; diff --git a/src/detectionPlotFX/DetectionGroupDisplayFX.java b/src/detectionPlotFX/DetectionGroupDisplayFX.java index ea831e73..f2257a04 100644 --- a/src/detectionPlotFX/DetectionGroupDisplayFX.java +++ b/src/detectionPlotFX/DetectionGroupDisplayFX.java @@ -4,6 +4,7 @@ import java.io.Serializable; import PamController.PamControlledUnitSettings; import PamController.PamController; +import PamController.PamControllerInterface; import PamController.PamSettingManager; import PamController.PamSettings; import PamguardMVC.PamDataBlock; @@ -74,7 +75,7 @@ public class DetectionGroupDisplayFX extends DetectionGroupDisplay implements U } @Override - public void closeNode() {}; + public void closeNode() {} @Override public DetectionPlotParams getDisplayParams() { @@ -116,7 +117,7 @@ public class DetectionGroupDisplayFX extends DetectionGroupDisplay implements U private void showSettingsPane(boolean b) { - this.detectionDisplay.getHidingPane(Side.RIGHT).showHidePane(b);; + this.detectionDisplay.getHidingPane(Side.RIGHT).showHidePane(b); } @@ -124,7 +125,7 @@ public class DetectionGroupDisplayFX extends DetectionGroupDisplay implements U public void notifyModelChanged(int changeType) { switch (changeType) { - case PamController.INITIALIZATION_COMPLETE: + case PamControllerInterface.INITIALIZATION_COMPLETE: PamDataBlock dataBlock = PamController.getInstance().getDataBlockByLongName(detectionPlotParams.dataSource); //set the correct parent data block if on exists displayControl.getUserDisplayProcess().setParentDataBlock(dataBlock); diff --git a/src/detectionPlotFX/DetectionPlotParams.java b/src/detectionPlotFX/DetectionPlotParams.java index 80840b7d..6a8e737e 100644 --- a/src/detectionPlotFX/DetectionPlotParams.java +++ b/src/detectionPlotFX/DetectionPlotParams.java @@ -5,7 +5,6 @@ import java.util.HashMap; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet.ParameterSetType; -import dataPlotsFX.TDParametersFX; import userDisplayFX.UserDisplayNodeParams; /** diff --git a/src/detectiongrouplocaliser/DetectionGroupControl.java b/src/detectiongrouplocaliser/DetectionGroupControl.java index 4361fb85..cfd03a47 100644 --- a/src/detectiongrouplocaliser/DetectionGroupControl.java +++ b/src/detectiongrouplocaliser/DetectionGroupControl.java @@ -11,7 +11,7 @@ import javax.swing.JMenuItem; import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; -import PamController.PamController; +import PamController.PamControllerInterface; import PamController.PamSettingManager; import PamController.PamSettings; import PamView.PamColors; @@ -159,7 +159,7 @@ public class DetectionGroupControl extends PamControlledUnit implements PamSetti public void notifyModelChanged(int changeType) { super.notifyModelChanged(changeType); switch (changeType) { - case PamController.DATA_LOAD_COMPLETE: + case PamControllerInterface.DATA_LOAD_COMPLETE: notifyGroupDataChanged(); } } diff --git a/src/detectiongrouplocaliser/DetectionGroupDataUnit.java b/src/detectiongrouplocaliser/DetectionGroupDataUnit.java index 5e6065af..3c8262c4 100644 --- a/src/detectiongrouplocaliser/DetectionGroupDataUnit.java +++ b/src/detectiongrouplocaliser/DetectionGroupDataUnit.java @@ -3,7 +3,6 @@ package detectiongrouplocaliser; import java.util.List; import PamguardMVC.PamDataUnit; -import PamguardMVC.debug.Debug; import PamguardMVC.superdet.SuperDetection; public class DetectionGroupDataUnit extends SuperDetection { diff --git a/src/detectiongrouplocaliser/DetectionGroupProcess.java b/src/detectiongrouplocaliser/DetectionGroupProcess.java index 587b3719..a904968c 100644 --- a/src/detectiongrouplocaliser/DetectionGroupProcess.java +++ b/src/detectiongrouplocaliser/DetectionGroupProcess.java @@ -1,8 +1,5 @@ package detectiongrouplocaliser; -import java.awt.MouseInfo; -import java.awt.Point; -import java.awt.PointerInfo; import java.awt.Window; import java.util.ArrayList; import java.util.List; @@ -10,7 +7,7 @@ import java.util.ListIterator; import javax.swing.JPopupMenu; -import PamController.PamController; +import PamController.PamControllerInterface; import PamUtils.PamCalendar; import PamView.GeneralProjector.ParameterType; import PamView.paneloverlay.OverlayMarkSwingPanel; @@ -88,7 +85,7 @@ public class DetectionGroupProcess extends PamProcess { public void notifyModelChanged(int changeType) { super.notifyModelChanged(changeType); switch (changeType) { - case PamController.INITIALIZATION_COMPLETE: + case PamControllerInterface.INITIALIZATION_COMPLETE: subscribeMarkObserver(); annotationHandler.loadAnnotationChoices(); sortSQLLogging(); @@ -413,7 +410,7 @@ public class DetectionGroupProcess extends PamProcess { } } for (PamDataUnit superData:groupSummary.getSuperDetections()) { - if (DetectionGroupDataUnit.class.isAssignableFrom(superData.getClass()) == false) { + if (!DetectionGroupDataUnit.class.isAssignableFrom(superData.getClass())) { continue; } DetectionGroupDataUnit dgdu = (DetectionGroupDataUnit) superData; diff --git a/src/detectiongrouplocaliser/DetectionGroupSummary.java b/src/detectiongrouplocaliser/DetectionGroupSummary.java index db461e89..9161ae5d 100644 --- a/src/detectiongrouplocaliser/DetectionGroupSummary.java +++ b/src/detectiongrouplocaliser/DetectionGroupSummary.java @@ -8,7 +8,6 @@ import PamView.paneloverlay.overlaymark.OverlayMark; import PamView.paneloverlay.overlaymark.OverlayMarker; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; -import PamguardMVC.superdet.SuperDetection; import javafx.scene.input.MouseEvent; /** diff --git a/src/detectiongrouplocaliser/EventBuilderFunctions.java b/src/detectiongrouplocaliser/EventBuilderFunctions.java index 6bd40eab..5455529e 100644 --- a/src/detectiongrouplocaliser/EventBuilderFunctions.java +++ b/src/detectiongrouplocaliser/EventBuilderFunctions.java @@ -1,11 +1,9 @@ package detectiongrouplocaliser; import java.awt.Color; -import java.awt.Point; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; -import java.util.Collections; import java.util.Comparator; import java.util.HashSet; import java.util.List; @@ -15,16 +13,13 @@ import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JPopupMenu; -import PamController.PamController; import PamUtils.PamCalendar; import PamView.PamColors; import PamView.PamSymbol; import PamView.paneloverlay.overlaymark.OverlayMark; import PamView.paneloverlay.overlaymark.OverlayMarkObserver; import PamView.paneloverlay.overlaymark.OverlayMarker; -import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; -import PamguardMVC.debug.Debug; import javafx.scene.input.MouseEvent; import warnings.PamWarning; import warnings.WarningSystem; diff --git a/src/difar/BScan.java b/src/difar/BScan.java index 4e8902dd..e3923eeb 100644 --- a/src/difar/BScan.java +++ b/src/difar/BScan.java @@ -1,18 +1,12 @@ package difar; -import java.util.ArrayList; -import java.util.Arrays; - -import difar.DifarParameters.DifarOutputTypes; -import difar.DifarProcess.DifarDemuxWorker; -import likelihoodDetectionModule.CheckRenderer; - - -import fftManager.Complex; -import fftManager.FastFFT; import PamUtils.MatrixOps; import Spectrogram.WindowFunction; +import difar.DifarParameters.DifarOutputTypes; +import difar.DifarProcess.DifarDemuxWorker; +import fftManager.Complex; +import fftManager.FastFFT; /** * DIFAR Calculations, based on the Matlab bScanNew functions diff --git a/src/difar/BuoyCalibration.java b/src/difar/BuoyCalibration.java index e81d1b66..2b94d264 100644 --- a/src/difar/BuoyCalibration.java +++ b/src/difar/BuoyCalibration.java @@ -3,12 +3,9 @@ */ package difar; -import Array.ArrayManager; import Array.HydrophoneLocator; -import GPS.GPSDataBlock; import PamUtils.LatLong; import PamUtils.PamCalendar; -import PamView.dialog.PamDialog; import PamguardMVC.PamDataUnit; /** diff --git a/src/difar/DIFARCrossingInfo.java b/src/difar/DIFARCrossingInfo.java index 900a3809..84166f11 100644 --- a/src/difar/DIFARCrossingInfo.java +++ b/src/difar/DIFARCrossingInfo.java @@ -1,11 +1,8 @@ package difar; -import java.util.ArrayList; - +import PamUtils.LatLong; import pamMaths.PamVector; import targetMotionModule.TargetMotionResult; -import GPS.GpsData; -import PamUtils.LatLong; /** * diff --git a/src/difar/DIFARTargetMotionInformation.java b/src/difar/DIFARTargetMotionInformation.java index cff688cc..90eea825 100644 --- a/src/difar/DIFARTargetMotionInformation.java +++ b/src/difar/DIFARTargetMotionInformation.java @@ -4,11 +4,11 @@ import java.util.ArrayList; import javax.vecmath.Point3f; -import pamMaths.PamQuaternion; -import pamMaths.PamVector; import GPS.GpsData; import PamUtils.LatLong; import PamguardMVC.PamDataUnit; +import pamMaths.PamQuaternion; +import pamMaths.PamVector; import targetMotionModule.TargetMotionInformation; public class DIFARTargetMotionInformation implements TargetMotionInformation { diff --git a/src/difar/DemuxWorkerMessage.java b/src/difar/DemuxWorkerMessage.java index 07064f54..4b2e595e 100644 --- a/src/difar/DemuxWorkerMessage.java +++ b/src/difar/DemuxWorkerMessage.java @@ -1,10 +1,7 @@ package difar; import Array.ArrayManager; -import Array.Streamer; -import Array.StreamerDataBlock; import Array.StreamerDataUnit; -import PamController.PamController; import PamUtils.LatLong; import PamUtils.PamCalendar; import PamUtils.PamUtils; diff --git a/src/difar/DifarBinaryDataSource.java b/src/difar/DifarBinaryDataSource.java index 3b71d73d..f725b380 100644 --- a/src/difar/DifarBinaryDataSource.java +++ b/src/difar/DifarBinaryDataSource.java @@ -7,21 +7,16 @@ import java.io.DataOutputStream; import java.io.File; import java.io.IOException; -import clipgenerator.ClipSettings; import Filters.FilterParams; -import PamDetection.AbstractLocalisation; import PamDetection.LocContents; import PamUtils.LatLong; -import PamUtils.PamCalendar; import PamUtils.PamUtils; -import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import binaryFileStorage.BinaryDataSource; import binaryFileStorage.BinaryHeader; import binaryFileStorage.BinaryObjectData; import binaryFileStorage.ModuleFooter; import binaryFileStorage.ModuleHeader; -import binaryFileStorage.PackedBinaryObject; public class DifarBinaryDataSource extends BinaryDataSource { diff --git a/src/difar/DifarControl.java b/src/difar/DifarControl.java index 1e1baf49..d8409676 100644 --- a/src/difar/DifarControl.java +++ b/src/difar/DifarControl.java @@ -1,12 +1,5 @@ package difar; -import generalDatabase.DBControl; -import generalDatabase.DBControlUnit; -import generalDatabase.PamConnection; -import generalDatabase.SQLLogging; -import generalDatabase.lookupTables.LookupItem; -import generalDatabase.lookupTables.LookupList; - import java.awt.Frame; import java.awt.KeyEventDispatcher; import java.awt.KeyboardFocusManager; @@ -23,32 +16,34 @@ import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.ArrayList; -import java.util.List; import java.util.ListIterator; import javax.swing.JFileChooser; import javax.swing.JList; import javax.swing.JMenu; import javax.swing.JMenuItem; -import javax.swing.JTable; import javax.swing.KeyStroke; -import javax.swing.RowSorter; -import javax.swing.RowSorter.SortKey; import javax.swing.filechooser.FileFilter; -import javax.swing.table.DefaultTableModel; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import offlineProcessing.DataCopyTask; -import offlineProcessing.OLProcessDialog; -import offlineProcessing.OfflineTaskGroup; +import Array.ArrayManager; +import PamController.PamControlledUnit; +import PamController.PamControlledUnitSettings; +import PamController.PamController; +import PamController.PamControllerInterface; +import PamController.PamSettingManager; +import PamController.PamSettings; +import PamUtils.PamCalendar; +import PamUtils.PamFileChooser; +import PamUtils.PamFileFilter; +import PamUtils.PamUtils; +import PamView.PamSymbol; +import Spectrogram.SpectrogramDisplay; +import Spectrogram.SpectrogramMarkObserver; +import Spectrogram.SpectrogramMarkObservers; import clipgenerator.clipDisplay.ClipDisplayParameters; import dataPlots.data.TDDataProviderRegister; import dataPlotsFX.layout.TDGraphFX; -import difar.DifarControl.SpectrogramObserver; import difar.DifarParameters.SpeciesParams; -import difar.beamforming.BeamformProcess; import difar.dialogs.DifarDisplayParamsDialog; import difar.dialogs.DifarParamsDialog; import difar.display.DIFARDisplayUnit; @@ -69,26 +64,12 @@ import difar.offline.UpdateCrossingTask; import difar.plots.DifarBearingPlotProvider; import difar.plots.DifarIntensityPlotProvider; import difar.trackedGroups.TrackedGroupProcess; -import fftManager.FFTDataBlock; +import generalDatabase.lookupTables.LookupItem; +import generalDatabase.lookupTables.LookupList; +import offlineProcessing.OLProcessDialog; +import offlineProcessing.OfflineTaskGroup; import userDisplay.UserDisplayControl; import warnings.PamWarning; -import warnings.WarningSystem; -import Array.ArrayManager; -import Filters.FilterParams; -import PamController.PamControlledUnit; -import PamController.PamControlledUnitSettings; -import PamController.PamController; -import PamController.PamSettingManager; -import PamController.PamSettings; -import PamUtils.PamCalendar; -import PamUtils.PamFileChooser; -import PamUtils.PamFileFilter; -import PamUtils.PamUtils; -import PamView.PamSymbol; -import Spectrogram.SpectrogramDisplay; -import Spectrogram.SpectrogramMarkConverter; -import Spectrogram.SpectrogramMarkObserver; -import Spectrogram.SpectrogramMarkObservers; public class DifarControl extends PamControlledUnit implements PamSettings { @@ -382,7 +363,7 @@ public class DifarControl extends PamControlledUnit implements PamSettings { int numChans = PamUtils.getNumChannels(channelBitmap); if (downUp == SpectrogramMarkObserver.MOUSE_UP) { - SpeciesParams sP = difarParameters.findSpeciesParams(difarParameters.Default); + SpeciesParams sP = difarParameters.findSpeciesParams(DifarParameters.Default); float sr = sP.sampleRate; if (difarParameters.multiChannelClips){ @@ -524,10 +505,10 @@ public class DifarControl extends PamControlledUnit implements PamSettings { public void notifyModelChanged(int changeType) { super.notifyModelChanged(changeType); switch (changeType) { - case PamController.INITIALIZATION_COMPLETE: + case PamControllerInterface.INITIALIZATION_COMPLETE: difarProcess.setupProcess(); break; - case PamController.OFFLINE_DATA_LOADED: + case PamControllerInterface.OFFLINE_DATA_LOADED: sonobuoyManager.updateSonobuoyTableData(); } } @@ -762,7 +743,7 @@ public class DifarControl extends PamControlledUnit implements PamSettings { if (keyPressed == nextClassKey){ int ix = difarSidePanel.getSpeciesSelector().getSelectedIndex(); ix = ++ix % difarSidePanel.getSpeciesSelector().getModel().getSize(); - difarSidePanel.getSpeciesSelector().setSelectedIndex(ix);; + difarSidePanel.getSpeciesSelector().setSelectedIndex(ix); return true; } if (keyPressed == prevClassKey){ @@ -780,20 +761,20 @@ public class DifarControl extends PamControlledUnit implements PamSettings { public boolean isSaveEnabled() { DifarDataUnit currentDataUnit = getCurrentDemuxedUnit(); - return (isViewer == false && + return (!isViewer && getCurrentDemuxedUnit() != null && getCurrentDemuxedUnit().getSelectedAngle() != null); } public boolean isSaveWithoutCrossEnabled() { - return (isViewer == false && + return (!isViewer && getCurrentDemuxedUnit() != null && getCurrentDemuxedUnit().getSelectedAngle() !=null && getCurrentDemuxedUnit().getTempCrossing() != null); } public boolean isDeleteEnabled() { - return (isViewer == false && getCurrentDemuxedUnit() != null); + return (!isViewer && getCurrentDemuxedUnit() != null); } diff --git a/src/difar/DifarDataBlock.java b/src/difar/DifarDataBlock.java index 5d71ab1a..70e29fbe 100644 --- a/src/difar/DifarDataBlock.java +++ b/src/difar/DifarDataBlock.java @@ -1,22 +1,13 @@ package difar; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.util.ListIterator; -import javax.swing.Timer; - -import clipgenerator.ClipDisplayDataBlock; -import difar.dataSelector.DifarDataSelectCreator; -import difar.dataSelector.DifarDataSelector; -import PamguardMVC.dataSelector.DataSelectorCreator; -import PamController.PamController; -import PamDetection.AbstractLocalisation; import PamDetection.LocContents; -import PamUtils.SystemTiming; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; -import PamguardMVC.PamProcess; +import PamguardMVC.dataSelector.DataSelectorCreator; +import clipgenerator.ClipDisplayDataBlock; +import difar.dataSelector.DifarDataSelectCreator; public class DifarDataBlock extends ClipDisplayDataBlock { diff --git a/src/difar/DifarDataUnit.java b/src/difar/DifarDataUnit.java index b57cf46c..f04d6fc8 100644 --- a/src/difar/DifarDataUnit.java +++ b/src/difar/DifarDataUnit.java @@ -3,16 +3,6 @@ package difar; import java.awt.Color; import java.awt.image.BufferedImage; -import fftManager.Complex; -import fftManager.FastFFT; -import generalDatabase.DBControlUnit; -import generalDatabase.SQLLogging; -import generalDatabase.lookupTables.LookupItem; -import generalDatabase.lookupTables.LookupList; -import clipgenerator.ClipDataUnit; -import difar.trackedGroups.TrackedGroupDataBlock; -import difar.trackedGroups.TrackedGroupDataUnit; -import difar.trackedGroups.TrackedGroupProcess; import Filters.Filter; import Filters.FilterBand; import Filters.FilterMethod; @@ -24,6 +14,13 @@ import PamUtils.LatLong; import PamUtils.PamCalendar; import PamUtils.PamUtils; import PamguardMVC.PamDataUnit; +import clipgenerator.ClipDataUnit; +import fftManager.Complex; +import fftManager.FastFFT; +import generalDatabase.DBControlUnit; +import generalDatabase.SQLLogging; +import generalDatabase.lookupTables.LookupItem; +import generalDatabase.lookupTables.LookupList; public class DifarDataUnit extends ClipDataUnit { diff --git a/src/difar/DifarLocalisation.java b/src/difar/DifarLocalisation.java index bad7863c..81786072 100644 --- a/src/difar/DifarLocalisation.java +++ b/src/difar/DifarLocalisation.java @@ -1,10 +1,10 @@ package difar; -import pamMaths.PamVector; import Array.ArrayManager; import PamDetection.AbstractLocalisation; import PamDetection.LocContents; import PamUtils.LatLong; +import pamMaths.PamVector; /** * Localisations from a single sonobuoy are bearings originating from the diff --git a/src/difar/DifarParameters.java b/src/difar/DifarParameters.java index b8b8dc8c..16359771 100644 --- a/src/difar/DifarParameters.java +++ b/src/difar/DifarParameters.java @@ -1,27 +1,17 @@ package difar; -import generalDatabase.lookupTables.LookupItem; -import generalDatabase.lookupTables.LookupList; - -import java.awt.event.KeyEvent; import java.io.Serializable; import java.lang.reflect.Field; import java.util.ArrayList; -import javax.swing.KeyStroke; - import Filters.FilterParams; import Filters.FilterType; -import PamController.PamController; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet.ParameterSetType; import PamModel.parametermanager.PrivatePamParameterData; -import PamUtils.PamCalendar; -import PamView.PamGui; -import PamView.PamView; -import PamguardMVC.PamDataBlock; -import difar.demux.GreenridgeParams; +import generalDatabase.lookupTables.LookupItem; +import generalDatabase.lookupTables.LookupList; public class DifarParameters implements Serializable, Cloneable, ManagedParameters { @@ -227,7 +217,7 @@ public class DifarParameters implements Serializable, Cloneable, ManagedParamete */ public boolean showDifarGramFreqLimits = true; - public static enum DifarDemuxTypes{GREENERIDGE, AMMC_EXPERIMENTAL}; + public static enum DifarDemuxTypes{GREENERIDGE, AMMC_EXPERIMENTAL} public DifarDemuxTypes demuxType=DifarDemuxTypes.AMMC_EXPERIMENTAL; @@ -237,7 +227,7 @@ public class DifarParameters implements Serializable, Cloneable, ManagedParamete public static final String DefaultGroup = "No group"; - public static enum DifarOutputTypes{BARTLETT, MVDR}; + public static enum DifarOutputTypes{BARTLETT, MVDR} /** * time afterwhich item has been sitting in difargram to autosave if no user interaction diff --git a/src/difar/DifarProcess.java b/src/difar/DifarProcess.java index 644da952..a18a3385 100644 --- a/src/difar/DifarProcess.java +++ b/src/difar/DifarProcess.java @@ -1,7 +1,5 @@ package difar; -import generalDatabase.lookupTables.LookupItem; - import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; @@ -12,23 +10,6 @@ import java.util.ListIterator; import javax.swing.SwingWorker; import javax.swing.Timer; -import targetMotionModule.TargetMotionResult; -import targetMotionModule.algorithms.Simplex2D; -import warnings.PamWarning; -import warnings.WarningSystem; -import difar.DifarParameters.DifarOutputTypes; -import difar.DifarParameters.DifarTriggerParams; -import difar.DifarParameters.SpeciesParams; -import difar.calibration.CalibrationDataBlock; -import difar.calibration.CalibrationHistogram; -import difar.calibration.CalibrationLogging; -import difar.calibration.CalibrationProcess; -import difar.demux.DifarDemux; -import difar.demux.DifarResult; -import difar.demux.AmmcDemux; -import difar.demux.NativeDemux; -import difar.display.DIFARUnitControlPanel; -import difar.display.DifarOverlayGraphics; import Acquisition.AcquisitionProcess; import Array.ArrayManager; import Array.PamArray; @@ -36,35 +17,45 @@ import Array.Streamer; import Array.streamerOrigin.OriginSettings; import Array.streamerOrigin.StaticOriginSettings; import Filters.FIRArbitraryFilter; -import Filters.FilterParams; -import Filters.FilterType; import GPS.GPSControl; import GPS.GpsData; import GPS.GpsDataUnit; import PamController.PamController; -import PamDetection.AbstractLocalisation; import PamDetection.LocContents; -import PamDetection.RawDataUnit; import PamDetection.PamDetection; +import PamDetection.RawDataUnit; import PamUtils.LatLong; import PamUtils.MatrixOps; import PamUtils.PamCalendar; import PamUtils.PamUtils; import PamView.symbol.StandardSymbolManager; -import PamguardMVC.AcousticDataUnit; import PamguardMVC.PamConstants; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; -import PamguardMVC.PamObserver; import PamguardMVC.PamObserverAdapter; import PamguardMVC.PamProcess; import PamguardMVC.PamRawDataBlock; import PamguardMVC.RawDataUnavailableException; import Spectrogram.WindowFunction; -import annotation.calcs.snr.SNRAnnotationType; -import annotation.calcs.spl.SPLAnnotationType; -import annotation.handler.AnnotationHandler; +import difar.DifarParameters.DifarOutputTypes; +import difar.DifarParameters.DifarTriggerParams; +import difar.DifarParameters.SpeciesParams; +import difar.calibration.CalibrationDataBlock; +import difar.calibration.CalibrationHistogram; +import difar.calibration.CalibrationLogging; +import difar.calibration.CalibrationProcess; +import difar.demux.AmmcDemux; +import difar.demux.DifarDemux; +import difar.demux.DifarResult; +import difar.demux.NativeDemux; +import difar.display.DIFARUnitControlPanel; +import difar.display.DifarOverlayGraphics; +import generalDatabase.lookupTables.LookupItem; +import targetMotionModule.TargetMotionResult; +import targetMotionModule.algorithms.Simplex2D; +import warnings.PamWarning; +import warnings.WarningSystem; public class DifarProcess extends PamProcess { @@ -1044,7 +1035,7 @@ public class DifarProcess extends PamProcess { int numTriggers = 0; for (int i = 0; i < acousticDataBlocks.size(); i++) { PamDataBlock aDataBlock = acousticDataBlocks.get(i); - if (aDataBlock.isCanClipGenerate() == true) numTriggers++; + if (aDataBlock.isCanClipGenerate()) numTriggers++; } return numTriggers; } @@ -1403,7 +1394,7 @@ public class DifarProcess extends PamProcess { if (otherUnit.getChannelBitmap() != 1< 0) { @@ -44,7 +44,7 @@ public class EffortParams implements Cloneable, Serializable, ManagedParameters * @return The most recently selected observer */ public String getObjective() { - if (isSet == false) { + if (!isSet) { return null; } if (recentObjectives.size() > 0) { diff --git a/src/envelopeTracer/EnvelopeControl.java b/src/envelopeTracer/EnvelopeControl.java index 00d1aa2c..ebb92964 100644 --- a/src/envelopeTracer/EnvelopeControl.java +++ b/src/envelopeTracer/EnvelopeControl.java @@ -9,7 +9,6 @@ import javax.swing.JMenuItem; import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; -import PamController.PamController; import PamController.PamControllerInterface; import PamController.PamSettingManager; import PamController.PamSettings; diff --git a/src/eventCounter/DataCounter.java b/src/eventCounter/DataCounter.java index 1eec8de6..1779fd07 100644 --- a/src/eventCounter/DataCounter.java +++ b/src/eventCounter/DataCounter.java @@ -6,7 +6,6 @@ import java.util.List; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; -import PamguardMVC.PamObserver; import PamguardMVC.PamObserverAdapter; /** diff --git a/src/export/ExportOptions.java b/src/export/ExportOptions.java index 2b01f7b3..06454be5 100644 --- a/src/export/ExportOptions.java +++ b/src/export/ExportOptions.java @@ -1,6 +1,7 @@ package export; import java.io.Serializable; + import javax.swing.JFrame; import PamController.PamControlledUnitSettings; diff --git a/src/export/PamDataUnitExporter.java b/src/export/PamDataUnitExporter.java index c3fc4a25..1cf525b5 100644 --- a/src/export/PamDataUnitExporter.java +++ b/src/export/PamDataUnitExporter.java @@ -4,7 +4,6 @@ import java.awt.Component; import java.io.File; import java.util.List; - import PamguardMVC.PamDataUnit; import javafx.scene.layout.Pane; diff --git a/src/export/PamExporterManager.java b/src/export/PamExporterManager.java index 6e5aa168..95503b2f 100644 --- a/src/export/PamExporterManager.java +++ b/src/export/PamExporterManager.java @@ -5,10 +5,8 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; -import PamUtils.PamCalendar; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; -import export.CSVExport.CSVExportManager; import export.MLExport.MLDetectionsManager; import export.RExport.RExportManager; import export.wavExport.WavDetExportManager; @@ -126,7 +124,7 @@ public class PamExporterManager { private boolean isNeedsNewFile(File currentFile2, PamDataUnitExporter pamDataUnitExporter) { if( getFileSizeMegaBytes(currentFile2) >= exportParams.maximumFileSize) { return true; - }; + } return pamDataUnitExporter.isNeedsNewFile(); } diff --git a/src/fftFilter/FFTFilter.java b/src/fftFilter/FFTFilter.java index 6585345c..5a024995 100644 --- a/src/fftFilter/FFTFilter.java +++ b/src/fftFilter/FFTFilter.java @@ -2,11 +2,11 @@ package fftFilter; import java.util.Arrays; -import edu.emory.mathcs.jtransforms.fft.DoubleFFT_1D; -import fftManager.Complex; import Filters.Filter; import PamUtils.PamUtils; import PamUtils.complex.ComplexArray; +import edu.emory.mathcs.jtransforms.fft.DoubleFFT_1D; +import fftManager.Complex; public class FFTFilter implements Filter { diff --git a/src/fftFilter/FFTFilterParams.java b/src/fftFilter/FFTFilterParams.java index bae3a3b6..fcd90ce2 100644 --- a/src/fftFilter/FFTFilterParams.java +++ b/src/fftFilter/FFTFilterParams.java @@ -2,9 +2,6 @@ package fftFilter; import java.io.Serializable; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - import Filters.FilterBand; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; @@ -32,7 +29,7 @@ public class FFTFilterParams implements Serializable, Cloneable, ManagedParamete @Override public boolean equals(Object other) { if (other == null) return false; - if (FFTFilterParams.class.isAssignableFrom(other.getClass()) == false) { + if (!FFTFilterParams.class.isAssignableFrom(other.getClass())) { return false; } FFTFilterParams that = (FFTFilterParams) other; diff --git a/src/fftManager/FFT.java b/src/fftManager/FFT.java index f35bbf04..af4d82a4 100644 --- a/src/fftManager/FFT.java +++ b/src/fftManager/FFT.java @@ -67,7 +67,7 @@ public class FFT { int signalEnd = testSignal.length; int kernelStart = 0; int kernelEnd = testKernel.length; - ; + double[] xCorrelation = crossCorrelation(testSignal, signalStart, signalEnd, testKernel, kernelStart, kernelEnd); @@ -90,7 +90,7 @@ public class FFT { .println("testCrossCorellation result matches expected result."); return resultMatch; - }; + } /** * Setup up the internal reference to the input double[] to be used to @@ -175,7 +175,7 @@ public class FFT { // //System.out.println("Nearest power: " + power); return power; - }; + } public static int log2(int num) { // return -1 if it's not a natural power of 2 diff --git a/src/fftManager/FFTParameters.java b/src/fftManager/FFTParameters.java index 947a375e..3fa491cc 100644 --- a/src/fftManager/FFTParameters.java +++ b/src/fftManager/FFTParameters.java @@ -27,9 +27,8 @@ import PamModel.parametermanager.FieldNotFoundException; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterData; import PamModel.parametermanager.PamParameterSet; -import spectrogramNoiseReduction.SpectrogramNoiseSettings; - import Spectrogram.WindowFunction; +import spectrogramNoiseReduction.SpectrogramNoiseSettings; public class FFTParameters implements Serializable, ManagedParameters, Cloneable { diff --git a/src/fftManager/FFTParametersDialog.java b/src/fftManager/FFTParametersDialog.java index b6fbbb57..c79a7279 100644 --- a/src/fftManager/FFTParametersDialog.java +++ b/src/fftManager/FFTParametersDialog.java @@ -43,12 +43,6 @@ import javax.swing.JTextField; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import noiseMonitor.ResolutionPanel; - -import spectrogramNoiseReduction.SpectrogramNoiseDialogPanel; -import spectrogramNoiseReduction.SpectrogramNoiseProcess; - - import PamController.PamController; import PamDetection.RawDataUnit; import PamView.dialog.PamDialog; @@ -58,6 +52,9 @@ import PamView.dialog.warn.WarnOnce; import PamguardMVC.PamDataBlock; import PamguardMVC.PamRawDataBlock; import Spectrogram.WindowFunction; +import noiseMonitor.ResolutionPanel; +import spectrogramNoiseReduction.SpectrogramNoiseDialogPanel; +import spectrogramNoiseReduction.SpectrogramNoiseProcess; public class FFTParametersDialog extends PamDialog implements FFTLengthModeled { @@ -324,7 +321,7 @@ public class FFTParametersDialog extends PamDialog implements FFTLengthModeled { fftParameters.windowFunction = windowFunction.getSelectedIndex(); - if (FFTParameters.isValidLength(fftParameters.fftLength) == false) { + if (!FFTParameters.isValidLength(fftParameters.fftLength)) { String msg = "Using FFT Lenghts which are not a power of two will significantly increase execution times"; int ans = WarnOnce.showWarning(getOwner(), "FFT Lengh is not a power of 2", msg, WarnOnce.OK_CANCEL_OPTION); if (ans == WarnOnce.CANCEL_OPTION) { @@ -368,6 +365,7 @@ public class FFTParametersDialog extends PamDialog implements FFTLengthModeled { paramsChanged=true; } + @Override public void setFFTLength(int l) { fftLengthData.setText(String.format("%d", l)); } diff --git a/src/fftManager/FFTPluginPanelProvider.java b/src/fftManager/FFTPluginPanelProvider.java index 5b85229a..66dc07a4 100644 --- a/src/fftManager/FFTPluginPanelProvider.java +++ b/src/fftManager/FFTPluginPanelProvider.java @@ -78,10 +78,12 @@ public class FFTPluginPanelProvider implements DisplayPanelProvider { DisplayProviderList.addDisplayPanelProvider(this); } + @Override public DisplayPanel createDisplayPanel(DisplayPanelContainer displayPanelContainer) { return new FFTPluginPanel(this, displayPanelContainer); } + @Override public String getDisplayPanelName() { return fftDataBlock.getDataName(); // return "Channel Spectra"; @@ -252,6 +254,7 @@ public class FFTPluginPanelProvider implements DisplayPanelProvider { class OptionsListener implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { showDialog(); } @@ -303,25 +306,30 @@ public class FFTPluginPanelProvider implements DisplayPanelProvider { } + @Override public String getObserverName() { return "Spectra plug in panel"; } + @Override public long getRequiredDataHistory(PamObservable o, Object arg) { return 0; } + @Override public void noteNewSettings() { prepareChannels(); // TODO Auto-generated method stub } + @Override public void removeObservable(PamObservable o) { // TODO Auto-generated method stub } + @Override public void setSampleRate(float sampleRate, boolean notify) { setupSouthAxis(sampleRate); } @@ -347,6 +355,7 @@ public class FFTPluginPanelProvider implements DisplayPanelProvider { // TODO Auto-generated method stub } + @Override public void addData(PamObservable o, PamDataUnit arg) { // TODO Auto-generated method stub @@ -444,27 +453,32 @@ public class FFTPluginPanelProvider implements DisplayPanelProvider { // don't do anything by default } + @Override public Serializable getSettingsReference() { return plotOptions; } + @Override public long getSettingsVersion() { return FFTDataDisplayOptions.serialVersionUID; } + @Override public String getUnitName() { return getDisplayPanelName(); // return displayPanelProvider.getDisplayPanelName(); } + @Override public String getUnitType() { return "FFTPluginPanelDisplayOptions"; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { plotOptions = ((FFTDataDisplayOptions) pamControlledUnitSettings.getSettings()).clone(); return true; diff --git a/src/fftManager/FFTPluginParamsDialog.java b/src/fftManager/FFTPluginParamsDialog.java index 77fa08e1..921d3a80 100644 --- a/src/fftManager/FFTPluginParamsDialog.java +++ b/src/fftManager/FFTPluginParamsDialog.java @@ -40,13 +40,12 @@ import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.border.TitledBorder; -import fftManager.FFTPluginPanelProvider.FFTPluginPanel; - import PamUtils.PamUtils; import PamView.dialog.ChannelListScroller; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; import PamView.dialog.PamLabel; +import fftManager.FFTPluginPanelProvider.FFTPluginPanel; @@ -215,6 +214,7 @@ public class FFTPluginParamsDialog extends PamDialog implements ActionListener{ private class UseSpecValues implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { enableControls(); } @@ -286,6 +286,7 @@ public class FFTPluginParamsDialog extends PamDialog implements ActionListener{ } + @Override public void actionPerformed(ActionEvent arg0) { // TODO Auto-generated method stub diff --git a/src/fftManager/FastFFT.java b/src/fftManager/FastFFT.java index 34674ca2..c1cbce5a 100644 --- a/src/fftManager/FastFFT.java +++ b/src/fftManager/FastFFT.java @@ -251,7 +251,7 @@ public class FastFFT { break; } return power; - }; + } /** * Finds the next highest binary exponential of the input integer. If the @@ -273,7 +273,7 @@ public class FastFFT { break; } return power; - }; + } /** * diff --git a/src/fftManager/FileFFTTest.java b/src/fftManager/FileFFTTest.java index 1e5698ed..55ca004e 100644 --- a/src/fftManager/FileFFTTest.java +++ b/src/fftManager/FileFFTTest.java @@ -6,8 +6,6 @@ import java.util.Arrays; import javax.swing.JOptionPane; import edu.emory.mathcs.jtransforms.fft.DoubleFFT_1D; - -import wavFiles.WavFile; import wavFiles.WavFileReader; import wavFiles.WavHeader; @@ -30,7 +28,7 @@ public class FileFFTTest { public void run() { File aFile = new File(fileName); - if (aFile.exists() == false) { + if (!aFile.exists()) { reportError("Wav file does not exist"); } wavFile = new WavFileReader(fileName); diff --git a/src/fftManager/PamFFTControl.java b/src/fftManager/PamFFTControl.java index ef73f913..26c206a1 100644 --- a/src/fftManager/PamFFTControl.java +++ b/src/fftManager/PamFFTControl.java @@ -27,16 +27,6 @@ import java.io.Serializable; import javax.swing.JMenuItem; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import dataPlots.data.TDDataProviderRegister; -import dataPlotsFX.data.TDDataProviderRegisterFX; -import dataPlotsFX.spectrogramPlotFX.FFTPlotProvider; -import fftManager.layoutFX.FFTGuiFX; -//import fftManager.layoutFX.FFTGuiFX; -import fftManager.newSpectrogram.SpectrogramPlotProvider; -import spectrogramNoiseReduction.SpectrogramNoiseProcess; import PamController.PamConfiguration; import PamController.PamControlledUnit; import PamController.PamControlledUnitGUI; @@ -49,6 +39,13 @@ import PamController.PamSettings; import PamView.PamControlledGUISwing; import PamView.WrapperControlledGUISwing; import PamguardMVC.PamRawDataBlock; +import dataPlots.data.TDDataProviderRegister; +import dataPlotsFX.data.TDDataProviderRegisterFX; +import dataPlotsFX.spectrogramPlotFX.FFTPlotProvider; +import fftManager.layoutFX.FFTGuiFX; +//import fftManager.layoutFX.FFTGuiFX; +import fftManager.newSpectrogram.SpectrogramPlotProvider; +import spectrogramNoiseReduction.SpectrogramNoiseProcess; public class PamFFTControl extends PamControlledUnit implements PamSettings { @@ -115,6 +112,7 @@ public class PamFFTControl extends PamControlledUnit implements PamSettings { this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { showParamsDialog(parentFrame); } @@ -140,6 +138,7 @@ public class PamFFTControl extends PamControlledUnit implements PamSettings { return fftParameters; } + @Override public Serializable getSettingsReference() { fftParameters.spectrogramNoiseSettings = spectrogramNoiseProcess.getNoiseSettings(); return fftParameters; @@ -148,11 +147,13 @@ public class PamFFTControl extends PamControlledUnit implements PamSettings { /** * @return An integer version number for the settings */ + @Override public long getSettingsVersion() { return FFTParameters.serialVersionUID; } + @Override public boolean restoreSettings( PamControlledUnitSettings pamControlledUnitSettings) { FFTParameters newParameters = (FFTParameters) pamControlledUnitSettings @@ -171,7 +172,7 @@ public class PamFFTControl extends PamControlledUnit implements PamSettings { //System.out.println("FFTControl: notifyModelChanged : " +changeType); super.notifyModelChanged(changeType); switch (changeType) { - case PamController.INITIALIZATION_COMPLETE: + case PamControllerInterface.INITIALIZATION_COMPLETE: setupControlledUnit(); break; } diff --git a/src/fftManager/PamFFTProcess.java b/src/fftManager/PamFFTProcess.java index 64803968..4a5648f6 100644 --- a/src/fftManager/PamFFTProcess.java +++ b/src/fftManager/PamFFTProcess.java @@ -24,17 +24,16 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Vector; -import PamController.PamController; import PamDetection.RawDataUnit; import PamUtils.PamUtils; import PamUtils.complex.ComplexArray; -import PamguardMVC.ProcessAnnotation; import PamguardMVC.PamConstants; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; import PamguardMVC.PamRawDataBlock; +import PamguardMVC.ProcessAnnotation; import Spectrogram.WindowFunction; /** diff --git a/src/fileOfflineData/OfflineFileControl.java b/src/fileOfflineData/OfflineFileControl.java index 45998aaf..cec34d63 100644 --- a/src/fileOfflineData/OfflineFileControl.java +++ b/src/fileOfflineData/OfflineFileControl.java @@ -13,10 +13,6 @@ import java.util.List; import javax.swing.JMenuItem; import javax.swing.SwingWorker; -import dataGram.DatagramManager; -import dataMap.OfflineDataMap; -import dataMap.OfflineDataMapPoint; -import pamScrollSystem.ViewLoadObserver; import PamController.AWTScheduler; import PamController.OfflineDataStore; import PamController.PamControlledUnit; @@ -26,10 +22,12 @@ import PamController.PamControllerInterface; import PamController.PamSettingManager; import PamController.PamSettings; import PamUtils.FileList; -import PamUtils.PamCalendar; import PamguardMVC.PamDataBlock; -import PamguardMVC.RequestCancellationObject; import PamguardMVC.dataOffline.OfflineDataLoadInfo; +import dataGram.DatagramManager; +import dataMap.OfflineDataMap; +import dataMap.OfflineDataMapPoint; +import pamScrollSystem.ViewLoadObserver; public abstract class OfflineFileControl extends PamControlledUnit implements OfflineDataStore { diff --git a/src/fileOfflineData/OfflineFileList.java b/src/fileOfflineData/OfflineFileList.java index cece0092..8fdadff5 100644 --- a/src/fileOfflineData/OfflineFileList.java +++ b/src/fileOfflineData/OfflineFileList.java @@ -48,7 +48,7 @@ public class OfflineFileList { } private void addFiles(File current) { - if (current.exists() == false) { + if (!current.exists()) { return; } if (current.isFile() && checkFilter(current)) { diff --git a/src/fileOfflineData/OfflineFileMapPoint.java b/src/fileOfflineData/OfflineFileMapPoint.java index fd149f08..58f2ec6d 100644 --- a/src/fileOfflineData/OfflineFileMapPoint.java +++ b/src/fileOfflineData/OfflineFileMapPoint.java @@ -1,11 +1,9 @@ package fileOfflineData; import java.io.File; -import java.lang.reflect.Field; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import dataMap.OfflineDataMapPoint; public class OfflineFileMapPoint extends OfflineDataMapPoint implements ManagedParameters { diff --git a/src/fileOfflineData/OfflineFileProgressDialog.java b/src/fileOfflineData/OfflineFileProgressDialog.java index c3106be9..a0824f81 100644 --- a/src/fileOfflineData/OfflineFileProgressDialog.java +++ b/src/fileOfflineData/OfflineFileProgressDialog.java @@ -13,8 +13,6 @@ import javax.swing.border.TitledBorder; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; -import dataMap.filemaps.FileMapMakingdialog; -import dataMap.filemaps.OfflineFileServer; public class OfflineFileProgressDialog extends PamDialog { diff --git a/src/generalDatabase/BaseAccessSystem.java b/src/generalDatabase/BaseAccessSystem.java index c4e17117..7a948fe2 100644 --- a/src/generalDatabase/BaseAccessSystem.java +++ b/src/generalDatabase/BaseAccessSystem.java @@ -1,10 +1,6 @@ package generalDatabase; -import generalDatabase.pamCursor.PamCursor; - -import java.awt.Component; import java.io.File; -import java.sql.Connection; import java.util.ArrayList; abstract public class BaseAccessSystem extends DBSystem { diff --git a/src/generalDatabase/BufferedSQLLogging.java b/src/generalDatabase/BufferedSQLLogging.java index 96782251..0b4e24ea 100644 --- a/src/generalDatabase/BufferedSQLLogging.java +++ b/src/generalDatabase/BufferedSQLLogging.java @@ -3,8 +3,6 @@ package generalDatabase; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.Collections; -import java.util.Enumeration; -import java.util.Hashtable; import java.util.Iterator; import java.util.LinkedList; import java.util.List; diff --git a/src/generalDatabase/DBCommitter.java b/src/generalDatabase/DBCommitter.java index b760e135..13b7011c 100644 --- a/src/generalDatabase/DBCommitter.java +++ b/src/generalDatabase/DBCommitter.java @@ -73,7 +73,7 @@ public class DBCommitter { return false; } try { - if (pamCon.getConnection().getAutoCommit() == false) { + if (!pamCon.getConnection().getAutoCommit()) { pamCon.getConnection().commit(); } } catch (SQLException e) { diff --git a/src/generalDatabase/DBControl.java b/src/generalDatabase/DBControl.java index 70e0d549..c3be91e7 100644 --- a/src/generalDatabase/DBControl.java +++ b/src/generalDatabase/DBControl.java @@ -1,38 +1,19 @@ package generalDatabase; -import generalDatabase.external.CopyManager; -import generalDatabase.layoutFX.DBGuiFX; -import generalDatabase.lookupTables.LookUpTables; -import generalDatabase.lookupTables.LookupList; -import generalDatabase.pamCursor.PamCursor; -import generalDatabase.postgresql.PostgreSQLSystem; -import generalDatabase.sqlite.SqliteSystem; -import loggerForms.FormsControl; - import java.awt.Component; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.io.File; import java.io.Serializable; import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; -import java.util.Properties; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuItem; -import org.apache.commons.io.FilenameUtils; - -import offlineProcessing.DataCopyTask; -import offlineProcessing.OLProcessDialog; -import offlineProcessing.OfflineTaskGroup; -import pamguard.GlobalArguments; -import warnings.PamWarning; -import warnings.WarningSystem; import PamController.PamConfiguration; import PamController.PamControlledUnit; import PamController.PamControlledUnitGUI; @@ -50,6 +31,19 @@ import PamView.dialog.warn.WarnOnce; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import annotation.userforms.UserFormAnnotationType; +import generalDatabase.external.CopyManager; +import generalDatabase.layoutFX.DBGuiFX; +import generalDatabase.lookupTables.LookUpTables; +import generalDatabase.lookupTables.LookupList; +import generalDatabase.pamCursor.PamCursor; +import generalDatabase.sqlite.SqliteSystem; +import loggerForms.FormsControl; +import offlineProcessing.DataCopyTask; +import offlineProcessing.OLProcessDialog; +import offlineProcessing.OfflineTaskGroup; +import pamguard.GlobalArguments; +import warnings.PamWarning; +import warnings.WarningSystem; /** * Database system for accessing data in just about any type of odbc database. @@ -159,7 +153,7 @@ PamSettingsSource { // selectDatabase(null); - if (isInMainConfiguration() == false) { + if (!isInMainConfiguration()) { openImmediately = false; } if (databaseSystem == null){ @@ -221,12 +215,12 @@ PamSettingsSource { // Do a quick check here to see if the database exists. If not, warn the user before creating a new one. Note that if // the database name is null, the user is creating a brand new database so skip the check boolean checkExists = databaseSystem.checkDatabaseExists(forcedName); - if (checkExists == false && forcedName != null) { + if (!checkExists && forcedName != null) { databaseSystem.createNewDatabase(forcedName); checkExists = databaseSystem.checkDatabaseExists(forcedName); } - if (checkExists == false) { + if (!checkExists) { String title = "Database not found"; String msg = "PAMGuard is unable to access the following database:

" + forcedName + @@ -303,7 +297,7 @@ PamSettingsSource { } synchronized (DBControl.class) { try { - if (connection.getConnection().getAutoCommit() == false) { + if (!connection.getConnection().getAutoCommit()) { connection.getConnection().commit(); } } catch (SQLException e) { @@ -368,15 +362,18 @@ PamSettingsSource { return connection; } + @Override public Serializable getSettingsReference() { dbParameters.setDatabaseName(getLongDatabaseName()); return dbParameters; } + @Override public long getSettingsVersion() { return DBParameters.serialVersionUID; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { DBParameters np = (DBParameters) pamControlledUnitSettings.getSettings(); dbParameters = np.clone(); @@ -419,7 +416,7 @@ PamSettingsSource { // if (dbParameters.getUseAutoCommit() == false) { JMenuItem commitItem = new JMenuItem("Commit Changes"); - commitItem.setEnabled(dbParameters.getUseAutoCommit() == false); + commitItem.setEnabled(!dbParameters.getUseAutoCommit()); commitItem.setToolTipText("Immediately commit recent changes to the database"); commitItem.addActionListener(new ActionListener() { @Override @@ -465,6 +462,7 @@ PamSettingsSource { this.frame = frame; } + @Override public void actionPerformed(ActionEvent e) { selectDatabase(frame, null); diff --git a/src/generalDatabase/DBControlSettings.java b/src/generalDatabase/DBControlSettings.java index 3d9c6fb5..a27019ab 100644 --- a/src/generalDatabase/DBControlSettings.java +++ b/src/generalDatabase/DBControlSettings.java @@ -108,7 +108,7 @@ public class DBControlSettings extends DBControl { } if (showDatabaseDialog == 2) { // open the database dialog. - if (selectDatabase(null, null) == false) { + if (!selectDatabase(null, null)) { return null; } } diff --git a/src/generalDatabase/DBControlUnit.java b/src/generalDatabase/DBControlUnit.java index a48971da..f60fa5a6 100644 --- a/src/generalDatabase/DBControlUnit.java +++ b/src/generalDatabase/DBControlUnit.java @@ -12,15 +12,9 @@ import java.util.List; import javax.swing.SwingWorker; -import dataGram.DatagramManager; -import dataMap.OfflineDataMapPoint; -import generalDatabase.backup.DatabaseBackupStream; -import pamScrollSystem.ViewLoadObserver; -import pamViewFX.pamTask.PamTaskUpdate; import PamController.AWTScheduler; import PamController.DataIntegrityChecker; import PamController.DataOutputStore; -import PamController.OfflineDataStore; import PamController.PamConfiguration; import PamController.PamControlledUnit; import PamController.PamController; @@ -32,9 +26,13 @@ import PamController.status.ModuleStatus; import PamController.status.QuickRemedialAction; import PamguardMVC.PamDataBlock; import PamguardMVC.PamProcess; -import PamguardMVC.RequestCancellationObject; import PamguardMVC.dataOffline.OfflineDataLoadInfo; import backupmanager.BackupInformation; +import dataGram.DatagramManager; +import dataMap.OfflineDataMapPoint; +import generalDatabase.backup.DatabaseBackupStream; +import pamScrollSystem.ViewLoadObserver; +import pamViewFX.pamTask.PamTaskUpdate; /** * Version of DBControl for normal use while PAMGUARD is running @@ -114,19 +112,19 @@ public class DBControlUnit extends DBControl implements DataOutputStore { public void notifyModelChanged(int changeType) { super.notifyModelChanged(changeType); switch (changeType) { - case PamController.INITIALIZATION_COMPLETE: + case PamControllerInterface.INITIALIZATION_COMPLETE: initialisationComplete = true; if (isViewer) { createOfflineDataMap(null); } getDbProcess().checkTables(); break; - case PamController.ADD_DATABLOCK: + case PamControllerInterface.ADD_DATABLOCK: if (initialisationComplete) { getDbProcess().checkTables(); } break; - case PamController.ADD_CONTROLLEDUNIT: + case PamControllerInterface.ADD_CONTROLLEDUNIT: if (initialisationComplete) { PamController pc = PamController.getInstance(); int nUnit = pc.getNumControlledUnits(); @@ -331,7 +329,7 @@ public class DBControlUnit extends DBControl implements DataOutputStore { while (resultSet.next()) { timestamp = resultSet.getObject(1);// getTimestamp(1); actualMillis = (Integer) resultSet.getObject(2); - utcMillis = sqlTypes.millisFromTimeStamp(timestamp); + utcMillis = SQLTypes.millisFromTimeStamp(timestamp); if (utcMillis % 1000 == 0 && actualMillis != null && dataMapPoint != null) { /* * dataMapPoint == null is indicate of it being the first map point in diff --git a/src/generalDatabase/DBDialog.java b/src/generalDatabase/DBDialog.java index 9f93d334..f3f852c9 100644 --- a/src/generalDatabase/DBDialog.java +++ b/src/generalDatabase/DBDialog.java @@ -12,8 +12,6 @@ import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JPanel; import javax.swing.border.TitledBorder; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; import PamView.dialog.PamDialog; import PamView.dialog.warn.WarnOnce; @@ -123,7 +121,7 @@ public class DBDialog extends PamDialog { @Override public boolean getParams() { - if (systemDialogPanel != null && systemDialogPanel.getParams() == false) return false; + if (systemDialogPanel != null && !systemDialogPanel.getParams()) return false; dbParameters.setDatabaseSystem(systemList.getSelectedIndex()); @@ -171,6 +169,7 @@ public class DBDialog extends PamDialog { class SelectDBSystem implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { selectSystem(); diff --git a/src/generalDatabase/DBMapMakingDialog.java b/src/generalDatabase/DBMapMakingDialog.java index 7cc791fb..0f013df8 100644 --- a/src/generalDatabase/DBMapMakingDialog.java +++ b/src/generalDatabase/DBMapMakingDialog.java @@ -57,7 +57,7 @@ public class DBMapMakingDialog extends PamDialog { @Override public void setVisible(boolean visible) { - if (visible == false) { + if (!visible) { // dispose(); // singleInstance = null; closeLater(); diff --git a/src/generalDatabase/DBOfflineDataMap.java b/src/generalDatabase/DBOfflineDataMap.java index 4540cfbe..fe6c01d6 100644 --- a/src/generalDatabase/DBOfflineDataMap.java +++ b/src/generalDatabase/DBOfflineDataMap.java @@ -1,7 +1,7 @@ package generalDatabase; -import dataMap.OfflineDataMap; import PamguardMVC.PamDataBlock; +import dataMap.OfflineDataMap; public class DBOfflineDataMap extends OfflineDataMap { diff --git a/src/generalDatabase/DBOfflineDataMapPoint.java b/src/generalDatabase/DBOfflineDataMapPoint.java index ff333da2..456a6f96 100644 --- a/src/generalDatabase/DBOfflineDataMapPoint.java +++ b/src/generalDatabase/DBOfflineDataMapPoint.java @@ -1,9 +1,9 @@ package generalDatabase; -import dataMap.OfflineDataMapPoint; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamUtils.PamCalendar; +import dataMap.OfflineDataMapPoint; public class DBOfflineDataMapPoint extends OfflineDataMapPoint implements ManagedParameters { diff --git a/src/generalDatabase/DBProcess.java b/src/generalDatabase/DBProcess.java index 597b1a10..0d6656e3 100644 --- a/src/generalDatabase/DBProcess.java +++ b/src/generalDatabase/DBProcess.java @@ -1,12 +1,5 @@ package generalDatabase; -import generalDatabase.ColumnMetaData.METACOLNAMES; -import generalDatabase.clauses.FixedClause; -import generalDatabase.clauses.FromClause; -import generalDatabase.clauses.PAMSelectClause; -import generalDatabase.pamCursor.PamCursor; -import generalDatabase.ucanAccess.UCanAccessSystem; - import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; @@ -15,17 +8,13 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; -import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.PreparedStatement; import java.sql.ResultSet; -import java.sql.ResultSetMetaData; import java.sql.SQLException; -import java.sql.SQLWarning; import java.sql.Statement; import java.sql.Types; import java.util.ArrayList; -import java.util.List; import javax.swing.JFileChooser; import javax.swing.JFrame; @@ -33,14 +22,6 @@ import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.Timer; -import warnings.PamWarning; -import warnings.WarningSystem; -import whistlesAndMoans.ConnectedRegionDataBlock; -import loggerForms.FormDescription; -import loggerForms.FormsControl; -import loggerForms.ItemInformation; -import loggerForms.UDFTableDefinition; -import loggerForms.formdesign.FormEditor; import PamController.PamControlledUnit; import PamController.PamController; import PamController.PamFolders; @@ -53,6 +34,15 @@ import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; import PamguardMVC.debug.Debug; +import generalDatabase.ColumnMetaData.METACOLNAMES; +import generalDatabase.clauses.FromClause; +import generalDatabase.clauses.PAMSelectClause; +import generalDatabase.pamCursor.PamCursor; +import generalDatabase.ucanAccess.UCanAccessSystem; +import loggerForms.FormDescription; +import loggerForms.FormsControl; +import warnings.PamWarning; +import warnings.WarningSystem; public class DBProcess extends PamProcess { @@ -299,7 +289,7 @@ public class DBProcess extends PamProcess { FormDescription theForm = loggerModule.getFormDescription(j); // if the table doesn't exist, create it - if (tableExists(theForm.getUdfTableDefinition()) == false) { + if (!tableExists(theForm.getUdfTableDefinition())) { checkTable(theForm.getUdfTableDefinition()); } // if this table already exists in the database, warn the user that it's about @@ -333,7 +323,7 @@ public class DBProcess extends PamProcess { */ public boolean checkTable(SQLLogging sqlLogging) { boolean ans = checkTable(sqlLogging.getTableDefinition()); - if (sqlLogging.doExtraChecks(this, databaseControll.getConnection()) == false) { + if (!sqlLogging.doExtraChecks(this, databaseControll.getConnection())) { return false; } if (sqlLogging instanceof SuperDetLogging) { @@ -365,9 +355,9 @@ public class DBProcess extends PamProcess { Debug.out.println("Checking table: " + tableDef.getTableName()); // } - if (tableExists(tableDef) == false) { + if (!tableExists(tableDef)) { createTable(tableDef); - if (tableExists(tableDef) == false) + if (!tableExists(tableDef)) return false; } @@ -382,7 +372,7 @@ public class DBProcess extends PamProcess { // getAllColumnMetaData(tableDef.tableName); for (int i = 0; i < tableDef.getTableItemCount(); i++) { - if (checkColumn(tableDef, tableDef.getTableItem(i)) == false) { + if (!checkColumn(tableDef, tableDef.getTableItem(i))) { columnErrors++; } } @@ -511,7 +501,7 @@ public class DBProcess extends PamProcess { * If the DB is NOT MS Access, not need to do anything. while the error occurred * it would have been impossible to create any other type of database. */ - if (databaseControll.databaseSystem.getSystemName().equals(MSAccessSystem.SYSTEMNAME) == false) { + if (!databaseControll.databaseSystem.getSystemName().equals(MSAccessSystem.SYSTEMNAME)) { return; } boolean hasPCLocalTime = columnExists(tableDef, "PCLocalTime", Types.TIMESTAMP); @@ -521,7 +511,7 @@ public class DBProcess extends PamProcess { * If it already has a PCLocalTime column, then we've probably been here before * and all is OK, */ - if (hasLocalTime == true && hasPCLocalTime == false) { + if (hasLocalTime && !hasPCLocalTime) { // we have a problem ! int ans = JOptionPane.showConfirmDialog(null, expMessage, "Database table " + tableDef.getTableName(), JOptionPane.OK_CANCEL_OPTION); @@ -643,14 +633,14 @@ public class DBProcess extends PamProcess { * @return true if column existed or was created. */ public boolean checkColumn(EmptyTableDefinition tableDef, PamTableItem tableItem) { - if (columnExists(tableDef, tableItem) == false) { - if (addColumn(tableDef, tableItem) == false) + if (!columnExists(tableDef, tableItem)) { + if (!addColumn(tableDef, tableItem)) return false; populateNewColumn(tableDef, null, tableItem); } if (tableItem.isPrimaryKey()) { boolean ispk = isPrimarykey(tableDef.getTableName(), tableItem.getName()); - if (ispk == false) { + if (!ispk) { String tit = "Database table " + tableDef.tableName; String msg = String.format("Column \"%s\" in the table \"%s\" should be a primary key, but this is not the case," + "
Database behaviour may become very unpredictable unless this is fixed." + @@ -689,7 +679,7 @@ public class DBProcess extends PamProcess { copyStr = String.format("UPDATE %s SET %s = %s", tableDef.getTableName(), tableColToUpdate.getName(), tableColWithValues.getName()); } - if (copyStr != null && runStmt(copyStr) == false) { + if (copyStr != null && !runStmt(copyStr)) { System.out.println("Error trying to copy data between columns: " + copyStr); return false; } @@ -866,7 +856,7 @@ public class DBProcess extends PamProcess { String sqlCmd; if (columnExists(tableName, tempColName, tableItem.getSqlType())) { sqlCmd = String.format("ALTER TABLE %s DROP COLUMN %s", sqlTypes.formatTableName(tableName), tempColName); - if (runStmt(sqlCmd) == false) { + if (!runStmt(sqlCmd)) { return false; } } @@ -874,21 +864,21 @@ public class DBProcess extends PamProcess { // create the temp column sqlCmd = String.format("ALTER TABLE %s ADD COLUMN %s %s", sqlTypes.formatTableName(tableName), tempColName, sqlTypes.typeToString(tableItem.getSqlType(), tableItem.getLength())); - if (runStmt(sqlCmd) == false) { + if (!runStmt(sqlCmd)) { return false; } // copy over the data sqlCmd = String.format("UPDATE %s SET %s = %s", sqlTypes.formatTableName(tableName), tempColName, sqlTypes.formatColumnName(tableItem.getName())); - if (runStmt(sqlCmd) == false) { + if (!runStmt(sqlCmd)) { return false; } // delete the original column sqlCmd = String.format("ALTER TABLE %s DROP COLUMN %s", sqlTypes.formatTableName(tableName), sqlTypes.formatColumnName(tableItem.getName())); - if (runStmt(sqlCmd) == false) { + if (!runStmt(sqlCmd)) { return false; } @@ -896,7 +886,7 @@ public class DBProcess extends PamProcess { sqlCmd = String.format("ALTER TABLE %s ADD COLUMN %s %s", sqlTypes.formatTableName(tableName), sqlTypes.formatColumnName(tableItem.getName()), sqlTypes.typeToString(tableItem.getSqlType(), tableItem.getLength())); - if (runStmt(sqlCmd) == false) { + if (!runStmt(sqlCmd)) { return false; } @@ -904,13 +894,13 @@ public class DBProcess extends PamProcess { sqlCmd = String.format("UPDATE %s SET %s = %s", sqlTypes.formatTableName(tableName), sqlTypes.formatColumnName(tableItem.getName()), tempColName); - if (runStmt(sqlCmd) == false) { + if (!runStmt(sqlCmd)) { return false; } // delete the original column sqlCmd = String.format("ALTER TABLE %s DROP COLUMN %s", tableName, tempColName); - if (runStmt(sqlCmd) == false) { + if (!runStmt(sqlCmd)) { return false; } @@ -1148,7 +1138,7 @@ public class DBProcess extends PamProcess { if (tableItem.isPrimaryKey()) { String primaryString = "ALTER TABLE " + tableDef.getTableName() + " ADD PRIMARY KEY ( " + sqlTypes.formatColumnName(tableItem.getName()) + " )"; - ; + try { stmt = databaseControll.getConnection().getConnection().createStatement(); @@ -1384,6 +1374,7 @@ public class DBProcess extends PamProcess { class TimerAction implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { databaseControll.setWriteCount(dbWriteOKs, dbWriteErrors); dbWriteOKs = dbWriteErrors = 0; @@ -1393,6 +1384,7 @@ public class DBProcess extends PamProcess { class ViewTimerAction implements ActionListener { + @Override public void actionPerformed(ActionEvent arg0) { viewTimerAction(); } diff --git a/src/generalDatabase/DBSidePanel.java b/src/generalDatabase/DBSidePanel.java index d8883b08..0527bbc3 100644 --- a/src/generalDatabase/DBSidePanel.java +++ b/src/generalDatabase/DBSidePanel.java @@ -12,8 +12,8 @@ import javax.swing.border.TitledBorder; import PamController.PamController; import PamView.ColorManaged; import PamView.PamColors; -import PamView.PamSidePanel; import PamView.PamColors.PamColor; +import PamView.PamSidePanel; import PamView.dialog.PamDialog; import PamView.dialog.PamLabel; @@ -105,6 +105,7 @@ public class DBSidePanel implements PamSidePanel { } } + @Override public JComponent getPanel() { // TODO Auto-generated method stub return p; @@ -112,6 +113,7 @@ public class DBSidePanel implements PamSidePanel { + @Override public void rename(String newName) { // TODO Auto-generated method stub diff --git a/src/generalDatabase/DBSpeedTest.java b/src/generalDatabase/DBSpeedTest.java index d39367c2..f57f5a4f 100644 --- a/src/generalDatabase/DBSpeedTest.java +++ b/src/generalDatabase/DBSpeedTest.java @@ -8,10 +8,6 @@ import java.sql.SQLException; import java.sql.Statement; import java.sql.Types; -import javax.swing.JOptionPane; - -import PamUtils.PamCalendar; - public class DBSpeedTest { @@ -271,7 +267,7 @@ public class DBSpeedTest { selectStatement.close(); } - if (con.getAutoCommit() == false) { + if (!con.getAutoCommit()) { con.commit(); } diff --git a/src/generalDatabase/DBSystem.java b/src/generalDatabase/DBSystem.java index b01c0527..a75a58e1 100644 --- a/src/generalDatabase/DBSystem.java +++ b/src/generalDatabase/DBSystem.java @@ -1,12 +1,12 @@ package generalDatabase; -import generalDatabase.layoutFX.SystemDialogPaneFX; -import generalDatabase.pamCursor.PamCursor; - import java.awt.Component; import java.io.File; import java.sql.SQLException; +import generalDatabase.layoutFX.SystemDialogPaneFX; +import generalDatabase.pamCursor.PamCursor; + abstract public class DBSystem { diff --git a/src/generalDatabase/DBTest.java b/src/generalDatabase/DBTest.java index e33b1ad4..5b942c0f 100644 --- a/src/generalDatabase/DBTest.java +++ b/src/generalDatabase/DBTest.java @@ -1,16 +1,15 @@ package generalDatabase; -import generalDatabase.pamCursor.NonScrollablePamCursor; -import generalDatabase.pamCursor.PamCursor; - import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; +import java.sql.Statement; import java.sql.Types; -import java.sql.Statement; +import generalDatabase.pamCursor.NonScrollablePamCursor; +import generalDatabase.pamCursor.PamCursor; public class DBTest { diff --git a/src/generalDatabase/DatabaseSpeedDialog.java b/src/generalDatabase/DatabaseSpeedDialog.java index 0a545425..41a0d54e 100644 --- a/src/generalDatabase/DatabaseSpeedDialog.java +++ b/src/generalDatabase/DatabaseSpeedDialog.java @@ -1,14 +1,10 @@ package generalDatabase; -import generalDatabase.pamCursor.PamCursor; -import generalDatabase.pamCursor.PamCursorManager; - import java.awt.BorderLayout; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Window; -import java.sql.Connection; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; @@ -18,12 +14,15 @@ import java.util.List; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; //import com.sun.java.help.impl.SwingWorker; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; +import generalDatabase.pamCursor.PamCursor; +import generalDatabase.pamCursor.PamCursorManager; public class DatabaseSpeedDialog extends PamDialog{ @@ -53,7 +52,7 @@ public class DatabaseSpeedDialog extends PamDialog{ tableDef.setUseCheatIndexing(true); getOkButton().setText("Start"); - if (checkTableDef() == false) { + if (!checkTableDef()) { getOkButton().setEnabled(false); } JPanel mainPanel = new JPanel(new BorderLayout()); @@ -64,23 +63,23 @@ public class DatabaseSpeedDialog extends PamDialog{ topPanel.setBorder(new TitledBorder("Test Output")); topPanel.setLayout(new GridBagLayout()); GridBagConstraints c = new PamGridBagContraints(); - addComponent(topPanel, new JLabel("Total Writes: ", JLabel.RIGHT), c); + addComponent(topPanel, new JLabel("Total Writes: ", SwingConstants.RIGHT), c); c.gridx++; addComponent(topPanel, nWrites = new JTextField(6), c); c.gridx = 0; c.gridy++; - addComponent(topPanel, new JLabel("Time for last write: ", JLabel.RIGHT), c); + addComponent(topPanel, new JLabel("Time for last write: ", SwingConstants.RIGHT), c); c.gridx++; addComponent(topPanel, lastTime = new JTextField(6), c); c.gridx++; - addComponent(topPanel, new JLabel(" milliseconds", JLabel.LEFT), c); + addComponent(topPanel, new JLabel(" milliseconds", SwingConstants.LEFT), c); c.gridx = 0; c.gridy++; - addComponent(topPanel, new JLabel("Last database index: ", JLabel.RIGHT), c); + addComponent(topPanel, new JLabel("Last database index: ", SwingConstants.RIGHT), c); c.gridx++; addComponent(topPanel, lastIndex = new JTextField(6), c); c.gridx++; - addComponent(topPanel, new JLabel(" (read back from db)", JLabel.LEFT), c); + addComponent(topPanel, new JLabel(" (read back from db)", SwingConstants.LEFT), c); setDialogComponent(mainPanel); @@ -231,7 +230,7 @@ public class DatabaseSpeedDialog extends PamDialog{ } catch (SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); - }; + } return null; } diff --git a/src/generalDatabase/EmptyTableDefinition.java b/src/generalDatabase/EmptyTableDefinition.java index 971faf0d..7348ff88 100644 --- a/src/generalDatabase/EmptyTableDefinition.java +++ b/src/generalDatabase/EmptyTableDefinition.java @@ -63,7 +63,7 @@ public class EmptyTableDefinition implements Cloneable { char c; for (int i = 0; i < newString.length(); i++) { c = newString.charAt(i); - if (isValidCharacter(c) == false) { + if (!isValidCharacter(c)) { newString = newString.replace(c, '_'); } } @@ -249,13 +249,13 @@ public class EmptyTableDefinition implements Cloneable { boolean first = true; for (int i = 0; i < nItems; i++) { tableItem = getTableItem(i); - if (tableItem.isCounter() && includeCounters == false) { + if (tableItem.isCounter() && !includeCounters) { continue; } - if (tableItem.isPrimaryKey() && includeCounters == false) { + if (tableItem.isPrimaryKey() && !includeCounters) { continue; } - if (first == false) { + if (!first) { str+=", "; valsBit+=", "; } diff --git a/src/generalDatabase/LogModules.java b/src/generalDatabase/LogModules.java index 84b1dc1c..4eebb01c 100644 --- a/src/generalDatabase/LogModules.java +++ b/src/generalDatabase/LogModules.java @@ -1,6 +1,5 @@ package generalDatabase; -import java.sql.Connection; import java.sql.Types; import PamController.PamControlledUnit; diff --git a/src/generalDatabase/LogSettings.java b/src/generalDatabase/LogSettings.java index c7072e30..7474a8f9 100644 --- a/src/generalDatabase/LogSettings.java +++ b/src/generalDatabase/LogSettings.java @@ -1,12 +1,7 @@ package generalDatabase; -import generalDatabase.pamCursor.NonScrollablePamCursor; -import generalDatabase.pamCursor.PamCursor; - -import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; -import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.sql.ResultSet; import java.sql.SQLException; @@ -21,6 +16,8 @@ import PamController.PamSettingsGroup; import PamUtils.Ascii6Bit; import PamUtils.PamCalendar; import PamguardMVC.PamDataUnit; +import generalDatabase.pamCursor.NonScrollablePamCursor; +import generalDatabase.pamCursor.PamCursor; /** * Functions for writing serialised Pamguard Settings into any database as character data @@ -196,7 +193,7 @@ public class LogSettings extends DbSpecial { tableItem = tableDef.getTimeStampItem(); // timestamp = (Timestamp) tableItem.getTimestampValue(); - timeMillis = sqlTypes.millisFromTimeStamp(tableItem.getValue()); + timeMillis = SQLTypes.millisFromTimeStamp(tableItem.getValue()); nStrings = (Integer) tableDef.getGroupTotal().getValue(); iString = (Integer) tableDef.getGroupIndex().getValue(); diff --git a/src/generalDatabase/LogXMLSettings.java b/src/generalDatabase/LogXMLSettings.java index 3f33c188..1b4e0bdf 100644 --- a/src/generalDatabase/LogXMLSettings.java +++ b/src/generalDatabase/LogXMLSettings.java @@ -60,7 +60,7 @@ public class LogXMLSettings extends DbSpecial { } private void saveModuleSettings(PamConnection con, long dataTime, long now, PamControlledUnit controlledUnit) { - if (controlledUnit instanceof PamSettings == false) { + if (!(controlledUnit instanceof PamSettings)) { return; } PamSettings pamSettings = (PamSettings) controlledUnit; @@ -84,7 +84,7 @@ public class LogXMLSettings extends DbSpecial { } private void updateModuleSettings(PamConnection con, long dataTime, long now, PamControlledUnit controlledUnit) { - if (controlledUnit instanceof PamSettings == false) { + if (!(controlledUnit instanceof PamSettings)) { return; } PamSettings pamSettings = (PamSettings) controlledUnit; diff --git a/src/generalDatabase/MSAccessDialogPanel.java b/src/generalDatabase/MSAccessDialogPanel.java index cce3f3c9..318c7465 100644 --- a/src/generalDatabase/MSAccessDialogPanel.java +++ b/src/generalDatabase/MSAccessDialogPanel.java @@ -2,16 +2,11 @@ package generalDatabase; import java.awt.BorderLayout; import java.awt.Component; -import java.awt.Desktop; import java.awt.FlowLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; -import java.net.URISyntaxException; -import java.net.URL; -import java.nio.file.CopyOption; import java.nio.file.Files; -import java.nio.file.StandardCopyOption; import javax.swing.JButton; import javax.swing.JComboBox; @@ -20,7 +15,6 @@ import javax.swing.JPanel; import javax.swing.border.TitledBorder; import PamUtils.PamFileFilter; -import PamUtils.PamUtils; public class MSAccessDialogPanel implements SystemDialogPanel { @@ -51,17 +45,19 @@ public class MSAccessDialogPanel implements SystemDialogPanel { browseButton.addActionListener(new BrowseButtonAction()); } + @Override public JPanel getPanel() { return p; } + @Override public boolean getParams() { // selected item may not be first in the list - so re-order the // list to make sure that it is. int ind = dbList.getSelectedIndex(); if (ind >= 0) { File selFile = (File) dbList.getSelectedItem(); - if (selFile.exists() == false) return false; + if (!selFile.exists()) return false; msAccessSystem.getRecentDatabases().remove(selFile); msAccessSystem.getRecentDatabases().add(0, selFile); return true; @@ -71,6 +67,7 @@ public class MSAccessDialogPanel implements SystemDialogPanel { } } + @Override public void setParams() { dbList.removeAllItems(); @@ -98,6 +95,7 @@ public class MSAccessDialogPanel implements SystemDialogPanel { class BrowseButtonAction implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { String newDB = msAccessSystem.browseDatabases(parent); @@ -112,7 +110,7 @@ public class MSAccessDialogPanel implements SystemDialogPanel { // then insert the file at the top of the list. File newFile = new File(newDB); // if the file doesn't exit, consider creating it. - if (newFile.exists() == false) { + if (!newFile.exists()) { newFile = createNewDatabase(newDB); if (newFile == null) { System.out.println("Unable to create "+newFile); @@ -134,7 +132,7 @@ public class MSAccessDialogPanel implements SystemDialogPanel { String dummy = "BlankAccess._accdb"; File cpdb=new File(dummy); - if (cpdb.exists() == false) { + if (!cpdb.exists()) { return null; } File newFile = new File(newDB); diff --git a/src/generalDatabase/MSAccessSystem.java b/src/generalDatabase/MSAccessSystem.java index 8cfce017..7c56dfb0 100644 --- a/src/generalDatabase/MSAccessSystem.java +++ b/src/generalDatabase/MSAccessSystem.java @@ -1,9 +1,5 @@ package generalDatabase; -import generalDatabase.layoutFX.SystemDialogPaneFX; -import generalDatabase.pamCursor.NonScrollablePamCursor; -import generalDatabase.pamCursor.PamCursor; - import java.awt.Component; import java.awt.Desktop; import java.io.File; @@ -32,6 +28,9 @@ import PamController.PamSettingManager; import PamController.PamSettings; import PamUtils.PamFileChooser; import PamUtils.PamFileFilter; +import generalDatabase.layoutFX.SystemDialogPaneFX; +import generalDatabase.pamCursor.NonScrollablePamCursor; +import generalDatabase.pamCursor.PamCursor; public class MSAccessSystem extends BaseAccessSystem implements PamSettings { @@ -52,6 +51,7 @@ public class MSAccessSystem extends BaseAccessSystem implements PamSettings { /** * @return the recentDatabases */ + @Override public ArrayList getRecentDatabases() { return recentDatabases; } @@ -286,10 +286,12 @@ public class MSAccessSystem extends BaseAccessSystem implements PamSettings { return SYSTEMNAME; } + @Override public String getUnitName() { return dbControl.getUnitName(); } + @Override public String getUnitType() { return "MS Access Database System"; } @@ -300,14 +302,17 @@ public class MSAccessSystem extends BaseAccessSystem implements PamSettings { // // + @Override public Serializable getSettingsReference() { return recentDatabases; } + @Override public long getSettingsVersion() { return 0; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { recentDatabases = (ArrayList) (pamControlledUnitSettings.getSettings()); return true; diff --git a/src/generalDatabase/MySQLDialogPanel.java b/src/generalDatabase/MySQLDialogPanel.java index 4e96dfe4..9addbeb4 100644 --- a/src/generalDatabase/MySQLDialogPanel.java +++ b/src/generalDatabase/MySQLDialogPanel.java @@ -44,6 +44,7 @@ public class MySQLDialogPanel implements SystemDialogPanel { this.serverBasedSystem = serverBasedSystem; } + @Override public JPanel getPanel() { if (p == null) { createPanel(); @@ -120,12 +121,13 @@ public class MySQLDialogPanel implements SystemDialogPanel { } MySQLParameters tempParams; + @Override public boolean getParams() { tempParams = serverBasedSystem.mySQLParameters.clone(); - if (getServerParams() == false) return false; + if (!getServerParams()) return false; - if (getDbParams() == false) return false; + if (!getDbParams()) return false; // now if all ok, copy back. serverBasedSystem.mySQLParameters = tempParams.clone(); @@ -148,6 +150,7 @@ public class MySQLDialogPanel implements SystemDialogPanel { return true; } + @Override public void setParams() { ipAddress.setText(serverBasedSystem.mySQLParameters.ipAddress); userName.setText(serverBasedSystem.mySQLParameters.userName); @@ -181,9 +184,10 @@ public class MySQLDialogPanel implements SystemDialogPanel { class ConnectServer implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { - if (getServerParams() == false) return; + if (!getServerParams()) return; serverBasedSystem.serverConnect(tempParams); sayServerStatus(); } @@ -213,6 +217,7 @@ public class MySQLDialogPanel implements SystemDialogPanel { class CreateNewDatabase implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { String defaultName = null; diff --git a/src/generalDatabase/MySQLPaneFX.java b/src/generalDatabase/MySQLPaneFX.java index 22b2dc48..00a48356 100644 --- a/src/generalDatabase/MySQLPaneFX.java +++ b/src/generalDatabase/MySQLPaneFX.java @@ -3,20 +3,22 @@ package generalDatabase; import java.util.ArrayList; import javax.swing.JOptionPane; + import PamUtils.PamCalendar; import generalDatabase.layoutFX.SystemDialogPaneFX; -import pamViewFX.PamGuiManagerFX; -import pamViewFX.fxNodes.PamBorderPane; -import pamViewFX.fxNodes.PamButton; -import pamViewFX.fxNodes.PamGridPane; -import pamViewFX.fxNodes.PamVBox; import javafx.geometry.HPos; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; import javafx.scene.control.Label; import javafx.scene.control.PasswordField; import javafx.scene.control.TextField; +import javafx.scene.layout.GridPane; import javafx.scene.layout.Pane; +import pamViewFX.PamGuiManagerFX; +import pamViewFX.fxNodes.PamBorderPane; +import pamViewFX.fxNodes.PamButton; +import pamViewFX.fxNodes.PamGridPane; +import pamViewFX.fxNodes.PamVBox; public class MySQLPaneFX extends PamBorderPane implements SystemDialogPaneFX { @@ -66,7 +68,7 @@ public class MySQLPaneFX extends PamBorderPane implements SystemDialogPaneFX { connectServer.setOnAction((action->{ connectServer(); })); - PamGridPane.setHalignment(connectServer, HPos.RIGHT); + GridPane.setHalignment(connectServer, HPos.RIGHT); vBox.getChildren().add(serverGridPane); @@ -92,7 +94,7 @@ public class MySQLPaneFX extends PamBorderPane implements SystemDialogPaneFX { newDatabase.setOnAction((action)->{ createNewDatabase(); }); - PamGridPane.setHalignment(newDatabase, HPos.RIGHT); + GridPane.setHalignment(newDatabase, HPos.RIGHT); vBox.getChildren().add(databaseGridPane); @@ -109,12 +111,13 @@ public class MySQLPaneFX extends PamBorderPane implements SystemDialogPaneFX { } MySQLParameters tempParams; + @Override public boolean getParams() { tempParams = serverBasedSystem.mySQLParameters.clone(); - if (getServerParams() == false) return false; + if (!getServerParams()) return false; - if (getDbParams() == false) return false; + if (!getDbParams()) return false; // now if all ok, copy back. serverBasedSystem.mySQLParameters = tempParams.clone(); @@ -137,6 +140,7 @@ public class MySQLPaneFX extends PamBorderPane implements SystemDialogPaneFX { return true; } + @Override public void setParams() { ipAddress.setText(serverBasedSystem.mySQLParameters.ipAddress); userName.setText(serverBasedSystem.mySQLParameters.userName); @@ -172,7 +176,7 @@ public class MySQLPaneFX extends PamBorderPane implements SystemDialogPaneFX { * Connect the SQL server. */ private void connectServer(){ - if (getServerParams() == false) return; + if (!getServerParams()) return; serverBasedSystem.serverConnect(tempParams); sayServerStatus(); } diff --git a/src/generalDatabase/MySQLParameters.java b/src/generalDatabase/MySQLParameters.java index cadd498f..99f276ff 100644 --- a/src/generalDatabase/MySQLParameters.java +++ b/src/generalDatabase/MySQLParameters.java @@ -5,8 +5,8 @@ import java.lang.reflect.Field; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; +import PamModel.parametermanager.PrivatePamParameterData; public class MySQLParameters implements Cloneable, Serializable, ManagedParameters { diff --git a/src/generalDatabase/MySQLSystem.java b/src/generalDatabase/MySQLSystem.java index 12774573..b4139d98 100644 --- a/src/generalDatabase/MySQLSystem.java +++ b/src/generalDatabase/MySQLSystem.java @@ -50,6 +50,7 @@ public class MySQLSystem extends ServerBasedSystem { return null; } + @Override public String buildDatabaseUrl(String ipAddress, int portNumber, String databaseName){ return "jdbc:mysql://" + ipAddress + ":" + portNumber + "/" + databaseName + "?jdbcCompliantTruncation=true"; @@ -60,6 +61,7 @@ public class MySQLSystem extends ServerBasedSystem { return schemaName; } + @Override public String getUnitType() { return "MySQL Database System"; } diff --git a/src/generalDatabase/PamDetectionLogging.java b/src/generalDatabase/PamDetectionLogging.java index b4e84133..70a2273f 100644 --- a/src/generalDatabase/PamDetectionLogging.java +++ b/src/generalDatabase/PamDetectionLogging.java @@ -361,7 +361,7 @@ public class PamDetectionLogging extends SQLLogging { pamDetection.setStartSample((Long) startSample.getValue()); pamDetection.setMeasuredAmplitude((Double) amplitude.getValue()); Object ts = tableDefinition.getTimeStampItem().getValue(); - long t = sqlTypes.millisFromTimeStamp(ts); + long t = SQLTypes.millisFromTimeStamp(ts); pamDetection.setTimeMilliseconds(t); return true; } diff --git a/src/generalDatabase/PamTableDefinition.java b/src/generalDatabase/PamTableDefinition.java index 8424b683..3f244df9 100644 --- a/src/generalDatabase/PamTableDefinition.java +++ b/src/generalDatabase/PamTableDefinition.java @@ -1,9 +1,8 @@ package generalDatabase; -import java.sql.Connection; import java.sql.Types; + import PamController.PamViewParameters; -import PamUtils.PamCalendar; /** * diff --git a/src/generalDatabase/PamTableItem.java b/src/generalDatabase/PamTableItem.java index e73772e8..83cee36f 100644 --- a/src/generalDatabase/PamTableItem.java +++ b/src/generalDatabase/PamTableItem.java @@ -228,7 +228,7 @@ public class PamTableItem implements Cloneable { // if (sqlType != Types.CHAR || value == null) { // return null; // } - if (value instanceof String == false) { + if (!(value instanceof String)) { return null; } return ((String) value).trim(); diff --git a/src/generalDatabase/SQLLogging.java b/src/generalDatabase/SQLLogging.java index 087a039f..92997bb8 100644 --- a/src/generalDatabase/SQLLogging.java +++ b/src/generalDatabase/SQLLogging.java @@ -29,11 +29,6 @@ package generalDatabase; -import generalDatabase.clauses.FixedClause; -import generalDatabase.clauses.PAMSelectClause; -import generalDatabase.clauses.UIDViewParameters; -import generalDatabase.pamCursor.CursorFinder; -import generalDatabase.pamCursor.PamCursor; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -42,12 +37,8 @@ import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; import java.util.Arrays; -import java.util.List; import java.util.ListIterator; -import pamScrollSystem.LoadQueueProgressData; -import pamScrollSystem.ViewLoadObserver; -import qa.QASoundDataUnit; import PamController.PamController; import PamController.PamViewParameters; import PamUtils.PamCalendar; @@ -55,10 +46,16 @@ import PamguardMVC.DataUnitFinder; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.SaveRequirements; -import PamguardMVC.debug.Debug; import PamguardMVC.superdet.SubdetectionInfo; import PamguardMVC.superdet.SuperDetection; import binaryFileStorage.DataUnitFileInformation; +import generalDatabase.clauses.FixedClause; +import generalDatabase.clauses.PAMSelectClause; +import generalDatabase.pamCursor.CursorFinder; +import generalDatabase.pamCursor.PamCursor; +import pamScrollSystem.LoadQueueProgressData; +import pamScrollSystem.ViewLoadObserver; +import qa.QASoundDataUnit; /** * @@ -664,7 +661,7 @@ public abstract class SQLLogging { return null; } boolean readOk = readLastData(con); - if (readOk == false) { + if (!readOk) { return null; } PamDataUnit du = createDataUnit(con.getSqlTypes(), lastTime, lastLoadIndex); @@ -969,7 +966,7 @@ public abstract class SQLLogging { if (clause == null) { clause = " ORDER BY UTC, UTCMilliseconds"; } - else if (clause.toUpperCase().contains("ORDER BY") == false) { + else if (!clause.toUpperCase().contains("ORDER BY")) { clause += " ORDER BY UTC, UTCMilliseconds"; } return clause; @@ -1163,7 +1160,7 @@ public abstract class SQLLogging { lastLoadIndex = getTableDefinition().getIndexItem().getIntegerValue(); if (tableDef instanceof PamTableDefinition) { PamTableDefinition pamTableDef = (PamTableDefinition) tableDef; - lastTime = sqlTypes.millisFromTimeStamp(pamTableDef.getTimeStampItem().getValue()); + lastTime = SQLTypes.millisFromTimeStamp(pamTableDef.getTimeStampItem().getValue()); if (lastTime%1000 == 0) { // some databases may have stored the milliseconds, in which // case this next bit is redundant. @@ -1233,7 +1230,7 @@ public abstract class SQLLogging { boolean ans; try { ans = mixedModeResult.next(); - if (ans == false) { + if (!ans) { return false; } return transferDataFromResult(sqlTypes, mixedModeResult); @@ -1295,7 +1292,7 @@ public abstract class SQLLogging { } } } - if (mixedModeResult.next() == false) { + if (!mixedModeResult.next()) { mixedDataWaiting = false; break; } @@ -1461,7 +1458,7 @@ public abstract class SQLLogging { clause = "WHERE Id < 0"; // generate a null set. } pamCursor = dbControlUnit.createPamCursor(getTableDefinition()); - if (pamCursor.openScrollableCursor(connection, true, true, clause) == false) { + if (!pamCursor.openScrollableCursor(connection, true, true, clause)) { System.out.println("Error opening update cursor " + pamDataBlock.getDataName()); } if (sr.getNumUpdates() > 0) while(pamCursor.next()) { diff --git a/src/generalDatabase/ServerBasedSystem.java b/src/generalDatabase/ServerBasedSystem.java index f2ccd286..70c5da3f 100644 --- a/src/generalDatabase/ServerBasedSystem.java +++ b/src/generalDatabase/ServerBasedSystem.java @@ -1,10 +1,5 @@ package generalDatabase; -import generalDatabase.layoutFX.SystemDialogPaneFX; -import generalDatabase.pamCursor.PamCursor; -import generalDatabase.pamCursor.PamCursorManager; -import generalDatabase.pamCursor.ScrollablePamCursor; - import java.awt.Component; import java.io.Serializable; import java.sql.Connection; @@ -16,15 +11,13 @@ import java.util.ArrayList; import javax.swing.JOptionPane; - - - - - - import PamController.PamControlledUnitSettings; import PamController.PamSettingManager; import PamController.PamSettings; +import generalDatabase.layoutFX.SystemDialogPaneFX; +import generalDatabase.pamCursor.PamCursor; +import generalDatabase.pamCursor.PamCursorManager; +import generalDatabase.pamCursor.ScrollablePamCursor; abstract public class ServerBasedSystem extends DBSystem implements PamSettings { @@ -130,8 +123,8 @@ abstract public class ServerBasedSystem extends DBSystem implements PamSettings } } } - if (isOpen == false || openDatabase.equalsIgnoreCase(databaseName) == false) { - if (serverConnect(mySQLParameters) == false) return null; + if (!isOpen || !openDatabase.equalsIgnoreCase(databaseName)) { + if (!serverConnect(mySQLParameters)) return null; if (databaseName == null) return null; String databaseURL = buildDatabaseUrl(mySQLParameters.ipAddress, mySQLParameters.portNumber, databaseName); @@ -187,7 +180,7 @@ abstract public class ServerBasedSystem extends DBSystem implements PamSettings params = goodUserParameters; } boolean ok = serverConnect(params.ipAddress, params.portNumber, getUserName(params), getUserPassword(params)); - if (ok == false) { + if (!ok) { goodUserParameters = null; } return ok; @@ -258,7 +251,7 @@ abstract public class ServerBasedSystem extends DBSystem implements PamSettings ArrayList getAvailableDatabases(boolean doUpdate) { if (serverConnection == null) return null; - if (doUpdate == false && availableDatabases != null) { + if (!doUpdate && availableDatabases != null) { return availableDatabases; } availableDatabases = new ArrayList(); @@ -307,18 +300,22 @@ abstract public class ServerBasedSystem extends DBSystem implements PamSettings return mySQLParameters.databaseName; } + @Override public Serializable getSettingsReference() { return mySQLParameters; } + @Override public long getSettingsVersion() { return MySQLParameters.serialVersionUID; } + @Override public String getUnitName() { return dbControl.getUnitName(); } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { mySQLParameters = ((MySQLParameters) pamControlledUnitSettings.getSettings()).clone(); return (mySQLParameters != null); @@ -340,14 +337,15 @@ abstract public class ServerBasedSystem extends DBSystem implements PamSettings public String browseDatabasesFX(int type) { // TODO Auto-generated method stub return null; - }; + } + @Override public boolean checkDatabaseExists(String dbName) { if (dbName == null) { dbName = mySQLParameters.databaseName; } boolean servOK = serverConnect(mySQLParameters); - if (servOK == false) { + if (!servOK) { return false; } ArrayList dbs = getAvailableDatabases(true); diff --git a/src/generalDatabase/SuperDetLogging.java b/src/generalDatabase/SuperDetLogging.java index bfdc7a3f..d42f8bda 100644 --- a/src/generalDatabase/SuperDetLogging.java +++ b/src/generalDatabase/SuperDetLogging.java @@ -6,7 +6,6 @@ import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.ArrayList; -import java.util.List; import PamController.PamViewParameters; import PamguardMVC.PamDataUnit; @@ -132,6 +131,7 @@ public abstract class SuperDetLogging extends SQLLogging { return ok; } + @Override public boolean saveOfflineData(DBControlUnit dbControlUnit, PamConnection connection) { return super.saveOfflineData(dbControlUnit, connection); } diff --git a/src/generalDatabase/TableUtilities.java b/src/generalDatabase/TableUtilities.java index 62e57817..b6b0c2a4 100644 --- a/src/generalDatabase/TableUtilities.java +++ b/src/generalDatabase/TableUtilities.java @@ -91,7 +91,7 @@ public class TableUtilities { } if (tableItem.isPrimaryKey()) { - String primaryString = "ALTER TABLE "+tableDef.getTableName()+" ADD PRIMARY KEY ( " + tableItem.getName() + " )";; + String primaryString = "ALTER TABLE "+tableDef.getTableName()+" ADD PRIMARY KEY ( " + tableItem.getName() + " )"; try { stmt = con.createStatement(); diff --git a/src/geoMag/TSAGeoMag.java b/src/geoMag/TSAGeoMag.java index 536d1fbc..150e35cf 100644 --- a/src/geoMag/TSAGeoMag.java +++ b/src/geoMag/TSAGeoMag.java @@ -54,13 +54,10 @@ import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; import java.io.StreamTokenizer; -import java.net.URISyntaxException; import java.util.Calendar; import java.util.GregorianCalendar; import PamController.PamController; -import PamController.PamSettingManager; -import PamModel.PamModel; //import org.apache.log4j.Logger; @@ -537,7 +534,7 @@ public class TSAGeoMag // InputStream input = getClass().getResourceAsStream("WMM.COF"); String thePath = PamController.getInstance().getInstallFolder(); File wmFile = new File(thePath + "WMM.COF"); - if (wmFile.exists() == false) { + if (!wmFile.exists()) { if(input == null) throw new FileNotFoundException("WMM.COF not found"); } InputStream input = new FileInputStream(wmFile); // changed from above getResourceAsStrem fn DG. 28/2/2016 diff --git a/src/gpl/GPLDetectionBlock.java b/src/gpl/GPLDetectionBlock.java index 3d4c197c..07a17d23 100644 --- a/src/gpl/GPLDetectionBlock.java +++ b/src/gpl/GPLDetectionBlock.java @@ -6,7 +6,6 @@ import PamView.GroupedSourceParameters; import PamView.dialog.GroupedSourcePanel; import PamguardMVC.AcousticDataBlock; import PamguardMVC.PamDataBlock; -import PamguardMVC.PamProcess; public class GPLDetectionBlock extends AcousticDataBlock implements GroupedDataSource { diff --git a/src/gpl/GPLParameters.java b/src/gpl/GPLParameters.java index fcda34d9..333b71e8 100644 --- a/src/gpl/GPLParameters.java +++ b/src/gpl/GPLParameters.java @@ -1,6 +1,5 @@ package gpl; -import java.io.File; import java.io.Serializable; import PamModel.parametermanager.FieldNotFoundException; @@ -14,7 +13,7 @@ public class GPLParameters implements Serializable, Cloneable, ManagedParameters public static final long serialVersionUID = 1L; - public enum ConnectType {CONNECT4, CONNECT8}; + public enum ConnectType {CONNECT4, CONNECT8} /** * Generic description for this parameter set used diff --git a/src/gpl/GPLProcess.java b/src/gpl/GPLProcess.java index e63dab92..f6866f6d 100644 --- a/src/gpl/GPLProcess.java +++ b/src/gpl/GPLProcess.java @@ -692,7 +692,7 @@ public class GPLProcess extends PamBlockProcess { whitenedSpectrogram.addPamData(newData); if (allNan) { for (int i = 1; i < wData.length-1; i++) { - if (Double.isNaN(wData[i]) == false) { + if (!Double.isNaN(wData[i])) { allNan = false; break; } @@ -848,7 +848,7 @@ public class GPLProcess extends PamBlockProcess { long startMillis = absSamplesToMilliseconds(startSample); int storedContours = 0; for (GPLContour aContour : contours) { - if (wantContour(aContour, params.minContourArea, storedContours) == false) { + if (!wantContour(aContour, params.minContourArea, storedContours)) { continue; } // startSample += aContour.getMinTBin()*sourceFFTData.getHopSamples(); diff --git a/src/gpl/GPLStateDataBlock.java b/src/gpl/GPLStateDataBlock.java index ef30fffc..bd2f7f40 100644 --- a/src/gpl/GPLStateDataBlock.java +++ b/src/gpl/GPLStateDataBlock.java @@ -1,7 +1,6 @@ package gpl; import PamguardMVC.PamDataBlock; -import PamguardMVC.PamProcess; public class GPLStateDataBlock extends PamDataBlock { diff --git a/src/gpl/GPLStateDataSource.java b/src/gpl/GPLStateDataSource.java index 0c2ab5d5..eade2807 100644 --- a/src/gpl/GPLStateDataSource.java +++ b/src/gpl/GPLStateDataSource.java @@ -7,7 +7,6 @@ import java.io.DataOutputStream; import java.io.File; import java.io.IOException; -import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import binaryFileStorage.BinaryDataSource; import binaryFileStorage.BinaryHeader; @@ -53,7 +52,7 @@ public class GPLStateDataSource extends BinaryDataSource { try { double baseline = dis.readFloat(); double ceilnoise = dis.readFloat(); - double threshfloor = dis.readFloat();; + double threshfloor = dis.readFloat(); int state = dis.readShort(); GPLStateDataUnit stateData = new GPLStateDataUnit(binaryObjectData.getDataUnitBaseData(), baseline, ceilnoise, threshfloor, state); return stateData; diff --git a/src/gpl/GPL_Quiet.java b/src/gpl/GPL_Quiet.java index 6187a851..a6d8f51c 100644 --- a/src/gpl/GPL_Quiet.java +++ b/src/gpl/GPL_Quiet.java @@ -1,7 +1,6 @@ package gpl; import gpl.whiten.InfiniteSort; -import gpl.whiten.InfiniteSortGroup; import gpl.whiten.MovingMatrix; import gpl.whiten.WhitenMatrix; import gpl.whiten.WhitenVector; diff --git a/src/group3dlocaliser/Group3DDataBlock.java b/src/group3dlocaliser/Group3DDataBlock.java index fce29024..1e22e00b 100644 --- a/src/group3dlocaliser/Group3DDataBlock.java +++ b/src/group3dlocaliser/Group3DDataBlock.java @@ -1,6 +1,5 @@ package group3dlocaliser; -import PamguardMVC.PamDataBlock; import PamguardMVC.dataSelector.DataSelectorCreator; import PamguardMVC.superdet.SuperDetDataBlock; import group3dlocaliser.dataselector.Group3DDataSelectCreator; diff --git a/src/group3dlocaliser/Group3DLocaliserControl.java b/src/group3dlocaliser/Group3DLocaliserControl.java index c2fe8c8a..776ddf18 100644 --- a/src/group3dlocaliser/Group3DLocaliserControl.java +++ b/src/group3dlocaliser/Group3DLocaliserControl.java @@ -16,7 +16,6 @@ import PamController.PamSettings; import group3dlocaliser.algorithm.LocaliserAlgorithm3D; import group3dlocaliser.algorithm.LocaliserAlgorithmParams; import group3dlocaliser.algorithm.crossedbearing.CrossedBearingGroupLocaliser; -import group3dlocaliser.algorithm.gridsearch.TOADGridSearch; import group3dlocaliser.algorithm.hyperbolic.HyperbolicLocaliser; import group3dlocaliser.algorithm.toadmcmc.ToadMCMCLocaliser; import group3dlocaliser.algorithm.toadmimplex.ToadMimplexLocaliser; @@ -92,7 +91,7 @@ public class Group3DLocaliserControl extends PamControlledUnit implements PamSet showSettingsMenu(parentFrame); } }); - if (isViewer() == false) { + if (!isViewer()) { return menuItem; } // Otherwise make a more complex menu. diff --git a/src/group3dlocaliser/Group3DParams.java b/src/group3dlocaliser/Group3DParams.java index b455494a..07c2c4f8 100644 --- a/src/group3dlocaliser/Group3DParams.java +++ b/src/group3dlocaliser/Group3DParams.java @@ -8,7 +8,6 @@ import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet.ParameterSetType; import PamModel.parametermanager.PrivatePamParameterData; -import PamView.GroupedSourceParameters; import group3dlocaliser.algorithm.LocaliserAlgorithm3D; import group3dlocaliser.algorithm.LocaliserAlgorithmParams; import group3dlocaliser.grouper.DetectionGrouperParams; diff --git a/src/group3dlocaliser/Group3DProcess.java b/src/group3dlocaliser/Group3DProcess.java index 6629b05f..6867d071 100644 --- a/src/group3dlocaliser/Group3DProcess.java +++ b/src/group3dlocaliser/Group3DProcess.java @@ -16,11 +16,9 @@ import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; -import PamguardMVC.debug.Debug; import generalDatabase.DBControlUnit; import generalDatabase.PamConnection; import group3dlocaliser.algorithm.LocaliserAlgorithm3D; -import group3dlocaliser.algorithm.crossedbearing.CrossedBearingGroupLocaliser; import group3dlocaliser.grouper.DetectionGroupMonitor; import group3dlocaliser.grouper.DetectionGroupedSet; import group3dlocaliser.grouper.DetectionGrouper; @@ -276,7 +274,7 @@ public class Group3DProcess extends PamProcess implements DetectionGroupMonitor } - if (bestLocalisation != null && logAll == false) { + if (bestLocalisation != null && !logAll) { // best make and output a data unit ! // List bestGroup = detectionGroupedSet.getGroup(bestSet); // Group3DDataUnit newDataUnit = new diff --git a/src/hfDaqCard/SmruDaqDialogPanel.java b/src/hfDaqCard/SmruDaqDialogPanel.java index 4f2dddcd..ce46a428 100644 --- a/src/hfDaqCard/SmruDaqDialogPanel.java +++ b/src/hfDaqCard/SmruDaqDialogPanel.java @@ -16,7 +16,6 @@ import javax.swing.border.TitledBorder; import Acquisition.AcquisitionDialog; import Array.ArrayManager; -import Array.PamArray; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; import PamguardMVC.PamConstants; @@ -55,7 +54,7 @@ public class SmruDaqDialogPanel { dialogPanel.setBorder(new TitledBorder("Daq card configuration")); GridBagConstraints c = new PamGridBagContraints(); c.gridwidth = 3; - dialogPanel.add(new JLabel("Library version: ", JLabel.RIGHT), c); + dialogPanel.add(new JLabel("Library version: ", SwingConstants.RIGHT), c); c.gridx += c.gridwidth; dialogPanel.add(libVersion = new JLabel("Unknown")); c.gridx = 0; @@ -79,10 +78,10 @@ public class SmruDaqDialogPanel { c.gridx = 0; c.gridy++; JLabel l; - PamDialog.addComponent(dialogPanel, l= new JLabel("**** WARNING ****", JLabel.CENTER), c); + PamDialog.addComponent(dialogPanel, l= new JLabel("**** WARNING ****", SwingConstants.CENTER), c); l.setForeground(Color.RED); c.gridy++; - PamDialog.addComponent(dialogPanel, l =new JLabel("No SAIL Daq cards are present on your system ", JLabel.CENTER), c); + PamDialog.addComponent(dialogPanel, l =new JLabel("No SAIL Daq cards are present on your system ", SwingConstants.CENTER), c); l.setForeground(Color.RED); } int iBoard = 0; @@ -97,7 +96,7 @@ public class SmruDaqDialogPanel { c.gridwidth = 5; JLabel snrLabel; - PamDialog.addComponent(dialogPanel, snrLabel = new JLabel("", JLabel.CENTER), c); + PamDialog.addComponent(dialogPanel, snrLabel = new JLabel("", SwingConstants.CENTER), c); if (b < nSmruDaqBoards) { snStr = String.format("Board %d s/n %X", b, smruDaqSystem.getSmruDaqJNI().getSerialNumber(b)); snrLabel.setText(snStr); @@ -232,6 +231,7 @@ public class SmruDaqDialogPanel { this.board = board; } + @Override public void actionPerformed(ActionEvent e) { SmruDaqJNI smruJNI = smruDaqSystem.getSmruDaqJNI(); boolean ok = smruJNI.flashLEDs(board, 6); @@ -255,6 +255,7 @@ public class SmruDaqDialogPanel { this.led = led; setText(); } + @Override public void actionPerformed(ActionEvent e) { smruDaqSystem.toggleLED(board, led); setText(); diff --git a/src/hfDaqCard/SmruDaqJNI.java b/src/hfDaqCard/SmruDaqJNI.java index 18c3b7e3..f5d78617 100644 --- a/src/hfDaqCard/SmruDaqJNI.java +++ b/src/hfDaqCard/SmruDaqJNI.java @@ -1,6 +1,5 @@ package hfDaqCard; -import java.util.ArrayList; import java.util.Arrays; import PamUtils.BubbleSort; @@ -293,7 +292,7 @@ public class SmruDaqJNI { * @return number of devices found. */ private int listDevices() { - if (haveLibrary == false) { + if (!haveLibrary) { return -1; } nDevices = getNumDevices(); @@ -369,7 +368,7 @@ public class SmruDaqJNI { * @return serial number. This will be zero if the reset failed. */ long resetBoard(int iBoard, boolean fullReset) { - if (haveLibrary == false) return 0; + if (!haveLibrary) return 0; jniCloseCard(iBoard); // jniResetCard(iBoard); int ok = prepareDevice(iBoard, fullReset); @@ -397,7 +396,7 @@ public class SmruDaqJNI { * Load the jni library */ private void loadLibrary() { - if (loadLibraryTried == false) { + if (!loadLibraryTried) { try { System.loadLibrary(SILIB); int v = jniGetVersion(); @@ -770,7 +769,7 @@ public class SmruDaqJNI { * @see jniGetChannelBufferSize */ public int getAvailableSamples(int device, int channel) { - if (haveLibrary == false) { + if (!haveLibrary) { return -1; } return jniGetAvailableSamples(device, channel); @@ -784,7 +783,7 @@ public class SmruDaqJNI { * @return the size of the data buffer for each channel in samples. */ public int getChannelBufferSize() { - if (haveLibrary == false) { + if (!haveLibrary) { return -1; } return jniGetChannelBufferSize(); @@ -801,7 +800,7 @@ public class SmruDaqJNI { * cannot be set. */ public int setChannelBufferSize(int bufferSamples) { - if (haveLibrary == false) { + if (!haveLibrary) { return -1; } return jniSetChannelBufferSize(bufferSamples); @@ -819,10 +818,10 @@ public class SmruDaqJNI { */ int hardId = getBoardOrder(board); boolean wasOpen = isboardOpen(hardId); - if (wasOpen == false) { + if (!wasOpen) { smruDaqSystem.terminalPrint("Opening card to flash board " + board, 2); boolean isOpen = prepareDevice(hardId, false) == 0; - if (isOpen == false) { + if (!isOpen) { return false; } } @@ -837,7 +836,7 @@ public class SmruDaqJNI { } setLED(board, 0, 0); setLED(board, 0, 0); - if (wasOpen == false) { + if (!wasOpen) { smruDaqSystem.terminalPrint("Closing card after flash board " + board, 2); closeCard(board); } diff --git a/src/hfDaqCard/SmruDaqSystem.java b/src/hfDaqCard/SmruDaqSystem.java index b9961924..1b69e423 100644 --- a/src/hfDaqCard/SmruDaqSystem.java +++ b/src/hfDaqCard/SmruDaqSystem.java @@ -1,22 +1,15 @@ package hfDaqCard; import java.io.Serializable; -import java.util.List; import javax.swing.JComponent; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import soundPlayback.PlaybackControl; -import soundPlayback.PlaybackSystem; import Acquisition.AcquisitionControl; import Acquisition.AcquisitionDialog; -import Acquisition.AcquisitionProcess; -import Acquisition.DaqSystem; import Acquisition.AudioDataQueue; +import Acquisition.DaqSystem; import PamController.PamControlledUnitSettings; import PamController.PamController; import PamController.PamGUIManager; @@ -24,8 +17,9 @@ import PamController.PamSettingManager; import PamController.PamSettings; import PamDetection.RawDataUnit; import PamUtils.PamUtils; -import PamView.dialog.PamDialog; import PamguardMVC.PamConstants; +import soundPlayback.PlaybackControl; +import soundPlayback.PlaybackSystem; public class SmruDaqSystem extends DaqSystem implements PamSettings { @@ -450,7 +444,7 @@ public class SmruDaqSystem extends DaqSystem implements PamSettings { totalSamples += readSamples; - }; + } daqThreadRunning = false; for (int iBoard = 0; iBoard < nDaqCards; iBoard++) { @@ -500,7 +494,7 @@ public class SmruDaqSystem extends DaqSystem implements PamSettings { @Override public void stopSystem(AcquisitionControl daqControl) { - if (keepRunning == false) { + if (!keepRunning) { /* * it was never running, so no need to do this. From the GUI this isn't ever a problem * but PAMDog can call stop a little over zealously, and there seems to be a problem diff --git a/src/ipcomms/Consumer.java b/src/ipcomms/Consumer.java index da9353ac..758a064f 100644 --- a/src/ipcomms/Consumer.java +++ b/src/ipcomms/Consumer.java @@ -146,6 +146,7 @@ public class Consumer { // Start pdu packaging timer Timer t = new Timer(40000, new ActionListener() { + @Override public void actionPerformed(ActionEvent evt) { System.out.println("timer"); // if (newDataUnits.size() >1) { @@ -204,6 +205,7 @@ public class Consumer { } class CaptureThread implements Runnable { + @Override public void run() { /* * Sit here reading data from the port. Every time a new NMEA string @@ -327,6 +329,7 @@ public class Consumer { } class DisplayThread implements Runnable { + @Override public void run() {}} } diff --git a/src/ishmaelComms/Client.java b/src/ishmaelComms/Client.java index 162de181..65d3e4b1 100644 --- a/src/ishmaelComms/Client.java +++ b/src/ishmaelComms/Client.java @@ -1,11 +1,23 @@ package ishmaelComms; +import java.awt.BorderLayout; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.io.PrintWriter; //import NMEA.GpsData; //import NMEA.GpsData.*; -import java.net.*; -import java.io.*; -import java.awt.BorderLayout; -import javax.swing.*; +import java.net.Socket; +import java.net.SocketAddress; + +import javax.swing.JFrame; +import javax.swing.JOptionPane; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; +import javax.swing.WindowConstants; @@ -127,6 +139,7 @@ public class Client extends JFrame implements Runnable } + @Override public void run() { @@ -395,6 +408,7 @@ public class Client extends JFrame implements Runnable ( new Runnable() { + @Override public void run() { displayArea.append(incoming); @@ -420,7 +434,7 @@ public class Client extends JFrame implements Runnable { Client PGClient =new Client(); - PGClient.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + PGClient.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); } diff --git a/src/ishmaelComms/IshmaelDataControl.java b/src/ishmaelComms/IshmaelDataControl.java index bf65e768..d8e0ac82 100644 --- a/src/ishmaelComms/IshmaelDataControl.java +++ b/src/ishmaelComms/IshmaelDataControl.java @@ -73,6 +73,7 @@ public class IshmaelDataControl extends PamControlledUnit implements PamSettings /* * Stuff for settings interface */ + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { // interface bluffing return true; @@ -81,10 +82,12 @@ public class IshmaelDataControl extends PamControlledUnit implements PamSettings * public void setNmeaSource(int source){ * acquireNmeaData.setNMEASource(source); } */ + @Override public Serializable getSettingsReference() { // interface bluffing return null; } + @Override public long getSettingsVersion() { return NMEAParameters.serialVersionUID; } diff --git a/src/ishmaelComms/IshmaelGraphics.java b/src/ishmaelComms/IshmaelGraphics.java index 66e82cba..2b0318e0 100644 --- a/src/ishmaelComms/IshmaelGraphics.java +++ b/src/ishmaelComms/IshmaelGraphics.java @@ -9,18 +9,15 @@ import java.awt.Point; import java.awt.Rectangle; import java.awt.Window; -import Array.ArrayManager; -import Array.HydrophoneLocator; -import Array.PamArray; import PamUtils.Coordinate3d; import PamUtils.LatLong; import PamView.GeneralProjector; +import PamView.GeneralProjector.ParameterType; +import PamView.GeneralProjector.ParameterUnits; import PamView.PamKeyItem; import PamView.PamSymbol; import PamView.PamSymbolType; import PamView.PanelOverlayDraw; -import PamView.GeneralProjector.ParameterType; -import PamView.GeneralProjector.ParameterUnits; import PamView.symbol.SymbolData; import PamguardMVC.PamDataUnit; @@ -37,6 +34,7 @@ public class IshmaelGraphics extends PanelOverlayDraw{ this.ishmaelDataControl = ishmaelDataControl; } + @Override public boolean canDraw(ParameterType[] parameterTypes, ParameterUnits[] parameterUnits) { if (parameterTypes[0] == GeneralProjector.ParameterType.LATITUDE && parameterTypes[1] == GeneralProjector.ParameterType.LONGITUDE) @@ -47,6 +45,7 @@ public class IshmaelGraphics extends PanelOverlayDraw{ return false; } + @Override public Rectangle drawDataUnit(Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector) { IshmaelDataUnit ishmaelDataUnit = (IshmaelDataUnit) pamDataUnit; if (generalProjector.getParmeterType(0) == ParameterType.LATITUDE @@ -166,11 +165,13 @@ public class IshmaelGraphics extends PanelOverlayDraw{ return null; } + @Override public PamKeyItem createKeyItem(GeneralProjector generalProjector, int keyType) { // TODO Auto-generated method stub return null; } + @Override public String getHoverText(GeneralProjector generalProjector, PamDataUnit dataUnit, int iSide) { // TODO Auto-generated method stub return null; diff --git a/src/ishmaelComms/ProcessIshmaelData.java b/src/ishmaelComms/ProcessIshmaelData.java index f95feb3b..8aa87b50 100644 --- a/src/ishmaelComms/ProcessIshmaelData.java +++ b/src/ishmaelComms/ProcessIshmaelData.java @@ -1,7 +1,5 @@ package ishmaelComms; -import ishmaelComms.IshmaelData.IshmaelDataType; - import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.BufferedReader; @@ -20,12 +18,11 @@ import javax.swing.JTextArea; import javax.swing.SwingUtilities; import javax.swing.Timer; - import PamUtils.PamCalendar; import PamView.symbol.StandardSymbolManager; import PamguardMVC.PamDataBlock; import PamguardMVC.PamProcess; -import autecPhones.AutecGraphics; +import ishmaelComms.IshmaelData.IshmaelDataType; public class ProcessIshmaelData extends PamProcess implements ActionListener { @@ -75,6 +72,7 @@ public class ProcessIshmaelData extends PamProcess implements ActionListener { } + @Override public void actionPerformed(ActionEvent e) { while(newIshmaelData.size() > 0) { @@ -153,6 +151,7 @@ public class ProcessIshmaelData extends PamProcess implements ActionListener { // super("PAMGUARD TCP CLIENT"); } // constructor + @Override public void run() { try { @@ -405,6 +404,7 @@ public class ProcessIshmaelData extends PamProcess implements ActionListener { //=================================================== void displayMessage(final String incoming) { SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { displayArea.append(incoming); } diff --git a/src/jsonStorage/JSONObjectDataSource.java b/src/jsonStorage/JSONObjectDataSource.java index 9730e805..54505b29 100644 --- a/src/jsonStorage/JSONObjectDataSource.java +++ b/src/jsonStorage/JSONObjectDataSource.java @@ -1,7 +1,7 @@ package jsonStorage; -import com.fasterxml.jackson.annotation.PropertyAccessor; import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; +import com.fasterxml.jackson.annotation.PropertyAccessor; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; diff --git a/src/landMarks/DatabaseImport.java b/src/landMarks/DatabaseImport.java index c5e4593e..c66a9378 100644 --- a/src/landMarks/DatabaseImport.java +++ b/src/landMarks/DatabaseImport.java @@ -1,10 +1,11 @@ package landMarks; +import java.awt.Color; +import java.lang.reflect.Field; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Types; import java.util.ArrayList; -import java.lang.reflect.Field; import PamUtils.LatLong; import PamView.PamSymbol; @@ -13,7 +14,6 @@ import generalDatabase.DBControlUnit; import generalDatabase.EmptyTableDefinition; import generalDatabase.PamTableItem; import generalDatabase.pamCursor.PamCursor; -import java.awt.Color; public class DatabaseImport { @@ -50,7 +50,7 @@ public class DatabaseImport { } public ArrayList readDatas(String tableName) { - if (checkTable(tableName) == false) { + if (!checkTable(tableName)) { return null; } DBControlUnit dbControl = DBControlUnit.findDatabaseControl(); diff --git a/src/landMarks/LandmarkControl.java b/src/landMarks/LandmarkControl.java index 1c0ea4a8..4a9a2e89 100644 --- a/src/landMarks/LandmarkControl.java +++ b/src/landMarks/LandmarkControl.java @@ -51,14 +51,17 @@ public class LandmarkControl extends PamControlledUnit implements PamSettings { return menuItem; } + @Override public Serializable getSettingsReference() { return landmarkDatas; } + @Override public long getSettingsVersion() { return LandmarkDatas.serialVersionUID; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { landmarkDatas = ((LandmarkDatas) pamControlledUnitSettings.getSettings()).clone(); landmarkDataBlock.createDataUnits(landmarkDatas); @@ -74,6 +77,7 @@ public class LandmarkControl extends PamControlledUnit implements PamSettings { this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { landmarkSettings(parentFrame); } diff --git a/src/landMarks/LandmarkDataBlock.java b/src/landMarks/LandmarkDataBlock.java index ce131036..4677a682 100644 --- a/src/landMarks/LandmarkDataBlock.java +++ b/src/landMarks/LandmarkDataBlock.java @@ -1,11 +1,9 @@ package landMarks; import PamUtils.PamCalendar; -import PamView.symbol.StandardSymbolManager; import PamguardMVC.PamDataBlock; import PamguardMVC.PamProcess; import PamguardMVC.dataOffline.OfflineDataLoadInfo; -import autecPhones.AutecGraphics; import pamScrollSystem.ViewLoadObserver; public class LandmarkDataBlock extends PamDataBlock { diff --git a/src/landMarks/LandmarkDialog.java b/src/landMarks/LandmarkDialog.java index 05a564fd..b47d8d4d 100644 --- a/src/landMarks/LandmarkDialog.java +++ b/src/landMarks/LandmarkDialog.java @@ -1,6 +1,5 @@ package landMarks; -import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Window; diff --git a/src/landMarks/LandmarkGraphics.java b/src/landMarks/LandmarkGraphics.java index 77d97f01..4bc27d06 100644 --- a/src/landMarks/LandmarkGraphics.java +++ b/src/landMarks/LandmarkGraphics.java @@ -1,22 +1,18 @@ package landMarks; -import java.awt.Color; import java.awt.Graphics; import java.awt.Rectangle; import java.awt.Window; -import javax.swing.SwingUtilities; - import PamController.masterReference.MasterReferencePoint; import PamUtils.Coordinate3d; import PamUtils.LatLong; import PamView.GeneralProjector; -import PamView.PamKeyItem; -import PamView.PamSymbol; -import PamView.PamSymbolType; -import PamView.PanelOverlayDraw; import PamView.GeneralProjector.ParameterType; import PamView.GeneralProjector.ParameterUnits; +import PamView.PamKeyItem; +import PamView.PamSymbol; +import PamView.PanelOverlayDraw; import PamView.symbol.SymbolData; import PamguardMVC.PamDataUnit; @@ -34,16 +30,19 @@ public class LandmarkGraphics extends PanelOverlayDraw { this.landmarkControl = landmarkControl; } + @Override public boolean canDraw(ParameterType[] parameterTypes, ParameterUnits[] parameterUnits) { return (parameterTypes[0] == GeneralProjector.ParameterType.LATITUDE && parameterTypes[1] == GeneralProjector.ParameterType.LONGITUDE); } + @Override public PamKeyItem createKeyItem(GeneralProjector generalProjector, int keyType) { return null; } + @Override public Rectangle drawDataUnit(Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector) { if (generalProjector.getParmeterType(0) == GeneralProjector.ParameterType.LATITUDE && @@ -70,6 +69,7 @@ public class LandmarkGraphics extends PanelOverlayDraw { return null; } + @Override public String getHoverText(GeneralProjector generalProjector, PamDataUnit dataUnit, int iSide) { LandmarkDataUnit landmarkDataUnit = (LandmarkDataUnit) dataUnit; diff --git a/src/landMarks/LandmarksDialog.java b/src/landMarks/LandmarksDialog.java index f9a87d59..869bc0d3 100644 --- a/src/landMarks/LandmarksDialog.java +++ b/src/landMarks/LandmarksDialog.java @@ -1,13 +1,8 @@ package landMarks; -import generalDatabase.DBControlUnit; - import java.awt.BorderLayout; import java.awt.Dimension; import java.awt.FlowLayout; -import java.awt.Frame; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -24,18 +19,9 @@ import javax.swing.ScrollPaneConstants; import javax.swing.border.TitledBorder; import javax.swing.table.AbstractTableModel; - - - - - - - - - import PamUtils.LatLong; import PamView.dialog.PamDialog; -import PamView.dialog.PamGridBagContraints; +import generalDatabase.DBControlUnit; public class LandmarksDialog extends PamDialog { @@ -139,6 +125,7 @@ public class LandmarksDialog extends PamDialog { } class DeleteButton implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { int row = table.getSelectedRow(); if (row < 0 || row >= landmarkDatas.size()) { @@ -150,6 +137,7 @@ public class LandmarksDialog extends PamDialog { } class AddButton implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { LandmarkData newLandmark = LandmarkDialog.showDialog(parentFrame, landmarkControl, null); if (newLandmark != null) { @@ -163,6 +151,7 @@ public class LandmarksDialog extends PamDialog { } class EditButton implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { int row = table.getSelectedRow(); if (row < 0 || row >= landmarkDatas.size()) { @@ -202,10 +191,12 @@ public class LandmarksDialog extends PamDialog { return colNames[column]; } + @Override public int getColumnCount() { return colNames.length; } + @Override public int getRowCount() { if (landmarkDatas == null) { return 0; @@ -225,6 +216,7 @@ public class LandmarksDialog extends PamDialog { } + @Override public Object getValueAt(int rowIndex, int columnIndex) { if (landmarkDatas == null) { return null; @@ -258,7 +250,7 @@ public class LandmarksDialog extends PamDialog { if (tN == null || tN.length() == 0) { return; } - if (dbi.checkTable(tN) == false) { + if (!dbi.checkTable(tN)) { return; } ArrayList newData = dbi.readDatas(tN); diff --git a/src/levelMeter/LevelMeterControl.java b/src/levelMeter/LevelMeterControl.java index aa329beb..3ca2817c 100644 --- a/src/levelMeter/LevelMeterControl.java +++ b/src/levelMeter/LevelMeterControl.java @@ -9,7 +9,7 @@ import javax.swing.JMenuItem; import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; -import PamController.PamController; +import PamController.PamControllerInterface; import PamController.PamSettingManager; import PamController.PamSettings; import PamView.PamSidePanel; @@ -29,7 +29,7 @@ public class LevelMeterControl extends PamControlledUnit implements PamSettings public void notifyModelChanged(int changeType) { super.notifyModelChanged(changeType); switch (changeType) { - case PamController.INITIALIZATION_COMPLETE: + case PamControllerInterface.INITIALIZATION_COMPLETE: levelMeterSidePanel.setup(); } } diff --git a/src/levelMeter/LevelMeterDialog.java b/src/levelMeter/LevelMeterDialog.java index aa2dc3c6..21030bfc 100644 --- a/src/levelMeter/LevelMeterDialog.java +++ b/src/levelMeter/LevelMeterDialog.java @@ -11,6 +11,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JRadioButton; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; import PamDetection.RawDataUnit; @@ -54,9 +55,9 @@ public class LevelMeterDialog extends PamDialog { JPanel rangebit = new JPanel(new FlowLayout(FlowLayout.LEFT)); // rangebit.setLayout(new BoxLayout(rangebit, BoxLayout.X_AXIS)); - rangebit.add(new JLabel("Scale range ", JLabel.RIGHT)); + rangebit.add(new JLabel("Scale range ", SwingConstants.RIGHT)); rangebit.add(scaleRange = new JTextField(5)); - rangebit.add(new JLabel(" dB", JLabel.LEFT)); + rangebit.add(new JLabel(" dB", SwingConstants.LEFT)); scalePanel.add(rangebit, BorderLayout.SOUTH); mainPanel.add(scalePanel,BorderLayout.CENTER); diff --git a/src/levelMeter/LevelMeterSidePanel.java b/src/levelMeter/LevelMeterSidePanel.java index 9712ec21..7909939d 100644 --- a/src/levelMeter/LevelMeterSidePanel.java +++ b/src/levelMeter/LevelMeterSidePanel.java @@ -9,6 +9,7 @@ import java.awt.GridBagLayout; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JProgressBar; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; import javax.swing.plaf.ProgressBarUI; @@ -18,11 +19,11 @@ import PamController.PamController; import PamDetection.RawDataUnit; import PamUtils.PamUtils; import PamView.PamColors.PamColor; +import PamView.PamSidePanel; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; import PamView.dialog.PamLabel; import PamView.panel.PamPanel; -import PamView.PamSidePanel; import PamguardMVC.PamConstants; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; @@ -59,9 +60,9 @@ public class LevelMeterSidePanel extends PamObserverAdapter implements PamSidePa mainPanel.setLayout(new GridBagLayout()); mainPanel.setBorder(new TitledBorder(levelMeterControl.getUnitName())); GridBagConstraints c = new PamGridBagContraints(); - minLab = new PamLabel(" ", JLabel.LEFT); - scaleLab = new PamLabel(" ", JLabel.CENTER); - maxLab = new PamLabel("0", JLabel.RIGHT); + minLab = new PamLabel(" ", SwingConstants.LEFT); + scaleLab = new PamLabel(" ", SwingConstants.CENTER); + maxLab = new PamLabel("0", SwingConstants.RIGHT); PamPanel scalePanel = new PamPanel(new BorderLayout()); scalePanel.add(minLab, BorderLayout.WEST); scalePanel.add(scaleLab, BorderLayout.CENTER); @@ -81,7 +82,7 @@ public class LevelMeterSidePanel extends PamObserverAdapter implements PamSidePa c.gridy++; c.gridx = 0; c.gridwidth = 1; - PamDialog.addComponent(mainPanel, chLab[i] = new PamLabel(String.format("%d", i), JLabel.LEFT), c); + PamDialog.addComponent(mainPanel, chLab[i] = new PamLabel(String.format("%d", i), SwingConstants.LEFT), c); c.gridx = 1; c.gridwidth = 3; levelDisplays[i] = new LevelDisplay(i); diff --git a/src/likelihoodDetectionModule/AbstractCellEditor.java b/src/likelihoodDetectionModule/AbstractCellEditor.java index 8873a528..2554b9e1 100644 --- a/src/likelihoodDetectionModule/AbstractCellEditor.java +++ b/src/likelihoodDetectionModule/AbstractCellEditor.java @@ -1,9 +1,12 @@ package likelihoodDetectionModule; -import javax.swing.*; -import javax.swing.event.*; import java.util.EventObject; +import javax.swing.CellEditor; +import javax.swing.event.CellEditorListener; +import javax.swing.event.ChangeEvent; +import javax.swing.event.EventListenerList; + /** * The class AbstractCellEditor serves as the base class for the TreeTable's * table cell editor. It provides additional functionality that would be @@ -19,39 +22,46 @@ public class AbstractCellEditor implements CellEditor { /* (non-Javadoc) * @see javax.swing.CellEditor#getCellEditorValue() */ - public Object getCellEditorValue() { return null; } + @Override + public Object getCellEditorValue() { return null; } /* (non-Javadoc) * @see javax.swing.CellEditor#isCellEditable(java.util.EventObject) */ - public boolean isCellEditable(EventObject e) { return true; } + @Override + public boolean isCellEditable(EventObject e) { return true; } /* (non-Javadoc) * @see javax.swing.CellEditor#shouldSelectCell(java.util.EventObject) */ - public boolean shouldSelectCell(EventObject anEvent) { return false; } + @Override + public boolean shouldSelectCell(EventObject anEvent) { return false; } /* (non-Javadoc) * @see javax.swing.CellEditor#stopCellEditing() */ - public boolean stopCellEditing() { return true; } + @Override + public boolean stopCellEditing() { return true; } /* (non-Javadoc) * @see javax.swing.CellEditor#cancelCellEditing() */ - public void cancelCellEditing() {} + @Override + public void cancelCellEditing() {} /* (non-Javadoc) * @see javax.swing.CellEditor#addCellEditorListener(javax.swing.event.CellEditorListener) */ - public void addCellEditorListener(CellEditorListener l) { + @Override + public void addCellEditorListener(CellEditorListener l) { listenerList.add(CellEditorListener.class, l); } /* (non-Javadoc) * @see javax.swing.CellEditor#removeCellEditorListener(javax.swing.event.CellEditorListener) */ - public void removeCellEditorListener(CellEditorListener l) { + @Override + public void removeCellEditorListener(CellEditorListener l) { listenerList.remove(CellEditorListener.class, l); } diff --git a/src/likelihoodDetectionModule/CheckRenderer.java b/src/likelihoodDetectionModule/CheckRenderer.java index c59ae65a..c150e88b 100644 --- a/src/likelihoodDetectionModule/CheckRenderer.java +++ b/src/likelihoodDetectionModule/CheckRenderer.java @@ -1,14 +1,21 @@ package likelihoodDetectionModule; -import javax.swing.*; -import javax.swing.tree.*; +import java.awt.Color; import java.awt.Component; import java.awt.Dimension; -import java.awt.Color; -import javax.swing.plaf.ColorUIResource; import java.awt.Graphics; import java.awt.event.ItemListener; +import javax.swing.Icon; +import javax.swing.JCheckBox; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JTree; +import javax.swing.UIManager; +import javax.swing.plaf.ColorUIResource; +import javax.swing.tree.TreeCellRenderer; +import javax.swing.tree.TreeModel; + /** * This class provides a custom renderer for a JTree that displays a * check box before the standard open/closed subtree icon, and a text string @@ -60,7 +67,8 @@ public class CheckRenderer extends JPanel implements TreeCellRenderer { /* (non-Javadoc) * @see javax.swing.tree.TreeCellRenderer#getTreeCellRendererComponent(javax.swing.JTree, java.lang.Object, boolean, boolean, boolean, int, boolean) */ - public Component getTreeCellRendererComponent( JTree tree, Object value, boolean isSelected, + @Override +public Component getTreeCellRendererComponent( JTree tree, Object value, boolean isSelected, boolean isExpanded, boolean isLeaf, int row, boolean hasFocus ) { String stringValue = tree.convertValueToText( value, isSelected, isExpanded, isLeaf, row, hasFocus ); diff --git a/src/likelihoodDetectionModule/ConfigurationDialogSettings.java b/src/likelihoodDetectionModule/ConfigurationDialogSettings.java index 9011ffbd..1d052bfe 100644 --- a/src/likelihoodDetectionModule/ConfigurationDialogSettings.java +++ b/src/likelihoodDetectionModule/ConfigurationDialogSettings.java @@ -5,8 +5,8 @@ import java.lang.reflect.Field; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; +import PamModel.parametermanager.PrivatePamParameterData; /** * The Class ConfigurationDialogSettings holds parameters about the diff --git a/src/likelihoodDetectionModule/LikelihoodDetectionParameters.java b/src/likelihoodDetectionModule/LikelihoodDetectionParameters.java index 9481c26c..31986145 100644 --- a/src/likelihoodDetectionModule/LikelihoodDetectionParameters.java +++ b/src/likelihoodDetectionModule/LikelihoodDetectionParameters.java @@ -1,12 +1,12 @@ package likelihoodDetectionModule; -import java.io.Serializable; -import java.util.ArrayList; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.ObjectOutputStream; -import java.io.ObjectInputStream; import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import java.util.ArrayList; import java.util.Iterator; import PamModel.parametermanager.ManagedParameters; diff --git a/src/likelihoodDetectionModule/LikelihoodDetectionParametersDialog.java b/src/likelihoodDetectionModule/LikelihoodDetectionParametersDialog.java index 8223d0df..908bf22a 100644 --- a/src/likelihoodDetectionModule/LikelihoodDetectionParametersDialog.java +++ b/src/likelihoodDetectionModule/LikelihoodDetectionParametersDialog.java @@ -1,15 +1,21 @@ package likelihoodDetectionModule; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Frame; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.util.ArrayList; + +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.border.TitledBorder; +import javax.swing.table.DefaultTableColumnModel; + import PamDetection.RawDataUnit; import PamView.dialog.PamDialog; import PamView.dialog.SourcePanel; -import javax.swing.*; -import java.awt.*; -import javax.swing.border.*; -import java.util.ArrayList; -import javax.swing.table.DefaultTableColumnModel; - /** * The class LikelihoodDetectionParametersDialog is created by the LikelihoodDetectionUnit to * integrate configuration of the likelihood detection module into the configuration menus diff --git a/src/likelihoodDetectionModule/LikelihoodDetectionUnit.java b/src/likelihoodDetectionModule/LikelihoodDetectionUnit.java index 445659c1..2fb71564 100644 --- a/src/likelihoodDetectionModule/LikelihoodDetectionUnit.java +++ b/src/likelihoodDetectionModule/LikelihoodDetectionUnit.java @@ -4,22 +4,24 @@ import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.Serializable; +import java.util.ArrayList; +import java.util.HashMap; + import javax.swing.JMenuItem; + import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; import PamController.PamController; +import PamController.PamControllerInterface; import PamController.PamSettingManager; import PamController.PamSettings; +import PamDetection.RawDataUnit; +import PamguardMVC.PamDataBlock; +import PamguardMVC.PamRawDataBlock; import likelihoodDetectionModule.linearAverageSpectra.LinearAverageSpectraProcess; import likelihoodDetectionModule.normalizer.NormalizerProcess; import likelihoodDetectionModule.spectralEti.SpectralEtiProcess; import likelihoodDetectionModule.thresholdDetector.ThresholdDetectorProcess; -import PamguardMVC.PamDataBlock; -import PamguardMVC.PamRawDataBlock; -import PamDetection.RawDataUnit; -import java.util.ArrayList; -import java.util.HashMap; -import PamController.PamControllerInterface; /** * The class LikelihoodDetectionUnit implements that standard PamControlledUnit functionality @@ -251,6 +253,7 @@ public class LikelihoodDetectionUnit extends PamControlledUnit implements PamSet /* (non-Javadoc) * @see PamController.PamSettings#getSettingsReference() */ + @Override public Serializable getSettingsReference() { return likelihoodDetectionParameters; } @@ -259,6 +262,7 @@ public class LikelihoodDetectionUnit extends PamControlledUnit implements PamSet /* (non-Javadoc) * @see PamController.PamSettings#getSettingsVersion() */ + @Override public long getSettingsVersion() { return LikelihoodDetectionParameters.serialVersionUID; } @@ -268,6 +272,7 @@ public class LikelihoodDetectionUnit extends PamControlledUnit implements PamSet /* (non-Javadoc) * @see PamController.PamSettings#restoreSettings(PamController.PamControlledUnitSettings) */ + @Override public boolean restoreSettings( PamControlledUnitSettings settings ) { // Point to the settings object stored in the controlled unit, rather // than the locally-created one. @@ -319,6 +324,7 @@ public class LikelihoodDetectionUnit extends PamControlledUnit implements PamSet /* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ + @Override public void actionPerformed( ActionEvent e ) { LikelihoodDetectionParameters p @@ -371,11 +377,11 @@ public class LikelihoodDetectionUnit extends PamControlledUnit implements PamSet // If this is the very first notification received, then configure. It is // helpful to configure once before initialisation is complete because the // notification is probably from this module being added. - if ( this.firstNotification == true ) { + if ( this.firstNotification ) { configure(); this.firstNotification = false; } - else if ( this.selfNotification == true ) { + else if ( this.selfNotification ) { // If this module is added before any others that are not dependencies, // then the notification from the first/subsequent configurations needs to // be run in order for those modules to find our output blocks. Sometimes @@ -387,14 +393,14 @@ public class LikelihoodDetectionUnit extends PamControlledUnit implements PamSet // For complicated scenarios, it is very helpful to ignore all of the traffic coming // from other modules until the initialisation complete notification is received. - if ( this.isInitialized == false && changeType == PamControllerInterface.INITIALIZATION_COMPLETE ) { + if ( !this.isInitialized && changeType == PamControllerInterface.INITIALIZATION_COMPLETE ) { this.isInitialized = true; configure(); } // After the initialisation complete notification has been seen, any other changes to processing // settings or new modules should trigger us to reconfigure. - if ( isInitialized == true && ( changeType == PamControllerInterface.CHANGED_PROCESS_SETTINGS || changeType == PamControllerInterface.ADD_CONTROLLEDUNIT || changeType == PamControllerInterface.ADD_PROCESS ) ) { + if ( isInitialized && ( changeType == PamControllerInterface.CHANGED_PROCESS_SETTINGS || changeType == PamControllerInterface.ADD_CONTROLLEDUNIT || changeType == PamControllerInterface.ADD_PROCESS ) ) { configure(); } } diff --git a/src/likelihoodDetectionModule/LikelihoodFFTController.java b/src/likelihoodDetectionModule/LikelihoodFFTController.java index 96276fe9..0a189921 100644 --- a/src/likelihoodDetectionModule/LikelihoodFFTController.java +++ b/src/likelihoodDetectionModule/LikelihoodFFTController.java @@ -108,7 +108,7 @@ public class LikelihoodFFTController extends PamControlledUnit { public void removeUnusedProcesses() { for ( int i = 0; i < fftProcesses.size(); ++i ) { LikelihoodFFTProcess p = fftProcesses.get(i); - if ( p.getInUse() == false ) { + if ( !p.getInUse() ) { p.destroyProcess(); removePamProcess( p ); fftProcesses.remove( i ); diff --git a/src/likelihoodDetectionModule/LikelihoodFFTParameters.java b/src/likelihoodDetectionModule/LikelihoodFFTParameters.java index 13b85fda..c839df99 100644 --- a/src/likelihoodDetectionModule/LikelihoodFFTParameters.java +++ b/src/likelihoodDetectionModule/LikelihoodFFTParameters.java @@ -5,10 +5,10 @@ import java.lang.reflect.Field; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; -import fftManager.FFTParameters; +import PamModel.parametermanager.PrivatePamParameterData; import Spectrogram.WindowFunction; +import fftManager.FFTParameters; /** * The LikelihoodFFTParameters class represents Likelihood Detector-specific FFT diff --git a/src/likelihoodDetectionModule/NewBandNameDialog.java b/src/likelihoodDetectionModule/NewBandNameDialog.java index 2fb11fd2..11273b4b 100644 --- a/src/likelihoodDetectionModule/NewBandNameDialog.java +++ b/src/likelihoodDetectionModule/NewBandNameDialog.java @@ -1,18 +1,21 @@ package likelihoodDetectionModule; -import javax.swing.JDialog; -import java.awt.event.ActionListener; +import java.awt.Color; +import java.awt.Dimension; import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.util.ArrayList; +import java.util.Iterator; + +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JLabel; -import javax.swing.JButton; import javax.swing.JPanel; -import java.util.ArrayList; import javax.swing.JTextField; -import java.awt.event.*; -import java.util.Iterator; -import javax.swing.BoxLayout; -import java.awt.*; /** * The NewBandNameDialog is used by the LikelihoodDetectionParametersDialog to allow the @@ -127,6 +130,7 @@ public class NewBandNameDialog extends JDialog implements ActionListener, KeyLis /* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ + @Override public void actionPerformed( ActionEvent e ) { if ( e.getSource() == okButton ) { @@ -142,6 +146,7 @@ public class NewBandNameDialog extends JDialog implements ActionListener, KeyLis /* (non-Javadoc) * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent) */ + @Override public void keyReleased( KeyEvent e ) { if ( identifierField.getText().isEmpty() ) { @@ -203,11 +208,13 @@ public class NewBandNameDialog extends JDialog implements ActionListener, KeyLis /* (non-Javadoc) * @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent) */ + @Override public void keyTyped( KeyEvent e ) {} /* (non-Javadoc) * @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent) */ + @Override public void keyPressed( KeyEvent e ) {} } diff --git a/src/likelihoodDetectionModule/SignalBand.java b/src/likelihoodDetectionModule/SignalBand.java index 3b3150d6..c75ce4a5 100644 --- a/src/likelihoodDetectionModule/SignalBand.java +++ b/src/likelihoodDetectionModule/SignalBand.java @@ -1,11 +1,9 @@ package likelihoodDetectionModule; import java.io.Serializable; -import java.lang.reflect.Field; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; /** diff --git a/src/likelihoodDetectionModule/TargetConfiguration.java b/src/likelihoodDetectionModule/TargetConfiguration.java index 0cc0e398..bda6c8b4 100644 --- a/src/likelihoodDetectionModule/TargetConfiguration.java +++ b/src/likelihoodDetectionModule/TargetConfiguration.java @@ -38,7 +38,7 @@ public class TargetConfiguration implements Serializable, ManagedParameters { /** The configuration is in Error. */ Error - }; + } /** The state. */ private State state = State.Active; diff --git a/src/likelihoodDetectionModule/TargetConfigurationExporter.java b/src/likelihoodDetectionModule/TargetConfigurationExporter.java index aa83e34e..a4c888c0 100644 --- a/src/likelihoodDetectionModule/TargetConfigurationExporter.java +++ b/src/likelihoodDetectionModule/TargetConfigurationExporter.java @@ -1,7 +1,9 @@ package likelihoodDetectionModule; -import java.util.*; -import java.io.*; +import java.io.File; +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.Formatter; /** * The Class TargetConfigurationExporter. This is used to export a target configuration diff --git a/src/likelihoodDetectionModule/TargetConfigurationImporter.java b/src/likelihoodDetectionModule/TargetConfigurationImporter.java index e4dd707e..626b3d8a 100644 --- a/src/likelihoodDetectionModule/TargetConfigurationImporter.java +++ b/src/likelihoodDetectionModule/TargetConfigurationImporter.java @@ -1,8 +1,11 @@ package likelihoodDetectionModule; -import java.io.*; -import java.util.Scanner; +import java.io.BufferedReader; +import java.io.FileNotFoundException; +import java.io.FileReader; +import java.io.IOException; import java.util.ArrayList; +import java.util.Scanner; /** * The TargetConfigurationImporter is used to import a target configuration from an ASCII diff --git a/src/likelihoodDetectionModule/TargetConfigurationNameDialog.java b/src/likelihoodDetectionModule/TargetConfigurationNameDialog.java index 6d67801d..0ccae5f1 100644 --- a/src/likelihoodDetectionModule/TargetConfigurationNameDialog.java +++ b/src/likelihoodDetectionModule/TargetConfigurationNameDialog.java @@ -1,18 +1,21 @@ package likelihoodDetectionModule; -import javax.swing.JDialog; -import java.awt.event.ActionListener; +import java.awt.Color; +import java.awt.Dimension; import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.util.ArrayList; +import java.util.Iterator; + +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JLabel; -import javax.swing.JButton; import javax.swing.JPanel; -import java.util.ArrayList; import javax.swing.JTextField; -import java.awt.event.*; -import java.util.Iterator; -import javax.swing.BoxLayout; -import java.awt.*; /** * The TargetConfigurationNameDialog is used by the LikelihoodDetectionParametersDialog to @@ -96,6 +99,7 @@ public class TargetConfigurationNameDialog extends JDialog implements ActionList /* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ + @Override public void actionPerformed( ActionEvent e ) { if ( e.getSource() == okButton ) { @@ -111,6 +115,7 @@ public class TargetConfigurationNameDialog extends JDialog implements ActionList /* (non-Javadoc) * @see java.awt.event.KeyListener#keyReleased(java.awt.event.KeyEvent) */ + @Override public void keyReleased( KeyEvent e ) { if ( identifierField.getText().isEmpty() ) { @@ -150,10 +155,12 @@ public class TargetConfigurationNameDialog extends JDialog implements ActionList /* (non-Javadoc) * @see java.awt.event.KeyListener#keyTyped(java.awt.event.KeyEvent) */ + @Override public void keyTyped( KeyEvent e ) {} /* (non-Javadoc) * @see java.awt.event.KeyListener#keyPressed(java.awt.event.KeyEvent) */ + @Override public void keyPressed( KeyEvent e ) {} } diff --git a/src/likelihoodDetectionModule/TreeTable.java b/src/likelihoodDetectionModule/TreeTable.java index a84a6947..db7a6f20 100644 --- a/src/likelihoodDetectionModule/TreeTable.java +++ b/src/likelihoodDetectionModule/TreeTable.java @@ -1,28 +1,52 @@ package likelihoodDetectionModule; -import javax.swing.*; -import javax.swing.event.*; -import javax.swing.tree.*; -import javax.swing.table.*; -import java.awt.Dimension; +import java.awt.Color; import java.awt.Component; +import java.awt.Dimension; import java.awt.Graphics; -import java.text.DecimalFormat; -import javax.swing.text.NumberFormatter; -import javax.swing.JFormattedTextField; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.util.EventObject; -import java.util.Vector; -import java.awt.Color; -import java.util.ArrayList; -import java.awt.event.ActionListener; -import java.awt.event.ActionEvent; -import javax.swing.filechooser.FileFilter; import java.io.File; -import javax.swing.event.CellEditorListener; +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.EventObject; import java.util.StringTokenizer; +import java.util.Vector; + +import javax.swing.BorderFactory; +import javax.swing.DefaultCellEditor; +import javax.swing.JComboBox; +import javax.swing.JDialog; +import javax.swing.JFileChooser; +import javax.swing.JFormattedTextField; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPopupMenu; +import javax.swing.JTable; +import javax.swing.JTree; +import javax.swing.ListSelectionModel; +import javax.swing.LookAndFeel; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.event.CellEditorListener; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.event.TreeExpansionEvent; import javax.swing.event.TreeExpansionListener; +import javax.swing.filechooser.FileFilter; +import javax.swing.table.DefaultTableCellRenderer; +import javax.swing.table.DefaultTableColumnModel; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableCellRenderer; +import javax.swing.text.NumberFormatter; +import javax.swing.tree.DefaultTreeCellRenderer; +import javax.swing.tree.DefaultTreeSelectionModel; +import javax.swing.tree.TreeCellRenderer; +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreePath; /** * The TreeTable class provides a widget that is not native to the standard @@ -591,6 +615,7 @@ public class TreeTable extends JTable { /* (non-Javadoc) * @see javax.swing.event.CellEditorListener#editingStopped(javax.swing.event.ChangeEvent) */ + @Override public void editingStopped( ChangeEvent e ) { model.fireTableStructureChanged(); } @@ -598,6 +623,7 @@ public class TreeTable extends JTable { /* (non-Javadoc) * @see javax.swing.event.CellEditorListener#editingCanceled(javax.swing.event.ChangeEvent) */ + @Override public void editingCanceled( ChangeEvent e ) { tree.updateUI(); } @@ -782,6 +808,7 @@ public class TreeTable extends JTable { * * @return the table cell renderer component */ + @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, @@ -817,6 +844,7 @@ public class TreeTable extends JTable { /* (non-Javadoc) * @see javax.swing.table.TableCellEditor#getTableCellEditorComponent(javax.swing.JTable, java.lang.Object, boolean, int, int) */ + @Override public Component getTableCellEditorComponent( JTable table, Object value, boolean isSelected, int row, int column ) { return tree; @@ -960,6 +988,7 @@ public class TreeTable extends JTable { /* (non-Javadoc) * @see javax.swing.event.ListSelectionListener#valueChanged(javax.swing.event.ListSelectionEvent) */ + @Override public void valueChanged(ListSelectionEvent e) { updateSelectedPathsFromSelectedRows(); } @@ -982,6 +1011,7 @@ public class TreeTable extends JTable { /* (non-Javadoc) * @see javax.swing.event.TreeExpansionListener#treeCollapsed(javax.swing.event.TreeExpansionEvent) */ + @Override public void treeCollapsed( TreeExpansionEvent e ) { String state = preserveExpanded(); model.setConfigurationDialogExpandedState(state); @@ -990,6 +1020,7 @@ public class TreeTable extends JTable { /* (non-Javadoc) * @see javax.swing.event.TreeExpansionListener#treeExpanded(javax.swing.event.TreeExpansionEvent) */ + @Override public void treeExpanded( TreeExpansionEvent e ) { String state = preserveExpanded(); model.setConfigurationDialogExpandedState(state); @@ -1158,6 +1189,7 @@ public class TreeTable extends JTable { /* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ + @Override public void actionPerformed( ActionEvent e ) { // Loop over the model and make a list of the existing identifiers. ArrayList existingIdentifiers = model.getTargetConfigurationNames(); @@ -1182,6 +1214,7 @@ public class TreeTable extends JTable { /* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ + @Override public void actionPerformed( ActionEvent e ) { // Get the currently selected target configuration name. int row = getSelectedRow(); @@ -1205,6 +1238,7 @@ public class TreeTable extends JTable { /* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ + @Override public void actionPerformed( ActionEvent e ) { // Find the name of the target configuration that is selected. @@ -1244,6 +1278,7 @@ public class TreeTable extends JTable { /* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ + @Override public void actionPerformed( ActionEvent e ) { // Find the name of the target configuration that is selected. int row = getSelectedRow(); @@ -1280,6 +1315,7 @@ public class TreeTable extends JTable { /* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ + @Override public void actionPerformed( ActionEvent e ) { // Get the currently selected target configuration name. int row = getSelectedRow(); @@ -1305,6 +1341,7 @@ public class TreeTable extends JTable { /* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ + @Override public void actionPerformed( ActionEvent e ) { // Get the currently selected target configuration name. int row = getSelectedRow(); @@ -1327,6 +1364,7 @@ public class TreeTable extends JTable { /* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ + @Override public void actionPerformed( ActionEvent e ) { JFileChooser chooser = new JFileChooser(); @@ -1381,6 +1419,7 @@ public class TreeTable extends JTable { /* (non-Javadoc) * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent) */ + @Override public void actionPerformed( ActionEvent e ) { int row = getSelectedRow(); String name = (String)getValueAt(row,0); diff --git a/src/likelihoodDetectionModule/TreeTableModel.java b/src/likelihoodDetectionModule/TreeTableModel.java index b85fd18e..6d22bdc3 100644 --- a/src/likelihoodDetectionModule/TreeTableModel.java +++ b/src/likelihoodDetectionModule/TreeTableModel.java @@ -1,16 +1,21 @@ package likelihoodDetectionModule; -import java.util.ArrayList; -import javax.swing.tree.*; -import javax.swing.event.*; -import javax.swing.tree.TreeModel; -import java.util.Iterator; -import java.awt.event.ItemListener; import java.awt.event.ItemEvent; -import java.util.Vector; -import likelihoodDetectionModule.normalizer.NormalizerProcess.NormalizerAlgorithm; +import java.awt.event.ItemListener; import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.Vector; + +import javax.swing.event.EventListenerList; +import javax.swing.event.TreeModelEvent; +import javax.swing.event.TreeModelListener; +import javax.swing.tree.TreeModel; +import javax.swing.tree.TreeNode; +import javax.swing.tree.TreePath; + +import likelihoodDetectionModule.normalizer.NormalizerProcess.NormalizerAlgorithm; /** * The TreeTableModel represents a LikelihoodDetectionParameters object @@ -775,7 +780,8 @@ public class TreeTableModel implements TreeModel { * @see TreeModel */ - public int getChildCount( Object node ) { + @Override + public int getChildCount( Object node ) { int retval = ((Node)node).children.size(); return retval; } @@ -791,7 +797,8 @@ public class TreeTableModel implements TreeModel { * @see TreeModel */ - public Object getChild( Object node, int child ) { + @Override + public Object getChild( Object node, int child ) { return ((Node)node).children.get( child ); } @@ -803,7 +810,8 @@ public class TreeTableModel implements TreeModel { * @see TreeModel */ - public Object getRoot() { + @Override + public Object getRoot() { return rootNode; } @@ -817,7 +825,8 @@ public class TreeTableModel implements TreeModel { * @see TreeModel */ - public boolean isLeaf(Object node) { + @Override + public boolean isLeaf(Object node) { //return getChildCount(node) == 0; boolean val = getChildCount(node) == 0; return val; @@ -833,7 +842,8 @@ public class TreeTableModel implements TreeModel { * @see TreeModel */ - public void valueForPathChanged(TreePath path, Object newValue) {} + @Override + public void valueForPathChanged(TreePath path, Object newValue) {} /** * Implementation of TreeModel.getIndexOfChild() @@ -846,7 +856,8 @@ public class TreeTableModel implements TreeModel { * @see TreeModel */ - public int getIndexOfChild(Object parent, Object child) { + @Override + public int getIndexOfChild(Object parent, Object child) { for (int i = 0; i < getChildCount(parent); i++) { if (getChild(parent, i).equals(child)) { return i; @@ -862,7 +873,8 @@ public class TreeTableModel implements TreeModel { * @param l the l */ - public void addTreeModelListener(TreeModelListener l) { + @Override + public void addTreeModelListener(TreeModelListener l) { listenerList.add(TreeModelListener.class, l); } @@ -872,7 +884,8 @@ public class TreeTableModel implements TreeModel { * @param l the l */ - public void removeTreeModelListener(TreeModelListener l) { + @Override + public void removeTreeModelListener(TreeModelListener l) { listenerList.remove(TreeModelListener.class, l); } @@ -1272,7 +1285,8 @@ public boolean isError() { return numberSignalNodes; } - public void itemStateChanged( ItemEvent e ) { + @Override +public void itemStateChanged( ItemEvent e ) { if ( e.getStateChange() == ItemEvent.SELECTED ) { if ( this.state != TargetConfiguration.State.Error ) state = TargetConfiguration.State.Active; } @@ -1283,7 +1297,7 @@ public boolean isError() { private TargetConfiguration.State state; private String name; -}; +} /** * The TimeResolutionNode represents the time resolution value diff --git a/src/likelihoodDetectionModule/TreeTableModelAdapter.java b/src/likelihoodDetectionModule/TreeTableModelAdapter.java index f623c3ec..48b6233f 100644 --- a/src/likelihoodDetectionModule/TreeTableModelAdapter.java +++ b/src/likelihoodDetectionModule/TreeTableModelAdapter.java @@ -1,15 +1,16 @@ package likelihoodDetectionModule; +import java.util.ArrayList; +import java.util.Vector; + import javax.swing.JTree; import javax.swing.SwingUtilities; -import javax.swing.table.AbstractTableModel; -import javax.swing.tree.TreePath; import javax.swing.event.TreeExpansionEvent; import javax.swing.event.TreeExpansionListener; import javax.swing.event.TreeModelEvent; import javax.swing.event.TreeModelListener; -import java.util.Vector; -import java.util.ArrayList; +import javax.swing.table.AbstractTableModel; +import javax.swing.tree.TreePath; /** * The class TreeTableModelAdapter is a necessary part of the TreeTable implementation @@ -58,10 +59,12 @@ public class TreeTableModelAdapter extends AbstractTableModel { tree.addTreeExpansionListener(new TreeExpansionListener() { // Don't use fireTableRowsInserted() here; the selection model // would get updated twice. - public void treeExpanded(TreeExpansionEvent event) { + @Override + public void treeExpanded(TreeExpansionEvent event) { fireTableDataChanged(); } - public void treeCollapsed(TreeExpansionEvent event) { + @Override + public void treeCollapsed(TreeExpansionEvent event) { fireTableDataChanged(); } }); @@ -71,19 +74,23 @@ public class TreeTableModelAdapter extends AbstractTableModel { // not be guaranteed the tree will have finished processing // the event before us. treeTableModel.addTreeModelListener(new TreeModelListener() { - public void treeNodesChanged(TreeModelEvent e) { + @Override + public void treeNodesChanged(TreeModelEvent e) { delayedFireTableDataChanged(); } - public void treeNodesInserted(TreeModelEvent e) { + @Override + public void treeNodesInserted(TreeModelEvent e) { delayedFireTableDataChanged(); } - public void treeNodesRemoved(TreeModelEvent e) { + @Override + public void treeNodesRemoved(TreeModelEvent e) { delayedFireTableDataChanged(); } - public void treeStructureChanged(TreeModelEvent e) { + @Override + public void treeStructureChanged(TreeModelEvent e) { delayedFireTableDataChanged(); } }); @@ -263,7 +270,8 @@ public class TreeTableModelAdapter extends AbstractTableModel { /* (non-Javadoc) * @see javax.swing.table.TableModel#getColumnCount() */ - public int getColumnCount() { + @Override + public int getColumnCount() { return treeTableModel.getColumnCount(); } @@ -286,7 +294,8 @@ public class TreeTableModelAdapter extends AbstractTableModel { /* (non-Javadoc) * @see javax.swing.table.TableModel#getRowCount() */ - public int getRowCount() { + @Override + public int getRowCount() { return tree.getRowCount(); } @@ -308,7 +317,8 @@ public class TreeTableModelAdapter extends AbstractTableModel { /* (non-Javadoc) * @see javax.swing.table.TableModel#getValueAt(int, int) */ - public Object getValueAt(int row, int column) { + @Override + public Object getValueAt(int row, int column) { return treeTableModel.getValueAt(nodeForRow(row), column); } @@ -335,7 +345,8 @@ public class TreeTableModelAdapter extends AbstractTableModel { */ protected void delayedFireTableDataChanged() { SwingUtilities.invokeLater(new Runnable() { - public void run() { + @Override + public void run() { fireTableDataChanged(); } }); diff --git a/src/listening/ListeningDialog.java b/src/listening/ListeningDialog.java index 193a203a..f8611914 100644 --- a/src/listening/ListeningDialog.java +++ b/src/listening/ListeningDialog.java @@ -142,7 +142,7 @@ public class ListeningDialog extends PamDialog { if (newSp == null) { return; } - if (checkSpeciesLength(newSp) == false) { + if (!checkSpeciesLength(newSp)) { return; } listeningParameters.speciesList.add(new SpeciesItem(newSp)); @@ -176,7 +176,7 @@ public class ListeningDialog extends PamDialog { if (newSp == null) { return; } - if (checkSpeciesLength(newSp) == false) { + if (!checkSpeciesLength(newSp)) { return; } sp.setName(newSp); diff --git a/src/listening/ListeningEffortGraphics.java b/src/listening/ListeningEffortGraphics.java index b4d4da0f..1406bd40 100644 --- a/src/listening/ListeningEffortGraphics.java +++ b/src/listening/ListeningEffortGraphics.java @@ -9,15 +9,12 @@ import PamUtils.Coordinate3d; import PamUtils.LatLong; import PamUtils.PamCalendar; import PamView.GeneralProjector; -import PamView.ManagedSymbol; -import PamView.ManagedSymbolInfo; -import PamView.PamKeyItem; -import PamView.PamSymbol; -import PamView.PamOldSymbolManager; -import PamView.PamSymbolType; -import PamView.PanelOverlayDraw; import PamView.GeneralProjector.ParameterType; import PamView.GeneralProjector.ParameterUnits; +import PamView.PamKeyItem; +import PamView.PamSymbol; +import PamView.PamSymbolType; +import PamView.PanelOverlayDraw; import PamView.symbol.SymbolData; import PamguardMVC.PamDataUnit; @@ -32,16 +29,19 @@ public class ListeningEffortGraphics extends PanelOverlayDraw { this.listeningControl = listeningControl; // PamOldSymbolManager.getInstance().addManagesSymbol(this); } + @Override public boolean canDraw(ParameterType[] parameterTypes, ParameterUnits[] parameterUnits) { return (parameterTypes[0] == GeneralProjector.ParameterType.LATITUDE && parameterTypes[1] == GeneralProjector.ParameterType.LONGITUDE); } + @Override public PamKeyItem createKeyItem(GeneralProjector generalProjector, int keyType) { return getDefaultSymbol().makeKeyItem("Listening Effort"); } + @Override public Rectangle drawDataUnit(Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector) { if (generalProjector.getParmeterType(0) == GeneralProjector.ParameterType.LATITUDE && @@ -70,6 +70,7 @@ public class ListeningEffortGraphics extends PanelOverlayDraw { return r; } + @Override public String getHoverText(GeneralProjector generalProjector, PamDataUnit dataUnit, int iSide) { diff --git a/src/listening/ListeningProcess.java b/src/listening/ListeningProcess.java index abc84ea3..d2677e01 100644 --- a/src/listening/ListeningProcess.java +++ b/src/listening/ListeningProcess.java @@ -1,11 +1,9 @@ package listening; import PamUtils.PamCalendar; -import PamView.PamSymbol; import PamView.symbol.StandardSymbolManager; import PamguardMVC.PamDataBlock; import PamguardMVC.PamProcess; -import autecPhones.AutecGraphics; public class ListeningProcess extends PamProcess { diff --git a/src/listening/ThingHeardGraphics.java b/src/listening/ThingHeardGraphics.java index 75080e9c..d1b1d284 100644 --- a/src/listening/ThingHeardGraphics.java +++ b/src/listening/ThingHeardGraphics.java @@ -9,15 +9,12 @@ import PamUtils.Coordinate3d; import PamUtils.LatLong; import PamUtils.PamCalendar; import PamView.GeneralProjector; -import PamView.ManagedSymbol; -import PamView.ManagedSymbolInfo; -import PamView.PamKeyItem; -import PamView.PamSymbol; -import PamView.PamOldSymbolManager; -import PamView.PamSymbolType; -import PamView.PanelOverlayDraw; import PamView.GeneralProjector.ParameterType; import PamView.GeneralProjector.ParameterUnits; +import PamView.PamKeyItem; +import PamView.PamSymbol; +import PamView.PamSymbolType; +import PamView.PanelOverlayDraw; import PamView.symbol.SymbolData; import PamguardMVC.PamDataUnit; @@ -33,16 +30,19 @@ public class ThingHeardGraphics extends PanelOverlayDraw { super(new PamSymbol(defaultSymbol)); this.listeningControl = listeningControl; } + @Override public boolean canDraw(ParameterType[] parameterTypes, ParameterUnits[] parameterUnits) { return (parameterTypes[0] == GeneralProjector.ParameterType.LATITUDE && parameterTypes[1] == GeneralProjector.ParameterType.LONGITUDE); } + @Override public PamKeyItem createKeyItem(GeneralProjector generalProjector, int keyType) { return getPamSymbol().makeKeyItem("Thing Heard"); } + @Override public Rectangle drawDataUnit(Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector) { if (generalProjector.getParmeterType(0) == GeneralProjector.ParameterType.LATITUDE && @@ -71,6 +71,7 @@ public class ThingHeardGraphics extends PanelOverlayDraw { return r; } + @Override public String getHoverText(GeneralProjector generalProjector, PamDataUnit dataUnit, int iSide) { diff --git a/src/listening/ThingHeardTabPanelControl.java b/src/listening/ThingHeardTabPanelControl.java index fd1d5995..a5b7c3e0 100644 --- a/src/listening/ThingHeardTabPanelControl.java +++ b/src/listening/ThingHeardTabPanelControl.java @@ -24,10 +24,6 @@ import javax.swing.Timer; import javax.swing.border.TitledBorder; import javax.swing.table.AbstractTableModel; -import pamScrollSystem.AbstractPamScroller; -import pamScrollSystem.AbstractPamScrollerAWT; -import pamScrollSystem.PamScrollObserver; -import pamScrollSystem.ScrollPaneAddon; import Array.ArrayManager; import Array.PamArray; import PamController.PamController; @@ -43,6 +39,10 @@ import PamView.dialog.PamLabel; import PamView.dialog.PamRadioButton; import PamView.panel.PamBorderPanel; import PamguardMVC.PamDataBlock; +import pamScrollSystem.AbstractPamScroller; +import pamScrollSystem.AbstractPamScrollerAWT; +import pamScrollSystem.PamScrollObserver; +import pamScrollSystem.ScrollPaneAddon; public class ThingHeardTabPanelControl implements PamTabPanel { diff --git a/src/loc3d_Thode/CrossStationMatcher.java b/src/loc3d_Thode/CrossStationMatcher.java index d2393628..74ddf65f 100644 --- a/src/loc3d_Thode/CrossStationMatcher.java +++ b/src/loc3d_Thode/CrossStationMatcher.java @@ -1,8 +1,8 @@ package loc3d_Thode; -import fftManager.FFT; -import Localiser.*; +import Localiser.DelayMeasurementParams; import Localiser.algorithms.Correlations; import Localiser.algorithms.TimeDelayData; +import fftManager.FFT; /* Match detections between two station queues. */ public class CrossStationMatcher { diff --git a/src/loc3d_Thode/GroupDetDataUnit.java b/src/loc3d_Thode/GroupDetDataUnit.java index a96a5d37..2bd717b9 100644 --- a/src/loc3d_Thode/GroupDetDataUnit.java +++ b/src/loc3d_Thode/GroupDetDataUnit.java @@ -1,8 +1,6 @@ package loc3d_Thode; import PamDetection.PamDetection; -import PamguardMVC.AcousticDataUnit; -import PamguardMVC.PamDataUnit; import PamguardMVC.superdet.SuperDetection; public class GroupDetDataUnit extends SuperDetection implements PamDetection { diff --git a/src/loc3d_Thode/StationQueue.java b/src/loc3d_Thode/StationQueue.java index 4714498d..af34a2ca 100644 --- a/src/loc3d_Thode/StationQueue.java +++ b/src/loc3d_Thode/StationQueue.java @@ -2,10 +2,9 @@ package loc3d_Thode; import java.util.ArrayList; -import fftManager.FFT; import Localiser.DelayMeasurementParams; import Localiser.algorithms.Correlations; -import loc3d_Thode.TowedArray3DProcessParameters; +import fftManager.FFT; /** * StationQueue-- diff --git a/src/loc3d_Thode/TowedArray3DController.java b/src/loc3d_Thode/TowedArray3DController.java index 9e904d68..733684bc 100644 --- a/src/loc3d_Thode/TowedArray3DController.java +++ b/src/loc3d_Thode/TowedArray3DController.java @@ -4,6 +4,7 @@ import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.Serializable; + import javax.swing.JMenuItem; import PamController.PamControlledUnit; @@ -98,6 +99,7 @@ public class TowedArray3DController extends PamControlledUnit implements PamSett */ class MapSymbolSelect implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { // PamSymbol newSymbol = PamSymbolDialog.show(towedArray3DProcessParameters.mapSymbol); @@ -133,6 +135,7 @@ public class TowedArray3DController extends PamControlledUnit implements PamSett this.towedArray3DController = towedArray3DController; } + @Override public void actionPerformed(ActionEvent e) { TowedArray3DProcessParameters newParams = TowedArray3DParametersDialog.showDialog(parentFrame, towedArray3DController, @@ -155,14 +158,17 @@ public class TowedArray3DController extends PamControlledUnit implements PamSett * These next three functions are needed for the PamSettings interface * which will enable Pamguard to save settings between runs */ + @Override public Serializable getSettingsReference() { return towedArray3DProcessParameters; } + @Override public long getSettingsVersion() { return TowedArray3DProcessParameters.serialVersionUID; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { towedArray3DProcessParameters = (TowedArray3DProcessParameters) pamControlledUnitSettings.getSettings(); return true; diff --git a/src/loc3d_Thode/TowedArray3DDataUnit.java b/src/loc3d_Thode/TowedArray3DDataUnit.java index b0916c2f..74295fe8 100644 --- a/src/loc3d_Thode/TowedArray3DDataUnit.java +++ b/src/loc3d_Thode/TowedArray3DDataUnit.java @@ -1,14 +1,10 @@ package loc3d_Thode; -import Array.ArrayManager; -import Array.HydrophoneLocator; -import Array.PamArray; import GPS.GpsData; import GPS.GpsDataUnit; import PamController.PamController; import PamDetection.PamDetection; import PamUtils.LatLong; -import PamguardMVC.AcousticDataUnit; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.superdet.SuperDetection; diff --git a/src/loc3d_Thode/TowedArray3DLocalization.java b/src/loc3d_Thode/TowedArray3DLocalization.java index fed0de85..0907aa38 100644 --- a/src/loc3d_Thode/TowedArray3DLocalization.java +++ b/src/loc3d_Thode/TowedArray3DLocalization.java @@ -4,10 +4,8 @@ package loc3d_Thode; import Array.ArrayManager; -import Array.HydrophoneLocator; import Array.PamArray; import PamDetection.AbstractLocalisation; -import PamDetection.LocContents; import PamDetection.LocalisationInfo; import PamUtils.LatLong; import PamguardMVC.PamDataUnit; @@ -99,13 +97,13 @@ public class TowedArray3DLocalization extends AbstractLocalisation { @Override public LatLong getLatLong(int iSide) { - if (towedArray3DDataUnit.HasLatLong() == false) return null; + if (!towedArray3DDataUnit.HasLatLong()) return null; return towedArray3DDataUnit.getLatlong(iSide); } @Override public double getDepth() { - if (towedArray3DDataUnit.isHasDepth() == false) return Double.NaN; + if (!towedArray3DDataUnit.isHasDepth()) return Double.NaN; return towedArray3DDataUnit.getDepth(); } @@ -117,7 +115,7 @@ public class TowedArray3DLocalization extends AbstractLocalisation { @Override public double getHeight(int iSide) { - if (towedArray3DDataUnit.isHasDepth() == false) return Double.NaN; + if (!towedArray3DDataUnit.isHasDepth()) return Double.NaN; return towedArray3DDataUnit.getDepth(); } diff --git a/src/loc3d_Thode/TowedArray3DParametersDialog.java b/src/loc3d_Thode/TowedArray3DParametersDialog.java index a403571b..e69f130c 100644 --- a/src/loc3d_Thode/TowedArray3DParametersDialog.java +++ b/src/loc3d_Thode/TowedArray3DParametersDialog.java @@ -18,10 +18,8 @@ import PamController.PamController; import PamDetection.PamDetection; import PamView.dialog.PamDialog; import PamView.dialog.SourcePanel; -import PamguardMVC.AcousticDataUnit; //import PamguardMVC.DataType; import PamguardMVC.PamDataBlock; -import PamguardMVC.PamDataUnit; import warnings.PamWarning; import warnings.WarningSystem; diff --git a/src/loc3d_Thode/TowedArray3DProcess.java b/src/loc3d_Thode/TowedArray3DProcess.java index 52c74098..ee26c1dc 100644 --- a/src/loc3d_Thode/TowedArray3DProcess.java +++ b/src/loc3d_Thode/TowedArray3DProcess.java @@ -1,8 +1,16 @@ package loc3d_Thode; +import java.io.FileWriter; +import java.io.IOException; import java.util.ArrayList; +import java.util.Calendar; import Acquisition.AcquisitionProcess; +//import loc3d_Thode.FindAnchorOverlayGraphics; +//import FindAnchor.FindAnchorSQLLogging; +import Array.ArrayManager; +import Array.PamArray; +import Array.SnapshotGeometry; import Localiser.DelayMeasurementParams; import Localiser.algorithms.Correlations; import PamController.PamController; @@ -12,25 +20,14 @@ import PamDetection.PamDetection; import PamUtils.PamCalendar; import PamUtils.PamUtils; import PamView.symbol.StandardSymbolManager; -import PamguardMVC.AcousticDataUnit; //import PamguardMVC.DataType; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; -import autecPhones.AutecGraphics; -import loc3d_Thode.TowedArray3DController; -//import loc3d_Thode.FindAnchorOverlayGraphics; -//import FindAnchor.FindAnchorSQLLogging; -import Array.ArrayManager; -import Array.PamArray; -import Array.SnapshotGeometry; import clickDetector.ClickDetection; import fftManager.FFT; -import java.util.Calendar; -import java.io.*; - public class TowedArray3DProcess extends PamProcess{ @@ -430,7 +427,7 @@ public class TowedArray3DProcess extends PamProcess{ ldu.setLatLong(); } else - ldu.getLocalisation().getLocContents().setLocContent(0);; + ldu.getLocalisation().getLocContents().setLocContent(0); try { diff --git a/src/loc3d_Thode/TowedArray3DSQLLogging.java b/src/loc3d_Thode/TowedArray3DSQLLogging.java index 95bc98e6..b99a7104 100644 --- a/src/loc3d_Thode/TowedArray3DSQLLogging.java +++ b/src/loc3d_Thode/TowedArray3DSQLLogging.java @@ -1,19 +1,16 @@ package loc3d_Thode; -import generalDatabase.EmptyTableDefinition; +import java.sql.Types; + +import PamDetection.LocContents; +import PamguardMVC.PamDataBlock; +import PamguardMVC.PamDataUnit; import generalDatabase.PamDetectionLogging; import generalDatabase.PamTableDefinition; import generalDatabase.PamTableItem; import generalDatabase.SQLLogging; import generalDatabase.SQLTypes; -import java.sql.Types; - -import PamguardMVC.PamDataBlock; -import PamguardMVC.PamDataUnit; -import PamDetection.AbstractLocalisation; -import PamDetection.LocContents; - public class TowedArray3DSQLLogging extends PamDetectionLogging { TowedArray3DController towedArray3DController; diff --git a/src/localTime/LocalTime.java b/src/localTime/LocalTime.java index 3bdb8dca..5256afcb 100644 --- a/src/localTime/LocalTime.java +++ b/src/localTime/LocalTime.java @@ -4,10 +4,10 @@ import java.awt.BorderLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.BoxLayout; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.SwingConstants; import javax.swing.Timer; import javax.swing.border.TitledBorder; @@ -48,7 +48,7 @@ public class LocalTime extends PamControlledUnit { mainPanel.setBorder(border); // mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.setLayout(new BorderLayout()); - timeLabel = new PamLabel("", JLabel.CENTER); + timeLabel = new PamLabel("", SwingConstants.CENTER); mainPanel.add(BorderLayout.CENTER, timeLabel); // mainPanel.add(zoneLabel = new JLabel("", JLabel.CENTER)); Timer timer = new Timer(500, new TimeAction()); diff --git a/src/localiserDisplay/LocaliserDisplayControlAWT.java b/src/localiserDisplay/LocaliserDisplayControlAWT.java index cd8c63b8..da957d66 100644 --- a/src/localiserDisplay/LocaliserDisplayControlAWT.java +++ b/src/localiserDisplay/LocaliserDisplayControlAWT.java @@ -46,10 +46,12 @@ public class LocaliserDisplayControlAWT extends LoclaiserDisplayControl implemen } + @Override public String getUniqueName() { return uniqueDisplayName; } + @Override public void setUniqueName(String uniqueName) { this.uniqueDisplayName = uniqueName; } diff --git a/src/loggerForms/FormDescription.java b/src/loggerForms/FormDescription.java index b6d862e7..7b55b689 100644 --- a/src/loggerForms/FormDescription.java +++ b/src/loggerForms/FormDescription.java @@ -1,14 +1,5 @@ package loggerForms; -import generalDatabase.DBControlUnit; -import generalDatabase.EmptyTableDefinition; -import generalDatabase.PamConnection; -import generalDatabase.PamTableDefinition; -import generalDatabase.SQLLogging; -import generalDatabase.SQLTypes; -import generalDatabase.pamCursor.PamCursor; -import generalDatabase.pamCursor.PamCursorManager; - import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; @@ -32,6 +23,10 @@ import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.JSplitPane; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + import com.fasterxml.jackson.core.JsonEncoding; import com.fasterxml.jackson.core.JsonFactory; import com.fasterxml.jackson.core.JsonGenerator; @@ -45,28 +40,27 @@ import Array.streamerOrigin.HydrophoneOriginMethods; import Array.streamerOrigin.OriginIterator; import Array.streamerOrigin.StaticOriginSystem; import GPS.GpsData; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; - -//import com.sun.org.apache.xerces.internal.dom.DocumentImpl; - -import pamScrollSystem.AbstractPamScrollerAWT; -import pamScrollSystem.ScrollPaneAddon; -import PamView.PamTabPanel; -import PamView.panel.PamPanel; -import PamguardMVC.PamDataBlock; -import PamguardMVC.PamDataUnit; import PamController.PamControlledUnitSettings; import PamController.PamController; import PamController.PamSettingManager; import PamController.PamSettings; import PamUtils.PamCalendar; import PamUtils.XMLUtils; +import PamView.PamTabPanel; +import PamView.panel.PamPanel; +import PamguardMVC.PamDataBlock; +import PamguardMVC.PamDataUnit; +import generalDatabase.DBControlUnit; +import generalDatabase.EmptyTableDefinition; +import generalDatabase.PamConnection; +import generalDatabase.PamTableDefinition; +import generalDatabase.SQLLogging; +import generalDatabase.SQLTypes; +import generalDatabase.pamCursor.PamCursor; +import generalDatabase.pamCursor.PamCursorManager; +import loggerForms.controlDescriptions.ControlDescription; import loggerForms.controlDescriptions.ControlTypes; import loggerForms.controlDescriptions.InputControlDescription; -import loggerForms.controlDescriptions.ControlDescription; import loggerForms.formdesign.FormEditDialog; import loggerForms.formdesign.FormEditor; import loggerForms.formdesign.FormList; @@ -74,6 +68,11 @@ import loggerForms.propertyInfos.BEARINGinfo; import loggerForms.propertyInfos.HEADINGinfo; import loggerForms.propertyInfos.RANGEinfo; import loggerForms.symbol.LoggerSymbolManager; + +//import com.sun.org.apache.xerces.internal.dom.DocumentImpl; + +import pamScrollSystem.AbstractPamScrollerAWT; +import pamScrollSystem.ScrollPaneAddon; /** * * @author Graham Weatherup - SMRU @@ -419,7 +418,7 @@ public class FormDescription implements Cloneable, Comparable { * want to look into the db at this point to see what's going on * and will get very confused if changes are not committed */ - if (DBControlUnit.findDatabaseControl().commitChanges() == false) { + if (!DBControlUnit.findDatabaseControl().commitChanges()) { System.out.println("Error Commiting logger form form changes to database"); } @@ -1453,7 +1452,7 @@ public class FormDescription implements Cloneable, Comparable { Object timeObject = outputTableDef.getTimeStampItem().getValue(); - Long timestamp = sqlTypes.millisFromTimeStamp(timeObject); + Long timestamp = SQLTypes.millisFromTimeStamp(timeObject); if (timestamp != null && timestamp > timestampNewest) { timestampNewest=timestamp; } @@ -1744,7 +1743,7 @@ public class FormDescription implements Cloneable, Comparable { return null; } - if (formName.equals(getFormName()) == false) { + if (!formName.equals(getFormName())) { return null; } Object[] formData = new Object[inputControlDescriptions.size()]; @@ -1768,7 +1767,7 @@ public class FormDescription implements Cloneable, Comparable { continue; } ControlDescription cd = getInputControlDescriptions().get(itemIndex); - if (cd.getType().equals(ctrlType) == false) { + if (!cd.getType().equals(ctrlType)) { continue; } Object data = cd.extractXMLElementData(dataElement, dataElement.getAttribute("Value")); diff --git a/src/loggerForms/FormPlotOptionsPanel.java b/src/loggerForms/FormPlotOptionsPanel.java index 92ac4f3c..8dd2e764 100644 --- a/src/loggerForms/FormPlotOptionsPanel.java +++ b/src/loggerForms/FormPlotOptionsPanel.java @@ -1,8 +1,5 @@ package loggerForms; -import generalDatabase.lookupTables.LookupComponent; -import generalDatabase.lookupTables.LookupItem; - import java.awt.Component; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -18,7 +15,8 @@ import javax.swing.border.TitledBorder; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; -import loggerForms.PropertyTypes; +import generalDatabase.lookupTables.LookupComponent; +import generalDatabase.lookupTables.LookupItem; import loggerForms.controlDescriptions.ControlDescription; import loggerForms.controlDescriptions.ControlTypes; @@ -71,7 +69,7 @@ public class FormPlotOptionsPanel { if (aControl.getEType() != ControlTypes.LOOKUP) { continue; } - if (aControl.getPlot() == null || aControl.getPlot() == false) { + if (aControl.getPlot() == null || !aControl.getPlot()) { continue; } LookupPanel lookupPanel = new LookupPanel(iControl, aControl); @@ -150,7 +148,7 @@ public class FormPlotOptionsPanel { } boolean s = showAll.isSelected(); for (int i = 1; i < checkBoxes.size(); i++) { - checkBoxes.get(i).setEnabled(s==false); + checkBoxes.get(i).setEnabled(!s); } } } diff --git a/src/loggerForms/FormsAlertSidePanel.java b/src/loggerForms/FormsAlertSidePanel.java index 97077710..ace3f33a 100644 --- a/src/loggerForms/FormsAlertSidePanel.java +++ b/src/loggerForms/FormsAlertSidePanel.java @@ -22,7 +22,6 @@ import PamView.dialog.PamLabel; import PamView.panel.PamBorderPanel; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; -import PamguardMVC.PamObserver; import PamguardMVC.PamObserverAdapter; public class FormsAlertSidePanel extends PamObserverAdapter implements PamSidePanel { diff --git a/src/loggerForms/FormsBinaryIO.java b/src/loggerForms/FormsBinaryIO.java index 5f8c3113..0f060add 100644 --- a/src/loggerForms/FormsBinaryIO.java +++ b/src/loggerForms/FormsBinaryIO.java @@ -6,14 +6,12 @@ import org.w3c.dom.Document; import org.w3c.dom.Element; import PamUtils.XMLUtils; -import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import binaryFileStorage.BinaryDataSource; import binaryFileStorage.BinaryHeader; import binaryFileStorage.BinaryObjectData; import binaryFileStorage.ModuleFooter; import binaryFileStorage.ModuleHeader; -import binaryFileStorage.PackedBinaryObject; public class FormsBinaryIO extends BinaryDataSource { diff --git a/src/loggerForms/FormsControl.java b/src/loggerForms/FormsControl.java index ba34a520..8959c685 100644 --- a/src/loggerForms/FormsControl.java +++ b/src/loggerForms/FormsControl.java @@ -1,38 +1,21 @@ package loggerForms; import java.awt.Frame; -import java.awt.KeyEventDispatcher; -import java.awt.KeyboardFocusManager; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import java.awt.event.KeyEvent; import java.io.Serializable; -import java.lang.reflect.Field; import java.sql.DatabaseMetaData; import java.sql.ResultSet; import java.sql.SQLException; import java.util.ArrayList; import java.util.Collections; -import java.util.logging.LogManager; import javax.swing.JCheckBoxMenuItem; -import javax.swing.JComponent; import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.JOptionPane; -import javax.swing.KeyStroke; -import org.jnativehook.GlobalScreen; -import org.jnativehook.NativeHookException; -import org.jnativehook.dispatcher.SwingDispatchService; -import org.jnativehook.keyboard.NativeKeyEvent; -import org.jnativehook.keyboard.NativeKeyListener; - -import generalDatabase.DBControlUnit; -import generalDatabase.PamConnection; -import loggerForms.FormDescription.FormPlotOptionsStore; -import loggerForms.monitor.FormsMonitorMaster; import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; import PamController.PamController; @@ -40,15 +23,14 @@ import PamController.PamControllerInterface; import PamController.PamSettingManager; import PamController.PamSettings; import PamController.status.ModuleStatus; -import PamModel.SMRUEnable; -import PamModel.parametermanager.ManagedParameters; -import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamView.PamGui; import PamView.PamSidePanel; import PamView.PamTabPanel; import PamView.PamView; import PamguardMVC.PamDataBlock; +import generalDatabase.DBControlUnit; +import generalDatabase.PamConnection; +import loggerForms.monitor.FormsMonitorMaster; /** * @@ -491,7 +473,7 @@ public class FormsControl extends PamControlledUnit implements PamSettings { } // will make a form table definition with a standard structure and name UDF_ ... // check the current name starts with UDF and add if necessary. - if (newName.toUpperCase().startsWith("UDF_") == false) { + if (!newName.toUpperCase().startsWith("UDF_")) { newName = "UDF_" + newName; } String message = String.format("The table definition %s will now be created in the database.", newName); @@ -504,7 +486,7 @@ public class FormsControl extends PamControlledUnit implements PamSettings { UDFTableDefinition tableDef = new UDFTableDefinition(newName); message = String.format("The table %s could not be created in the databse %s", newName, DBControlUnit.findDatabaseControl().getDatabaseName()); - if (DBControlUnit.findDatabaseControl().getDbProcess().checkTable(tableDef) == false) { + if (!DBControlUnit.findDatabaseControl().getDbProcess().checkTable(tableDef)) { JOptionPane.showMessageDialog(parentFrame, "Error Creating form", message, JOptionPane.ERROR_MESSAGE); } return newName; diff --git a/src/loggerForms/FormsDataBlock.java b/src/loggerForms/FormsDataBlock.java index 220ae3ba..1980921a 100644 --- a/src/loggerForms/FormsDataBlock.java +++ b/src/loggerForms/FormsDataBlock.java @@ -4,12 +4,8 @@ import PamController.PamController; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamProcess; -import PamguardMVC.dataSelector.DataSelector; -import PamguardMVC.dataSelector.DataSelectorCreator; import loggerForms.dataselect.FormDataSelCreator; -import loggerForms.effort.FormsEffortUnit; import loggerForms.effort.LoggerEffortProvider; -import loggerForms.monitor.FormsDataSelectorCreator; /** * * @author Graham Weatherup diff --git a/src/loggerForms/FormsDataDisplayTable.java b/src/loggerForms/FormsDataDisplayTable.java index 011739f2..b3f556e7 100644 --- a/src/loggerForms/FormsDataDisplayTable.java +++ b/src/loggerForms/FormsDataDisplayTable.java @@ -19,14 +19,14 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.table.AbstractTableModel; -import loggerForms.controlDescriptions.ControlDescription; -import loggerForms.controlDescriptions.ControlTypes; import PamController.PamController; import PamUtils.PamCalendar; import PamView.PamTable; import PamView.dialog.PamDialog; import PamView.dialog.warn.WarnOnce; import PamguardMVC.PamDataBlock; +import loggerForms.controlDescriptions.ControlDescription; +import loggerForms.controlDescriptions.ControlTypes; /** * @author GrahamWeatherup @@ -119,7 +119,7 @@ public class FormsDataDisplayTable { class EditDataListener extends MouseAdapter{ @Override public void mouseClicked(MouseEvent e) { - if (canEdit() == false) { + if (!canEdit()) { return; } if (e.getClickCount() == 2) { @@ -147,10 +147,10 @@ public class FormsDataDisplayTable { } private void maybePopup(MouseEvent e) { - if (e.isPopupTrigger() == false) { + if (!e.isPopupTrigger()) { return; } - if (canEdit() == false) { + if (!canEdit()) { return; } int row = formsTable.getSelectedRow(); @@ -225,7 +225,7 @@ public class FormsDataDisplayTable { Object value = ctrlDescription.formatDataItem(fd[ctIndex]); if (value == null) return null; if (getColumnClass(columnIndex) == Boolean.class) { - if (value instanceof Boolean == false) { + if (!(value instanceof Boolean)) { // System.out.println("Bad boolean value: " + value); return FormsControl.checkBadBoolean(value); } diff --git a/src/loggerForms/FormsDataUnit.java b/src/loggerForms/FormsDataUnit.java index 30cb4f0a..8cec4914 100644 --- a/src/loggerForms/FormsDataUnit.java +++ b/src/loggerForms/FormsDataUnit.java @@ -2,7 +2,6 @@ package loggerForms; import GPS.GpsData; import PamUtils.PamCalendar; -import PamView.GeneralProjector; import PamguardMVC.PamDataUnit; import generalDatabase.SQLTypes; import loggerForms.controlDescriptions.ControlDescription; diff --git a/src/loggerForms/FormsHotKeyControl.java b/src/loggerForms/FormsHotKeyControl.java index 95a503f4..7ba3fe8c 100644 --- a/src/loggerForms/FormsHotKeyControl.java +++ b/src/loggerForms/FormsHotKeyControl.java @@ -1,12 +1,10 @@ package loggerForms; -import java.awt.Component; import java.awt.event.ActionEvent; import java.beans.PropertyChangeListener; import javax.swing.Action; import javax.swing.JComponent; -import javax.swing.JPanel; import javax.swing.KeyStroke; import PamView.PamTabPanel; diff --git a/src/loggerForms/FormsLogging.java b/src/loggerForms/FormsLogging.java index e2c9c843..b25881be 100644 --- a/src/loggerForms/FormsLogging.java +++ b/src/loggerForms/FormsLogging.java @@ -3,15 +3,15 @@ package loggerForms; import java.util.ArrayList; import PamController.PamViewParameters; +import PamguardMVC.PamDataBlock; +import PamguardMVC.PamDataUnit; +import generalDatabase.EmptyTableDefinition; +import generalDatabase.PamConnection; +import generalDatabase.SQLLogging; +import generalDatabase.SQLTypes; import loggerForms.controlDescriptions.ControlDescription; import loggerForms.controlDescriptions.InputControlDescription; import pamScrollSystem.ViewLoadObserver; -import PamguardMVC.PamDataBlock; -import PamguardMVC.PamDataUnit; -import generalDatabase.PamConnection; -import generalDatabase.PamTableDefinition; -import generalDatabase.SQLLogging; -import generalDatabase.SQLTypes; public class FormsLogging extends SQLLogging { @@ -37,7 +37,7 @@ public class FormsLogging extends SQLLogging { if (startName == null) { return standardClause; } - startName = PamTableDefinition.deblankString(startName); // replace blanks with underscores. + startName = EmptyTableDefinition.deblankString(startName); // replace blanks with underscores. startName = sqlTypes.formatColumnName(startName); // wrap as standard for this database taype. String t1 = sqlTypes.formatDBDateTimeQueryString(pvp.viewStartTime); String t2 = sqlTypes.formatDBDateTimeQueryString(pvp.viewEndTime); diff --git a/src/loggerForms/FormsPlotOptionsDialog.java b/src/loggerForms/FormsPlotOptionsDialog.java index a0cce72f..9e8f7700 100644 --- a/src/loggerForms/FormsPlotOptionsDialog.java +++ b/src/loggerForms/FormsPlotOptionsDialog.java @@ -30,7 +30,7 @@ public class FormsPlotOptionsDialog extends PamDialog { mainPanel.add(BorderLayout.CENTER, tabbedPane); for (int i = 0; i < n; i++) { formDescription = formsControl.getFormDescription(i); - if (formDescription.canDrawOnMap() == false) { + if (!formDescription.canDrawOnMap()) { continue; } aPanel = new FormPlotOptionsPanel(formDescription); diff --git a/src/loggerForms/FormsTabPanel.java b/src/loggerForms/FormsTabPanel.java index 93d2cca4..fe1b1f00 100644 --- a/src/loggerForms/FormsTabPanel.java +++ b/src/loggerForms/FormsTabPanel.java @@ -4,7 +4,6 @@ import java.awt.BorderLayout; import java.awt.Frame; import java.awt.KeyEventDispatcher; import java.awt.event.KeyEvent; -import java.util.logging.LogManager; import javax.swing.JComponent; import javax.swing.JMenu; @@ -13,9 +12,6 @@ import javax.swing.JPanel; import javax.swing.JToolBar; import javax.swing.KeyStroke; -import org.jnativehook.GlobalScreen; -import org.jnativehook.NativeHookException; -import org.jnativehook.dispatcher.SwingDispatchService; import org.jnativehook.keyboard.NativeKeyEvent; import org.jnativehook.keyboard.NativeKeyListener; diff --git a/src/loggerForms/FormsTableItem.java b/src/loggerForms/FormsTableItem.java index 867f4510..e5f95e14 100644 --- a/src/loggerForms/FormsTableItem.java +++ b/src/loggerForms/FormsTableItem.java @@ -1,7 +1,7 @@ package loggerForms; -import loggerForms.controlDescriptions.ControlDescription; import generalDatabase.PamTableItem; +import loggerForms.controlDescriptions.ControlDescription; public class FormsTableItem extends PamTableItem { diff --git a/src/loggerForms/ItemDescription.java b/src/loggerForms/ItemDescription.java index c8236bb5..4a46532e 100644 --- a/src/loggerForms/ItemDescription.java +++ b/src/loggerForms/ItemDescription.java @@ -1,7 +1,5 @@ package loggerForms; -import generalDatabase.PamTableItem; - public abstract class ItemDescription { private FormDescription formDescription; diff --git a/src/loggerForms/ItemInformation.java b/src/loggerForms/ItemInformation.java index 469feb8e..7212466f 100644 --- a/src/loggerForms/ItemInformation.java +++ b/src/loggerForms/ItemInformation.java @@ -1,19 +1,10 @@ package loggerForms; -import java.awt.ComponentOrientation; -import java.awt.GridLayout; import java.sql.Types; import java.util.Hashtable; -import javax.swing.JCheckBox; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; - -import PamView.panel.PamPanel; -import loggerForms.controlDescriptions.ControlTypes; -import generalDatabase.EmptyTableDefinition; import generalDatabase.PamTableItem; +import loggerForms.controlDescriptions.ControlTypes; /** * diff --git a/src/loggerForms/LoggerForm.java b/src/loggerForms/LoggerForm.java index 12535752..b83b3b47 100644 --- a/src/loggerForms/LoggerForm.java +++ b/src/loggerForms/LoggerForm.java @@ -1,12 +1,6 @@ package loggerForms; -import generalDatabase.DBControlUnit; -import generalDatabase.EmptyTableDefinition; -import generalDatabase.PamConnection; -import generalDatabase.SQLTypes; - import java.awt.BorderLayout; -import java.awt.Component; import java.awt.Container; import java.awt.FlowLayout; import java.awt.Font; @@ -27,21 +21,7 @@ import javax.swing.JRootPane; import javax.swing.JScrollPane; import javax.swing.Timer; -import Array.streamerOrigin.GPSOriginMethod; -import Array.streamerOrigin.GPSOriginSystem; -import Array.streamerOrigin.HydrophoneOriginMethod; -import Array.streamerOrigin.HydrophoneOriginMethods; -import Array.streamerOrigin.OriginIterator; -import Array.streamerOrigin.StaticOriginSystem; -import loggerForms.PropertyTypes; -import loggerForms.controlDescriptions.ControlDescription; -import loggerForms.controlDescriptions.ControlTypes; -import loggerForms.controlDescriptions.InputControlDescription; -import loggerForms.controls.CounterControl; -import loggerForms.controls.LoggerControl; -import loggerForms.controls.NMEAControl; import GPS.GPSDataBlock; -import GPS.GpsData; import GPS.GpsDataUnit; import NMEA.NMEADataBlock; import NMEA.NMEADataUnit; @@ -54,11 +34,20 @@ import PamView.dialog.PamLabel; import PamView.dialog.warn.WarnOnce; import PamView.panel.PamPanel; import PamView.panel.VerticalLayout; -import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamObserver; import PamguardMVC.PamObserverAdapter; +import generalDatabase.DBControlUnit; +import generalDatabase.EmptyTableDefinition; +import generalDatabase.PamConnection; +import generalDatabase.SQLTypes; +import loggerForms.controlDescriptions.ControlDescription; +import loggerForms.controlDescriptions.ControlTypes; +import loggerForms.controlDescriptions.InputControlDescription; +import loggerForms.controls.CounterControl; +import loggerForms.controls.LoggerControl; +import loggerForms.controls.NMEAControl; /** * A LoggerForm is the central component of all form types, inclucing normal forms @@ -261,7 +250,7 @@ public class LoggerForm{ String stringId = NMEADataBlock.getSubString(nmeaString, 0); stringId = stringId.substring(1); - if (stringId.equalsIgnoreCase(nmeaSentence) == false) { + if (!stringId.equalsIgnoreCase(nmeaSentence)) { return; } @@ -565,7 +554,7 @@ public class LoggerForm{ // boolean isSubForm = (formDescription.findProperty(PropertyTypes.SUBFORM) != null); boolean isPopup = (formDescription.findProperty(PropertyTypes.POPUP) != null); boolean isNormal; - if (isSubTabs==false && isPopup==false){ + if (!isSubTabs && !isPopup){ isNormal=true; }else{ isNormal=false; @@ -833,7 +822,7 @@ public class LoggerForm{ // boolean isSubForm = (formDescription.findProperty(PropertyTypes.SUBFORM) != null); boolean isPopup = (formDescription.findProperty(PropertyTypes.POPUP) != null); boolean isNormal; - if (isSubTabs==false && isPopup==false){ + if (!isSubTabs && !isPopup){ isNormal=true; }else{ isNormal=false; @@ -928,7 +917,7 @@ public class LoggerForm{ String req = ""; String name = loggerControlComponent.getControlDescription().getTitle()+": "; - if (loggerControlComponent.getControlDescription().getRequired()==true){ + if (loggerControlComponent.getControlDescription().getRequired()){ req = ": Required"; } diff --git a/src/loggerForms/LoggerFormGraphics.java b/src/loggerForms/LoggerFormGraphics.java index 7ad5759f..f403c89c 100644 --- a/src/loggerForms/LoggerFormGraphics.java +++ b/src/loggerForms/LoggerFormGraphics.java @@ -1,16 +1,27 @@ package loggerForms; -import generalDatabase.lookupTables.LookupItem; -import generalDatabase.lookupTables.LookupList; -import geoMag.MagneticVariation; - -import java.awt.Color; import java.awt.Graphics; import java.awt.Point; import java.awt.Rectangle; import java.awt.Window; import java.util.ArrayList; +import GPS.GpsData; +import Map.MapRectProjector; +import PamUtils.Coordinate3d; +import PamUtils.LatLong; +import PamView.GeneralProjector; +import PamView.GeneralProjector.ParameterType; +import PamView.GeneralProjector.ParameterUnits; +import PamView.PamKeyItem; +import PamView.PamSymbol; +import PamView.PanelOverlayDraw; +import PamView.symbol.PamSymbolChooser; +import PamView.symbol.SymbolData; +import PamguardMVC.PamDataUnit; +import generalDatabase.lookupTables.LookupItem; +import generalDatabase.lookupTables.LookupList; +import geoMag.MagneticVariation; import loggerForms.controlDescriptions.CdLookup; import loggerForms.controlDescriptions.ControlDescription; import loggerForms.controlDescriptions.ControlTypes; @@ -19,22 +30,6 @@ import loggerForms.formdesign.propertypanels.SymbolPanel; import loggerForms.propertyInfos.BEARINGinfo; import loggerForms.propertyInfos.HEADINGinfo; import loggerForms.propertyInfos.RANGEinfo; -import loggerForms.PropertyTypes; -import GPS.GpsData; -import Map.MapRectProjector; -import PamUtils.Coordinate3d; -import PamUtils.LatLong; -import PamView.GeneralProjector; -import PamView.PamColors; -import PamView.PamKeyItem; -import PamView.PamSymbol; -import PamView.PamSymbolType; -import PamView.PanelOverlayDraw; -import PamView.GeneralProjector.ParameterType; -import PamView.GeneralProjector.ParameterUnits; -import PamView.symbol.PamSymbolChooser; -import PamView.symbol.SymbolData; -import PamguardMVC.PamDataUnit; public class LoggerFormGraphics extends PanelOverlayDraw { @@ -117,7 +112,7 @@ public class LoggerFormGraphics extends PanelOverlayDraw { private Rectangle drawOnMap(Graphics g, PamDataUnit pamDataUnit, GeneralProjector generalProjector) { FormsDataUnit formDataUnit = (FormsDataUnit) pamDataUnit; - if (shouldPlotOnMap(formDataUnit, generalProjector) == false) { + if (!shouldPlotOnMap(formDataUnit, generalProjector)) { return null; } @@ -327,7 +322,7 @@ public class LoggerFormGraphics extends PanelOverlayDraw { continue; } controlDescription = controlDescriptions.get(i); - if (controlDescription.getPlot() == false) { + if (!controlDescription.getPlot()) { // control description is not one to plot, so won't decide on that either ! continue; } @@ -390,7 +385,7 @@ public class LoggerFormGraphics extends PanelOverlayDraw { continue; } controlDescription = controlDescriptions.get(i); - if (controlDescription.getPlot() == false) { + if (!controlDescription.getPlot()) { // control description is not one to plot, so won't decide on that either ! continue; } @@ -410,7 +405,7 @@ public class LoggerFormGraphics extends PanelOverlayDraw { } } } - if (formPlotOptions.isPlotControl(i+1) == false) { + if (!formPlotOptions.isPlotControl(i+1)) { /* * this one will work for non lookup controls and for lookup * controls where the select all function has been selected. diff --git a/src/loggerForms/LoggerFormPanel.java b/src/loggerForms/LoggerFormPanel.java index 516ebad5..eccf3da8 100644 --- a/src/loggerForms/LoggerFormPanel.java +++ b/src/loggerForms/LoggerFormPanel.java @@ -3,8 +3,6 @@ package loggerForms; import java.awt.Color; import java.awt.LayoutManager; -import loggerForms.PropertyTypes; - import PamView.PamColors; import PamView.panel.PamPanel; diff --git a/src/loggerForms/LoggerSubTabbedPane.java b/src/loggerForms/LoggerSubTabbedPane.java index 64b3bf53..411f3dae 100644 --- a/src/loggerForms/LoggerSubTabbedPane.java +++ b/src/loggerForms/LoggerSubTabbedPane.java @@ -3,6 +3,7 @@ package loggerForms; import java.awt.event.MouseEvent; import javax.swing.JComponent; + import PamView.ColorManaged; import PamView.PamColors.PamColor; import PamView.panel.PamTabbedPane; diff --git a/src/loggerForms/UDColName.java b/src/loggerForms/UDColName.java index 6d9c864c..4f05d126 100644 --- a/src/loggerForms/UDColName.java +++ b/src/loggerForms/UDColName.java @@ -1,7 +1,5 @@ package loggerForms; -import generalDatabase.PamTableItem; - import java.sql.Types; public enum UDColName { diff --git a/src/ltsa/LtsaBinaryDataSource.java b/src/ltsa/LtsaBinaryDataSource.java index ff06e576..8a0d1e41 100644 --- a/src/ltsa/LtsaBinaryDataSource.java +++ b/src/ltsa/LtsaBinaryDataSource.java @@ -7,7 +7,6 @@ import java.io.DataOutputStream; import java.io.File; import java.io.IOException; -import fftManager.Complex; import PamController.PamController; import PamUtils.complex.ComplexArray; import PamguardMVC.PamDataUnit; @@ -16,7 +15,6 @@ import binaryFileStorage.BinaryHeader; import binaryFileStorage.BinaryObjectData; import binaryFileStorage.ModuleFooter; import binaryFileStorage.ModuleHeader; -import binaryFileStorage.PackedBinaryObject; public class LtsaBinaryDataSource extends BinaryDataSource { diff --git a/src/ltsa/LtsaControl.java b/src/ltsa/LtsaControl.java index 534f2c25..67447b4c 100644 --- a/src/ltsa/LtsaControl.java +++ b/src/ltsa/LtsaControl.java @@ -7,15 +7,11 @@ import java.io.Serializable; import javax.swing.JMenuItem; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import fftManager.FFTPluginPanelProvider; - import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; import PamController.PamSettingManager; import PamController.PamSettings; +import fftManager.FFTPluginPanelProvider; public class LtsaControl extends PamControlledUnit implements PamSettings { diff --git a/src/ltsa/LtsaDataBlock.java b/src/ltsa/LtsaDataBlock.java index ef7b4248..345d6977 100644 --- a/src/ltsa/LtsaDataBlock.java +++ b/src/ltsa/LtsaDataBlock.java @@ -5,7 +5,6 @@ import java.util.ListIterator; import PamguardMVC.LoadObserver; import PamguardMVC.PamObserver; import PamguardMVC.PamProcess; -import PamguardMVC.RequestCancellationObject; import PamguardMVC.dataOffline.OfflineDataLoadInfo; import fftManager.FFTDataBlock; import fftManager.FFTDataUnit; diff --git a/src/ltsa/LtsaDialog.java b/src/ltsa/LtsaDialog.java index e2e55f25..74e35efb 100644 --- a/src/ltsa/LtsaDialog.java +++ b/src/ltsa/LtsaDialog.java @@ -12,11 +12,11 @@ import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; -import fftManager.FFTDataUnit; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; import PamView.dialog.SourcePanel; import PamguardMVC.PamDataBlock; +import fftManager.FFTDataUnit; public class LtsaDialog extends PamDialog { diff --git a/src/ltsa/LtsaModuleHeader.java b/src/ltsa/LtsaModuleHeader.java index 50c1034d..5f8da189 100644 --- a/src/ltsa/LtsaModuleHeader.java +++ b/src/ltsa/LtsaModuleHeader.java @@ -1,12 +1,11 @@ package ltsa; -import java.io.Serializable; import java.lang.reflect.Field; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; +import PamModel.parametermanager.PrivatePamParameterData; import binaryFileStorage.BinaryHeader; import binaryFileStorage.BinaryObjectData; import binaryFileStorage.ModuleHeader; diff --git a/src/ltsa/LtsaProcess.java b/src/ltsa/LtsaProcess.java index f1842c64..d97e376e 100644 --- a/src/ltsa/LtsaProcess.java +++ b/src/ltsa/LtsaProcess.java @@ -1,8 +1,5 @@ package ltsa; -import fftManager.Complex; -import fftManager.FFTDataBlock; -import fftManager.FFTDataUnit; import PamController.PamController; import PamUtils.PamCalendar; import PamUtils.PamUtils; @@ -12,6 +9,8 @@ import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; import PamguardMVC.dataOffline.OfflineDataLoadInfo; +import fftManager.FFTDataBlock; +import fftManager.FFTDataUnit; public class LtsaProcess extends PamProcess { diff --git a/src/map3D/Map3DDisplayComponent.java b/src/map3D/Map3DDisplayComponent.java index c99131f3..18f3259f 100644 --- a/src/map3D/Map3DDisplayComponent.java +++ b/src/map3D/Map3DDisplayComponent.java @@ -5,8 +5,6 @@ import java.awt.Component; import javafx.application.Platform; import javafx.embed.swing.JFXPanel; import map3D.fx.DIY3DDisplay; -import map3D.fx.Map3DDisplayFX; -import map3D.fx.Test3DDisplayFX; import userDisplay.UserDisplayComponent; import userDisplay.UserDisplayControl; diff --git a/src/mapgrouplocaliser/MapGroupAnnotationHandler.java b/src/mapgrouplocaliser/MapGroupAnnotationHandler.java index c87ae896..f52f9667 100644 --- a/src/mapgrouplocaliser/MapGroupAnnotationHandler.java +++ b/src/mapgrouplocaliser/MapGroupAnnotationHandler.java @@ -4,7 +4,6 @@ import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import annotation.handler.AnnotationChoiceHandler; import annotation.handler.AnnotationChoices; -import annotation.handler.AnnotationHandler; import annotation.string.StringAnnotationType; import annotation.userforms.UserFormAnnotationType; diff --git a/src/mapgrouplocaliser/MapGroupLocaliserControl.java b/src/mapgrouplocaliser/MapGroupLocaliserControl.java index f65d9443..b0fb1b09 100644 --- a/src/mapgrouplocaliser/MapGroupLocaliserControl.java +++ b/src/mapgrouplocaliser/MapGroupLocaliserControl.java @@ -5,21 +5,18 @@ import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.Serializable; -import java.util.ArrayList; import javax.swing.JMenuItem; import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; -import PamController.PamController; +import PamController.PamControllerInterface; import PamController.PamSettingManager; import PamController.PamSettings; import PamView.GeneralProjector.ParameterType; import PamView.GeneralProjector.ParameterUnits; import PamView.paneloverlay.overlaymark.MarkRelationships; import PamView.paneloverlay.overlaymark.OverlayMarkObservers; -import PamView.paneloverlay.overlaymark.OverlayMarkProviders; -import PamView.paneloverlay.overlaymark.OverlayMarker; import annotation.handler.AnnotationChoiceHandler; import generalDatabase.DBControlUnit; import generalDatabase.SQLLogging; @@ -59,7 +56,7 @@ public class MapGroupLocaliserControl extends PamControlledUnit implements PamSe public void notifyModelChanged(int changeType) { super.notifyModelChanged(changeType); switch (changeType) { - case PamController.INITIALIZATION_COMPLETE: + case PamControllerInterface.INITIALIZATION_COMPLETE: subscribeMarkObserver(); annotationHandler.loadAnnotationChoices(); sortSQLLogging(); diff --git a/src/mapgrouplocaliser/MapGroupOverlayDraw.java b/src/mapgrouplocaliser/MapGroupOverlayDraw.java index 5340350c..056421a9 100644 --- a/src/mapgrouplocaliser/MapGroupOverlayDraw.java +++ b/src/mapgrouplocaliser/MapGroupOverlayDraw.java @@ -2,21 +2,14 @@ package mapgrouplocaliser; import java.awt.BasicStroke; import java.awt.Color; -import java.awt.Graphics; -import java.awt.Graphics2D; -import java.awt.Rectangle; import java.awt.Stroke; -import PamView.GeneralProjector; -import PamView.ManagedSymbol; import PamView.ManagedSymbolInfo; import PamView.PamSymbol; -import PamView.PamOldSymbolManager; import PamView.PamSymbolType; import PamView.paneloverlay.overlaymark.MarkManager; import PamView.paneloverlay.overlaymark.MarkOverlayDraw; import PamView.symbol.SymbolData; -import PamguardMVC.PamDataUnit; public class MapGroupOverlayDraw extends MarkOverlayDraw { @@ -38,7 +31,7 @@ public class MapGroupOverlayDraw extends MarkOverlayDraw { */ @Override public Color getFillCol() { - if (getPamSymbol().isFill() == false) { + if (!getPamSymbol().isFill()) { return null; } Color col = getPamSymbol().getFillColor(); diff --git a/src/mapgrouplocaliser/MapGroupOverlayManager.java b/src/mapgrouplocaliser/MapGroupOverlayManager.java index 52ce090b..116780ba 100644 --- a/src/mapgrouplocaliser/MapGroupOverlayManager.java +++ b/src/mapgrouplocaliser/MapGroupOverlayManager.java @@ -6,8 +6,6 @@ package mapgrouplocaliser; import java.awt.Window; import Map.MapProjector; -import PamView.GeneralProjector; -import PamView.paneloverlay.OverlayDataInfo; import PamView.paneloverlay.OverlayDataManager; import PamView.paneloverlay.OverlayMarkSwingPanel; import PamView.paneloverlay.OverlaySwingPanel; diff --git a/src/mapgrouplocaliser/MapGrouperDialog.java b/src/mapgrouplocaliser/MapGrouperDialog.java index fe6ad776..959a5c18 100644 --- a/src/mapgrouplocaliser/MapGrouperDialog.java +++ b/src/mapgrouplocaliser/MapGrouperDialog.java @@ -7,11 +7,9 @@ import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.border.TitledBorder; -import PamView.GeneralProjector.ParameterType; import PamView.dialog.PamDialog; import PamView.dialog.warn.WarnOnce; import PamView.panel.WestAlignedPanel; -import PamView.paneloverlay.OverlayDataManager; import PamView.paneloverlay.OverlaySwingPanel; import PamView.paneloverlay.overlaymark.MarkProvidersPanel; import annotation.handler.AnnotationsSelectionPanel; @@ -73,13 +71,13 @@ public class MapGrouperDialog extends PamDialog { @Override public boolean getParams() { - if (markProvidersPanel.getParams() == false) { + if (!markProvidersPanel.getParams()) { int ans = WarnOnce.showWarning(getOwner(), "Marker Selection", "No marking displays have been selected", WarnOnce.OK_CANCEL_OPTION); if (ans == WarnOnce.CANCEL_OPTION) { return false; } } - if (overlayPanel.getParams() == false) { + if (!overlayPanel.getParams()) { int ans = WarnOnce.showWarning(getOwner(), "Data Selection", "No data types have been selected", WarnOnce.OK_CANCEL_OPTION); if (ans == WarnOnce.CANCEL_OPTION) { return false; diff --git a/src/mapgrouplocaliser/MapGrouperSettings.java b/src/mapgrouplocaliser/MapGrouperSettings.java index 440700b7..10a9646b 100644 --- a/src/mapgrouplocaliser/MapGrouperSettings.java +++ b/src/mapgrouplocaliser/MapGrouperSettings.java @@ -2,13 +2,11 @@ package mapgrouplocaliser; import java.io.Serializable; import java.lang.reflect.Field; -import java.util.Hashtable; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; -import PamView.paneloverlay.OverlayDataInfo; +import PamModel.parametermanager.PrivatePamParameterData; import PamView.paneloverlay.overlaymark.MarkDataSelectorParams; import PamView.paneloverlay.overlaymark.OverlayMarkDataInfo; import PamguardMVC.PamDataBlock; diff --git a/src/mapgrouplocaliser/MarkGroupDataBlock.java b/src/mapgrouplocaliser/MarkGroupDataBlock.java index f8785062..90b833bf 100644 --- a/src/mapgrouplocaliser/MarkGroupDataBlock.java +++ b/src/mapgrouplocaliser/MarkGroupDataBlock.java @@ -1,6 +1,5 @@ package mapgrouplocaliser; -import PamguardMVC.PamDataBlock; import PamguardMVC.PamProcess; import PamguardMVC.superdet.SuperDetDataBlock; import annotationMark.MarkDataUnit; diff --git a/src/mapgrouplocaliser/MarkGroupDataUnit.java b/src/mapgrouplocaliser/MarkGroupDataUnit.java index bb9f0575..77c86159 100644 --- a/src/mapgrouplocaliser/MarkGroupDataUnit.java +++ b/src/mapgrouplocaliser/MarkGroupDataUnit.java @@ -1,7 +1,6 @@ package mapgrouplocaliser; import PamView.paneloverlay.overlaymark.OverlayMark; -import PamguardMVC.PamDataUnit; import PamguardMVC.superdet.SuperDetection; public class MarkGroupDataUnit extends SuperDetection { diff --git a/src/mapgrouplocaliser/MarkGroupProcess.java b/src/mapgrouplocaliser/MarkGroupProcess.java index 6a578315..93947b42 100644 --- a/src/mapgrouplocaliser/MarkGroupProcess.java +++ b/src/mapgrouplocaliser/MarkGroupProcess.java @@ -3,20 +3,15 @@ package mapgrouplocaliser; import java.awt.MouseInfo; import java.awt.Point; import java.awt.PointerInfo; -import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import java.util.ListIterator; -import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import PamUtils.PamCalendar; -import PamUtils.PamCoordinate; import PamView.GeneralProjector; import PamView.GeneralProjector.ParameterType; import PamView.HoverData; -import PamView.paneloverlay.OverlayDataInfo; import PamView.paneloverlay.overlaymark.MarkDataMatcher; import PamView.paneloverlay.overlaymark.MarkDataSelector; import PamView.paneloverlay.overlaymark.OverlayMark; @@ -32,7 +27,6 @@ import annotation.AnnotationDialog; import annotation.AnnotationDialogPanel; import annotation.DataAnnotationType; import annotation.handler.AnnotationChoiceHandler; -import autecPhones.AutecGraphics; import detectiongrouplocaliser.DetectionGroupSummary; import javafx.scene.input.MouseEvent; @@ -93,7 +87,7 @@ public class MarkGroupProcess extends PamProcess implements OverlayMarkObserver continue; } - if (wantDataUnit(hoverData, markMatch) == false) { + if (!wantDataUnit(hoverData, markMatch)) { continue; } @@ -156,11 +150,11 @@ public class MarkGroupProcess extends PamProcess implements OverlayMarkObserver PamDataBlock dataBlock = dataUnit.getParentDataBlock(); OverlayMarkDataInfo overlayDataInfo = findMarkDataInfo(dataBlock); // is it checked that we want this type of data. - if (overlayDataInfo == null || overlayDataInfo.select == false) { + if (overlayDataInfo == null || !overlayDataInfo.select) { return false; } // do we want this individual data unit ? - if (isDataSelected(dataBlock, dataUnit) == false) { + if (!isDataSelected(dataBlock, dataUnit)) { return false; } // now see if it's in the marked area... diff --git a/src/mapgrouplocaliser/MarkGroupSQLLogging.java b/src/mapgrouplocaliser/MarkGroupSQLLogging.java index 8a366fd8..af7e52e5 100644 --- a/src/mapgrouplocaliser/MarkGroupSQLLogging.java +++ b/src/mapgrouplocaliser/MarkGroupSQLLogging.java @@ -1,29 +1,21 @@ package mapgrouplocaliser; -import java.awt.Shape; import java.io.ByteArrayInputStream; import java.io.IOException; import java.util.ArrayList; -import com.fasterxml.jackson.core.JsonEncoding; import com.fasterxml.jackson.core.JsonFactory; -import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.node.ArrayNode; -import Localiser.algorithms.locErrors.json.ErrorJsonConverter; -import PamUtils.Coordinate3d; import PamUtils.LatLong; import PamUtils.PamCoordinate; import PamView.paneloverlay.overlaymark.OverlayMark; import PamView.paneloverlay.overlaymark.OverlayMark.OverlayMarkType; -import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.superdet.SuperDetDataBlock; -import generalDatabase.DBControlUnit; import generalDatabase.JsonConverter; -import generalDatabase.PamConnection; import generalDatabase.SQLLogging; import generalDatabase.SQLTypes; import generalDatabase.SuperDetLogging; diff --git a/src/matchedTemplateClassifer/ImportTemplateCSV.java b/src/matchedTemplateClassifer/ImportTemplateCSV.java index 69b1063e..7a1b4626 100644 --- a/src/matchedTemplateClassifer/ImportTemplateCSV.java +++ b/src/matchedTemplateClassifer/ImportTemplateCSV.java @@ -4,9 +4,7 @@ package matchedTemplateClassifer import java.io.File; import java.math.BigDecimal; import java.util.ArrayList; -import java.util.Collection; -import PamUtils.PamArrayUtils; import PamUtils.TxtFileUtils; /** @@ -70,6 +68,7 @@ public class ImportTemplateCSV implements TemplateImport { * Get extension * @return the extension */ + @Override public String[] getExtension() { return extensionStrings; } diff --git a/src/matchedTemplateClassifer/MTClassifierControl.java b/src/matchedTemplateClassifer/MTClassifierControl.java index dc8ef4b8..eb2bcb15 100644 --- a/src/matchedTemplateClassifer/MTClassifierControl.java +++ b/src/matchedTemplateClassifer/MTClassifierControl.java @@ -6,6 +6,7 @@ import java.util.ArrayList; import javax.swing.JMenu; import javax.swing.JMenuItem; + import PamController.PamControlledUnit; import PamController.PamControlledUnitGUI; import PamController.PamControlledUnitSettings; @@ -405,6 +406,7 @@ public class MTClassifierControl extends PamControlledUnit implements PamSetting * @param flag. The GUI type flag defined in PAMGuiManager. * @return the GUI for the PamControlledUnit unit. */ + @Override public PamControlledUnitGUI getGUI(int flag) { if (flag == PamGUIManager.FX) { if (matchedClickGUIFX == null) { diff --git a/src/matchedTemplateClassifer/MTClassifierTest.java b/src/matchedTemplateClassifer/MTClassifierTest.java index c5906f05..2a3baba2 100644 --- a/src/matchedTemplateClassifer/MTClassifierTest.java +++ b/src/matchedTemplateClassifer/MTClassifierTest.java @@ -109,7 +109,7 @@ public class MTClassifierTest { //add templates if inpout if (templates!=null) { mtclassifier.waveformMatch=templates.get(i); - mtclassifier.waveformReject=templates.get(i);; + mtclassifier.waveformReject=templates.get(i); } FastFFT fft = new FastFFT(); diff --git a/src/matchedTemplateClassifer/MTControlGUI.java b/src/matchedTemplateClassifer/MTControlGUI.java index c1bef1ef..af198914 100644 --- a/src/matchedTemplateClassifer/MTControlGUI.java +++ b/src/matchedTemplateClassifer/MTControlGUI.java @@ -1,15 +1,8 @@ package matchedTemplateClassifer; -import PamController.PamControlledUnitGUI; -import PamController.PamController; import PamController.PamControllerInterface; -import PamController.PamGUIManager; import PamController.SettingsPane; -import PamView.WrapperControlledGUISwing; import pamViewFX.PamControlledGUIFX; -import rawDeepLearningClassifier.DLControl; -import rawDeepLearningClassifier.DLControlGUI; -import rawDeepLearningClassifier.RawDLParams; /** * The JavaFX GUI for the Matched click classifier control... @@ -35,6 +28,7 @@ public class MTControlGUI extends PamControlledGUIFX { * @param * @return a Pane containing controls to change settings for module. */ + @Override public SettingsPane getSettingsPane(){ mtControl.getSettingsPane().setParams(mtControl.getMTParams()); return mtControl.getSettingsPane(); @@ -54,7 +48,7 @@ public class MTControlGUI extends PamControlledGUIFX { @Override public void notifyGUIChange(int changeType) { switch (changeType) { - case PamController.INITIALIZATION_COMPLETE: + case PamControllerInterface.INITIALIZATION_COMPLETE: break; case PamControllerInterface.CHANGED_PROCESS_SETTINGS: //data source may have potentially changed. e.g. by a datamodelfx Need to set in params. diff --git a/src/matchedTemplateClassifer/MTProcess.java b/src/matchedTemplateClassifer/MTProcess.java index 1e9c305f..6606678f 100644 --- a/src/matchedTemplateClassifer/MTProcess.java +++ b/src/matchedTemplateClassifer/MTProcess.java @@ -4,8 +4,6 @@ import java.util.ArrayList; import java.util.Arrays; import PamController.PamController; -import PamDetection.RawDataUnit; -import PamUtils.PamArrayUtils; import PamUtils.complex.ComplexArray; import PamView.symbol.PamSymbolManager; import PamguardMVC.PamDataBlock; @@ -17,7 +15,6 @@ import Spectrogram.WindowFunction; import clickDetector.ClickDetection; import clickDetector.ClickLength; import clickDetector.ClickClassifiers.basicSweep.SweepClassifierSet; -import clipgenerator.ClipDataUnit; import fftManager.FastFFT; import matchedTemplateClassifer.annotation.MatchedClickAnnotation; import matchedTemplateClassifer.annotation.MatchedClickAnnotationType; diff --git a/src/matchedTemplateClassifer/MatchedTemplateParams.java b/src/matchedTemplateClassifer/MatchedTemplateParams.java index edd2b912..0e26ca8c 100644 --- a/src/matchedTemplateClassifer/MatchedTemplateParams.java +++ b/src/matchedTemplateClassifer/MatchedTemplateParams.java @@ -7,8 +7,8 @@ import java.util.ArrayList; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; +import PamModel.parametermanager.PrivatePamParameterData; import PamView.PamSymbolType; import PamView.symbol.SymbolData; import fftFilter.FFTFilterParams; diff --git a/src/mcc/MccJniInterface.java b/src/mcc/MccJniInterface.java index c0e5149e..fcb4758a 100644 --- a/src/mcc/MccJniInterface.java +++ b/src/mcc/MccJniInterface.java @@ -1,13 +1,5 @@ package mcc; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; - -import analoginput.AnalogRangeData; -import analoginput.AnalogRangeData.AnalogType; - /** * Interface to Measurement Computing data acquisition boards. * Interfaces to native source code (MS Windows only) diff --git a/src/mcc/MccPanel.java b/src/mcc/MccPanel.java index fa2b9a09..c0f94a81 100644 --- a/src/mcc/MccPanel.java +++ b/src/mcc/MccPanel.java @@ -7,7 +7,7 @@ import java.util.ArrayList; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; -import javax.swing.border.TitledBorder; +import javax.swing.SwingConstants; import PamView.dialog.PamGridBagContraints; import mcc.mccjna.MCCBoardInfo; @@ -36,7 +36,7 @@ public class MccPanel { GridBagConstraints c = new PamGridBagContraints(); c.gridwidth = 1; c.fill = GridBagConstraints.HORIZONTAL; - mccPanel.add(new JLabel("Board ", JLabel.RIGHT), c); + mccPanel.add(new JLabel("Board ", SwingConstants.RIGHT), c); c.gridx++; c.gridwidth = 2; mccPanel.add(boardList = new JComboBox<>(), c); @@ -45,7 +45,7 @@ public class MccPanel { c.gridx = 0; c.gridy++; c.gridwidth = 1; - mccPanel.add(new JLabel("Range ", JLabel.RIGHT), c); + mccPanel.add(new JLabel("Range ", SwingConstants.RIGHT), c); c.gridx++; c.gridwidth = 2; mccPanel.add(boardRange = new JComboBox<>(), c); diff --git a/src/metadata/MetaDataContol.java b/src/metadata/MetaDataContol.java index 8fc66ee5..cdaeecff 100644 --- a/src/metadata/MetaDataContol.java +++ b/src/metadata/MetaDataContol.java @@ -7,7 +7,6 @@ import java.io.Serializable; import javax.swing.JFrame; import javax.swing.JMenuItem; -import Array.ArrayManager; import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; import PamController.PamController; diff --git a/src/metadata/PamguardMetaData.java b/src/metadata/PamguardMetaData.java index ae4064ab..d995e620 100644 --- a/src/metadata/PamguardMetaData.java +++ b/src/metadata/PamguardMetaData.java @@ -2,7 +2,6 @@ package metadata; import java.io.Serializable; -import PamUtils.LatLong; import nilus.ContactInfo; import nilus.Deployment; import nilus.DeploymentRecoveryDetails; diff --git a/src/meygenturbine/MeygenDataUnit.java b/src/meygenturbine/MeygenDataUnit.java index b9fe5b66..5bf1f643 100644 --- a/src/meygenturbine/MeygenDataUnit.java +++ b/src/meygenturbine/MeygenDataUnit.java @@ -2,7 +2,6 @@ package meygenturbine; import PamUtils.LatLong; import PamUtils.PamCalendar; -import PamguardMVC.DataUnitBaseData; import PamguardMVC.PamDataUnit; public class MeygenDataUnit extends PamDataUnit { diff --git a/src/meygenturbine/MeygenGraphics.java b/src/meygenturbine/MeygenGraphics.java index 6f5322de..1c9003fa 100644 --- a/src/meygenturbine/MeygenGraphics.java +++ b/src/meygenturbine/MeygenGraphics.java @@ -17,8 +17,6 @@ import PamUtils.LatLong; import PamView.GeneralProjector; import PamView.GeneralProjector.ParameterType; import PamView.GeneralProjector.ParameterUnits; -import PamView.HoverData; -import PamView.PamDetectionOverlayGraphics; import PamView.PamKeyItem; import PamView.PamSymbol; import PamView.PanelOverlayDraw; @@ -64,7 +62,7 @@ public class MeygenGraphics extends PanelOverlayDraw { } private Rectangle drawOnMap(Graphics g, MeygenDataUnit dataUnit, GeneralProjector generalProjector) { - if (generalProjector instanceof MapRectProjector == false) { + if (!(generalProjector instanceof MapRectProjector)) { return null; } MapRectProjector mapProj = (MapRectProjector) generalProjector; diff --git a/src/meygenturbine/MeygenTurbine.java b/src/meygenturbine/MeygenTurbine.java index 1cbeb5b1..4b2b2036 100644 --- a/src/meygenturbine/MeygenTurbine.java +++ b/src/meygenturbine/MeygenTurbine.java @@ -1,7 +1,6 @@ package meygenturbine; import PamController.PamControlledUnit; -import PamguardMVC.PamDataBlock; import PamguardMVC.PamProcess; public class MeygenTurbine extends PamControlledUnit { diff --git a/src/modbustcp/ModbusTCP.java b/src/modbustcp/ModbusTCP.java index 1ef99041..740a62e3 100644 --- a/src/modbustcp/ModbusTCP.java +++ b/src/modbustcp/ModbusTCP.java @@ -69,7 +69,7 @@ public class ModbusTCP { } public boolean isAlive() { - return tcpSocket.isClosed() == false; + return !tcpSocket.isClosed(); } public void close() { diff --git a/src/nidaqdev/NIChannelListPanel.java b/src/nidaqdev/NIChannelListPanel.java index 20bcbfd8..852cb43f 100644 --- a/src/nidaqdev/NIChannelListPanel.java +++ b/src/nidaqdev/NIChannelListPanel.java @@ -318,7 +318,7 @@ public class NIChannelListPanel implements ChannelListPanel { hasMaster = true; } } - if (hasMaster == false) { + if (!hasMaster) { JOptionPane.showConfirmDialog(null, "At least one channel must be using the master device selected above!", "Error", JOptionPane.OK_OPTION, JOptionPane.ERROR_MESSAGE); @@ -383,7 +383,7 @@ public class NIChannelListPanel implements ChannelListPanel { for (int i = 0; i < nDevices; i++) { if (devChannels[i] > 0) { devInfo = niDaqProcess.getDeviceInfo(i); - if (devInfo.isExists() == false) { + if (!devInfo.isExists()) { String er2 = String.format("The device %s is not currently present, continue anyway ?", devInfo); int ans = JOptionPane.showConfirmDialog(null, er2, @@ -395,7 +395,7 @@ public class NIChannelListPanel implements ChannelListPanel { continue; // skip the next stage ! } } - if (devInfo.canSample(sr, devChannels[i]) == false) { + if (!devInfo.canSample(sr, devChannels[i])) { String err = String.format("The device %s cannot sample %d channels at %d Hz", devInfo.toString(), devChannels[i], (int) sr); JOptionPane.showConfirmDialog(null, err, diff --git a/src/nidaqdev/NIDAQProcess.java b/src/nidaqdev/NIDAQProcess.java index c0977d91..b504f972 100644 --- a/src/nidaqdev/NIDAQProcess.java +++ b/src/nidaqdev/NIDAQProcess.java @@ -8,7 +8,6 @@ import java.awt.event.ActionListener; import java.io.Serializable; import java.util.ArrayList; import java.util.Arrays; -import java.util.List; import javax.swing.JCheckBox; import javax.swing.JComboBox; @@ -18,29 +17,20 @@ import javax.swing.JPanel; import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import soundPlayback.FilePlayback; -import soundPlayback.PlaybackControl; -import soundPlayback.PlaybackSystem; -import soundPlayback.SoundCardPlayback; - - import Acquisition.AcquisitionControl; import Acquisition.AcquisitionDialog; +import Acquisition.AudioDataQueue; import Acquisition.ChannelListPanel; import Acquisition.DaqSystem; -import Acquisition.AudioDataQueue; -import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; -import PamController.PamController; import PamController.PamSettingManager; import PamController.PamSettings; import PamDetection.RawDataUnit; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; import PamguardMVC.PamConstants; +import soundPlayback.PlaybackControl; +import soundPlayback.PlaybackSystem; public class NIDAQProcess extends DaqSystem implements PamSettings { @@ -471,14 +461,17 @@ public class NIDAQProcess extends DaqSystem implements PamSettings { return range[1]-range[0]; } + @Override public Serializable getSettingsReference() { return niParameters; } + @Override public long getSettingsVersion() { return NIDaqParams.serialVersionUID; } + @Override public String getUnitName() { // return settingsUnitName; return daqControl.getUnitName(); @@ -498,11 +491,13 @@ public class NIDAQProcess extends DaqSystem implements PamSettings { // } // } + @Override public String getUnitType() { // return "Acquisition System"; return settingsUnitName; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { // if (PamSettingManager.getInstance().isSettingsUnit(this, pamControlledUnitSettings)) { try { @@ -526,7 +521,7 @@ public class NIDAQProcess extends DaqSystem implements PamSettings { @Override public void actionPerformed(ActionEvent arg0) { - if (allowMultiBoard.isSelected() == false) { + if (!allowMultiBoard.isSelected()) { getNiChannelListPanel().setAllBoards(audioDevices.getSelectedIndex()); } checkDevice(); @@ -540,7 +535,7 @@ public class NIDAQProcess extends DaqSystem implements PamSettings { else if (devInfo.isSimulated()) { warningText.setText("*** Simulted NI Device ***"); } - else if (devInfo.isExists() == false) { + else if (!devInfo.isExists()) { warningText.setText("*** This NI Device is not currently present ***"); } else { @@ -548,11 +543,11 @@ public class NIDAQProcess extends DaqSystem implements PamSettings { } } public void enableMasterDevice() { - audioDevices.setEnabled(allowMultiBoard.isSelected() == false); + audioDevices.setEnabled(!allowMultiBoard.isSelected()); } public void setMasterDevice(int iDevice) { - if (audioDevices == null || allowMultiBoard == null || allowMultiBoard.isSelected() == false) { + if (audioDevices == null || allowMultiBoard == null || !allowMultiBoard.isSelected()) { return; } if (iDevice >= 0) { @@ -595,6 +590,7 @@ public class NIDAQProcess extends DaqSystem implements PamSettings { // } class AllowMultiBoard implements ActionListener { + @Override public void actionPerformed(ActionEvent arg0) { if (warnMultiBoardOps()) { enableMultiBoardOps(); @@ -645,6 +641,7 @@ public class NIDAQProcess extends DaqSystem implements PamSettings { class NITransferThread implements Runnable { + @Override public void run() { } diff --git a/src/nidaqdev/NIDaqParams.java b/src/nidaqdev/NIDaqParams.java index 2da07df5..7ed75965 100644 --- a/src/nidaqdev/NIDaqParams.java +++ b/src/nidaqdev/NIDaqParams.java @@ -9,7 +9,6 @@ import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PrivatePamParameterData; import PamguardMVC.PamConstants; -import hfDaqCard.SmruDaqSystem; public class NIDaqParams extends SoundCardParameters implements Serializable, Cloneable, ManagedParameters { diff --git a/src/nidaqdev/NIFilePlayback.java b/src/nidaqdev/NIFilePlayback.java index 3b8b42ed..3e904504 100644 --- a/src/nidaqdev/NIFilePlayback.java +++ b/src/nidaqdev/NIFilePlayback.java @@ -67,7 +67,7 @@ public class NIFilePlayback implements FilePlaybackDevice, PamSettings { if (deviceInfo.get(i).isSimulated()) { niDeviceNames[nDevs] += " (simulated)"; } - if (deviceInfo.get(i).isExists() == false) { + if (!deviceInfo.get(i).isExists()) { niDeviceNames[nDevs] += " (not present)"; } niDeviceLUT[nDevs] = i; diff --git a/src/nidaqdev/NIPlaybackSettingsPanel.java b/src/nidaqdev/NIPlaybackSettingsPanel.java index 65af6c88..ffa52d53 100644 --- a/src/nidaqdev/NIPlaybackSettingsPanel.java +++ b/src/nidaqdev/NIPlaybackSettingsPanel.java @@ -7,6 +7,7 @@ import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; import PamView.dialog.PamDialog; @@ -27,7 +28,7 @@ public class NIPlaybackSettingsPanel implements PamDialogPanel { mainPanel.setBorder(new TitledBorder("NI Play options")); GridBagConstraints c = new PamGridBagContraints(); - mainPanel.add(new JLabel("Output level ", JLabel.RIGHT), c); + mainPanel.add(new JLabel("Output level ", SwingConstants.RIGHT), c); c.gridx++; mainPanel.add(outputLevel = new JComboBox<>(), c); c.gridx++; diff --git a/src/nidaqdev/Nidaq.java b/src/nidaqdev/Nidaq.java index a3609da6..d0d96ff2 100644 --- a/src/nidaqdev/Nidaq.java +++ b/src/nidaqdev/Nidaq.java @@ -773,7 +773,7 @@ public class Nidaq { public void setTaskHandle(int taskHandle) { this.taskHandle = taskHandle; } - }; + } // ------------------------------------------ DAQmxStopTaskParams public class DAQmxStopTaskParams @@ -795,7 +795,7 @@ public class Nidaq { public void setTaskHandle(int taskHandle) { this.taskHandle = taskHandle; } - }; + } // ------------------------------------------ DAQmxClearTaskParams public class DAQmxClearTaskParams { @@ -817,7 +817,7 @@ public class Nidaq { public void setTaskHandle(int taskHandle) { this.taskHandle = taskHandle; } - }; + } // ------------------------------------------ DAQmxCreateAIVoltageChanParams public class DAQmxCreateAIVoltageChanParams @@ -1000,7 +1000,7 @@ public class Nidaq { public void setDeviceIsSimulated(boolean deviceIsSimulated) { this.deviceIsSimulated = deviceIsSimulated; - }; + } } // ------------------------------------------ DAQmxReadAnalogF64Params @@ -1128,7 +1128,7 @@ public class Nidaq { // } public void load() { - if (loadLibraryTried == false) { + if (!loadLibraryTried) { try { System.loadLibrary(SILIB); loadLibraryOK = true; @@ -1152,7 +1152,7 @@ public class Nidaq { * May be useful for assisting users. */ private void sayVersionInfo() { - if (versionShown == false) { + if (!versionShown) { int majV = getMajorVersion(); int minV = getMinorVersion(); System.out.println(String.format("National Instruments software loaded version %d.%d", majV, minV)); diff --git a/src/nmeaEmulator/NMEAFrontEnd.java b/src/nmeaEmulator/NMEAFrontEnd.java index dfe1205a..c2f8ac1b 100644 --- a/src/nmeaEmulator/NMEAFrontEnd.java +++ b/src/nmeaEmulator/NMEAFrontEnd.java @@ -1,6 +1,5 @@ package nmeaEmulator; -import generalDatabase.DBControl; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -21,6 +20,7 @@ import PamController.PamControlledUnit; import PamController.PamController; import PamController.PamSettingManager; import PamguardMVC.PamDataBlock; +import generalDatabase.DBControl; public class NMEAFrontEnd { @@ -121,6 +121,7 @@ public class NMEAFrontEnd { } class MenuExit implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ prepareToClose(); } @@ -128,7 +129,7 @@ public class NMEAFrontEnd { private boolean prepareToClose() { - if (PamController.getInstance().canClose() == false) { + if (!PamController.getInstance().canClose()) { return false; } serialOutput.closeSerialPort(); @@ -156,12 +157,14 @@ public class NMEAFrontEnd { class MenuStart implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ // menuTimes(); } } class MenuStop implements ActionListener { + @Override public void actionPerformed(ActionEvent ev){ // menuTimes(); } @@ -215,7 +218,7 @@ public class NMEAFrontEnd { boolean dataPrepared[] = new boolean[nBlocks]; String outString; publish(new EmulationProgress("Initialise serial port ...")); - if (serialOutput.openSerialPort() == false) { + if (!serialOutput.openSerialPort()) { publish(new EmulationProgress("Unable to open serial port ...")); return null; } @@ -238,7 +241,7 @@ public class NMEAFrontEnd { emulatedData[i] = emulatedDataBlocks.get(i).getNextData(); } } - while (stopNow == false) { + while (!stopNow) { currentRealTime = System.currentTimeMillis(); timePassed = currentRealTime - simStartTime; currentDataTime = timeLimits[0] + timePassed; @@ -276,7 +279,7 @@ public class NMEAFrontEnd { publish(new EmulationProgress(currentRealTime, currentDataTime, (int) (timePassed * 100 / dataLength))); } - if (stopNow || nmeaOutdialog.isRepeat() == false) { + if (stopNow || !nmeaOutdialog.isRepeat()) { break; } } diff --git a/src/nmeaEmulator/SerialOutput.java b/src/nmeaEmulator/SerialOutput.java index 4ec93884..7ec6a87b 100644 --- a/src/nmeaEmulator/SerialOutput.java +++ b/src/nmeaEmulator/SerialOutput.java @@ -4,12 +4,13 @@ import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; + import com.fazecast.jSerialComm.SerialPort; +import NMEA.NMEAParameters; import serialComms.SerialPortConstants; import serialComms.jserialcomm.PJSerialComm; import serialComms.jserialcomm.PJSerialException; -import NMEA.NMEAParameters; public class SerialOutput { diff --git a/src/noiseBandMonitor/NoiseBandControl.java b/src/noiseBandMonitor/NoiseBandControl.java index 7f85fa96..cd643eba 100644 --- a/src/noiseBandMonitor/NoiseBandControl.java +++ b/src/noiseBandMonitor/NoiseBandControl.java @@ -7,12 +7,6 @@ import java.io.Serializable; import java.util.ArrayList; import javax.swing.JMenuItem; -import javax.swing.JOptionPane; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import noiseMonitor.NoiseTabPanel; import Filters.ButterworthMethod; import Filters.FIRFilterMethod; @@ -22,11 +16,11 @@ import Filters.FilterParams; import Filters.FilterType; import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; -import PamController.PamController; +import PamController.PamControllerInterface; import PamController.PamSettingManager; import PamController.PamSettings; import PamView.PamTabPanel; -import PamguardMVC.debug.Debug; +import noiseMonitor.NoiseTabPanel; public class NoiseBandControl extends PamControlledUnit implements PamSettings { @@ -266,7 +260,7 @@ public class NoiseBandControl extends PamControlledUnit implements PamSettings { @Override public void notifyModelChanged(int changeType) { switch (changeType) { - case PamController.INITIALIZATION_COMPLETE: + case PamControllerInterface.INITIALIZATION_COMPLETE: noiseBandProcess.setupProcess(); sortBandEdges(); } diff --git a/src/noiseBandMonitor/NoiseBandDatagramProvider.java b/src/noiseBandMonitor/NoiseBandDatagramProvider.java index 51f7f863..8930e07a 100644 --- a/src/noiseBandMonitor/NoiseBandDatagramProvider.java +++ b/src/noiseBandMonitor/NoiseBandDatagramProvider.java @@ -1,9 +1,9 @@ package noiseBandMonitor; -import noiseMonitor.NoiseDataUnit; import PamguardMVC.PamDataUnit; import dataGram.DatagramProvider; import dataGram.DatagramScaleInformation; +import noiseMonitor.NoiseDataUnit; public class NoiseBandDatagramProvider implements DatagramProvider { diff --git a/src/noiseBandMonitor/NoiseBandDialog.java b/src/noiseBandMonitor/NoiseBandDialog.java index fef945ce..de832d38 100644 --- a/src/noiseBandMonitor/NoiseBandDialog.java +++ b/src/noiseBandMonitor/NoiseBandDialog.java @@ -15,34 +15,26 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; -import java.awt.image.BandCombineOp; import java.util.ArrayList; import javax.swing.BorderFactory; import javax.swing.BoxLayout; -import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; -import javax.swing.JRadioButton; import javax.swing.JSpinner; import javax.swing.JTextField; import javax.swing.SpinnerNumberModel; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; import Filters.ANSIStandard; -import Filters.ButterworthMethod; -import Filters.FIRFilterMethod; -import Filters.Filter; -import Filters.FilterBand; import Filters.FilterMethod; -import Filters.FilterParams; import Filters.FilterType; -import Filters.IIRFilterMethod; import Layout.PamAxis; import Layout.PamAxisPanel; import PamDetection.RawDataUnit; @@ -51,7 +43,6 @@ import PamView.dialog.PamGridBagContraints; import PamView.dialog.SourcePanel; import PamView.panel.JPanelWithPamKey; import PamView.panel.PamBorderPanel; -import PamView.panel.PamPanel; import PamguardMVC.PamDataBlock; public class NoiseBandDialog extends PamDialog { @@ -136,11 +127,11 @@ public class NoiseBandDialog extends PamDialog { outputPanel.setBorder(new TitledBorder("Output")); outputPanel.setLayout(new GridBagLayout()); GridBagConstraints c = new PamGridBagContraints(); - addComponent(outputPanel, new JLabel("Output Interval ", JLabel.RIGHT), c); + addComponent(outputPanel, new JLabel("Output Interval ", SwingConstants.RIGHT), c); c.gridx++; addComponent(outputPanel, outputInterval = new JTextField(5), c); c.gridx++; - addComponent(outputPanel, new JLabel(" s", JLabel.RIGHT), c); + addComponent(outputPanel, new JLabel(" s", SwingConstants.RIGHT), c); optionsPanel.add(outputPanel); JPanel bandPanel = new JPanel(); @@ -158,7 +149,7 @@ public class NoiseBandDialog extends PamDialog { // bbGroup.add(thirdOctave); // octave.addActionListener(bl); // thirdOctave.addActionListener(bl); - addComponent(bandPanel, new JLabel("Band Type: ", JLabel.RIGHT), c); + addComponent(bandPanel, new JLabel("Band Type: ", SwingConstants.RIGHT), c); c.gridx++; c.gridwidth = 2; addComponent(bandPanel, bandType = new JComboBox(), c); @@ -181,7 +172,7 @@ public class NoiseBandDialog extends PamDialog { addComponent(bandPanel, maxButton, c); c.gridx = 0; c.gridy++; - addComponent(bandPanel, new JLabel("Number of decimators ", JLabel.RIGHT), c); + addComponent(bandPanel, new JLabel("Number of decimators ", SwingConstants.RIGHT), c); c.gridx++; nDecimators = new SpinnerNumberModel(2, 0, 20, 1); nDecimators.addChangeListener(new NDEcimatorsListener()); @@ -193,7 +184,7 @@ public class NoiseBandDialog extends PamDialog { filtPanel.setLayout(new GridBagLayout()); filtPanel.setBorder(new TitledBorder("Filters")); c = new PamGridBagContraints(); - addComponent(filtPanel, new JLabel("Filter Type ", JLabel.RIGHT), c); + addComponent(filtPanel, new JLabel("Filter Type ", SwingConstants.RIGHT), c); c.gridx++; c.gridwidth = 2; addComponent(filtPanel, filterType = new JComboBox(), c); @@ -201,14 +192,14 @@ public class NoiseBandDialog extends PamDialog { c.gridx = 0; c.gridwidth = 1; c.gridy++; - addComponent(filtPanel, new JLabel("Filter Order ", JLabel.RIGHT), c); + addComponent(filtPanel, new JLabel("Filter Order ", SwingConstants.RIGHT), c); c.gridx++; filterOrder = new SpinnerNumberModel(2, 2, 20, 1); filterOrder.addChangeListener(new FilterOrderListener()); addComponent(filtPanel, new JSpinner(filterOrder), c); c.gridx = 0; c.gridy++; - addComponent(filtPanel, new JLabel("Filter Gamma ", JLabel.RIGHT), c); + addComponent(filtPanel, new JLabel("Filter Gamma ", SwingConstants.RIGHT), c); c.gridx++; addComponent(filtPanel, filterGamma = new JTextField(), c); filterType.addItem("Butterworth"); @@ -581,7 +572,7 @@ public class NoiseBandDialog extends PamDialog { PamAxis xAxis = bodePlotAxis.xAxis; PamAxis yAxis = bodePlotAxis.yAxis; for (int i = 0; i < 3; i++) { - if (showStandard[i].isSelected() == false) { + if (!showStandard[i].isSelected()) { continue; } minAtten = ANSIStandard.getMinAttenuation(i); @@ -644,7 +635,7 @@ public class NoiseBandDialog extends PamDialog { @Override public void actionPerformed(ActionEvent arg0) { - if (setupComplete == false) { + if (!setupComplete) { return; } findDataSource(); @@ -657,7 +648,7 @@ public class NoiseBandDialog extends PamDialog { private class FilterTypeListener implements ActionListener { @Override public void actionPerformed(ActionEvent arg0) { - if (setupComplete == false) { + if (!setupComplete) { return; } FilterType ft = getFilterType(); @@ -670,7 +661,7 @@ public class NoiseBandDialog extends PamDialog { @Override public void stateChanged(ChangeEvent arg0) { - if (setupComplete == false) { + if (!setupComplete) { return; } repaintAll(); @@ -682,7 +673,7 @@ public class NoiseBandDialog extends PamDialog { @Override public void stateChanged(ChangeEvent arg0) { - if (setupComplete == false) { + if (!setupComplete) { return; } noiseBandSettings.endDecimation = (Integer) nDecimators.getValue(); @@ -786,10 +777,10 @@ public class NoiseBandDialog extends PamDialog { } public void repaintAll() { - if (this.setupComplete == false) { + if (!this.setupComplete) { return; } - if (getParams() == false) { + if (!getParams()) { return; } makeFilters(); diff --git a/src/noiseBandMonitor/NoiseBandProcess.java b/src/noiseBandMonitor/NoiseBandProcess.java index 0da99e14..9a5755b8 100644 --- a/src/noiseBandMonitor/NoiseBandProcess.java +++ b/src/noiseBandMonitor/NoiseBandProcess.java @@ -3,17 +3,10 @@ package noiseBandMonitor; import java.util.ArrayList; import java.util.Arrays; -import noiseMonitor.NoiseBinaryDataSource; -import noiseMonitor.NoiseDataBlock; -import noiseMonitor.NoiseDataUnit; -import noiseMonitor.NoiseLogging; - import Acquisition.AcquisitionProcess; import Filters.Filter; import Filters.FilterMethod; import Filters.FilterParams; -import PamController.PamControlledUnit; -import PamController.PamController; import PamDetection.RawDataUnit; import PamUtils.PamUtils; import PamguardMVC.PamConstants; @@ -21,8 +14,10 @@ import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; -import PamguardMVC.PamRawDataBlock; -import PamguardMVC.debug.Debug; +import noiseMonitor.NoiseBinaryDataSource; +import noiseMonitor.NoiseDataBlock; +import noiseMonitor.NoiseDataUnit; +import noiseMonitor.NoiseLogging; public class NoiseBandProcess extends PamProcess { @@ -60,6 +55,7 @@ public class NoiseBandProcess extends PamProcess { } + @Override public void setupProcess() { super.setupProcess(); PamDataBlock sourceData = noiseBandControl.getPamConfiguration().getDataBlock(RawDataUnit.class, noiseBandControl.noiseBandSettings.rawDataSource); diff --git a/src/noiseBandMonitor/NoiseBandSettings.java b/src/noiseBandMonitor/NoiseBandSettings.java index 8f00571c..6f5d0515 100644 --- a/src/noiseBandMonitor/NoiseBandSettings.java +++ b/src/noiseBandMonitor/NoiseBandSettings.java @@ -6,8 +6,8 @@ import java.lang.reflect.Field; import Filters.FilterType; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; +import PamModel.parametermanager.PrivatePamParameterData; public class NoiseBandSettings implements Serializable, Cloneable, ManagedParameters { diff --git a/src/noiseMonitor/NoiseBinaryDataSource.java b/src/noiseMonitor/NoiseBinaryDataSource.java index a1bf8df0..45c96d84 100644 --- a/src/noiseMonitor/NoiseBinaryDataSource.java +++ b/src/noiseMonitor/NoiseBinaryDataSource.java @@ -12,11 +12,9 @@ import PamUtils.PamUtils; import PamguardMVC.PamDataUnit; import binaryFileStorage.BinaryDataSource; import binaryFileStorage.BinaryHeader; -import binaryFileStorage.BinaryInputStream; import binaryFileStorage.BinaryObjectData; import binaryFileStorage.ModuleFooter; import binaryFileStorage.ModuleHeader; -import binaryFileStorage.PackedBinaryObject; public class NoiseBinaryDataSource extends BinaryDataSource { diff --git a/src/noiseMonitor/NoiseControl.java b/src/noiseMonitor/NoiseControl.java index e1fbce42..e7524e12 100644 --- a/src/noiseMonitor/NoiseControl.java +++ b/src/noiseMonitor/NoiseControl.java @@ -8,12 +8,9 @@ import java.util.Arrays; import javax.swing.JMenuItem; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; -import PamController.PamController; +import PamController.PamControllerInterface; import PamController.PamSettingManager; import PamController.PamSettings; import PamView.PamTabPanel; @@ -304,7 +301,7 @@ public class NoiseControl extends PamControlledUnit implements PamSettings { public void notifyModelChanged(int changeType) { super.notifyModelChanged(changeType); switch (changeType) { - case PamController.INITIALIZATION_COMPLETE: + case PamControllerInterface.INITIALIZATION_COMPLETE: noiseProcess.setupProcess(); sortBandEdges(); } diff --git a/src/noiseMonitor/NoiseDataBlock.java b/src/noiseMonitor/NoiseDataBlock.java index effbd591..04521d21 100644 --- a/src/noiseMonitor/NoiseDataBlock.java +++ b/src/noiseMonitor/NoiseDataBlock.java @@ -1,21 +1,19 @@ package noiseMonitor; -import noiseMonitor.alarm.NoiseAlarmCounter; -import noiseMonitor.alarm.NoiseAlarmProvider; -import noiseMonitor.species.TethysNoiseDataProvider; -import tethys.TethysControl; -import tethys.pamdata.TethysDataProvider; -import tethys.species.DataBlockSpeciesManager; -import tethys.species.FixedSpeciesManager; -import alarm.AlarmCounter; -import alarm.AlarmCounterProvider; -import alarm.AlarmDataSource; import PamUtils.FrequencyFormat; import PamUtils.PamUtils; import PamguardMVC.DataAutomation; import PamguardMVC.DataAutomationInfo; import PamguardMVC.PamDataBlock; import PamguardMVC.PamProcess; +import alarm.AlarmCounterProvider; +import alarm.AlarmDataSource; +import noiseMonitor.alarm.NoiseAlarmProvider; +import noiseMonitor.species.TethysNoiseDataProvider; +import tethys.TethysControl; +import tethys.pamdata.TethysDataProvider; +import tethys.species.DataBlockSpeciesManager; +import tethys.species.FixedSpeciesManager; public class NoiseDataBlock extends PamDataBlock implements AlarmDataSource { @@ -55,6 +53,7 @@ public class NoiseDataBlock extends PamDataBlock implements Alarm } + @Override public void masterClockUpdate(long milliSeconds, long clockSample) { super.masterClockUpdate(milliSeconds, clockSample); } diff --git a/src/noiseMonitor/NoiseDialog.java b/src/noiseMonitor/NoiseDialog.java index 1844054c..356eb709 100644 --- a/src/noiseMonitor/NoiseDialog.java +++ b/src/noiseMonitor/NoiseDialog.java @@ -24,13 +24,13 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.table.AbstractTableModel; -import fftManager.FFTDataBlock; -import fftManager.FFTDataUnit; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; import PamView.dialog.SourcePanel; import PamView.dialog.SourcePanelMonitor; import PamguardMVC.PamDataBlock; +import fftManager.FFTDataBlock; +import fftManager.FFTDataUnit; public class NoiseDialog extends PamDialog { @@ -285,8 +285,8 @@ public class NoiseDialog extends PamDialog { } private void enableControls() { - nMeasures.setEnabled(useAllButton.isSelected() == false); - if (useAllButton.isSelected() == true) { + nMeasures.setEnabled(!useAllButton.isSelected()); + if (useAllButton.isSelected()) { autoNMeasures(); } boolean hasSource = (findSourceData() != null); @@ -305,7 +305,7 @@ public class NoiseDialog extends PamDialog { if (interval == null || nMeasures == null || useAllButton == null) { return; } - if (useAllButton.isSelected() == false) { + if (!useAllButton.isSelected()) { return; } if (sourceData == null) { diff --git a/src/noiseMonitor/NoiseDisplayDialog.java b/src/noiseMonitor/NoiseDisplayDialog.java index 744022ba..5fc5e157 100644 --- a/src/noiseMonitor/NoiseDisplayDialog.java +++ b/src/noiseMonitor/NoiseDisplayDialog.java @@ -88,7 +88,7 @@ public class NoiseDisplayDialog extends PamDialog { } public void enableControls() { - boolean e = (autoLevel.isSelected() == false); + boolean e = !autoLevel.isSelected(); maxLevel.setEnabled(e); minLevel.setEnabled(e); } diff --git a/src/noiseMonitor/NoiseProcess.java b/src/noiseMonitor/NoiseProcess.java index a984030d..0ccd7511 100644 --- a/src/noiseMonitor/NoiseProcess.java +++ b/src/noiseMonitor/NoiseProcess.java @@ -2,13 +2,8 @@ package noiseMonitor; import java.util.Arrays; import java.util.Random; -import pamMaths.Mean; -import fftManager.Complex; -import fftManager.FFTDataBlock; -import fftManager.FFTDataUnit; import Acquisition.AcquisitionProcess; -import PamController.PamController; import PamController.PamControllerInterface; import PamUtils.PamUtils; import PamUtils.complex.ComplexArray; @@ -18,6 +13,9 @@ import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; import beamformer.continuous.BeamFormerDataBlock; +import fftManager.FFTDataBlock; +import fftManager.FFTDataUnit; +import pamMaths.Mean; public class NoiseProcess extends PamProcess { diff --git a/src/noiseMonitor/NoiseSettings.java b/src/noiseMonitor/NoiseSettings.java index a1f301fc..809c8305 100644 --- a/src/noiseMonitor/NoiseSettings.java +++ b/src/noiseMonitor/NoiseSettings.java @@ -7,8 +7,8 @@ import java.util.ListIterator; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; +import PamModel.parametermanager.PrivatePamParameterData; public class NoiseSettings implements Serializable, Cloneable, ManagedParameters { diff --git a/src/noiseMonitor/NoiseTabPanel.java b/src/noiseMonitor/NoiseTabPanel.java index 01140c31..2fe782de 100644 --- a/src/noiseMonitor/NoiseTabPanel.java +++ b/src/noiseMonitor/NoiseTabPanel.java @@ -34,13 +34,6 @@ import javax.swing.border.Border; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; -import noiseBandMonitor.NoiseBandSettings; -import pamScrollSystem.AbstractPamScroller; -import pamScrollSystem.AbstractPamScrollerAWT; -import pamScrollSystem.PamScrollObserver; -import pamScrollSystem.PamScroller; -import pamScrollSystem.RangeSpinner; -import pamScrollSystem.RangeSpinnerListener; import Layout.PamAxis; import Layout.PamAxisPanel; import PamController.PamControlledUnit; @@ -48,6 +41,7 @@ import PamController.PamControlledUnitSettings; import PamController.PamController; import PamController.PamSettingManager; import PamController.PamSettings; +import PamController.soundMedium.GlobalMedium; import PamUtils.FrequencyFormat; import PamUtils.PamCalendar; import PamUtils.PamUtils; @@ -55,11 +49,11 @@ import PamView.BasicKeyItem; import PamView.ColourArray; import PamView.LineKeyItem; import PamView.PamColors; +import PamView.PamColors.PamColor; import PamView.PamKeyItem; import PamView.PamSymbol; import PamView.PamSymbolType; import PamView.PamTabPanel; -import PamView.PamColors.PamColor; import PamView.dialog.PamCheckBox; import PamView.dialog.PamGridBagContraints; import PamView.dialog.PamLabel; @@ -69,12 +63,15 @@ import PamView.panel.JPanelWithPamKey; import PamView.panel.KeyPanel; import PamView.panel.PamPanel; import PamguardMVC.PamConstants; -import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; -import PamguardMVC.PamObserver; import PamguardMVC.PamObserverAdapter; -import PamController.soundMedium.GlobalMedium; +import pamScrollSystem.AbstractPamScroller; +import pamScrollSystem.AbstractPamScrollerAWT; +import pamScrollSystem.PamScrollObserver; +import pamScrollSystem.PamScroller; +import pamScrollSystem.RangeSpinner; +import pamScrollSystem.RangeSpinnerListener; public class NoiseTabPanel implements PamTabPanel { @@ -312,7 +309,7 @@ private void setAxisLabels() { if (noiseDataBlock != null) { noiseDataBlock.addObserver(noiseObserver); } - if (noiseDisplaySettings.autoScale == false) { + if (!noiseDisplaySettings.autoScale) { levelAxis.setMinVal(noiseDisplaySettings.levelMin); levelAxis.setMaxVal(noiseDisplaySettings.levelMax); if (specLevelAxis != null) { @@ -375,7 +372,7 @@ private void setAxisLabels() { noiseData = aUnit.getNoiseBandData(); // chan = PamUtils.getSingleChannel(aUnit.getChannelBitmap()); chan = PamUtils.getSingleChannel(aUnit.getSequenceBitmap()); - if (noiseDisplaySettings.selectedChannels[chan] == false) { + if (!noiseDisplaySettings.selectedChannels[chan]) { // continue; } nBands = noiseData.length; @@ -384,7 +381,7 @@ private void setAxisLabels() { } lastUnit = lastChanUnit[chan]; for (int i = 0; i < nMeasures; i++) { - if (noiseDisplaySettings.isSelectData(i) == false) { + if (!noiseDisplaySettings.isSelectData(i)) { // continue; } for (int m = 0; m < nBands; m++) { @@ -565,13 +562,13 @@ private void setAxisLabels() { int nStats = noiseDataBlock.getNumUsedStats(); if (noiseDisplaySettings.selectedChannels == null) { return; - }; + } for (int iChan = 0; iChan <= hChan; iChan++) { // if (((1< implements AlarmDataSource { diff --git a/src/noiseOneBand/OneBandDataSource.java b/src/noiseOneBand/OneBandDataSource.java index 38a989a2..8c41fb13 100644 --- a/src/noiseOneBand/OneBandDataSource.java +++ b/src/noiseOneBand/OneBandDataSource.java @@ -13,7 +13,6 @@ import binaryFileStorage.BinaryHeader; import binaryFileStorage.BinaryObjectData; import binaryFileStorage.ModuleFooter; import binaryFileStorage.ModuleHeader; -import binaryFileStorage.PackedBinaryObject; public class OneBandDataSource extends BinaryDataSource { diff --git a/src/noiseOneBand/OneBandDialog.java b/src/noiseOneBand/OneBandDialog.java index f9383044..e0509d29 100644 --- a/src/noiseOneBand/OneBandDialog.java +++ b/src/noiseOneBand/OneBandDialog.java @@ -1,7 +1,6 @@ package noiseOneBand; import java.awt.BorderLayout; -import java.awt.FlowLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Window; @@ -13,6 +12,7 @@ import javax.swing.JCheckBox; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; import Filters.FilterDialogPanel; @@ -21,7 +21,6 @@ import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; import PamView.dialog.SourcePanel; import PamguardMVC.PamDataBlock; -import PamguardMVC.PamRawDataBlock; public class OneBandDialog extends PamDialog { @@ -61,18 +60,18 @@ public class OneBandDialog extends PamDialog { timePanel.setBorder(new TitledBorder("Measurement Time")); timePanel.setLayout(new GridBagLayout()); GridBagConstraints c = new PamGridBagContraints(); - timePanel.add(new JLabel("Measurement Interval ", JLabel.RIGHT), c); + timePanel.add(new JLabel("Measurement Interval ", SwingConstants.RIGHT), c); c.gridx++; timePanel.add(measurementInterval = new JTextField(3), c); c.gridx++; - timePanel.add(new JLabel(" s", JLabel.LEFT), c); + timePanel.add(new JLabel(" s", SwingConstants.LEFT), c); c.gridx = 0; c.gridy++; - timePanel.add(new JLabel("SEL Integration Time ", JLabel.RIGHT), c); + timePanel.add(new JLabel("SEL Integration Time ", SwingConstants.RIGHT), c); c.gridx++; timePanel.add(integrationTime = new JTextField(3), c); c.gridx++; - timePanel.add(new JLabel(" s", JLabel.LEFT), c); + timePanel.add(new JLabel(" s", SwingConstants.LEFT), c); northPanel.add(timePanel); JPanel pulsePanel = new JPanel(); @@ -85,18 +84,18 @@ public class OneBandDialog extends PamDialog { c.gridwidth = 1; c.gridx = 0; c.gridy++; - pulsePanel.add(new JLabel("Det' Threshold ", JLabel.RIGHT), c); + pulsePanel.add(new JLabel("Det' Threshold ", SwingConstants.RIGHT), c); c.gridx++; pulsePanel.add(singlePulseThreshold = new JTextField(3), c); c.gridx++; - pulsePanel.add(new JLabel(" dB", JLabel.LEFT), c); + pulsePanel.add(new JLabel(" dB", SwingConstants.LEFT), c); c.gridx = 0; c.gridy++; - pulsePanel.add(new JLabel("Max Length ", JLabel.RIGHT), c); + pulsePanel.add(new JLabel("Max Length ", SwingConstants.RIGHT), c); c.gridx++; pulsePanel.add(maxPulseLength = new JTextField(3), c); c.gridx++; - pulsePanel.add(new JLabel(" S", JLabel.LEFT), c); + pulsePanel.add(new JLabel(" S", SwingConstants.LEFT), c); northPanel.add(pulsePanel); @@ -146,7 +145,7 @@ public class OneBandDialog extends PamDialog { params.channelMap = sourcePanel.getChannelList(); filterDialogPanel.setSampleRate(dataBlock.getSampleRate()); - if (filterDialogPanel.getParams() == false) { + if (!filterDialogPanel.getParams()) { return false; } params.setFilterParams(filterDialogPanel.getFilterParams()); diff --git a/src/noiseOneBand/OneBandDisplayDialog.java b/src/noiseOneBand/OneBandDisplayDialog.java index bcfe706d..03b19cca 100644 --- a/src/noiseOneBand/OneBandDisplayDialog.java +++ b/src/noiseOneBand/OneBandDisplayDialog.java @@ -125,7 +125,7 @@ public class OneBandDisplayDialog extends PamDialog { } private void enableControls() { - boolean e = (autoScale.isSelected() == false); + boolean e = !autoScale.isSelected(); minAmp.setEnabled(e); maxAmp.setEnabled(e); if (PamController.getInstance().getRunMode() == PamController.RUN_NETWORKRECEIVER) { @@ -181,7 +181,7 @@ public class OneBandDisplayDialog extends PamDialog { } int selChan = 0; for (int i = 0; i < showChannel.length; i++) { - if (showChannel[i].isVisible() == false) { + if (!showChannel[i].isVisible()) { continue; } if (showChannel[i].isSelected()) { diff --git a/src/noiseOneBand/OneBandDisplayPanel.java b/src/noiseOneBand/OneBandDisplayPanel.java index bfb78684..85441bdb 100644 --- a/src/noiseOneBand/OneBandDisplayPanel.java +++ b/src/noiseOneBand/OneBandDisplayPanel.java @@ -23,12 +23,6 @@ import javax.swing.JPanel; import javax.swing.JPopupMenu; import javax.swing.border.EmptyBorder; -import pamScrollSystem.AbstractPamScroller; -import pamScrollSystem.AbstractPamScrollerAWT; -import pamScrollSystem.PamScrollObserver; -import pamScrollSystem.PamScroller; -import pamScrollSystem.RangeSpinner; -import pamScrollSystem.RangeSpinnerListener; import Layout.PamAxis; import Layout.PamAxisPanel; import PamController.PamControlledUnitSettings; @@ -51,6 +45,12 @@ import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamObserverAdapter; +import pamScrollSystem.AbstractPamScroller; +import pamScrollSystem.AbstractPamScrollerAWT; +import pamScrollSystem.PamScrollObserver; +import pamScrollSystem.PamScroller; +import pamScrollSystem.RangeSpinner; +import pamScrollSystem.RangeSpinnerListener; /** * Display panel for dBHt data - can be incorporated into a spectrogram * plug in or a stand alone display window. @@ -447,7 +447,7 @@ public class OneBandDisplayPanel { public void newParams() { OneBandDisplayParams params = getDisplayParams(this.panelType); - if (params.autoScale == false) { + if (!params.autoScale) { ampAxis.setRange(params.minAmplitude, params.maxAmplitude); } for (int i = 0; i < OneBandControl.NMEASURES; i++) { diff --git a/src/noiseOneBand/OneBandParameters.java b/src/noiseOneBand/OneBandParameters.java index ea2f3320..8de456f2 100644 --- a/src/noiseOneBand/OneBandParameters.java +++ b/src/noiseOneBand/OneBandParameters.java @@ -1,16 +1,13 @@ package noiseOneBand; -import java.io.File; import java.io.Serializable; import java.lang.reflect.Field; -import java.util.Arrays; import Filters.FilterParams; -import Filters.FilterType; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; +import PamModel.parametermanager.PrivatePamParameterData; public class OneBandParameters implements Serializable, Cloneable, ManagedParameters { diff --git a/src/noiseOneBand/OneBandProcess.java b/src/noiseOneBand/OneBandProcess.java index c2284829..0e008fdb 100644 --- a/src/noiseOneBand/OneBandProcess.java +++ b/src/noiseOneBand/OneBandProcess.java @@ -1,10 +1,6 @@ package noiseOneBand; -import networkTransfer.receive.BuoyStatusDataUnit; -import noiseOneBand.offline.OneBandDatagramProvider; - import Acquisition.AcquisitionProcess; -import Filters.FIRArbitraryFilter; import Filters.Filter; import Filters.FilterMethod; import PamController.PamController; @@ -19,6 +15,8 @@ import PamguardMVC.PamObserver; import PamguardMVC.PamObserverAdapter; import PamguardMVC.PamProcess; import PamguardMVC.PamRawDataBlock; +import networkTransfer.receive.BuoyStatusDataUnit; +import noiseOneBand.offline.OneBandDatagramProvider; public class OneBandProcess extends PamProcess { @@ -141,6 +139,7 @@ public class OneBandProcess extends PamProcess { /** * @return the sourceDataBlock */ + @Override public PamRawDataBlock getRawSourceDataBlock() { return rawSourceDataBlock; } diff --git a/src/noiseOneBand/OneBandPulseProcess.java b/src/noiseOneBand/OneBandPulseProcess.java index 3b608b32..c09282e4 100644 --- a/src/noiseOneBand/OneBandPulseProcess.java +++ b/src/noiseOneBand/OneBandPulseProcess.java @@ -1,13 +1,11 @@ package noiseOneBand; -import noiseOneBand.offline.OneBandDatagramProvider; -import PamController.PamControlledUnit; import PamUtils.PamUtils; import PamguardMVC.PamConstants; -import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; +import noiseOneBand.offline.OneBandDatagramProvider; public class OneBandPulseProcess extends PamProcess { @@ -113,7 +111,7 @@ public class OneBandPulseProcess extends PamProcess { prevRms = rms; return; } - if (pulseOn == false) { + if (!pulseOn) { if (rms-prevRms > dbhtControl.getParameters().singlePulseThreshold) { // start a pulse peakMax = rms; diff --git a/src/offlineProcessing/DataCopyTask.java b/src/offlineProcessing/DataCopyTask.java index c67a00c9..cf07bf10 100644 --- a/src/offlineProcessing/DataCopyTask.java +++ b/src/offlineProcessing/DataCopyTask.java @@ -1,16 +1,13 @@ package offlineProcessing; -import java.sql.Connection; - +import PamguardMVC.PamDataBlock; +import PamguardMVC.PamDataUnit; import binaryFileStorage.BinaryDataSource; -import generalDatabase.DBControl; +import dataMap.OfflineDataMapPoint; import generalDatabase.DBControlUnit; import generalDatabase.DBProcess; import generalDatabase.PamConnection; import generalDatabase.SQLLogging; -import PamguardMVC.PamDataBlock; -import PamguardMVC.PamDataUnit; -import dataMap.OfflineDataMapPoint; /** * Generic class for copying data from binary data files to database files. diff --git a/src/offlineProcessing/OLProcessDialog.java b/src/offlineProcessing/OLProcessDialog.java index 872e0e20..edc98a2e 100644 --- a/src/offlineProcessing/OLProcessDialog.java +++ b/src/offlineProcessing/OLProcessDialog.java @@ -2,7 +2,6 @@ package offlineProcessing; import java.awt.BorderLayout; import java.awt.Color; -import java.awt.Container; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; @@ -25,7 +24,6 @@ import javax.swing.SwingConstants; import javax.swing.WindowConstants; import javax.swing.border.TitledBorder; -import org.kordamp.ikonli.materialdesign2.MaterialDesignC; import org.kordamp.ikonli.swing.FontIcon; import PamUtils.PamCalendar; @@ -301,7 +299,7 @@ public class OLProcessDialog extends PamDialog { @Override protected void okButtonPressed() { - if (getParams() == false) { + if (!getParams()) { return; } if (taskGroup.runTasks()) { @@ -330,7 +328,7 @@ public class OLProcessDialog extends PamDialog { for (int i = 0; i < nTasks; i++) { aTask = taskGroup.getTask(i); taskCheckBox[i].setEnabled(aTask.canRun() && nr); - if (aTask.canRun() == false) { + if (!aTask.canRun()) { taskCheckBox[i].setSelected(false); } if (settingsButton[i] != null) { diff --git a/src/offlineProcessing/OfflineTask.java b/src/offlineProcessing/OfflineTask.java index ec63f39b..cd063b1e 100644 --- a/src/offlineProcessing/OfflineTask.java +++ b/src/offlineProcessing/OfflineTask.java @@ -1,5 +1,15 @@ package offlineProcessing; +import java.util.ArrayList; +import java.util.ListIterator; + +import PamController.PamControlledUnit; +import PamController.PamViewParameters; +import PamguardMVC.PamDataBlock; +import PamguardMVC.PamDataUnit; +import PamguardMVC.PamProcess; +import PamguardMVC.superdet.SuperDetection; +import dataMap.OfflineDataMapPoint; import generalDatabase.DBControlUnit; import generalDatabase.PamConnection; import generalDatabase.SQLLogging; @@ -9,18 +19,6 @@ import generalDatabase.clauses.FixedClause; import generalDatabase.clauses.FromClause; import generalDatabase.clauses.PAMSelectClause; -import java.util.ArrayList; -import java.util.ListIterator; - -import PamController.PamControlledUnit; -import PamController.PamViewParameters; -import dataMap.OfflineDataMapPoint; - -import PamguardMVC.PamDataBlock; -import PamguardMVC.PamDataUnit; -import PamguardMVC.PamProcess; -import PamguardMVC.superdet.SuperDetection; - /** * An offline task, such as click species id. * Generally controlled and operated from within @@ -333,7 +331,7 @@ public abstract class OfflineTask { * @return true to run. */ public boolean isDoRun() { - if (canRun() == false) { + if (!canRun()) { return false; } return doRun; diff --git a/src/offlineProcessing/OfflineTaskGroup.java b/src/offlineProcessing/OfflineTaskGroup.java index e3c8f4ca..7ad4fe41 100644 --- a/src/offlineProcessing/OfflineTaskGroup.java +++ b/src/offlineProcessing/OfflineTaskGroup.java @@ -8,18 +8,11 @@ import java.util.ListIterator; import javax.swing.SwingWorker; -import binaryFileStorage.DataUnitFileInformation; -import dataMap.OfflineDataMap; -import dataMap.OfflineDataMapPoint; -import generalDatabase.DBControlUnit; -import offlineProcessing.logging.TaskLogging; -import offlineProcessing.superdet.OfflineSuperDetFilter; -import pamScrollSystem.DataTimeLimits; -import pamScrollSystem.ViewLoadObserver; import PamController.OfflineDataStore; import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; import PamController.PamController; +import PamController.PamControllerInterface; import PamController.PamSettingManager; import PamController.PamSettings; import PamUtils.CPUMonitor; @@ -29,6 +22,14 @@ import PamguardMVC.PamDataUnit; import PamguardMVC.dataOffline.OfflineDataLoadInfo; import PamguardMVC.debug.Debug; import PamguardMVC.superdet.SuperDetDataBlock; +import binaryFileStorage.DataUnitFileInformation; +import dataMap.OfflineDataMap; +import dataMap.OfflineDataMapPoint; +import generalDatabase.DBControlUnit; +import offlineProcessing.logging.TaskLogging; +import offlineProcessing.superdet.OfflineSuperDetFilter; +import pamScrollSystem.DataTimeLimits; +import pamScrollSystem.ViewLoadObserver; /** * @@ -96,7 +97,7 @@ public class OfflineTaskGroup implements PamSettings { aTask = getTask(iTask); for (int i = 0; i < aTask.getNumRequiredDataBlocks(); i++) { blockInfo = aTask.getRequiredDataBlock(i); - if (hasRequiredDataBlock(blockInfo) == false) { + if (!hasRequiredDataBlock(blockInfo)) { requiredDataBlocks.add(blockInfo); } } @@ -121,8 +122,8 @@ public class OfflineTaskGroup implements PamSettings { } for (RequiredDataBlockInfo dbinfo : requiredDataBlocks) { if (dbinfo.getPamDataBlock() == dataBlockInfo.getPamDataBlock()) { - dbinfo.setPreLoadTime(Math.max(dbinfo.getPreLoadTime(), dataBlockInfo.getPreLoadTime()));; - dbinfo.setPostLoadTime(Math.max(dbinfo.getPostLoadTime(), dataBlockInfo.getPostLoadTime()));; + dbinfo.setPreLoadTime(Math.max(dbinfo.getPreLoadTime(), dataBlockInfo.getPreLoadTime())); + dbinfo.setPostLoadTime(Math.max(dbinfo.getPostLoadTime(), dataBlockInfo.getPostLoadTime())); return true; } } @@ -226,7 +227,7 @@ public class OfflineTaskGroup implements PamSettings { // then scan the database to try to find if everything is later ... long taskMinLatest = Long.MAX_VALUE; for (OfflineTask aTask : offlineTasks) { - if (aTask.isDoRun() == false) { + if (!aTask.isDoRun()) { continue; } Long taskLatest = getPreviousEndTime(aTask); @@ -271,7 +272,7 @@ public class OfflineTaskGroup implements PamSettings { return 0; } for (OfflineTask task : tasks) { - if (haveTask(task) == false) { + if (!haveTask(task)) { addTask(task); n++; } @@ -490,9 +491,9 @@ public class OfflineTaskGroup implements PamSettings { //System.out.println("HELLOOOOO: " + (mapPoint.getEndTime()-mapPoint.getStartTime())/1000.+ "s"); continue; // will whip through early part of list without increasing the counters } - if (shouldProcess(mapPoint) == false) { + if (!shouldProcess(mapPoint)) { Debug.out.printf("Skipping map point %s since no matching data\n", mapPoint.toString()); - reallyDoIt = false;; + reallyDoIt = false; } primaryDataBlock.clearAll(); @@ -513,7 +514,7 @@ public class OfflineTaskGroup implements PamSettings { loadSecondaryData(mapPoint.getStartTime(), mapPoint.getEndTime()); // } for (OfflineTask aTask: offlineTasks) { - if (aTask.isDoRun() == false) { + if (!aTask.isDoRun()) { continue; } aTask.newDataLoad(mapPoint.getStartTime(), mapPoint.getEndTime(), mapPoint); @@ -587,7 +588,7 @@ public class OfflineTaskGroup implements PamSettings { OfflineTask aTask; for (int iTask = 0; iTask < nTasks; iTask++) { aTask = getTask(iTask); - if (aTask.canRun() == false) { + if (!aTask.canRun()) { continue; } if (aTask.isDoRun()) { @@ -696,7 +697,7 @@ public class OfflineTaskGroup implements PamSettings { break; } - if (shouldProcess(dataUnit) == false) { + if (!shouldProcess(dataUnit)) { doTasks = false; } @@ -710,7 +711,7 @@ public class OfflineTaskGroup implements PamSettings { for (int iTask = 0; iTask < nTasks; iTask++) { aTask = getTask(iTask); - if (aTask.isDoRun() == false || !isInTimeChunk(dataUnit, taskGroupParams.timeChunks)) { + if (!aTask.isDoRun() || !isInTimeChunk(dataUnit, taskGroupParams.timeChunks)) { continue; } cpuMonitor.start(); @@ -737,7 +738,7 @@ public class OfflineTaskGroup implements PamSettings { } for (int iTask = 0; iTask < nTasks; iTask++) { aTask = getTask(iTask); - if (aTask.isDoRun() == false) { + if (!aTask.isDoRun()) { continue; } aTask.loadedDataComplete(); @@ -805,7 +806,7 @@ public class OfflineTaskGroup implements PamSettings { OfflineTask aTask; for (int iTask = 0; iTask < nTasks; iTask++) { aTask = getTask(iTask); - if (aTask.canRun() == false) { + if (!aTask.canRun()) { continue; } aTask.completeTask(); @@ -868,7 +869,7 @@ public class OfflineTaskGroup implements PamSettings { private void logTaskStatus(TaskMonitorData monitorData) { for (OfflineTask aTask : offlineTasks) { - if (aTask.isDoRun() == false) { + if (!aTask.isDoRun()) { continue; } @@ -890,7 +891,7 @@ public class OfflineTaskGroup implements PamSettings { long currentStart = primaryDataBlock.getCurrentViewDataStart(); long currentEnd = primaryDataBlock.getCurrentViewDataEnd(); //System.out.println("TASKS COMPLETE:"); - PamController.getInstance().notifyModelChanged(PamController.OFFLINE_PROCESS_COMPLETE); + PamController.getInstance().notifyModelChanged(PamControllerInterface.OFFLINE_PROCESS_COMPLETE); } @Override diff --git a/src/offlineProcessing/OfflineTaskManager.java b/src/offlineProcessing/OfflineTaskManager.java index 9c6485ce..60e0cc64 100644 --- a/src/offlineProcessing/OfflineTaskManager.java +++ b/src/offlineProcessing/OfflineTaskManager.java @@ -137,10 +137,10 @@ public class OfflineTaskManager { public OfflineTask findOfflineTask(String unitType, String unitName, String taskName) { // could possibly also do a check on class type ???? for (OfflineTask aTask : globalTaskList) { - if (aTask.getUnitType().equals(unitType) == false) { + if (!aTask.getUnitType().equals(unitType)) { continue; } - if (aTask.getUnitName().equals(unitName) == false) { + if (!aTask.getUnitName().equals(unitName)) { continue; } if (aTask.getName().equals(taskName)) { diff --git a/src/offlineProcessing/TaskGroupParams.java b/src/offlineProcessing/TaskGroupParams.java index c04a88cc..b82a095e 100644 --- a/src/offlineProcessing/TaskGroupParams.java +++ b/src/offlineProcessing/TaskGroupParams.java @@ -7,8 +7,8 @@ import java.util.Arrays; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; +import PamModel.parametermanager.PrivatePamParameterData; /** * Parameter control for offline task groups. diff --git a/src/pamMaths/HistogramDisplay.java b/src/pamMaths/HistogramDisplay.java index 771910c0..340efa83 100644 --- a/src/pamMaths/HistogramDisplay.java +++ b/src/pamMaths/HistogramDisplay.java @@ -9,9 +9,9 @@ import java.util.ArrayList; import java.util.Observable; import java.util.Observer; -import javax.swing.BorderFactory; import javax.swing.JComponent; import javax.swing.SwingConstants; + import Layout.PamAxis; import Layout.PamAxisPanel; import PamView.PamColors; @@ -123,6 +123,7 @@ public class HistogramDisplay extends Object implements Observer { histoAxisPanel.getSouthAxis().setFormat(format); } + @Override public void update(Observable o, Object arg) { if (arg == o) { // it's the histogram itself which has changed, so redraw the axis. diff --git a/src/pamMaths/PamVector.java b/src/pamMaths/PamVector.java index 8029e0aa..71625410 100644 --- a/src/pamMaths/PamVector.java +++ b/src/pamMaths/PamVector.java @@ -463,7 +463,7 @@ public class PamVector implements Serializable, Cloneable, PamCoordinate, Manage return true; } // first check they are parallel - if (isParallel(vec) == false) { + if (!isParallel(vec)) { return false; } /* diff --git a/src/pamMaths/WignerTransform.java b/src/pamMaths/WignerTransform.java index 6b3a86ba..1c4782e4 100644 --- a/src/pamMaths/WignerTransform.java +++ b/src/pamMaths/WignerTransform.java @@ -2,11 +2,9 @@ package pamMaths; import java.util.Arrays; -import com.sun.glass.ui.Pixels; - import PamUtils.complex.ComplexArray; -import signal.Hilbert; import fftManager.FastFFT; +import signal.Hilbert; public class WignerTransform { diff --git a/src/pamScrollSystem/AbstractPamScroller.java b/src/pamScrollSystem/AbstractPamScroller.java index 54f441e7..bc0ba869 100644 --- a/src/pamScrollSystem/AbstractPamScroller.java +++ b/src/pamScrollSystem/AbstractPamScroller.java @@ -236,6 +236,7 @@ public abstract class AbstractPamScroller implements DataTimeLimits { /** * @return the minimumMillis - the minimum of loaded data */ + @Override public long getMinimumMillis() { return scrollerData.minimumMillis; } @@ -243,6 +244,7 @@ public abstract class AbstractPamScroller implements DataTimeLimits { /** * @return the maximumMillis - the maximum of loaded data */ + @Override public long getMaximumMillis() { return scrollerData.maximumMillis; } diff --git a/src/pamScrollSystem/AbstractScrollManager.java b/src/pamScrollSystem/AbstractScrollManager.java index ff7afbf9..e1485a4d 100644 --- a/src/pamScrollSystem/AbstractScrollManager.java +++ b/src/pamScrollSystem/AbstractScrollManager.java @@ -6,10 +6,10 @@ import java.util.Vector; import javax.swing.JPopupMenu; -import dataMap.OfflineDataMap; -import pamScrollSystem.coupling.ScrollerCoupling; import PamController.PamController; import PamguardMVC.PamDataBlock; +import dataMap.OfflineDataMap; +import pamScrollSystem.coupling.ScrollerCoupling; public abstract class AbstractScrollManager { diff --git a/src/pamScrollSystem/LoadOptionsDialog.java b/src/pamScrollSystem/LoadOptionsDialog.java index 59cd869a..e89b13e1 100644 --- a/src/pamScrollSystem/LoadOptionsDialog.java +++ b/src/pamScrollSystem/LoadOptionsDialog.java @@ -68,7 +68,7 @@ public class LoadOptionsDialog extends PamDialog { c.gridwidth = 1; addComponent(panel, startTime = new JTextField(14), c); c.gridx++; - addComponent(panel, startTimeZone = new JLabel("", JLabel.LEFT), c); + addComponent(panel, startTimeZone = new JLabel("", SwingConstants.LEFT), c); c.gridx = 0; c.gridwidth = 1; c.gridy++; diff --git a/src/pamScrollSystem/LoadQueueProgressData.java b/src/pamScrollSystem/LoadQueueProgressData.java index 949c4cec..62421254 100644 --- a/src/pamScrollSystem/LoadQueueProgressData.java +++ b/src/pamScrollSystem/LoadQueueProgressData.java @@ -162,6 +162,7 @@ public class LoadQueueProgressData extends PamTaskUpdate { * If two updates are available then this is used to return the fine progress update message. * @return */ + @Override public String getProgressString2(){ if (getState() == LoadQueueProgressData.STATE_LINKINGSUBTABLE) { return "Linking " + getStreamName(); diff --git a/src/pamScrollSystem/LoadingDataDialog.java b/src/pamScrollSystem/LoadingDataDialog.java index 699e9b19..a53cfe06 100644 --- a/src/pamScrollSystem/LoadingDataDialog.java +++ b/src/pamScrollSystem/LoadingDataDialog.java @@ -37,7 +37,7 @@ public class LoadingDataDialog extends PamDialog { super(parentFrame, "Loading viewer data", false); streamProgress = new JProgressBar(SwingConstants.HORIZONTAL); allProgress = new JProgressBar(SwingConstants.HORIZONTAL); - storeName = new JLabel(" - ", JLabel.LEFT) { + storeName = new JLabel(" - ", SwingConstants.LEFT) { @Override public Dimension getPreferredSize() { // do this to set a minimum width for the control, will stretch out the @@ -48,7 +48,7 @@ public class LoadingDataDialog extends PamDialog { } }; - streamName = new JLabel(" - ", JLabel.LEFT); + streamName = new JLabel(" - ", SwingConstants.LEFT); // storeName.setEditable(false); // streamName.setEditable(false); JPanel p = new JPanel(); @@ -107,7 +107,7 @@ public class LoadingDataDialog extends PamDialog { * the main frame ends up being pushed back down a layer * and disappears behind another window. */ - if (visible == false) { + if (!visible) { closeLater(); } else { diff --git a/src/pamScrollSystem/PamScrollSlider.java b/src/pamScrollSystem/PamScrollSlider.java index d6d36491..bb1062ad 100644 --- a/src/pamScrollSystem/PamScrollSlider.java +++ b/src/pamScrollSystem/PamScrollSlider.java @@ -1,15 +1,12 @@ package pamScrollSystem; import java.awt.BorderLayout; -import java.awt.Insets; -import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.awt.event.MouseWheelEvent; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JSlider; -import javax.swing.border.Border; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; diff --git a/src/pamScrollSystem/PamScroller.java b/src/pamScrollSystem/PamScroller.java index 81aafccf..9c2406f4 100644 --- a/src/pamScrollSystem/PamScroller.java +++ b/src/pamScrollSystem/PamScroller.java @@ -1,7 +1,6 @@ package pamScrollSystem; import java.awt.BorderLayout; -import java.awt.Color; import java.awt.event.AdjustmentEvent; import java.awt.event.AdjustmentListener; import java.awt.event.MouseEvent; @@ -11,16 +10,11 @@ import javax.swing.BoxLayout; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.JScrollBar; -import javax.swing.SwingUtilities; -import PamController.PamControlledUnit; import PamUtils.PamCalendar; import PamView.component.PamScrollBar; import PamView.dialog.PamLabel; import PamView.panel.PamPanel; -import PamguardMVC.PamDataBlock; -import PamguardMVC.PamProcess; -import javafx.application.Platform; public class PamScroller extends AbstractPamScrollerAWT { @@ -116,7 +110,7 @@ public class PamScroller extends AbstractPamScrollerAWT { } public void setShowTimes(boolean showTimes) { - if (showTimes == false && timePanel != null) { + if (!showTimes && timePanel != null) { panel.remove(timePanel); timePanel = null; } diff --git a/src/pamScrollSystem/PamScrollerFX.java b/src/pamScrollSystem/PamScrollerFX.java index c122db89..8803827f 100644 --- a/src/pamScrollSystem/PamScrollerFX.java +++ b/src/pamScrollSystem/PamScrollerFX.java @@ -1,14 +1,12 @@ package pamScrollSystem; -import pamViewFX.fxNodes.PamBorderPane; -import pamViewFX.fxNodes.PamScrollBarFX; -import pamViewFX.fxNodes.pamScrollers.AbstractPamScrollerFX; -import PamUtils.PamCalendar; import javafx.beans.value.ChangeListener; import javafx.beans.value.ObservableValue; import javafx.geometry.Orientation; -import javafx.scene.Node; import javafx.scene.layout.Pane; +import pamViewFX.fxNodes.PamBorderPane; +import pamViewFX.fxNodes.PamScrollBarFX; +import pamViewFX.fxNodes.pamScrollers.AbstractPamScrollerFX; /** * Creates a scroll bar system that allows users to navigate through data in real time and viewer mode. @@ -50,7 +48,8 @@ public class PamScrollerFX extends AbstractPamScrollerFX { //add a listener to the scroll bar. scrollBar.valueProperty().addListener(new ChangeListener() { - public void changed(ObservableValue ov, + @Override + public void changed(ObservableValue ov, Number old_val, Number new_val) { scrollMoved(); } @@ -168,6 +167,7 @@ public class PamScrollerFX extends AbstractPamScrollerFX { * * @return The visible amount of the display in milliseconds. */ + @Override public long getVisibleAmount() { return (long) scrollBar.getVisibleAmount() * (long) scrollerData.getStepSizeMillis(); } diff --git a/src/pamScrollSystem/RangeSpinner.java b/src/pamScrollSystem/RangeSpinner.java index 9babb6c2..0a1f6aa8 100644 --- a/src/pamScrollSystem/RangeSpinner.java +++ b/src/pamScrollSystem/RangeSpinner.java @@ -13,6 +13,7 @@ import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; + import PamUtils.TimeRangeFormatter; /** diff --git a/src/pamScrollSystem/ViewerScrollerManager.java b/src/pamScrollSystem/ViewerScrollerManager.java index d189b6b3..82159a4d 100644 --- a/src/pamScrollSystem/ViewerScrollerManager.java +++ b/src/pamScrollSystem/ViewerScrollerManager.java @@ -20,10 +20,8 @@ import PamController.PamSettings; import PamguardMVC.PamDataBlock; import PamguardMVC.dataOffline.OfflineDataLoadInfo; import PamguardMVC.superdet.SuperDetDataBlock; -import clickDetector.offlineFuncs.OfflineEventDataBlock; import dataMap.DataMapControl; import dataMap.OfflineDataMap; -import detectiongrouplocaliser.DetectionGroupDataBlock; import generalDatabase.SQLLogging; import generalDatabase.SuperDetLogging; import offlineProcessing.superdet.OfflineSuperDetFilter; @@ -86,7 +84,7 @@ public class ViewerScrollerManager extends AbstractScrollManager implements PamS } aScroller.anotherScrollerMovedOuter(newMin, newMax); } - if (currentScrollInitialisation == false) { + if (!currentScrollInitialisation) { loadData(false); } } @@ -227,7 +225,7 @@ public class ViewerScrollerManager extends AbstractScrollManager implements PamS private void loadSubformData(ArrayList dataLoadQueue, DataLoader dataLoader) { for (int i=0; i { holderBox.setSpacing(5); tabChoice=new ComboBox(); tabChoice.setMinWidth(100); - PamHBox.setHgrow(tabChoice, Priority.ALWAYS); //make sure choice nox is big enough + HBox.setHgrow(tabChoice, Priority.ALWAYS); //make sure choice nox is big enough tabChoice.setEditable(false); //listener for adding tabs diff --git a/src/pamguard/Pamguard.java b/src/pamguard/Pamguard.java index 33009522..7ec89404 100644 --- a/src/pamguard/Pamguard.java +++ b/src/pamguard/Pamguard.java @@ -20,33 +20,6 @@ package pamguard; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import javax.swing.SwingUtilities; -import javax.swing.UIManager; - -import Acquisition.FolderInputSystem; -import PamController.PamController; -import PamController.PamGUIManager; -import PamController.PamSettingManager; -import PamController.PamguardVersionInfo; -import PamController.pamBuoyGlobals; -import PamController.fileprocessing.ReprocessStoreChoice; -import PamModel.SMRUEnable; -import PamUtils.FileFunctions; -import PamUtils.PamExceptionHandler; -import PamUtils.PlatformInfo; -import PamUtils.Splash; -import PamUtils.PlatformInfo.OSType; -import PamView.FullScreen; -import PamView.ScreenSize; -import PamView.dialog.warn.WarnOnce; -import PamguardMVC.debug.Debug; -import binaryFileStorage.BinaryStore; -import dataPlotsFX.JamieDev; -import generalDatabase.DBControl; -import networkTransfer.send.NetworkSender; -import offlineProcessing.OfflineTaskManager; -import rocca.RoccaDev; - import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; @@ -62,6 +35,33 @@ import java.util.Date; import java.util.TimeZone; //import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; + +import Acquisition.FolderInputSystem; +import PamController.PamController; +import PamController.PamGUIManager; +import PamController.PamSettingManager; +import PamController.PamguardVersionInfo; +import PamController.pamBuoyGlobals; +import PamController.fileprocessing.ReprocessStoreChoice; +import PamModel.SMRUEnable; +import PamUtils.FileFunctions; +import PamUtils.PamExceptionHandler; +import PamUtils.PlatformInfo; +import PamUtils.PlatformInfo.OSType; +import PamUtils.Splash; +import PamView.FullScreen; +import PamView.ScreenSize; +import PamView.dialog.warn.WarnOnce; +import PamguardMVC.debug.Debug; +import binaryFileStorage.BinaryStore; +import dataPlotsFX.JamieDev; +import generalDatabase.DBControl; +import networkTransfer.send.NetworkSender; +import offlineProcessing.OfflineTaskManager; +import rocca.RoccaDev; + /** * Pamguard main class. * @@ -386,9 +386,9 @@ public class Pamguard { System.out.println("(Windows users right click on window title bar for edit / copy options)"); System.out.println(""); - if (checkJavaVersion(javaV) == false) { + if (!checkJavaVersion(javaV)) { System.exit(0); - }; + } int spashTime = 5000; if (SMRUEnable.isEnable()) { @@ -402,6 +402,7 @@ public class Pamguard { } // final Runnable createPamguard = new Runnable() { + @Override public void run() { PamController.create(chosenRunMode); } @@ -594,6 +595,7 @@ public class Pamguard { /** * Print to both the console and the file */ + @Override public synchronized void print(final String str) { if (str.contains("WARN org.docx4j") || str.contains("INFO org.docx4j")) return; // don't bother printing these messages out origPrintStream.print(str); @@ -607,6 +609,7 @@ public class Pamguard { /** * Print to both the console and the file */ + @Override public synchronized void println(final String str) { if (str == null) { println("null"); @@ -627,6 +630,7 @@ public class Pamguard { * the string. Instead, compile it all into a single string first * and then call print */ + @Override public synchronized PrintStream printf(String format, Object... args) { String theString = String.format(format, args); print(theString); diff --git a/src/pamguard/PamguardFX.java b/src/pamguard/PamguardFX.java index 4ae7dbe5..0ea6d354 100644 --- a/src/pamguard/PamguardFX.java +++ b/src/pamguard/PamguardFX.java @@ -20,21 +20,6 @@ package pamguard; * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -import PamController.PamController; -import PamController.PamGUIManager; -import PamController.PamSettingManager; -import PamController.PamguardVersionInfo; -import PamController.pamBuoyGlobals; -import PamModel.SMRUEnable; -import PamUtils.FileFunctions; -import PamUtils.PamExceptionHandler; -import PamView.FullScreen; -import PamView.ScreenSize; -import PamguardMVC.debug.Debug; -import dataPlotsFX.JamieDev; -import javafx.application.Application; -import javafx.stage.Stage; - import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; @@ -50,6 +35,21 @@ import java.util.Date; import java.util.TimeZone; //import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; +import PamController.PamController; +import PamController.PamGUIManager; +import PamController.PamSettingManager; +import PamController.PamguardVersionInfo; +import PamController.pamBuoyGlobals; +import PamModel.SMRUEnable; +import PamUtils.FileFunctions; +import PamUtils.PamExceptionHandler; +import PamView.FullScreen; +import PamView.ScreenSize; +import PamguardMVC.debug.Debug; +import dataPlotsFX.JamieDev; +import javafx.application.Application; +import javafx.stage.Stage; + /** * Pamguard main class. * @@ -379,6 +379,7 @@ public class PamguardFX extends Application { /** * Print to both the console and the file */ + @Override public synchronized void print(final String str) { if (str.contains("WARN org.docx4j") || str.contains("INFO org.docx4j")) return; // don't bother printing these messages out origPrintStream.print(str); @@ -392,6 +393,7 @@ public class PamguardFX extends Application { /** * Print to both the console and the file */ + @Override public synchronized void println(final String str) { if (str.contains("WARN org.docx4j") || str.contains("INFO org.docx4j")) return; // don't bother printing these messages out origPrintStream.println(str); @@ -408,6 +410,7 @@ public class PamguardFX extends Application { * the string. Instead, compile it all into a single string first * and then call print */ + @Override public synchronized PrintStream printf(String format, Object... args) { String theString = String.format(format, args); print(theString); diff --git a/src/patchPanel/PatchPanelControl.java b/src/patchPanel/PatchPanelControl.java index 98ebcfa9..b28318c4 100644 --- a/src/patchPanel/PatchPanelControl.java +++ b/src/patchPanel/PatchPanelControl.java @@ -48,6 +48,7 @@ public class PatchPanelControl extends PamControlledUnit implements PamSettings this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { PatchPanelParameters newParams = PatchPanelDialog.showDialog(parentFrame, @@ -64,14 +65,17 @@ public class PatchPanelControl extends PamControlledUnit implements PamSettings patchPanelProcess.noteNewSettings(); } + @Override public Serializable getSettingsReference() { return patchPanelParameters; } + @Override public long getSettingsVersion() { return PatchPanelParameters.serialVersionUID; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { patchPanelParameters = ((PatchPanelParameters) pamControlledUnitSettings.getSettings()).clone(); diff --git a/src/patchPanel/PatchPanelDialog.java b/src/patchPanel/PatchPanelDialog.java index da50e2c4..7c3de410 100644 --- a/src/patchPanel/PatchPanelDialog.java +++ b/src/patchPanel/PatchPanelDialog.java @@ -13,7 +13,6 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.border.TitledBorder; - import PamController.PamController; import PamDetection.RawDataUnit; import PamView.dialog.PamDialog; @@ -170,6 +169,7 @@ public class PatchPanelDialog extends PamDialog { } class PatchBoxListener implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { buttonsChanged(); @@ -180,9 +180,9 @@ public class PatchPanelDialog extends PamDialog { private void buttonsChanged() { - if (immediate.isSelected() == false) return; + if (!immediate.isSelected()) return; - if (getParams() == false) return; + if (!getParams()) return; patchPanelControl.newSettings(patchPanelParameters); diff --git a/src/performanceTests/GraphicsDotTest2.java b/src/performanceTests/GraphicsDotTest2.java index f4e722ea..627b9d4b 100644 --- a/src/performanceTests/GraphicsDotTest2.java +++ b/src/performanceTests/GraphicsDotTest2.java @@ -3,6 +3,7 @@ package performanceTests; import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; + import javax.swing.JPanel; public class GraphicsDotTest2 extends GraphicsDotTest { diff --git a/src/performanceTests/PerformanceDialog.java b/src/performanceTests/PerformanceDialog.java index 60196e66..5ae83699 100644 --- a/src/performanceTests/PerformanceDialog.java +++ b/src/performanceTests/PerformanceDialog.java @@ -103,7 +103,7 @@ public class PerformanceDialog extends PamDialog { str = String.format("%d. %s", iTest+1, pt.getName()); appendString(str); boolean ran = pt.runTest(); - if (ran == false) { + if (!ran) { appendString(String.format("****** TEST FAILED ******")); } appendString(pt.getResultString()); diff --git a/src/printscreen/PrintScreenControl.java b/src/printscreen/PrintScreenControl.java index f0dcb496..edb5ecf4 100644 --- a/src/printscreen/PrintScreenControl.java +++ b/src/printscreen/PrintScreenControl.java @@ -8,8 +8,6 @@ import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; import javax.imageio.ImageIO; import javax.swing.JFrame; @@ -18,6 +16,7 @@ import javax.swing.JMenuItem; import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; import PamController.PamController; +import PamController.PamControllerInterface; import PamController.PamSettingManager; import PamController.PamSettings; import PamUtils.FileFunctions; @@ -26,8 +25,6 @@ import PamView.GuiFrameManager; import PamView.PamSidePanel; import PamguardMVC.PamProcess; import annotation.handler.AnnotationChoiceHandler; -import annotation.handler.AnnotationChoices; -import annotation.handler.AnnotationHandler; import annotation.string.StringAnnotationType; import annotation.userforms.UserFormAnnotationType; import generalDatabase.DBControlUnit; @@ -85,7 +82,7 @@ public class PrintScreenControl extends PamControlledUnit implements PamSettings public void notifyModelChanged(int changeType) { super.notifyModelChanged(changeType); switch (changeType) { - case PamController.INITIALIZATION_COMPLETE: + case PamControllerInterface.INITIALIZATION_COMPLETE: annotationHandler.loadAnnotationChoices(); sortSQLLogging(); break; @@ -141,7 +138,7 @@ public class PrintScreenControl extends PamControlledUnit implements PamSettings if (frameIndex == 0) { // only do annotations for the first frame to keep life simple. boolean ok = annotationHandler.annotateDataUnit(getGuiFrame(), psdu); - if (ok == false) { + if (!ok) { return false; } } diff --git a/src/propagation/FrequencyAttenutationModel.java b/src/propagation/FrequencyAttenutationModel.java index f1a9599f..148131d7 100644 --- a/src/propagation/FrequencyAttenutationModel.java +++ b/src/propagation/FrequencyAttenutationModel.java @@ -1,6 +1,5 @@ package propagation; -import PamUtils.PamUtils; import fftManager.FastFFT; public class FrequencyAttenutationModel implements AttenuationModel { @@ -13,7 +12,7 @@ public class FrequencyAttenutationModel implements AttenuationModel { return null; } int len = wave.length; - int fftLen = fastFFT.nextBinaryExp(len); + int fftLen = FastFFT.nextBinaryExp(len); double[] complexData = new double[len*2]; // fastFFT.rfft(wave, complexData, fftLen); return null; diff --git a/src/propagation/PropagationModel.java b/src/propagation/PropagationModel.java index 75c4f0c9..9c71ad91 100644 --- a/src/propagation/PropagationModel.java +++ b/src/propagation/PropagationModel.java @@ -1,7 +1,7 @@ package propagation; -import pamMaths.PamVector; import PamUtils.LatLong; +import pamMaths.PamVector; /** * Really simple propagation models. Basically just spreading models diff --git a/src/propagation/SphericalPropagation.java b/src/propagation/SphericalPropagation.java index 75b77fd8..120c4f93 100644 --- a/src/propagation/SphericalPropagation.java +++ b/src/propagation/SphericalPropagation.java @@ -1,9 +1,5 @@ package propagation; -import pamMaths.PamVector; -import Array.ArrayManager; -import PamUtils.LatLong; - /** * Simple spherical propagation model to use with the simulated acquisition model. * @author Doug Gillespie diff --git a/src/propagation/SurfaceEcho.java b/src/propagation/SurfaceEcho.java index 56540638..38be14bd 100644 --- a/src/propagation/SurfaceEcho.java +++ b/src/propagation/SurfaceEcho.java @@ -1,7 +1,7 @@ package propagation; -import pamMaths.PamVector; import PamUtils.LatLong; +import pamMaths.PamVector; public class SurfaceEcho implements PropagationModel { diff --git a/src/qa/QAControl.java b/src/qa/QAControl.java index 08a104a4..340a7273 100644 --- a/src/qa/QAControl.java +++ b/src/qa/QAControl.java @@ -259,7 +259,7 @@ public class QAControl extends PamControlledUnit implements PamSettings, QANotif int nSeq = qaParameters.getnQuickTestSequences(); for (QACluster cluster:availableClusters) { ClusterParameters clusterParams = qaParameters.getClusterParameters(cluster); - if (clusterParams.runImmediate == false) { + if (!clusterParams.runImmediate) { continue; } QALocationGenerator locGen = locationManager.makeLocationGenerator(locator, cluster, nSeq, getRangeLimits(clusterParams.monitorRange)); diff --git a/src/qa/QASequenceDataUnit.java b/src/qa/QASequenceDataUnit.java index fbe9a9d5..e8664f7e 100644 --- a/src/qa/QASequenceDataUnit.java +++ b/src/qa/QASequenceDataUnit.java @@ -1,6 +1,5 @@ package qa; -import PamguardMVC.PamDataUnit; import qa.generator.sequence.SoundSequence; public class QASequenceDataUnit extends QADataUnit { diff --git a/src/qa/RandomTestManager.java b/src/qa/RandomTestManager.java index 0b9e8b7c..08167642 100644 --- a/src/qa/RandomTestManager.java +++ b/src/qa/RandomTestManager.java @@ -3,7 +3,6 @@ package qa; import java.util.ArrayList; import java.util.ListIterator; -import PamController.PamController; import PamController.PamControllerInterface; import PamController.PamViewParameters; import PamUtils.PamCalendar; @@ -61,7 +60,7 @@ public class RandomTestManager implements QANotifyable { //active don't need to do anything. LongRandomTestSet lrts = (LongRandomTestSet) currentDataUnit.getQaTestSet(); String currentState = lrts.getStatus(); - if (QATestSet.STATUS_ACTIVE.equalsIgnoreCase(currentState) == false) { + if (!QATestSet.STATUS_ACTIVE.equalsIgnoreCase(currentState)) { lrts.setStatus(QATestSet.STATUS_ACTIVE); lrts.resetNextSample(generatorProcess.getCurrentSample(), generatorProcess.getSampleRate()); testsDataBlock.updatePamData(currentDataUnit, PamCalendar.getTimeInMillis()); @@ -71,11 +70,11 @@ public class RandomTestManager implements QANotifyable { // want it, but don't have it, so make it startRandomTest(cluster); } - else if (wantRun == false && currentDataUnit != null) { + else if (!wantRun && currentDataUnit != null) { // have it but don't want it, so stop the test. stopRandomTest(currentDataUnit); } - else if (wantRun == false && currentDataUnit == null) { + else if (!wantRun && currentDataUnit == null) { // don't have it and don't want it. } diff --git a/src/quickAnnotation/QuickAnnotationModule.java b/src/quickAnnotation/QuickAnnotationModule.java index 6e9210db..d3f8ff44 100644 --- a/src/quickAnnotation/QuickAnnotationModule.java +++ b/src/quickAnnotation/QuickAnnotationModule.java @@ -6,13 +6,14 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.Serializable; import java.util.ArrayList; + import javax.swing.JMenu; import javax.swing.JMenuItem; + import PamController.PamControlledUnitSettings; import PamController.PamSettingManager; import PamController.PamSettings; import PamView.importData.ImportDataSystem; -import PamView.paneloverlay.overlaymark.OverlayMarkObservers; import annotation.calcs.snr.SNRAnnotationType; import annotation.calcs.spl.SPLAnnotationType; import annotation.calcs.wav.WavAnnotation; @@ -22,7 +23,6 @@ import annotation.string.StringAnnotationType; import annotationMark.MarkAnnotationDialog; import annotationMark.MarkDataUnit; import annotationMark.spectrogram.SpectrogramAnnotationModule; -import annotationMark.spectrogram.SpectrogramAnnotationModule.DisplayObserver; import generalDatabase.lookupTables.LookupItem; import quickAnnotation.importAnnotation.QuickAnnotationImport; import quickAnnotation.importAnnotation.QuickAnnotationImportParams; @@ -76,7 +76,7 @@ public class QuickAnnotationModule extends SpectrogramAnnotationModule implement @Override public long getSettingsVersion() { // TODO Auto-generated method stub - return quickAnnotationParams.serialVersionUID; + return QuickAnnotationParameters.serialVersionUID; } @Override diff --git a/src/quickAnnotation/QuickAnnotationOverlayDraw.java b/src/quickAnnotation/QuickAnnotationOverlayDraw.java index a484d601..e8f486a0 100644 --- a/src/quickAnnotation/QuickAnnotationOverlayDraw.java +++ b/src/quickAnnotation/QuickAnnotationOverlayDraw.java @@ -1,16 +1,15 @@ package quickAnnotation; import java.awt.BasicStroke; -import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; + import PamUtils.Coordinate3d; import PamView.GeneralProjector; import PamView.PamSymbol; import PamguardMVC.PamDataUnit; import annotation.string.StringAnnotation; -import annotation.string.StringAnnotationType; import annotationMark.MarkDataBlock; import annotationMark.MarkDataUnit; import annotationMark.MarkModule; diff --git a/src/quickAnnotation/QuickAnnotationParameters.java b/src/quickAnnotation/QuickAnnotationParameters.java index 65e3b05b..d8b39c4a 100644 --- a/src/quickAnnotation/QuickAnnotationParameters.java +++ b/src/quickAnnotation/QuickAnnotationParameters.java @@ -8,10 +8,8 @@ import java.lang.reflect.Field; import PamController.PamSettingManager; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; -import difar.DifarControl; -import difar.DifarParameters; +import PamModel.parametermanager.PrivatePamParameterData; import generalDatabase.lookupTables.LookupItem; import generalDatabase.lookupTables.LookupList; @@ -43,6 +41,7 @@ public class QuickAnnotationParameters implements Serializable, Cloneable, Manag shouldPopupDialog = false; } + @Override public QuickAnnotationParameters clone() { try { QuickAnnotationParameters np = (QuickAnnotationParameters) super.clone(); diff --git a/src/quickAnnotation/QuickAnnotationParamsDialog.java b/src/quickAnnotation/QuickAnnotationParamsDialog.java index 001cd8b7..80129913 100644 --- a/src/quickAnnotation/QuickAnnotationParamsDialog.java +++ b/src/quickAnnotation/QuickAnnotationParamsDialog.java @@ -1,12 +1,12 @@ package quickAnnotation; -import java.awt.Component; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.io.File; import javax.swing.BoxLayout; import javax.swing.JMenuItem; @@ -14,8 +14,6 @@ import javax.swing.JPopupMenu; import javax.swing.JTextField; import javax.swing.border.TitledBorder; -import java.io.File; - import PamController.PamController; import PamController.PamSettingManager; import PamUtils.SelectFolder; @@ -25,7 +23,6 @@ import PamView.dialog.PamDialog; import PamView.dialog.PamLabel; import PamView.panel.PamBorderPanel; import PamView.panel.PamPanel; -import annotation.handler.AnnotationsSelectionPanel; import generalDatabase.lookupTables.LookupEditDialog; import generalDatabase.lookupTables.LookupList; @@ -95,7 +92,7 @@ public class QuickAnnotationParamsDialog extends PamDialog { c.gridy++; c.gridx = 0; - c.gridwidth = c.REMAINDER; + c.gridwidth = GridBagConstraints.REMAINDER; wavFolderSelect = new SelectFolder("Select output folder", 32, false); String filePath = PamSettingManager.getInstance().getDefaultFile(); @@ -161,7 +158,8 @@ public class QuickAnnotationParamsDialog extends PamDialog { * Edit lookup list and update the side panel of quick selections */ private void editQuickList() { - LookupList newList = LookupEditDialog.showDialog(PamController.getInstance().getMainFrame(), + PamController.getInstance(); + LookupList newList = LookupEditDialog.showDialog(PamController.getMainFrame(), quickAnnotationModule.getQuickAnnotationParameters().getQuickList(quickAnnotationModule)); if (newList != null) { quickAnnotationModule.getQuickAnnotationParameters().setQuickList(newList); @@ -197,6 +195,7 @@ public class QuickAnnotationParamsDialog extends PamDialog { */ class SorpDefaultAction implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { LookupList newList = quickAnnotationParams.sorpList(quickAnnotationModule); if (newList != null) { diff --git a/src/quickAnnotation/QuickAnnotationSidePanel.java b/src/quickAnnotation/QuickAnnotationSidePanel.java index 3ce4bba6..22b36f99 100644 --- a/src/quickAnnotation/QuickAnnotationSidePanel.java +++ b/src/quickAnnotation/QuickAnnotationSidePanel.java @@ -1,7 +1,5 @@ package quickAnnotation; -import generalDatabase.lookupTables.LookupItem; - import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -17,7 +15,6 @@ import javax.swing.JComponent; import javax.swing.JList; import javax.swing.ListSelectionModel; import javax.swing.ScrollPaneConstants; -import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; @@ -27,6 +24,7 @@ import PamView.PamSidePanel; import PamView.dialog.PamCheckBox; import PamView.panel.PamPanel; import PamView.panel.PamScrollPane; +import generalDatabase.lookupTables.LookupItem; /** * The DIFAR SidePanel contains the list of DIFAR classifications, to allow @@ -45,6 +43,7 @@ public class QuickAnnotationSidePanel implements PamSidePanel { DefaultListModel defaultListModel; PamList labelList; private final Object defaultItem= new Object(){ + @Override public String toString() { return ""; }; @@ -65,14 +64,16 @@ public class QuickAnnotationSidePanel implements PamSidePanel { defaultListModel = new DefaultListModel(); labelList = new PamList(defaultListModel) { - public String getToolTipText( MouseEvent e ) + @Override + public String getToolTipText( MouseEvent e ) { int row = locationToIndex( e.getPoint() ); Object o = getModel().getElementAt(row); return o.toString(); } - public Point getToolTipLocation(MouseEvent e) + @Override + public Point getToolTipLocation(MouseEvent e) { int row = locationToIndex( e.getPoint() ); Rectangle r = getCellBounds(row, row); diff --git a/src/radardisplay/RadarDataInfo.java b/src/radardisplay/RadarDataInfo.java index 5c1885aa..842ce3a2 100644 --- a/src/radardisplay/RadarDataInfo.java +++ b/src/radardisplay/RadarDataInfo.java @@ -25,6 +25,7 @@ package radardisplay; import java.io.Serializable; + import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamView.paneloverlay.OverlayDataInfo; diff --git a/src/radardisplay/RadarDisplay.java b/src/radardisplay/RadarDisplay.java index 879ff75b..f4764692 100644 --- a/src/radardisplay/RadarDisplay.java +++ b/src/radardisplay/RadarDisplay.java @@ -18,14 +18,6 @@ import javax.swing.JMenuItem; import javax.swing.JPopupMenu; import javax.swing.Timer; -import pamScrollSystem.AbstractPamScroller; -import pamScrollSystem.AbstractPamScrollerAWT; -import pamScrollSystem.PamScrollObserver; -import pamScrollSystem.PamScroller; -import pamScrollSystem.RangeSpinner; -import pamScrollSystem.RangeSpinnerListener; -import userDisplay.UserDisplayControl; -import userDisplay.UserFramePlots; import GPS.GpsDataUnit; import Layout.PamAxis; import Layout.PamAxisPanel; @@ -38,10 +30,10 @@ import PamController.PamSettings; import PamDetection.AbstractLocalisation; import PamUtils.PamCalendar; import PamView.PamColors; +import PamView.PamColors.PamColor; import PamView.PamKeyItem; import PamView.PamSymbol; import PamView.SymbolKeyItem; -import PamView.PamColors.PamColor; import PamView.panel.CornerLayoutContraint; import PamView.panel.JPanelWithPamKey; import PamView.panel.KeyPanel; @@ -54,6 +46,14 @@ import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamObserver; import PamguardMVC.dataSelector.DataSelector; +import pamScrollSystem.AbstractPamScroller; +import pamScrollSystem.AbstractPamScrollerAWT; +import pamScrollSystem.PamScrollObserver; +import pamScrollSystem.PamScroller; +import pamScrollSystem.RangeSpinner; +import pamScrollSystem.RangeSpinnerListener; +import userDisplay.UserDisplayControl; +import userDisplay.UserFramePlots; public class RadarDisplay extends UserFramePlots implements PamObserver, PamSettings { @@ -231,7 +231,7 @@ public class RadarDisplay extends UserFramePlots implements PamObserver, PamSett PamDataBlock dataBlock; for (int i = 0; i < detectorDataBlocks.size(); i++) { dataBlock = detectorDataBlocks.get(i); - if (dataBlock.canDraw(radarProjector) == false || radarParameters.getRadarDataInfo(dataBlock).select == false) continue; + if (!dataBlock.canDraw(radarProjector) || !radarParameters.getRadarDataInfo(dataBlock).select) continue; RadarDataInfo rdi = radarParameters.getRadarDataInfo(dataBlock); paintDetectorData(g2d, dataBlock, rdi.getDetectorLifetime() * 1000, rdi.isFadeDetector()); } @@ -694,6 +694,7 @@ public class RadarDisplay extends UserFramePlots implements PamObserver, PamSett } class SettingsAction implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { RadarParameters newParams = RadarParametersDialog.showDialog(RadarDisplay.this, @@ -765,13 +766,14 @@ public class RadarDisplay extends UserFramePlots implements PamObserver, PamSett } void repaintAll(){ - if (radarPlot.isShowing() == false) return; + if (!radarPlot.isShowing()) return; radarAxis.repaint(); radarPlot.repaint(); } class TimerListener implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { radarPlot.repaint(); @@ -795,7 +797,7 @@ public class RadarDisplay extends UserFramePlots implements PamObserver, PamSett for (int i = 0; i < detectorDataBlocks.size(); i++) { dataBlock = detectorDataBlocks.get(i); dataBlock.deleteObserver(this); - if (radarParameters.getRadarDataInfo(dataBlock).select == false) continue; + if (!radarParameters.getRadarDataInfo(dataBlock).select) continue; dataBlock.addObserver(this); if (radarScroller != null) { radarScroller.addDataBlock(dataBlock); @@ -821,7 +823,7 @@ public class RadarDisplay extends UserFramePlots implements PamObserver, PamSett PamDataBlock dataBlock; for (int i = 0; i < detectorDataBlocks.size(); i++) { dataBlock = detectorDataBlocks.get(i); - if (dataBlock.canDraw(radarProjector) == false || radarParameters.getRadarDataInfo(dataBlock).select == false) continue; + if (!dataBlock.canDraw(radarProjector) || !radarParameters.getRadarDataInfo(dataBlock).select) continue; // keyPanel.add(dataBlock.createKeyItem(radarProjector, keyPanel.getKeyType())); SymbolData symbolData = null; @@ -866,10 +868,12 @@ public class RadarDisplay extends UserFramePlots implements PamObserver, PamSett radarPlot.setKeyPosition(keyPos); } + @Override public String getObserverName() { return getName(); } + @Override public long getRequiredDataHistory(PamObservable o, Object arg) { if (detectorDataBlocks == null) return 0; PamDataBlock dataBlock = (PamDataBlock) o; @@ -879,17 +883,20 @@ public class RadarDisplay extends UserFramePlots implements PamObserver, PamSett return 0; } + @Override public void noteNewSettings() { // TODO Auto-generated method stub newSettings(); } + @Override public void removeObservable(PamObservable o) { // TODO Auto-generated method stub } + @Override public void setSampleRate(float sampleRate, boolean notify) { // TODO Auto-generated method stub @@ -903,6 +910,7 @@ public class RadarDisplay extends UserFramePlots implements PamObserver, PamSett } + @Override public void addData(PamObservable o, PamDataUnit pamDataUnit) { if (o == gpsDataBlock) { diff --git a/src/radardisplay/RadarParametersDialog.java b/src/radardisplay/RadarParametersDialog.java index 6acaceaa..040df5fd 100644 --- a/src/radardisplay/RadarParametersDialog.java +++ b/src/radardisplay/RadarParametersDialog.java @@ -14,13 +14,12 @@ import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; -import javax.swing.JRadioButton; import javax.swing.JTabbedPane; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; import Array.ArrayManager; -import Map.MapDetectionData; import PamController.PamController; import PamView.GeneralProjector.ParameterType; import PamView.dialog.PamDialog; @@ -86,9 +85,9 @@ public class RadarParametersDialog extends PamDialog { @Override public boolean getParams() { - if (stylePanel.getParams() == false) return false; - if (scalePanel.getParams() == false) return false; - if (detectorsPanel.getParams() == false) return false; + if (!stylePanel.getParams()) return false; + if (!scalePanel.getParams()) return false; + if (!detectorsPanel.getParams()) return false; return true; } @@ -141,20 +140,20 @@ public class RadarParametersDialog extends PamDialog { setBorder(new TitledBorder("Plot layout")); constraints.gridx = 0; constraints.gridy = 0; - addComponent(this, new JLabel("Name ", JLabel.RIGHT), constraints); + addComponent(this, new JLabel("Name ", SwingConstants.RIGHT), constraints); constraints.gridx ++; constraints.gridwidth = 2; addComponent(this, windowName = new JTextField(20), constraints); constraints.gridwidth = 1; constraints.gridx = 0; constraints.gridy ++; - addComponent(this, new JLabel("Style ", JLabel.RIGHT), constraints); + addComponent(this, new JLabel("Style ", SwingConstants.RIGHT), constraints); constraints.gridx ++; addComponent(this, sides = new JComboBox(), constraints); constraints.gridx = 0; constraints.gridy ++; - addComponent(this, new JLabel("Orientation ", JLabel.RIGHT), constraints); + addComponent(this, new JLabel("Orientation ", SwingConstants.RIGHT), constraints); constraints.gridx ++; addComponent(this, orientation = new JComboBox(), constraints); orientation.addItem("Heading Up"); @@ -163,7 +162,7 @@ public class RadarParametersDialog extends PamDialog { constraints.gridx = 0; constraints.gridy ++; - addComponent(this, new JLabel("Radial Axis ", JLabel.RIGHT), constraints); + addComponent(this, new JLabel("Radial Axis ", SwingConstants.RIGHT), constraints); constraints.gridx ++; addComponent(this, radialAxis = new JComboBox(), constraints); radialAxis.addActionListener(new ChangeListener()); @@ -214,6 +213,7 @@ public class RadarParametersDialog extends PamDialog { class ChangeListener implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { if (scalePanel != null) { @@ -384,9 +384,9 @@ public class RadarParametersDialog extends PamDialog { addComponent(this, new JLabel("Detector"), constraints); constraints.gridx++; - addComponent(this, new JLabel("Lifetime (s)", JLabel.CENTER), constraints); + addComponent(this, new JLabel("Lifetime (s)", SwingConstants.CENTER), constraints); constraints.gridx++; - addComponent(this, new JLabel(" Fade ", JLabel.CENTER), constraints); + addComponent(this, new JLabel(" Fade ", SwingConstants.CENTER), constraints); if (detectorDataBlocks != null) { // if (radarParameters.showDetector == null || @@ -409,7 +409,7 @@ public class RadarParametersDialog extends PamDialog { EnableListener enableListener = new EnableListener(); for (int i = 0; i < detectorDataBlocks.size(); i++) { dataBlock = detectorDataBlocks.get(i); - if (dataBlock.canDraw(radarProjector) == false) continue; + if (!dataBlock.canDraw(radarProjector)) continue; constraints.gridx = 0; constraints.gridy ++; constraints.anchor = GridBagConstraints.WEST; diff --git a/src/radardisplay/RadarProjector.java b/src/radardisplay/RadarProjector.java index 84fe07b5..d945af47 100644 --- a/src/radardisplay/RadarProjector.java +++ b/src/radardisplay/RadarProjector.java @@ -2,8 +2,6 @@ package radardisplay; import java.awt.Point; -import clickDetector.ClickBTDisplay.PlotKeyListener; - import PamUtils.Coordinate3d; import PamUtils.PamCoordinate; import PamView.GeneralProjector; @@ -110,7 +108,7 @@ public class RadarProjector extends GeneralProjector { */ private Coordinate3d getRangeCood3d(double bearing, double range) { - if (canPlot(bearing) == false) return null; + if (!canPlot(bearing)) return null; Coordinate3d coord = new Coordinate3d(); Point p = radarDisplay.getCentre(); @@ -147,7 +145,7 @@ public class RadarProjector extends GeneralProjector { private Coordinate3d getSlantCoord3d(double bearing, double slantAngle) { - if (canPlot(bearing) == false) return null; + if (!canPlot(bearing)) return null; Coordinate3d coord = new Coordinate3d(); Point p = radarDisplay.getCentre(); diff --git a/src/ravendata/RavenDataBlock.java b/src/ravendata/RavenDataBlock.java index 8fe3f9c5..0aaea7be 100644 --- a/src/ravendata/RavenDataBlock.java +++ b/src/ravendata/RavenDataBlock.java @@ -1,7 +1,6 @@ package ravendata; import PamguardMVC.PamDataBlock; -import PamguardMVC.PamProcess; public class RavenDataBlock extends PamDataBlock { diff --git a/src/ravendata/RavenDataRow.java b/src/ravendata/RavenDataRow.java index 8924ef9f..0a4dd3f7 100644 --- a/src/ravendata/RavenDataRow.java +++ b/src/ravendata/RavenDataRow.java @@ -182,7 +182,7 @@ public class RavenDataRow { @Override public boolean equals(Object obj) { - if (obj instanceof RavenDataRow == false) { + if (!(obj instanceof RavenDataRow)) { return false; } RavenDataRow oth = (RavenDataRow) obj; diff --git a/src/ravendata/RavenDataUnit.java b/src/ravendata/RavenDataUnit.java index 9f09f769..118bd13a 100644 --- a/src/ravendata/RavenDataUnit.java +++ b/src/ravendata/RavenDataUnit.java @@ -6,7 +6,6 @@ import java.util.Set; import PamDetection.PamDetection; import PamguardMVC.AcousticDataUnit; -import PamguardMVC.DataUnitBaseData; import PamguardMVC.PamDataUnit; public class RavenDataUnit extends PamDataUnit implements AcousticDataUnit, PamDetection { diff --git a/src/ravendata/RavenFileReader.java b/src/ravendata/RavenFileReader.java index bd93ed4c..17c0f01a 100644 --- a/src/ravendata/RavenFileReader.java +++ b/src/ravendata/RavenFileReader.java @@ -2,7 +2,6 @@ package ravendata; import java.io.BufferedReader; import java.io.File; -import java.io.FileNotFoundException; import java.io.FileReader; import java.io.IOException; import java.sql.Types; @@ -189,7 +188,7 @@ private int columnErrors; // now find any extra columns hidden away in there. extraColumns = new ArrayList<>(); for (int i = 0; i < columnNames.size(); i++) { - if (isStandard[i] == false) { + if (!isStandard[i]) { extraColumns.add(new RavenColumnInfo(i, columnNames.get(i))); } } diff --git a/src/ravendata/RavenProcess.java b/src/ravendata/RavenProcess.java index 125eef1a..9c0b0d69 100644 --- a/src/ravendata/RavenProcess.java +++ b/src/ravendata/RavenProcess.java @@ -95,7 +95,7 @@ public class RavenProcess extends PamProcess { RavenDataRow prevRow = null; for (RavenDataRow ravenRow : ravenData) { - if (ravenRow.equals(prevRow) == false) { + if (!ravenRow.equals(prevRow)) { /** * A lot of Raven data appear twice, with different view values. * No need to import both. so only doing this if they are different. diff --git a/src/rawDeepLearningClassifier/DLControl.java b/src/rawDeepLearningClassifier/DLControl.java index a90cfa7f..3d89c6e1 100644 --- a/src/rawDeepLearningClassifier/DLControl.java +++ b/src/rawDeepLearningClassifier/DLControl.java @@ -39,10 +39,10 @@ import rawDeepLearningClassifier.dlClassification.delphinID.DelphinIDClassifier; import rawDeepLearningClassifier.dlClassification.genericModel.GenericDLClassifier; import rawDeepLearningClassifier.dlClassification.ketos.KetosClassifier2; import rawDeepLearningClassifier.dlClassification.koogu.KooguClassifier; +import rawDeepLearningClassifier.layoutFX.DLSettingsPane; import rawDeepLearningClassifier.layoutFX.DLSidePanelSwing; import rawDeepLearningClassifier.layoutFX.DLSymbolManager; import rawDeepLearningClassifier.layoutFX.PredictionSymbolManager; -import rawDeepLearningClassifier.layoutFX.DLSettingsPane; import rawDeepLearningClassifier.logging.DLAnnotationType; import rawDeepLearningClassifier.logging.DLDataUnitDatagram; import rawDeepLearningClassifier.logging.DLDetectionBinarySource; @@ -273,7 +273,6 @@ public class DLControl extends PamControlledUnit implements PamSettings { if (this.isViewer) { dlOfflineProcess = new DLOfflineProcess(this); } - ; // register click detector for the javafx display. TDDataProviderRegisterFX.getInstance() @@ -385,7 +384,7 @@ public class DLControl extends PamControlledUnit implements PamSettings { @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { RawDLParams newParameters = (RawDLParams) pamControlledUnitSettings.getSettings(); - ; + rawDLParmas = newParameters.clone(); return true; } @@ -497,6 +496,7 @@ public class DLControl extends PamControlledUnit implements PamSettings { * @param flag. The GUI type flag defined in PAMGuiManager. * @return the GUI for the PamControlledUnit unit. */ + @Override public PamControlledUnitGUI getGUI(int flag) { if (flag == PamGUIManager.FX) { if (rawGUIFX == null) { diff --git a/src/rawDeepLearningClassifier/DLControlGUI.java b/src/rawDeepLearningClassifier/DLControlGUI.java index fdb36c58..4edeefa7 100644 --- a/src/rawDeepLearningClassifier/DLControlGUI.java +++ b/src/rawDeepLearningClassifier/DLControlGUI.java @@ -1,6 +1,5 @@ package rawDeepLearningClassifier; -import PamController.PamController; import PamController.PamControllerInterface; import PamController.SettingsPane; import pamViewFX.PamControlledGUIFX; @@ -30,6 +29,7 @@ public class DLControlGUI extends PamControlledGUIFX { * @param * @return a Pane containing controls to change settings for module. */ + @Override public SettingsPane getSettingsPane(){ dlControl.getSettingsPane().setParams(dlControl.getDLParams()); return dlControl.getSettingsPane(); @@ -49,7 +49,7 @@ public class DLControlGUI extends PamControlledGUIFX { @Override public void notifyGUIChange(int changeType) { switch (changeType) { - case PamController.INITIALIZATION_COMPLETE: + case PamControllerInterface.INITIALIZATION_COMPLETE: break; case PamControllerInterface.CHANGED_PROCESS_SETTINGS: //data source may have potentially changed. e.g. by a datamodelfx Need to set in params. diff --git a/src/rawDeepLearningClassifier/DLDownloadManager.java b/src/rawDeepLearningClassifier/DLDownloadManager.java index 507fd8f4..a6c83ec2 100644 --- a/src/rawDeepLearningClassifier/DLDownloadManager.java +++ b/src/rawDeepLearningClassifier/DLDownloadManager.java @@ -13,7 +13,6 @@ import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.nio.file.StandardCopyOption; import java.util.ArrayList; import java.util.List; import java.util.Map; @@ -324,9 +323,9 @@ public class DLDownloadManager { */ private static File makeFolder(String settingsFolder) { File folder = new File(settingsFolder); - if (folder.exists() == false) { + if (!folder.exists()) { folder.mkdirs(); - if (folder.exists() == false) { + if (!folder.exists()) { return null; } } diff --git a/src/reportWriter/PamReportViewer.java b/src/reportWriter/PamReportViewer.java index 99306896..cfa9e5bc 100644 --- a/src/reportWriter/PamReportViewer.java +++ b/src/reportWriter/PamReportViewer.java @@ -1,17 +1,5 @@ package reportWriter; -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; - -import javax.swing.JFrame; -import javax.swing.JScrollPane; -import javax.swing.JTextPane; -import javax.swing.text.BadLocationException; - // //import sl.docx.DocxDocument; //import sl.docx.DocxEditorKit; diff --git a/src/reportWriter/ReportChart.java b/src/reportWriter/ReportChart.java index efb2d4e4..21181a32 100644 --- a/src/reportWriter/ReportChart.java +++ b/src/reportWriter/ReportChart.java @@ -36,7 +36,6 @@ import javafx.scene.Scene; import javafx.scene.chart.LineChart; import javafx.scene.chart.NumberAxis; import javafx.scene.chart.XYChart; -import javafx.stage.Stage; /** * @author mo55 diff --git a/src/reportWriter/ReportFactory.java b/src/reportWriter/ReportFactory.java index 1deba22e..d4b80ff2 100644 --- a/src/reportWriter/ReportFactory.java +++ b/src/reportWriter/ReportFactory.java @@ -32,7 +32,6 @@ import java.io.ByteArrayOutputStream; import java.io.File; import java.io.IOException; import java.io.InputStream; - import java.util.List; import javax.imageio.ImageIO; @@ -57,7 +56,6 @@ import org.docx4j.wml.Text; import org.docx4j.wml.Tr; import PamView.PamTable; -import PamguardMVC.debug.Debug; /** * Static class containing all of the processing necessary to generate a docx report from a Report object. @@ -250,7 +248,7 @@ public final class ReportFactory { run.getContent().add(text); // run.getContent().add(getLineBreak()); paragraph.getContent().add(run); - mainDoc.addObject(paragraph);; + mainDoc.addObject(paragraph); } } @@ -265,7 +263,7 @@ public final class ReportFactory { run.getContent().add(text); // run.getContent().add(getLineBreak()); paragraph.getContent().add(run); - mainDoc.addObject(paragraph);; + mainDoc.addObject(paragraph); } Tbl newTable = processTable(aSection.getTable(), wordPackage); if (newTable!=null) { diff --git a/src/reportWriter/ReportWriterTest.java b/src/reportWriter/ReportWriterTest.java index d1bb1d5f..a1b59048 100644 --- a/src/reportWriter/ReportWriterTest.java +++ b/src/reportWriter/ReportWriterTest.java @@ -29,15 +29,8 @@ import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; -import javax.swing.JTable; import PamView.PamTable; -import javafx.scene.Scene; -import javafx.scene.chart.LineChart; -import javafx.scene.chart.NumberAxis; -import javafx.scene.chart.XYChart; -import javafx.stage.Stage; -import javafx.application.Application; /** * Class that tests out the report generation diff --git a/src/rocca/AttTest.java b/src/rocca/AttTest.java index 714b8e70..d1a6a53a 100644 --- a/src/rocca/AttTest.java +++ b/src/rocca/AttTest.java @@ -3,9 +3,11 @@ package rocca; import java.io.BufferedInputStream; import java.io.FileInputStream; + import javax.help.HelpSet; import javax.help.JHelpContentViewer; import javax.swing.ProgressMonitorInputStream; + import weka.classifiers.trees.RandomForest; import weka.core.Instances; diff --git a/src/rocca/RoccaAxis.java b/src/rocca/RoccaAxis.java index a5fa0f14..66b42558 100644 --- a/src/rocca/RoccaAxis.java +++ b/src/rocca/RoccaAxis.java @@ -23,12 +23,14 @@ package rocca; -import Layout.PamAxis; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Rectangle; + import javax.swing.JComponent; +import Layout.PamAxis; + /** * * @author Michael Oswald diff --git a/src/rocca/RoccaClassifier.java b/src/rocca/RoccaClassifier.java index 20acb872..3ae367ad 100644 --- a/src/rocca/RoccaClassifier.java +++ b/src/rocca/RoccaClassifier.java @@ -23,9 +23,6 @@ package rocca; -import PamUtils.PamCalendar; -import PamView.dialog.warn.WarnOnce; - import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; @@ -35,6 +32,8 @@ import java.util.Locale; import javax.swing.ProgressMonitorInputStream; +import PamUtils.PamCalendar; +import PamView.dialog.warn.WarnOnce; import weka.classifiers.AbstractClassifier; import weka.core.DenseInstance; import weka.core.Instance; @@ -414,7 +413,7 @@ public class RoccaClassifier { else { String fname = roccaControl.roccaParameters.roccaClassifierModelFilename.getAbsolutePath(); File f = new File(fname); - if (f.exists() == false) { + if (!f.exists()) { WarnOnce.showWarning(roccaControl.getUnitName(), "Rocca whistle classifier file cannot be found at " + fname, WarnOnce.WARNING_MESSAGE); roccaControl.roccaParameters.setClassifyWhistles(false); } @@ -464,7 +463,7 @@ public class RoccaClassifier { else { String fname = roccaControl.roccaParameters.roccaClickClassifierModelFilename.getAbsolutePath(); File f = new File(fname); - if (f.exists() == false) { + if (!f.exists()) { WarnOnce.showWarning(roccaControl.getUnitName(), "Rocca click classifier file cannot be found at " + fname, WarnOnce.WARNING_MESSAGE); roccaControl.roccaParameters.setClassifyClicks(false); } @@ -521,7 +520,7 @@ public class RoccaClassifier { else { String fname = roccaControl.roccaParameters.roccaEventClassifierModelFilename.getAbsolutePath(); File f = new File(fname); - if (f.exists() == false) { + if (!f.exists()) { WarnOnce.showWarning(roccaControl.getUnitName(), "Rocca events classifier file cannot be found at " + fname, WarnOnce.WARNING_MESSAGE); roccaControl.roccaParameters.setClassifyEvents(false); } diff --git a/src/rocca/RoccaClassifyThisClick.java b/src/rocca/RoccaClassifyThisClick.java index 12562b34..275ef9b6 100644 --- a/src/rocca/RoccaClassifyThisClick.java +++ b/src/rocca/RoccaClassifyThisClick.java @@ -31,8 +31,6 @@ import java.io.FileWriter; import java.io.IOException; import java.util.EnumMap; -import javax.swing.JFileChooser; - import PamUtils.PamCalendar; diff --git a/src/rocca/RoccaClassifyThisEvent.java b/src/rocca/RoccaClassifyThisEvent.java index c03ddf2f..5d46f945 100644 --- a/src/rocca/RoccaClassifyThisEvent.java +++ b/src/rocca/RoccaClassifyThisEvent.java @@ -29,11 +29,6 @@ import java.io.FileNotFoundException; import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; -import java.util.EnumMap; - -import javax.swing.JFileChooser; - -import PamUtils.PamCalendar; diff --git a/src/rocca/RoccaClickEventList.java b/src/rocca/RoccaClickEventList.java index f2524794..be97a29a 100644 --- a/src/rocca/RoccaClickEventList.java +++ b/src/rocca/RoccaClickEventList.java @@ -20,10 +20,27 @@ */ package rocca; -import javax.swing.*; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; -import java.awt.*; -import java.awt.event.*; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JList; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.ListSelectionModel; +import javax.swing.SwingConstants; /** * Creates a modal dialog box containing the current Click Events, and allows the user @@ -94,7 +111,8 @@ public class RoccaClickEventList extends JDialog implements ActionListener { //of the list. An alternative would be to set the unitIncrement //of the JScrollBar to a fixed value. You wouldn't get the nice //aligned scrolling, but it should work. - public int getScrollableUnitIncrement(Rectangle visibleRect, + @Override + public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { int row; @@ -165,7 +183,8 @@ public class RoccaClickEventList extends JDialog implements ActionListener { } //Handle clicks on the buttons. - public void actionPerformed(ActionEvent e) { + @Override + public void actionPerformed(ActionEvent e) { if (e.getSource()==analyzeButton) { RoccaClickEventList.value = list.getSelectedIndices(); RoccaClickEventList.dialog.setVisible(false); diff --git a/src/rocca/RoccaClickTypeDialog.java b/src/rocca/RoccaClickTypeDialog.java index d8e05cc6..4e8d1dc7 100644 --- a/src/rocca/RoccaClickTypeDialog.java +++ b/src/rocca/RoccaClickTypeDialog.java @@ -20,10 +20,29 @@ */ package rocca; -import javax.swing.*; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; -import java.awt.*; -import java.awt.event.*; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JList; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.ListSelectionModel; +import javax.swing.SwingConstants; /** * Use this modal dialog to let the user choose one string from a long @@ -96,7 +115,8 @@ public class RoccaClickTypeDialog extends JDialog implements ActionListener { //of the list. An alternative would be to set the unitIncrement //of the JScrollBar to a fixed value. You wouldn't get the nice //aligned scrolling, but it should work. - public int getScrollableUnitIncrement(Rectangle visibleRect, + @Override + public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction) { int row; @@ -124,7 +144,8 @@ public class RoccaClickTypeDialog extends JDialog implements ActionListener { list.setLayoutOrientation(JList.VERTICAL); list.setVisibleRowCount(-1); list.addMouseListener(new MouseAdapter() { - public void mouseClicked(MouseEvent e) { + @Override + public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { setButton.doClick(); //emulate button click } @@ -165,7 +186,8 @@ public class RoccaClickTypeDialog extends JDialog implements ActionListener { } //Handle clicks on the Set and Cancel buttons. - public void actionPerformed(ActionEvent e) { + @Override + public void actionPerformed(ActionEvent e) { if ("Set".equals(e.getActionCommand())) { RoccaClickTypeDialog.value = list.getSelectedIndices(); } diff --git a/src/rocca/RoccaContour.java b/src/rocca/RoccaContour.java index 81ba39f7..fe6d586b 100644 --- a/src/rocca/RoccaContour.java +++ b/src/rocca/RoccaContour.java @@ -23,17 +23,14 @@ package rocca; +import java.util.ListIterator; + import PamUtils.PamUtils; import PamUtils.complex.ComplexArray; import PamguardMVC.PamRawDataBlock; import PamguardMVC.RawDataUnavailableException; -import fftManager.Complex; import fftManager.FFTDataBlock; import fftManager.FFTDataUnit; -import java.util.ListIterator; -import whistleDetector.ShapeDataUnit; -import whistleDetector.WhistlePeak; -import whistleDetector.WhistleShape; /** * diff --git a/src/rocca/RoccaContourDataBlock.java b/src/rocca/RoccaContourDataBlock.java index 1672c93d..2227d9a2 100644 --- a/src/rocca/RoccaContourDataBlock.java +++ b/src/rocca/RoccaContourDataBlock.java @@ -23,18 +23,18 @@ package rocca; -import Acquisition.AcquisitionProcess; -import Acquisition.FileInputSystem; -import PamController.PamController; -import PamUtils.PamCalendar; -import PamguardMVC.PamDataBlock; -import PamguardMVC.PamProcess; import java.io.File; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.EnumMap; +import Acquisition.AcquisitionProcess; +import Acquisition.FileInputSystem; +import PamController.PamController; +import PamUtils.PamCalendar; +import PamguardMVC.PamDataBlock; +import PamguardMVC.PamProcess; import clickDetector.ClickDetection; import clickDetector.ClickClassifiers.basicSweep.ZeroCrossingStats; @@ -912,7 +912,7 @@ public class RoccaContourDataBlock extends PamDataBlock { // 2017/11/30 synchronize to make sure that the data doesn't accidentally get erased halfway through the calc double[] waveData; synchronized (clickDetection) { - waveData = clickDetection.applyHanningWindow(clickDetection.getWaveData()[0]); + waveData = ClickDetection.applyHanningWindow(clickDetection.getWaveData()[0]); } // calculate the peak frequency @@ -1003,7 +1003,7 @@ public class RoccaContourDataBlock extends PamDataBlock { if (clickNoise != null) { double[] noiseData; synchronized (clickNoise) { - noiseData = clickDetection.applyHanningWindow(clickNoise.getWaveData()[0]); + noiseData = ClickDetection.applyHanningWindow(clickNoise.getWaveData()[0]); } double sumNoise = 0; for (int i = 0; i < noiseData.length; i++) @@ -1348,7 +1348,7 @@ public class RoccaContourDataBlock extends PamDataBlock { // serialVersionUI=22 2015/09/09 if (PamController.getInstance().getRunMode() == PamController.RUN_PAMVIEW) { boolean success = roccaProcess.rldb.saveViewerData(); - if (success == false) { + if (!success) { System.out.println("RoccaContourDataBlock: Unable to save info to database"); // } else { // System.out.println("RoccaContourDataBlock: info saved to database"); @@ -1378,7 +1378,7 @@ public class RoccaContourDataBlock extends PamDataBlock { try { AcquisitionProcess sourceProcess = (AcquisitionProcess) roccaProcess.getSourceProcess(); Acquisition.DaqSystem daqSystem = sourceProcess.getAcquisitionControl().findDaqSystem(null); - if (daqSystem != null & daqSystem.isRealTime() == false) { + if (daqSystem != null & !daqSystem.isRealTime()) { // assume it's a file name. // MIGHT NOT WORK IF THIS IS A LINE INPUT - TEST Acquisition.FileInputSystem fileSystem = (FileInputSystem) daqSystem; diff --git a/src/rocca/RoccaContourDataUnit.java b/src/rocca/RoccaContourDataUnit.java index 60714e07..76fabd37 100644 --- a/src/rocca/RoccaContourDataUnit.java +++ b/src/rocca/RoccaContourDataUnit.java @@ -24,7 +24,6 @@ package rocca; import PamDetection.PamDetection; -import PamguardMVC.AcousticDataUnit; import PamguardMVC.PamDataUnit; /** diff --git a/src/rocca/RoccaControl.java b/src/rocca/RoccaControl.java index c3881b17..fa9be449 100644 --- a/src/rocca/RoccaControl.java +++ b/src/rocca/RoccaControl.java @@ -21,6 +21,15 @@ package rocca; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.Serializable; + +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; + import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; import PamController.PamController; @@ -31,19 +40,6 @@ import PamUtils.PamCalendar; import PamView.PamGui; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; - -import java.awt.Frame; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.Serializable; - -import javax.swing.AbstractAction; -import javax.swing.JMenu; -import javax.swing.JMenuBar; -import javax.swing.JMenuItem; -import javax.swing.event.MenuEvent; -import javax.swing.event.MenuListener; - import clickDetector.ClickControl; import clickDetector.ClickDetection; import clickDetector.offlineFuncs.OfflineEventDataBlock; @@ -300,6 +296,7 @@ public class RoccaControl extends PamControlledUnit implements PamSettings { // class CheckRoccaMenuItem implements MenuListener { class CheckRoccaMenuItem implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { createClickEventDialog(); } @@ -383,6 +380,7 @@ public class RoccaControl extends PamControlledUnit implements PamSettings { class SelectClickEvent implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { JMenuItem source = (JMenuItem)(e.getSource()); int index = (int) source.getClientProperty("index"); @@ -400,6 +398,7 @@ public class RoccaControl extends PamControlledUnit implements PamSettings { this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { RoccaParameters newParams = RoccaParametersDialog.showDialog (parentFrame, roccaParameters, roccaControl); @@ -476,15 +475,18 @@ public class RoccaControl extends PamControlledUnit implements PamSettings { } // Serializable methods - public Serializable getSettingsReference() { + @Override + public Serializable getSettingsReference() { return roccaParameters; } - public long getSettingsVersion() { + @Override + public long getSettingsVersion() { return RoccaParameters.serialVersionUID; } - public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { + @Override + public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { this.roccaParameters = ((RoccaParameters) pamControlledUnitSettings .getSettings()).clone(); return true; diff --git a/src/rocca/RoccaDataUnit.java b/src/rocca/RoccaDataUnit.java index 8839b5fe..4f339542 100644 --- a/src/rocca/RoccaDataUnit.java +++ b/src/rocca/RoccaDataUnit.java @@ -22,7 +22,6 @@ package rocca; import PamDetection.PamDetection; -import PamguardMVC.AcousticDataUnit; import PamguardMVC.PamDataUnit; diff --git a/src/rocca/RoccaDetectionLogger.java b/src/rocca/RoccaDetectionLogger.java index d0736d8f..e66f1a54 100644 --- a/src/rocca/RoccaDetectionLogger.java +++ b/src/rocca/RoccaDetectionLogger.java @@ -30,15 +30,14 @@ package rocca; -import generalDatabase.PamTableItem; -import generalDatabase.SQLLogging; -import generalDatabase.SQLTypes; - import java.sql.Types; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import generalDatabase.PamTableDefinition; +import generalDatabase.PamTableItem; +import generalDatabase.SQLLogging; +import generalDatabase.SQLTypes; /** * Databse logging information for Rocca statistics. diff --git a/src/rocca/RoccaFixParams.java b/src/rocca/RoccaFixParams.java index 00791d03..803a0e05 100644 --- a/src/rocca/RoccaFixParams.java +++ b/src/rocca/RoccaFixParams.java @@ -31,8 +31,6 @@ import java.io.IOException; import javax.swing.JFileChooser; -import PamUtils.PamCalendar; - /** @@ -98,7 +96,8 @@ public class RoccaFixParams { // listOfFiles[0] = new File(dirIn, csvIn); listOfFiles = this.dir.listFiles(new FilenameFilter() { - public boolean accept(File dir, String name) { + @Override + public boolean accept(File dir, String name) { return name.toLowerCase().endsWith(".csv"); } }); diff --git a/src/rocca/RoccaGraphics.java b/src/rocca/RoccaGraphics.java index 6b82ef0c..88431708 100644 --- a/src/rocca/RoccaGraphics.java +++ b/src/rocca/RoccaGraphics.java @@ -21,6 +21,7 @@ package rocca; import java.awt.Color; + import PamView.PamDetectionOverlayGraphics; import PamView.PamSymbol; import PamView.PamSymbolType; diff --git a/src/rocca/RoccaLoggingDataUnit.java b/src/rocca/RoccaLoggingDataUnit.java index 77afa850..56927f94 100644 --- a/src/rocca/RoccaLoggingDataUnit.java +++ b/src/rocca/RoccaLoggingDataUnit.java @@ -21,11 +21,10 @@ package rocca; -import PamguardMVC.AcousticDataUnit; -import PamguardMVC.PamDataUnit; import java.util.EnumMap; import PamDetection.PamDetection; +import PamguardMVC.PamDataUnit; /** diff --git a/src/rocca/RoccaParameters.java b/src/rocca/RoccaParameters.java index c7db4aae..88478740 100644 --- a/src/rocca/RoccaParameters.java +++ b/src/rocca/RoccaParameters.java @@ -29,8 +29,8 @@ import java.lang.reflect.Field; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; +import PamModel.parametermanager.PrivatePamParameterData; /** * Parameters for Rocca
diff --git a/src/rocca/RoccaParametersDialog.java b/src/rocca/RoccaParametersDialog.java index fb74da29..bb3797d6 100644 --- a/src/rocca/RoccaParametersDialog.java +++ b/src/rocca/RoccaParametersDialog.java @@ -22,32 +22,11 @@ package rocca; import java.awt.BorderLayout; +import java.awt.Dimension; import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.GridLayout; -import java.util.ArrayList; -import java.util.Objects; -import java.util.Vector; - -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.border.EmptyBorder; -import javax.swing.border.TitledBorder; -import javax.swing.filechooser.FileNameExtensionFilter; - -import GPS.GPSControl; -import GPS.GpsDataUnit; -import fftManager.FFTDataUnit; -import warnings.PamWarning; -import warnings.WarningSystem; -import PamController.PamController; -import PamUtils.PamFileChooser; -import PamView.dialog.PamDialog; -import PamView.dialog.SourcePanel; -import PamguardMVC.PamDataBlock; -import java.awt.Dimension; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -58,6 +37,10 @@ import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.FileReader; +import java.util.ArrayList; +import java.util.Objects; +import java.util.Vector; + import javax.swing.Box; import javax.swing.BoxLayout; import javax.swing.DefaultComboBoxModel; @@ -65,19 +48,35 @@ import javax.swing.GroupLayout; import javax.swing.JButton; import javax.swing.JCheckBox; import javax.swing.JComboBox; -import javax.swing.JRadioButton; import javax.swing.JFileChooser; +import javax.swing.JLabel; +import javax.swing.JPanel; +import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JTabbedPane; import javax.swing.JTextArea; +import javax.swing.JTextField; import javax.swing.ProgressMonitorInputStream; import javax.swing.ScrollPaneConstants; import javax.swing.SwingConstants; +import javax.swing.border.EmptyBorder; import javax.swing.border.EtchedBorder; +import javax.swing.border.TitledBorder; +import javax.swing.filechooser.FileNameExtensionFilter; +import GPS.GPSControl; +import GPS.GpsDataUnit; +import PamController.PamController; +import PamUtils.PamFileChooser; +import PamView.dialog.PamDialog; +import PamView.dialog.SourcePanel; +import PamguardMVC.PamDataBlock; import clickDetector.ClickControl; import clickDetector.ClickDetection; import clickDetector.NoiseDataBlock; +import fftManager.FFTDataUnit; +import warnings.PamWarning; +import warnings.WarningSystem; import weka.core.Attribute; import weka.core.Instances; import weka.core.SerializationHelper; @@ -329,7 +328,7 @@ public class RoccaParametersDialog extends PamDialog implements ActionListener, c.anchor=GridBagConstraints.LINE_START; c.fill=GridBagConstraints.NONE; clickSourceSubPanel.setBorder(new TitledBorder("Click Detector Data source")); - clickSourceSubPanel.add(new JLabel("Click Detector Source", JLabel.LEFT),c); + clickSourceSubPanel.add(new JLabel("Click Detector Source", SwingConstants.LEFT),c); c.gridx++; c.fill=GridBagConstraints.HORIZONTAL; clickSourceSubPanel.add(clickSourcePanel.getPanel(),c); @@ -344,7 +343,7 @@ public class RoccaParametersDialog extends PamDialog implements ActionListener, c.gridx=0; c.gridwidth=2; clickTypeNote = new JLabel("

Warning - one or more Click Types must be defined " + - " in the Click Classifier before you can use Rocca with the Click Detector
", JLabel.CENTER); + " in the Click Classifier before you can use Rocca with the Click Detector", SwingConstants.CENTER); clickSourceSubPanel.add(clickTypeNote,c); c.gridy++; clickTypeDialog = new JButton("Select Click Types to analyze"); @@ -866,7 +865,8 @@ public class RoccaParametersDialog extends PamDialog implements ActionListener, setDialogComponent(tabbedPane); } - public void actionPerformed(ActionEvent e) { + @Override + public void actionPerformed(ActionEvent e) { if (e.getSource() == outputDirectoryButton) { selectDirectory(); } else if (e.getSource() == outputContourStatsFileButton) { @@ -1720,7 +1720,7 @@ public class RoccaParametersDialog extends PamDialog implements ActionListener, } } else if (e.getSource() == gpsButton) { if (e.getStateChange()==ItemEvent.SELECTED) { - roccaParameters.setUseGPS(true);; + roccaParameters.setUseGPS(true); } else { roccaParameters.setUseGPS(false); } diff --git a/src/rocca/RoccaProcess.java b/src/rocca/RoccaProcess.java index 7abe2577..3da20d49 100644 --- a/src/rocca/RoccaProcess.java +++ b/src/rocca/RoccaProcess.java @@ -23,28 +23,6 @@ package rocca; -import Acquisition.AcquisitionControl; -import Acquisition.AcquisitionProcess; -import Acquisition.DaqStatusDataUnit; -import GPS.GPSDataBlock; -import GPS.GpsDataUnit; -import PamController.PamControlledUnit; -import PamController.PamController; -import PamDetection.RawDataUnit; -import PamUtils.FileParts; -import PamUtils.PamCalendar; -import PamUtils.PamUtils; -import PamView.dialog.warn.WarnOnce; -import PamguardMVC.PamDataBlock; -import PamguardMVC.PamDataUnit; -import PamguardMVC.PamObservable; -import PamguardMVC.PamProcess; -import PamguardMVC.PamRawDataBlock; -import PamguardMVC.RawDataUnavailableException; -import PamModel.PamModel; -import Spectrogram.SpectrogramDisplay; -import fftManager.FFTDataBlock; - import java.io.BufferedWriter; import java.io.File; import java.io.FileNotFoundException; @@ -61,11 +39,31 @@ import java.util.ListIterator; import javax.swing.JOptionPane; +import Acquisition.AcquisitionControl; +import Acquisition.AcquisitionProcess; +import Acquisition.DaqStatusDataUnit; +import GPS.GPSDataBlock; +import GPS.GpsDataUnit; +import PamController.PamControlledUnit; +import PamController.PamController; +import PamDetection.RawDataUnit; +import PamModel.PamModel; +import PamUtils.FileParts; +import PamUtils.PamCalendar; +import PamUtils.PamUtils; +import PamView.dialog.warn.WarnOnce; +import PamguardMVC.PamDataBlock; +import PamguardMVC.PamDataUnit; +import PamguardMVC.PamObservable; +import PamguardMVC.PamProcess; +import PamguardMVC.PamRawDataBlock; +import PamguardMVC.RawDataUnavailableException; +import Spectrogram.SpectrogramDisplay; import clickDetector.ClickDataBlock; import clickDetector.ClickDetection; import clickDetector.NoiseDataBlock; import clickDetector.TrackedClickDataBlock; -import wavFiles.WavFile; +import fftManager.FFTDataBlock; import wavFiles.WavFileWriter; import whistlesAndMoans.AbstractWhistleDataBlock; import whistlesAndMoans.AbstractWhistleDataUnit; @@ -1126,7 +1124,7 @@ public class RoccaProcess extends PamProcess { RoccaContourDataUnit rcdu = null; int numPoints = rcdb.getUnitsCount(); for (int i = 0; i < numPoints; i++) { - rcdu = rcdb.getDataUnit(i, RoccaContourDataBlock.REFERENCE_CURRENT); + rcdu = rcdb.getDataUnit(i, PamDataBlock.REFERENCE_CURRENT); if (rcdu.getPeakFreq() != RoccaParameters.NO_CONTOUR_HERE ) { String contourPoints = rcdu.getTime() + "," + rcdu.getPeakFreq() + "," + diff --git a/src/rocca/RoccaSidePanel.java b/src/rocca/RoccaSidePanel.java index 35a8fa55..f209217c 100644 --- a/src/rocca/RoccaSidePanel.java +++ b/src/rocca/RoccaSidePanel.java @@ -23,27 +23,10 @@ package rocca; -import PamUtils.PamCalendar; import java.awt.Color; +import java.awt.Dimension; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; - -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JTextField; -import javax.swing.border.TitledBorder; - -import PamView.PamColors; -import PamView.PamSidePanel; -import PamView.PamColors.PamColor; -import PamView.panel.PamBorderPanel; -import PamguardMVC.PamDataBlock; -import PamguardMVC.PamDataUnit; -import PamguardMVC.PamObservable; -import PamguardMVC.PamObserver; -import PamguardMVC.PamObserverAdapter; - -import java.awt.Dimension; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -55,15 +38,26 @@ import java.io.FileReader; import java.io.FileWriter; import java.io.FilenameFilter; import java.io.IOException; -import java.lang.String; import java.util.Calendar; import java.util.Timer; import java.util.TimerTask; -import java.util.concurrent.TimeUnit; import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JLabel; import javax.swing.JOptionPane; +import javax.swing.JTextField; import javax.swing.SwingConstants; +import javax.swing.border.TitledBorder; + +import PamUtils.PamCalendar; +import PamView.PamColors; +import PamView.PamColors.PamColor; +import PamView.PamSidePanel; +import PamView.panel.PamBorderPanel; +import PamguardMVC.PamDataBlock; +import PamguardMVC.PamObservable; +import PamguardMVC.PamObserverAdapter; public class RoccaSidePanel extends PamObserverAdapter implements PamSidePanel { @@ -154,7 +148,7 @@ public class RoccaSidePanel extends PamObserverAdapter implements PamSidePanel setLayout(gb); /* if we've loaded a classifier, draw the species list */ - if (roccaControl.roccaProcess.isClassifierLoaded() == true) { + if (roccaControl.roccaProcess.isClassifierLoaded()) { drawThePanel(); /* otherwise, warn the user that no classifier has been loaded */ @@ -211,7 +205,8 @@ public class RoccaSidePanel extends PamObserverAdapter implements PamSidePanel prevSight = new JButton("<"); addComponent(this, prevSight, c ); prevSight.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent evt) { + @Override + public void actionPerformed(ActionEvent evt) { prevSighting(); } }); @@ -220,7 +215,8 @@ public class RoccaSidePanel extends PamObserverAdapter implements PamSidePanel nextSight = new JButton(">"); addComponent(this, nextSight, c); nextSight.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent evt) { + @Override + public void actionPerformed(ActionEvent evt) { nextSighting(); } }); @@ -274,7 +270,8 @@ public class RoccaSidePanel extends PamObserverAdapter implements PamSidePanel encounterID.setHorizontalAlignment(SwingConstants.CENTER); encounterID.setEditable(true); encounterID.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent evt) { + @Override + public void actionPerformed(ActionEvent evt) { saveNewEncounterID(); } }); @@ -291,7 +288,8 @@ public class RoccaSidePanel extends PamObserverAdapter implements PamSidePanel speciesID.setHorizontalAlignment(SwingConstants.CENTER); speciesID.setEditable(true); speciesID.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent evt) { + @Override + public void actionPerformed(ActionEvent evt) { saveNewSpeciesID(); } }); @@ -304,7 +302,8 @@ public class RoccaSidePanel extends PamObserverAdapter implements PamSidePanel renameSighting = new JButton("Rename Encounter"); addComponent(this, renameSighting, c); renameSighting.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent evt) { + @Override + public void actionPerformed(ActionEvent evt) { // String oldNum = currentUnit.getSightNum(); // currentUnit.setSightNum(RoccaSightingDataUnit.NONE); // String dummy = addASighting(false); @@ -319,7 +318,8 @@ public class RoccaSidePanel extends PamObserverAdapter implements PamSidePanel classifySighting = new JButton("Classify Encounter"); addComponent(this, classifySighting, c); classifySighting.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent evt) { + @Override + public void actionPerformed(ActionEvent evt) { classifySighting(); } }); @@ -327,7 +327,8 @@ public class RoccaSidePanel extends PamObserverAdapter implements PamSidePanel saveSighting = new JButton("Save Encounter Now"); addComponent(this, saveSighting, c); saveSighting.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent evt) { + @Override + public void actionPerformed(ActionEvent evt) { saveSighting(); } }); @@ -343,7 +344,8 @@ public class RoccaSidePanel extends PamObserverAdapter implements PamSidePanel newSightingNum = new JButton("New Encounter"); addComponent(this, newSightingNum, c); newSightingNum.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent evt) { + @Override + public void actionPerformed(ActionEvent evt) { String dummy = addASighting(false); } }); @@ -527,7 +529,8 @@ public class RoccaSidePanel extends PamObserverAdapter implements PamSidePanel public SightNumFilter(String sNum) { this.sNum = sNum + "-"; } - public boolean accept(File dir, String name) { + @Override + public boolean accept(File dir, String name) { return name.startsWith(sNum); } } @@ -1159,17 +1162,20 @@ public class RoccaSidePanel extends PamObserverAdapter implements PamSidePanel speciesID.setText(roccaControl.roccaParameters.getNotesKnownSpecies()); } + @Override public JComponent getPanel() { return sidePanel; } + @Override public void rename(String newName) { titledBorder.setTitle(newName); sidePanel.repaint(); } + @Override public String getObserverName() { return "Rocca side panel"; } @@ -1393,6 +1399,7 @@ public class RoccaSidePanel extends PamObserverAdapter implements PamSidePanel this.currentUnit = currentUnit; } + @Override public long getRequiredDataHistory(PamObservable o, Object arg) { return 60000; } diff --git a/src/rocca/RoccaSightingDataUnit.java b/src/rocca/RoccaSightingDataUnit.java index fc99798c..66b42778 100644 --- a/src/rocca/RoccaSightingDataUnit.java +++ b/src/rocca/RoccaSightingDataUnit.java @@ -23,20 +23,18 @@ package rocca; -import PamDetection.PamDetection; -import PamguardMVC.AcousticDataUnit; -import PamguardMVC.PamDataUnit; - import java.text.DecimalFormat; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.TreeMap; import javax.swing.JLabel; +import PamDetection.PamDetection; +import PamguardMVC.PamDataUnit; + /** * Container holding information about the current sighting, including pointers * to the contours already measured diff --git a/src/rocca/RoccaSpecPopUp.java b/src/rocca/RoccaSpecPopUp.java index 7dc49431..d1c69a81 100644 --- a/src/rocca/RoccaSpecPopUp.java +++ b/src/rocca/RoccaSpecPopUp.java @@ -22,25 +22,11 @@ package rocca; -//import com.csvreader.CsvReader; -import Acquisition.AcquisitionProcess; -import PamController.PamController; -import PamUtils.FileParts; -import PamUtils.PamCalendar; -import PamUtils.PamUtils; -import PamUtils.complex.ComplexArray; -import PamView.dialog.warn.WarnOnce; -import PamguardMVC.PamRawDataBlock; -import PamguardMVC.RawDataUnavailableException; -import Spectrogram.SpectrogramDisplay; -import fftManager.Complex; -import fftManager.FFTDataBlock; -import fftManager.FFTDataUnit; import java.awt.Cursor; import java.awt.Dimension; +import java.awt.Frame; import java.awt.Point; import java.awt.event.ActionEvent; - import java.awt.geom.Point2D; import java.io.BufferedWriter; import java.io.File; @@ -53,19 +39,32 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Calendar; + +import javax.swing.GroupLayout; +import javax.swing.GroupLayout.Alignment; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JScrollBar; import javax.swing.JToggleButton; -import javax.swing.SpinnerNumberModel; -import wavFiles.WavFile; -import wavFiles.WavFileWriter; - -import javax.swing.GroupLayout.Alignment; -import javax.swing.GroupLayout; import javax.swing.LayoutStyle.ComponentPlacement; +import javax.swing.SpinnerNumberModel; import javax.swing.SwingConstants; -import javax.swing.JButton; + +//import com.csvreader.CsvReader; +import Acquisition.AcquisitionProcess; +import PamController.PamController; +import PamUtils.FileParts; +import PamUtils.PamCalendar; +import PamUtils.PamUtils; +import PamUtils.complex.ComplexArray; +import PamView.dialog.warn.WarnOnce; +import PamguardMVC.PamDataBlock; +import PamguardMVC.PamRawDataBlock; +import PamguardMVC.RawDataUnavailableException; +import Spectrogram.SpectrogramDisplay; +import fftManager.FFTDataBlock; +import fftManager.FFTDataUnit; +import wavFiles.WavFileWriter; /** * @@ -444,7 +443,7 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { */ double[][] d = new double[numTimeBins][numFreqBins]; for(int currentTimeBin = 0; currentTimeBin < numTimeBins; currentTimeBin++) { - fftUnit = fftData.getDataUnit(currentTimeBin, FFTDataBlock.REFERENCE_CURRENT); + fftUnit = fftData.getDataUnit(currentTimeBin, PamDataBlock.REFERENCE_CURRENT); fftVals = fftUnit.getFftData(); timeBins[currentTimeBin] = fftUnit.getTimeMilliseconds(); @@ -481,7 +480,7 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { timeBin = timeBins.length; for (int j=0; j=roccaContourDataBlock.getDataUnit - (i, FFTDataBlock.REFERENCE_CURRENT).getTimeMilliseconds()) { + (i, PamDataBlock.REFERENCE_CURRENT).getTimeMilliseconds()) { timeBin = j; break; } @@ -492,7 +491,7 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { * frequency bin to the constant NO_CONTOUR_HERE */ if (roccaContourDataBlock.getDataUnit - (i, FFTDataBlock.REFERENCE_CURRENT).getPeakFreq() + (i, PamDataBlock.REFERENCE_CURRENT).getPeakFreq() == RoccaContour.OUTOFRANGE) { freqBin = RoccaParameters.NO_CONTOUR_HERE; @@ -501,7 +500,7 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { for (int j=0; j=roccaContourDataBlock.getDataUnit - (i, FFTDataBlock.REFERENCE_CURRENT).getPeakFreq()) { + (i, PamDataBlock.REFERENCE_CURRENT).getPeakFreq()) { freqBin = j; break; } @@ -572,7 +571,8 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { zoomIn.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Zoom-in 16.png"))); // NOI18N zoomIn.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { zoomInActionPerformed(evt); } }); @@ -583,7 +583,8 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { classify.setEnabled(false); classify.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); classify.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { classifyActionPerformed(evt); } }); @@ -616,59 +617,69 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { zoomOut.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Zoom-out 16.png"))); // NOI18N zoomOut.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { zoomOutActionPerformed(evt); } }); reset.setText("Reset"); reset.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { resetActionPerformed(evt); } }); brightDec.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Brightness dec 16.png"))); // NOI18N brightDec.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { brightDecActionPerformed(evt); } }); brightInc.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/Brightness inc 16.png"))); // NOI18N brightInc.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { brightIncActionPerformed(evt); } }); contrastDec.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/contrast dec 16.png"))); // NOI18N contrastDec.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { contrastDecActionPerformed(evt); } }); contrastInc.setIcon(new javax.swing.ImageIcon(getClass().getResource("/images/contrast inc 16.png"))); // NOI18N contrastInc.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { contrastIncActionPerformed(evt); } }); scroller.addMouseListener(new java.awt.event.MouseAdapter() { - public void mousePressed(java.awt.event.MouseEvent evt) { + @Override + public void mousePressed(java.awt.event.MouseEvent evt) { scrollerMousePressed(evt); } - public void mouseReleased(java.awt.event.MouseEvent evt) { + @Override + public void mouseReleased(java.awt.event.MouseEvent evt) { scrollerMouseReleased(evt); } }); scroller.addMouseMotionListener(new java.awt.event.MouseMotionAdapter() { - public void mouseDragged(java.awt.event.MouseEvent evt) { + @Override + public void mouseDragged(java.awt.event.MouseEvent evt) { scrollerMouseDragged(evt); } - public void mouseMoved(java.awt.event.MouseEvent evt) { + @Override + public void mouseMoved(java.awt.event.MouseEvent evt) { scrollerMouseMoved(evt); } }); @@ -676,14 +687,16 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { saveExit.setText("Save as encounter "); saveExit.setEnabled(false); saveExit.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { saveExitActionPerformed(evt); } }); discardExit.setText("Discard and Exit"); discardExit.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { discardExitActionPerformed(evt); } }); @@ -692,7 +705,8 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { noiseSensSpinner.setEnabled(false); noiseSensSpinner.addChangeListener(new javax.swing.event.ChangeListener() { - public void stateChanged(javax.swing.event.ChangeEvent evt) { + @Override + public void stateChanged(javax.swing.event.ChangeEvent evt) { noiseSensSpinnerStateChanged(evt); } }); @@ -703,7 +717,8 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { resetContour.setText("Reset Contour"); resetContour.setEnabled(false); resetContour.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { resetContourActionPerformed(evt); } }); @@ -711,7 +726,8 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { saveNewNameExit.setText("Save as diff encounter"); saveNewNameExit.setEnabled(false); saveNewNameExit.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { saveNewNameExitActionPerformed(evt); } }); @@ -719,7 +735,8 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { saveWavOnly.setText("Save WAV discard class"); saveWavOnly.setEnabled(false); saveWavOnly.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { saveWavOnlyActionPerformed(evt); } }); @@ -727,7 +744,8 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { undoLastMove.setText("Undo Last Move"); undoLastMove.setEnabled(false); undoLastMove.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { undoLastMoveActionPerformed(evt); } }); @@ -735,7 +753,8 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { recalcContour.setText("Recalc Contour"); recalcContour.setEnabled(false); recalcContour.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { recalcContourActionPerformed(evt); } }); @@ -745,11 +764,12 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { highpassLbl.setText("Highpass Filter"); highpassLbl.setEnabled(false); - highPass.setHorizontalAlignment(javax.swing.JTextField.RIGHT); + highPass.setHorizontalAlignment(SwingConstants.RIGHT); highPass.setText("0"); highPass.setEnabled(false); highPass.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { highPassActionPerformed(evt); } }); @@ -760,11 +780,12 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { lowpassLbl.setText("Lowpass Filter"); lowpassLbl.setEnabled(false); - lowPass.setHorizontalAlignment(javax.swing.JTextField.RIGHT); + lowPass.setHorizontalAlignment(SwingConstants.RIGHT); lowPass.setText(String.format("%5.0f", freqBins[freqBins.length-1])); lowPass.setEnabled(false); lowPass.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { lowPassActionPerformed(evt); } }); @@ -776,7 +797,8 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { resetFilters.setEnabled(false); resetFilters.setMargin(new java.awt.Insets(2, 10, 2, 10)); resetFilters.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { resetFiltersActionPerformed(evt); } }); @@ -786,7 +808,8 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { setLowpass.setEnabled(false); setLowpass.setMargin(new java.awt.Insets(2, 10, 2, 10)); setLowpass.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { setLowpassActionPerformed(evt); } }); @@ -796,7 +819,8 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { setHighpass.setEnabled(false); setHighpass.setMargin(new java.awt.Insets(2, 10, 2, 10)); setHighpass.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { setHighpassActionPerformed(evt); } }); @@ -855,7 +879,8 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { selectStart.setSelected(true); selectStart.setText("Select Contour Start"); selectStart.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { selectStartActionPerformed(evt); } }); @@ -863,7 +888,8 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { selectEnd.setText("Select Contour End"); selectEnd.setEnabled(false); selectEnd.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { selectEndActionPerformed(evt); } }); @@ -872,7 +898,8 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { toggleContour.setActionCommand("Toggle Contour"); toggleContour.setEnabled(false); toggleContour.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { toggleContourActionPerformed(evt); } }); @@ -885,7 +912,8 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { btnPickPoints.setMaximumSize(new Dimension(33, 9)); btnPickPoints.setEnabled(false); btnPickPoints.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { + @Override + public void actionPerformed(java.awt.event.ActionEvent evt) { btnPickPointsActionPerformed(evt); } }); @@ -1238,10 +1266,10 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { setTimeMilliseconds(timeBins[(int) x]); */ roccaContourDataBlock. - getDataUnit(indx, FFTDataBlock.REFERENCE_CURRENT). + getDataUnit(indx, PamDataBlock.REFERENCE_CURRENT). setPeakFreq(freqBins[(int) y]); roccaContourDataBlock. - getDataUnit(indx, FFTDataBlock.REFERENCE_CURRENT). + getDataUnit(indx, PamDataBlock.REFERENCE_CURRENT). setUserChanged(true); // set the contourChanged flag @@ -2047,7 +2075,7 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { RoccaContourDataUnit rcdu = null; int numPoints = roccaContourDataBlock.getUnitsCount(); for (int i = 0; i < numPoints; i++) { - rcdu = roccaContourDataBlock.getDataUnit(i, RoccaContourDataBlock.REFERENCE_CURRENT); + rcdu = roccaContourDataBlock.getDataUnit(i, PamDataBlock.REFERENCE_CURRENT); if (rcdu.getPeakFreq() != RoccaParameters.NO_CONTOUR_HERE) { String contourPoints = rcdu.getTime() + "," + rcdu.getPeakFreq() + "," + @@ -2459,7 +2487,7 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { setTimeMilliseconds(timeBins[(int) lastMovedPoint.getX()]); */ roccaContourDataBlock. - getDataUnit(lastMovedIndx, FFTDataBlock.REFERENCE_CURRENT). + getDataUnit(lastMovedIndx, PamDataBlock.REFERENCE_CURRENT). setPeakFreq(freqBins[(int) lastMovedPoint.getY()]); /* clear the last point fields */ @@ -2752,7 +2780,7 @@ public class RoccaSpecPopUp extends javax.swing.JPanel { thisFrame.setContentPane(this); thisFrame.pack(); thisFrame.setVisible(true); - thisFrame.setState(JFrame.ICONIFIED); + thisFrame.setState(Frame.ICONIFIED); } /** diff --git a/src/rocca/RoccaStatsLogger.java b/src/rocca/RoccaStatsLogger.java index 2cf4b202..f5941c0a 100644 --- a/src/rocca/RoccaStatsLogger.java +++ b/src/rocca/RoccaStatsLogger.java @@ -31,15 +31,14 @@ package rocca; -import generalDatabase.PamTableItem; -import generalDatabase.SQLLogging; -import generalDatabase.SQLTypes; - import java.sql.Types; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import generalDatabase.PamTableDefinition; +import generalDatabase.PamTableItem; +import generalDatabase.SQLLogging; +import generalDatabase.SQLTypes; /** * Databse logging information for Rocca statistics. diff --git a/src/rocca/RoccaTrainClassifier.java b/src/rocca/RoccaTrainClassifier.java index 70acc07d..cf75a5c6 100644 --- a/src/rocca/RoccaTrainClassifier.java +++ b/src/rocca/RoccaTrainClassifier.java @@ -27,7 +27,6 @@ import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.util.Date; -import java.util.Enumeration; import javax.swing.JFileChooser; import javax.swing.filechooser.FileNameExtensionFilter; diff --git a/src/rocca/SpectrogramPanel.java b/src/rocca/SpectrogramPanel.java index 6509c9cb..d8315e7e 100644 --- a/src/rocca/SpectrogramPanel.java +++ b/src/rocca/SpectrogramPanel.java @@ -40,9 +40,6 @@ package rocca; -import PamView.ColourArray; -import PamView.ColourArray.ColourArrayType; - import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; @@ -61,6 +58,9 @@ import java.util.ArrayList; import javax.swing.JPanel; +import PamView.ColourArray; +import PamView.ColourArray.ColourArrayType; + /** diff --git a/src/rockBlock/RockBlockControl.java b/src/rockBlock/RockBlockControl.java index c7dc03e5..b5638fde 100644 --- a/src/rockBlock/RockBlockControl.java +++ b/src/rockBlock/RockBlockControl.java @@ -142,6 +142,7 @@ public class RockBlockControl extends PamControlledUnit implements PamSettings { this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { RockBlockParams newParams = RockBlockParamsDialog.showDialog(parentFrame, rockBlockParams); /* diff --git a/src/rockBlock/RockBlockParams.java b/src/rockBlock/RockBlockParams.java index a25a250d..8f6d4491 100644 --- a/src/rockBlock/RockBlockParams.java +++ b/src/rockBlock/RockBlockParams.java @@ -1,8 +1,6 @@ package rockBlock; import java.io.Serializable; -import rocca.RoccaParameters; - /* * PAMGUARD - Passive Acoustic Monitoring GUARDianship. * To assist in the Detection Classification and Localisation diff --git a/src/rockBlock/RockBlockParamsDialog.java b/src/rockBlock/RockBlockParamsDialog.java index 015d2dd4..8e29390e 100644 --- a/src/rockBlock/RockBlockParamsDialog.java +++ b/src/rockBlock/RockBlockParamsDialog.java @@ -24,8 +24,6 @@ package rockBlock; import java.awt.Frame; import java.awt.Window; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import javax.swing.BoxLayout; import javax.swing.JLabel; diff --git a/src/rockBlock/RockBlockProcess2.java b/src/rockBlock/RockBlockProcess2.java index 3cd0d17a..f67ceccf 100644 --- a/src/rockBlock/RockBlockProcess2.java +++ b/src/rockBlock/RockBlockProcess2.java @@ -1,5 +1,19 @@ package rockBlock; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.IOException; + +import javax.swing.Timer; + +import PamController.status.BaseProcessCheck; +import PamController.status.ModuleStatus; +import PamController.status.ModuleStatusManager; +import PamUtils.PamCalendar; +import PamguardMVC.PamDataBlock; +import PamguardMVC.PamProcess; +import PamguardMVC.debug.Debug; + /* * PAMGUARD - Passive Acoustic Monitoring GUARDianship. * To assist in the Detection Classification and Localisation @@ -23,22 +37,8 @@ package rockBlock; */ import serialComms.jserialcomm.PJSerialComm; -import serialComms.jserialcomm.PJSerialException; import serialComms.jserialcomm.PJSerialLineListener; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.io.IOException; -import javax.swing.Timer; - -import PamController.status.BaseProcessCheck; -import PamController.status.ModuleStatus; -import PamController.status.ModuleStatusManager; -import PamUtils.PamCalendar; -import PamguardMVC.PamDataBlock; -import PamguardMVC.PamProcess; -import PamguardMVC.debug.Debug; - /** * This version of RockBlockProcess uses the jSerialComm library instead of RXTX diff --git a/src/rockBlock/RockBlockSidePanel.java b/src/rockBlock/RockBlockSidePanel.java index d0cf3c04..a287d0ed 100644 --- a/src/rockBlock/RockBlockSidePanel.java +++ b/src/rockBlock/RockBlockSidePanel.java @@ -31,11 +31,9 @@ import java.awt.GridBagLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; -import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JLabel; -import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.SwingConstants; import javax.swing.Timer; @@ -43,13 +41,12 @@ import javax.swing.border.TitledBorder; import PamUtils.PamCalendar; import PamView.PamColors; +import PamView.PamColors.PamColor; import PamView.PamSidePanel; import PamView.dialog.PamButton; import PamView.dialog.PamGridBagContraints; import PamView.dialog.PamLabel; -import PamView.PamColors.PamColor; import PamView.panel.PamBorderPanel; -import rocca.RoccaSidePanel.SidePanel; /** * @author mo55 @@ -151,7 +148,8 @@ public class RockBlockSidePanel implements PamSidePanel{ // send.setHorizontalAlignment(SwingConstants.LEFT); // send.setAlignmentX(LEFT_ALIGNMENT); send.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent evt) { + @Override + public void actionPerformed(ActionEvent evt) { sendTheMessage(); } }); @@ -160,6 +158,7 @@ public class RockBlockSidePanel implements PamSidePanel{ // checkSignal.setHorizontalAlignment(SwingConstants.LEFT); // resetRockBlock.setAlignmentX(LEFT_ALIGNMENT); resetRockBlock.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { resetRBCommObject(); } @@ -168,37 +167,37 @@ public class RockBlockSidePanel implements PamSidePanel{ c.gridy++; c.gridx = 0; JLabel aLabel; - this.add(aLabel = new JLabel("Com Port: ", JLabel.RIGHT),c); + this.add(aLabel = new JLabel("Com Port: ", SwingConstants.RIGHT),c); c.gridx++; this.add(comPort, c); c.gridy++; c.gridx = 0; - add(aLabel = new JLabel("Com Ready: ", JLabel.RIGHT),c); + add(aLabel = new JLabel("Com Ready: ", SwingConstants.RIGHT),c); c.gridx++; add(commReady,c); c.gridy++; c.gridx = 0; - this.add(aLabel = new JLabel("Com Error: ", JLabel.RIGHT),c); + this.add(aLabel = new JLabel("Com Error: ", SwingConstants.RIGHT),c); c.gridx++; this.add(portError,c); c.gridy++; c.gridx = 0; - this.add(aLabel = new JLabel("Signal Strength: ", JLabel.RIGHT),c); + this.add(aLabel = new JLabel("Signal Strength: ", SwingConstants.RIGHT),c); c.gridx++; this.add(signalStrength,c); c.gridy++; c.gridx = 0; - this.add(aLabel = new JLabel("Num Outgoing Mess: ", JLabel.RIGHT),c); + this.add(aLabel = new JLabel("Num Outgoing Mess: ", SwingConstants.RIGHT),c); c.gridx++; this.add(numOutgoing,c); c.gridy++; c.gridx = 0; - this.add(aLabel = new JLabel("Num Incoming Mess: ", JLabel.RIGHT),c); + this.add(aLabel = new JLabel("Num Incoming Mess: ", SwingConstants.RIGHT),c); c.gridx++; this.add(numIncoming,c); diff --git a/src/seismicVeto/VetoController.java b/src/seismicVeto/VetoController.java index 615544ad..5fbdeba4 100644 --- a/src/seismicVeto/VetoController.java +++ b/src/seismicVeto/VetoController.java @@ -48,6 +48,7 @@ public class VetoController extends PamControlledUnit implements PamSettings { this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { VetoParameters newParams = VetoParametersDialog.showDialog(parentFrame, vetoParameters, vetoProcess.getFftOutputData()); if (newParams != null) { @@ -71,14 +72,17 @@ public class VetoController extends PamControlledUnit implements PamSettings { } } + @Override public Serializable getSettingsReference() { return vetoParameters; } + @Override public long getSettingsVersion() { return VetoParameters.serialVersionUID; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { vetoParameters = ((VetoParameters) pamControlledUnitSettings.getSettings()).clone(); return true; diff --git a/src/seismicVeto/VetoDataUnit.java b/src/seismicVeto/VetoDataUnit.java index 5bf52f42..31922474 100644 --- a/src/seismicVeto/VetoDataUnit.java +++ b/src/seismicVeto/VetoDataUnit.java @@ -1,7 +1,6 @@ package seismicVeto; import PamDetection.PamDetection; -import PamguardMVC.AcousticDataUnit; import PamguardMVC.PamDataUnit; public class VetoDataUnit extends PamDataUnit implements PamDetection { diff --git a/src/seismicVeto/VetoParameters.java b/src/seismicVeto/VetoParameters.java index e41907f7..902e6e5c 100644 --- a/src/seismicVeto/VetoParameters.java +++ b/src/seismicVeto/VetoParameters.java @@ -5,8 +5,8 @@ import java.lang.reflect.Field; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; +import PamModel.parametermanager.PrivatePamParameterData; public class VetoParameters implements Serializable, Cloneable, ManagedParameters { diff --git a/src/seismicVeto/VetoParametersDialog.java b/src/seismicVeto/VetoParametersDialog.java index cf455cdb..8c88b725 100644 --- a/src/seismicVeto/VetoParametersDialog.java +++ b/src/seismicVeto/VetoParametersDialog.java @@ -12,10 +12,10 @@ import javax.swing.JRadioButton; import javax.swing.JTextField; import javax.swing.border.TitledBorder; -import fftManager.FFTDataUnit; import PamView.dialog.PamDialog; import PamView.dialog.SourcePanel; import PamguardMVC.PamDataBlock; +import fftManager.FFTDataUnit; public class VetoParametersDialog extends PamDialog { diff --git a/src/seismicVeto/VetoPluginPanelProvider.java b/src/seismicVeto/VetoPluginPanelProvider.java index c62f7401..7f2d14d2 100644 --- a/src/seismicVeto/VetoPluginPanelProvider.java +++ b/src/seismicVeto/VetoPluginPanelProvider.java @@ -48,10 +48,12 @@ public class VetoPluginPanelProvider implements DisplayPanelProvider { DisplayProviderList.addDisplayPanelProvider(this); } + @Override public DisplayPanel createDisplayPanel(DisplayPanelContainer displayPanelContainer) { return new VetoPluginPanel(this, displayPanelContainer); } + @Override public String getDisplayPanelName() { return "Seismic Veto trigger function"; } @@ -136,24 +138,29 @@ public class VetoPluginPanelProvider implements DisplayPanelProvider { } + @Override public String getObserverName() { return "veto plug in panel"; } + @Override public long getRequiredDataHistory(PamObservable o, Object arg) { return (long) this.displayPanelContainer.getXDuration(); } + @Override public void noteNewSettings() { // TODO Auto-generated method stub } + @Override public void removeObservable(PamObservable o) { // TODO Auto-generated method stub } + @Override public void setSampleRate(float sampleRate, boolean notify) { // TODO Auto-generated method stub @@ -170,6 +177,7 @@ public class VetoPluginPanelProvider implements DisplayPanelProvider { /** * new data have arrived - work out what channel it's from and plot it. */ + @Override public void addData(PamObservable o, PamDataUnit arg) { /* * Get the channel and y pixel for this data point diff --git a/src/seismicVeto/VetoProcess.java b/src/seismicVeto/VetoProcess.java index 8c0f494d..d56745d5 100644 --- a/src/seismicVeto/VetoProcess.java +++ b/src/seismicVeto/VetoProcess.java @@ -3,10 +3,6 @@ package seismicVeto; import java.awt.Color; import java.util.Random; -import fftManager.Complex; -import fftManager.FFTDataBlock; -import fftManager.FFTDataUnit; -import fftManager.FastFFT; import Acquisition.AcquisitionProcess; import PamController.PamController; import PamDetection.RawDataUnit; @@ -24,7 +20,10 @@ import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; import PamguardMVC.PamRawDataBlock; -import autecPhones.AutecGraphics; +import fftManager.Complex; +import fftManager.FFTDataBlock; +import fftManager.FFTDataUnit; +import fftManager.FastFFT; public class VetoProcess extends PamProcess { @@ -563,7 +562,7 @@ public class VetoProcess extends PamProcess { } background *= b2; background += (energy * b1); - if (isVetoed(channel, arg.getStartSample()) == false) { + if (!isVetoed(channel, arg.getStartSample())) { ComplexArray fftData = arg.getFftData(); for (int i = 0; i < runningBackground.length; i++) { @@ -576,16 +575,16 @@ public class VetoProcess extends PamProcess { // background *= backgroundUpdateConstant1; // background += (energy * backgroundUpdateConstant); - if (overThresh == true && detectionOn == false) { + if (overThresh && !detectionOn) { startDetection(arg, energy); if (vetoController.vetoParameters.randomFillWaveform) { randomWaveData = prepareRandomWaveData(NRANDOMSAMPLES); } } - else if (overThresh == true && detectionOn == true) { + else if (overThresh && detectionOn) { continueDetection(arg, energy); } - else if (overThresh == false && detectionOn == true) { + else if (!overThresh && detectionOn) { endDetection(); } // don't need to handle overThresh == false && detectionOn == false diff --git a/src/serialComms/SerialPortPanel.java b/src/serialComms/SerialPortPanel.java index 4fdc63d9..78c7d21a 100644 --- a/src/serialComms/SerialPortPanel.java +++ b/src/serialComms/SerialPortPanel.java @@ -2,9 +2,11 @@ package serialComms; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; + import javax.swing.JComboBox; import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; import com.fazecast.jSerialComm.SerialPort; @@ -85,7 +87,7 @@ public class SerialPortPanel extends Object { c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.EAST; // c.insets = new Insets(2,5,2,5); - PamDialog.addComponent(panel, new JLabel("Port Id ", JLabel.RIGHT), c); + PamDialog.addComponent(panel, new JLabel("Port Id ", SwingConstants.RIGHT), c); c.gridx = 1; c.anchor = GridBagConstraints.WEST; PamDialog.addComponent(panel, portList = new JComboBox(), c); @@ -94,7 +96,7 @@ public class SerialPortPanel extends Object { c.gridy++; c.gridx = 0; c.anchor = GridBagConstraints.EAST; - PamDialog.addComponent(panel, new JLabel("Bits per second (BAUD) ", JLabel.RIGHT), c); + PamDialog.addComponent(panel, new JLabel("Bits per second (BAUD) ", SwingConstants.RIGHT), c); c.gridx = 1; c.anchor = GridBagConstraints.WEST; PamDialog.addComponent(panel, baudList, c); @@ -104,7 +106,7 @@ public class SerialPortPanel extends Object { c.gridy++; c.gridx = 0; c.anchor = GridBagConstraints.EAST; - PamDialog.addComponent(panel, new JLabel("Data Bits ", JLabel.RIGHT), c); + PamDialog.addComponent(panel, new JLabel("Data Bits ", SwingConstants.RIGHT), c); c.gridx = 1; c.anchor = GridBagConstraints.WEST; PamDialog.addComponent(panel, bitsList, c); @@ -114,7 +116,7 @@ public class SerialPortPanel extends Object { c.gridy++; c.gridx = 0; c.anchor = GridBagConstraints.EAST; - PamDialog.addComponent(panel, new JLabel("Parity ", JLabel.RIGHT), c); + PamDialog.addComponent(panel, new JLabel("Parity ", SwingConstants.RIGHT), c); c.gridx = 1; c.anchor = GridBagConstraints.WEST; PamDialog.addComponent(panel, parityList, c); @@ -124,7 +126,7 @@ public class SerialPortPanel extends Object { c.gridy++; c.gridx = 0; c.anchor = GridBagConstraints.EAST; - PamDialog.addComponent(panel, new JLabel("Stop Bits ", JLabel.RIGHT), c); + PamDialog.addComponent(panel, new JLabel("Stop Bits ", SwingConstants.RIGHT), c); c.gridx = 1; c.anchor = GridBagConstraints.WEST; PamDialog.addComponent(panel, stopBitsList, c); @@ -134,7 +136,7 @@ public class SerialPortPanel extends Object { c.gridy++; c.gridx = 0; c.anchor = GridBagConstraints.EAST; - PamDialog.addComponent(panel, new JLabel("Flow Control ", JLabel.RIGHT), c); + PamDialog.addComponent(panel, new JLabel("Flow Control ", SwingConstants.RIGHT), c); c.gridx = 1; c.anchor = GridBagConstraints.WEST; PamDialog.addComponent(panel, flowControlList, c); diff --git a/src/signal/Hilbert.java b/src/signal/Hilbert.java index 7c98b100..fd12010b 100644 --- a/src/signal/Hilbert.java +++ b/src/signal/Hilbert.java @@ -3,7 +3,6 @@ package signal; import java.util.Arrays; import PamUtils.complex.ComplexArray; -import fftManager.Complex; import fftManager.FastFFT; /** diff --git a/src/simulatedAcquisition/SimDialogPanel.java b/src/simulatedAcquisition/SimDialogPanel.java index b4639f9f..65889261 100644 --- a/src/simulatedAcquisition/SimDialogPanel.java +++ b/src/simulatedAcquisition/SimDialogPanel.java @@ -2,7 +2,6 @@ package simulatedAcquisition; import java.awt.BorderLayout; import java.awt.Dimension; -import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Window; @@ -23,11 +22,11 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import javax.swing.table.AbstractTableModel; -import propagation.PropagationModel; import PamController.masterReference.MasterReferencePoint; import PamUtils.LatLong; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; +import propagation.PropagationModel; public class SimDialogPanel { diff --git a/src/simulatedAcquisition/SimGraphics.java b/src/simulatedAcquisition/SimGraphics.java index 1801ac6f..d3f9e5da 100644 --- a/src/simulatedAcquisition/SimGraphics.java +++ b/src/simulatedAcquisition/SimGraphics.java @@ -9,15 +9,13 @@ import PamUtils.Coordinate3d; import PamUtils.LatLong; import PamView.BasicKeyItem; import PamView.GeneralProjector; -import PamView.ManagedSymbol; +import PamView.GeneralProjector.ParameterType; +import PamView.GeneralProjector.ParameterUnits; import PamView.ManagedSymbolInfo; import PamView.PamKeyItem; import PamView.PamSymbol; -import PamView.PamOldSymbolManager; import PamView.PamSymbolType; import PamView.PanelOverlayDraw; -import PamView.GeneralProjector.ParameterType; -import PamView.GeneralProjector.ParameterUnits; import PamView.symbol.SymbolData; import PamguardMVC.PamDataUnit; diff --git a/src/simulatedAcquisition/SimObject.java b/src/simulatedAcquisition/SimObject.java index 335139fb..f9d071ed 100644 --- a/src/simulatedAcquisition/SimObject.java +++ b/src/simulatedAcquisition/SimObject.java @@ -7,9 +7,9 @@ import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet.ParameterSetType; import PamModel.parametermanager.PrivatePamParameterData; +import PamUtils.LatLong; import simulatedAcquisition.movement.MovementModel; import simulatedAcquisition.movement.MovementModels; -import PamUtils.LatLong; /** * Information on a single simulated object diff --git a/src/simulatedAcquisition/SimObjectDataUnit.java b/src/simulatedAcquisition/SimObjectDataUnit.java index 8dac200e..deebafd0 100644 --- a/src/simulatedAcquisition/SimObjectDataUnit.java +++ b/src/simulatedAcquisition/SimObjectDataUnit.java @@ -4,17 +4,8 @@ import java.util.LinkedList; import java.util.ListIterator; import java.util.Random; -import javax.sound.midi.Transmitter; - -import pamMaths.PamVector; -import propagation.PropagationModel; -import simulatedAcquisition.movement.MovementModel; -import simulatedAcquisition.movement.MovementModels; -import simulatedAcquisition.sounds.SimSignal; -import simulatedAcquisition.sounds.SimSound; import Acquisition.AcquisitionProcess; import Array.ArrayManager; -import Array.HydrophoneLocator; import Array.PamArray; import Array.SnapshotGeometry; import PamController.PamController; @@ -22,7 +13,11 @@ import PamUtils.LatLong; import PamUtils.PamCalendar; import PamUtils.PamUtils; import PamguardMVC.PamDataUnit; -import PamguardMVC.debug.Debug; +import pamMaths.PamVector; +import propagation.PropagationModel; +import simulatedAcquisition.movement.MovementModel; +import simulatedAcquisition.sounds.SimSignal; +import simulatedAcquisition.sounds.SimSound; /** * SimObjectDataUnit is one per sound source, i.e. think @@ -95,7 +90,7 @@ public class SimObjectDataUnit extends PamDataUnit { return; } float sampleRate = simProcess.getSampleRate(); - if (simObject.randomIntervals == false && lastGenSample > 0) { + if (!simObject.randomIntervals && lastGenSample > 0) { lastGenSample += (long) (sampleRate * simObject.meanInterval); } else { @@ -352,7 +347,7 @@ public class SimObjectDataUnit extends PamDataUnit { PamCalendar.getSessionStartTime(); // always move just before a sound is generated. boolean contSim = movementModel.takeStep(millis, this); - if (contSim == false) { + if (!contSim) { stopRun(); } else { diff --git a/src/simulatedAcquisition/SimObjectDialog.java b/src/simulatedAcquisition/SimObjectDialog.java index c638881a..31a9256c 100644 --- a/src/simulatedAcquisition/SimObjectDialog.java +++ b/src/simulatedAcquisition/SimObjectDialog.java @@ -1,6 +1,5 @@ package simulatedAcquisition; -import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Window; @@ -14,15 +13,16 @@ import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; -import simulatedAcquisition.movement.MovementModel; -import simulatedAcquisition.sounds.SimSignal; -import simulatedAcquisition.sounds.SimSignals; import PamModel.SMRUEnable; import PamUtils.LatLongDialogStrip; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; +import simulatedAcquisition.movement.MovementModel; +import simulatedAcquisition.sounds.SimSignal; +import simulatedAcquisition.sounds.SimSignals; public class SimObjectDialog extends PamDialog { @@ -56,31 +56,31 @@ public class SimObjectDialog extends PamDialog { p.setBorder(new TitledBorder("Object parameters")); p.setLayout(new GridBagLayout()); GridBagConstraints c = new PamGridBagContraints(); - addComponent(p, new JLabel("Name ", JLabel.RIGHT), c); + addComponent(p, new JLabel("Name ", SwingConstants.RIGHT), c); c.gridx++; c.gridwidth = 5; addComponent(p, name = new JTextField(10), c); c.gridy++; c.gridx = 0; c.gridwidth = 1; - addComponent(p, new JLabel("Sound Type ", JLabel.RIGHT), c); + addComponent(p, new JLabel("Sound Type ", SwingConstants.RIGHT), c); c.gridx++; c.gridwidth = 5; addComponent(p, soundTypes = new JComboBox(), c); c.gridx = 0; c.gridy++; c.gridwidth = 1; - addComponent(p, new JLabel("Source Level", JLabel.RIGHT), c); + addComponent(p, new JLabel("Source Level", SwingConstants.RIGHT), c); c.gridx++; addComponent(p, amplitude = new JTextField(5), c); c.gridx++; c.gridwidth = 2; - addComponent(p, new JLabel("dB re.1μPa p-p", JLabel.LEFT), c); + addComponent(p, new JLabel("dB re.1μPa p-p", SwingConstants.LEFT), c); if (SMRUEnable.isEnable()) { c.gridy++; c.gridx= 0; c.gridwidth = 1; - addComponent(p, new JLabel("Beam Pattern ", JLabel.RIGHT), c); + addComponent(p, new JLabel("Beam Pattern ", SwingConstants.RIGHT), c); c.gridx++; c.gridwidth = 3; addComponent(p, pistonModel = new JCheckBox("Use Piston Model radius"), c); @@ -88,17 +88,17 @@ public class SimObjectDialog extends PamDialog { c.gridwidth = 1; addComponent(p, pistonRadius = new JTextField(3), c); c.gridx++; - addComponent(p, new JLabel(" cm", JLabel.LEFT), c); + addComponent(p, new JLabel(" cm", SwingConstants.LEFT), c); } c.gridy++; c.gridx= 0; c.gridwidth = 1; - addComponent(p, new JLabel("Mean Interval ", JLabel.RIGHT), c); + addComponent(p, new JLabel("Mean Interval ", SwingConstants.RIGHT), c); c.gridx++; addComponent(p, meanInterval = new JTextField(5), c); c.gridx++; - addComponent(p, new JLabel(" s ", JLabel.LEFT), c); + addComponent(p, new JLabel(" s ", SwingConstants.LEFT), c); c.gridx++; c.gridwidth = 2; c.anchor = GridBagConstraints.WEST; @@ -107,7 +107,7 @@ public class SimObjectDialog extends PamDialog { c.gridy++; c.gridx=0; c.gridwidth=1; - addComponent(p, new JLabel("Echos", JLabel.RIGHT), c); + addComponent(p, new JLabel("Echos", SwingConstants.RIGHT), c); c.gridx++; addComponent(p, enableEchoes=new JCheckBox("Add Echoes"), c); enableEchoes.addActionListener((action)->{ @@ -115,11 +115,11 @@ public class SimObjectDialog extends PamDialog { }); enableEchoes.setToolTipText("Add some echoes to the simulated data"); c.gridx++; - addComponent(p, new JLabel("Delay", JLabel.RIGHT), c); + addComponent(p, new JLabel("Delay", SwingConstants.RIGHT), c); c.gridx++; addComponent(p, echoTextField = new JTextField(5), c); c.gridx++; - addComponent(p, new JLabel("ms", JLabel.LEFT), c); + addComponent(p, new JLabel("ms", SwingConstants.LEFT), c); c.gridx++; addComponent(p, seperateEchoes=new JCheckBox("Seperate"), c); seperateEchoes.setToolTipText("Click to have seperate detections which are echoes. " @@ -136,13 +136,13 @@ public class SimObjectDialog extends PamDialog { addComponent(p, longDialogStrip, c); c.gridy++; c.gridwidth = 1; - addComponent(p, new JLabel("Depth ", JLabel.RIGHT), c); + addComponent(p, new JLabel("Depth ", SwingConstants.RIGHT), c); c.gridx++; addComponent(p, depth = new JTextField(3), c); c.gridx++; addComponent(p, new JLabel(" m "), c); c.gridx++; - addComponent(p, new JLabel(" Speed ", JLabel.RIGHT), c); + addComponent(p, new JLabel(" Speed ", SwingConstants.RIGHT), c); c.gridx++; addComponent(p, spd = new JTextField(3), c); c.gridx++; @@ -150,13 +150,13 @@ public class SimObjectDialog extends PamDialog { c.gridy++; c.gridx = 0; c.gridwidth = 1; - addComponent(p, new JLabel("Course ", JLabel.RIGHT), c); + addComponent(p, new JLabel("Course ", SwingConstants.RIGHT), c); c.gridx++; addComponent(p, cog = new JTextField(3), c); c.gridx++; addComponent(p, new JLabel(" deg' "), c); c.gridx++; - addComponent(p, new JLabel(" Slant ", JLabel.RIGHT), c); + addComponent(p, new JLabel(" Slant ", SwingConstants.RIGHT), c); c.gridx++; addComponent(p, slant = new JTextField(3), c); c.gridx++; @@ -165,7 +165,7 @@ public class SimObjectDialog extends PamDialog { c.gridy++; c.gridx = 0; c.gridwidth = 1; - addComponent(p, new JLabel("Movement Model ", JLabel.RIGHT), c); + addComponent(p, new JLabel("Movement Model ", SwingConstants.RIGHT), c); c.gridx++; c.gridwidth = 2; addComponent(p, movementModel = new JComboBox(), c); @@ -228,14 +228,14 @@ public class SimObjectDialog extends PamDialog { echoTextField.setEnabled(enableEchoes.isSelected()); seperateEchoes.setEnabled(enableEchoes.isSelected()); - latDialogStrip.setEnabled(adv == false); - longDialogStrip.setEnabled(adv == false); - depth.setEnabled(adv == false); - spd.setEnabled(adv == false); - cog.setEnabled(adv == false); - slant.setEnabled(adv == false); + latDialogStrip.setEnabled(!adv); + longDialogStrip.setEnabled(!adv); + depth.setEnabled(!adv); + spd.setEnabled(!adv); + cog.setEnabled(!adv); + slant.setEnabled(!adv); if (advancedButton != null) { - advancedButton.setEnabled(adv == true); + advancedButton.setEnabled(adv); } } diff --git a/src/simulatedAcquisition/SimParameters.java b/src/simulatedAcquisition/SimParameters.java index ee4074f7..b82ff2a7 100644 --- a/src/simulatedAcquisition/SimParameters.java +++ b/src/simulatedAcquisition/SimParameters.java @@ -9,7 +9,6 @@ import Acquisition.SoundCardParameters; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PrivatePamParameterData; -import hfDaqCard.SmruDaqSystem; /** * Parameters for all simulated objects diff --git a/src/simulatedAcquisition/SimProcess.java b/src/simulatedAcquisition/SimProcess.java index f8905170..47fdd5eb 100644 --- a/src/simulatedAcquisition/SimProcess.java +++ b/src/simulatedAcquisition/SimProcess.java @@ -13,27 +13,19 @@ import java.util.Random; import javax.swing.JComponent; import javax.swing.SwingUtilities; -import pamMaths.PamVector; -import propagation.PropagationModel; -import propagation.SphericalPropagation; -import propagation.SurfaceEcho; - - -import simulatedAcquisition.sounds.SimSignals; import Acquisition.AcquisitionControl; import Acquisition.AcquisitionDialog; -import Acquisition.DaqSystem; import Acquisition.AudioDataQueue; +import Acquisition.DaqSystem; import Array.ArrayManager; import Array.PamArray; -import Array.StreamerDataUnit; -import GPS.GpsData; import Map.MapController; import Map.MapPanel; import Map.MapRectProjector; import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; import PamController.PamController; +import PamController.PamControllerInterface; import PamController.PamSettingManager; import PamController.PamSettings; import PamDetection.RawDataUnit; @@ -43,7 +35,11 @@ import PamUtils.PamCalendar; import PamView.symbol.StandardSymbolManager; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; -import PamguardMVC.debug.Debug; +import pamMaths.PamVector; +import propagation.PropagationModel; +import propagation.SphericalPropagation; +import propagation.SurfaceEcho; +import simulatedAcquisition.sounds.SimSignals; /** * Simulation of simulated sound. @@ -144,12 +140,12 @@ public class SimProcess extends DaqSystem implements PamSettings { if (simSoundsDataBlock == null) { simSoundsDataBlock = new SimSoundDataBlock("Simulated Sounds", daqControl.getAcquisitionProcess(), 0); } - if (wasSelected && select == false) { + if (wasSelected && !select) { daqControl.getAcquisitionProcess().removeOutputDatablock(simObjectsDataBlock); daqControl.getAcquisitionProcess().removeOutputDatablock(simSoundsDataBlock); // PamController.getInstance().notifyModelChanged(PamControllerInterface.REMOVE_DATABLOCK); } - else if (wasSelected == false && select) { + else if (!wasSelected && select) { daqControl.getAcquisitionProcess().addOutputDataBlock(simObjectsDataBlock); daqControl.getAcquisitionProcess().addOutputDataBlock(simSoundsDataBlock); setupObjects(); @@ -270,7 +266,7 @@ public class SimProcess extends DaqSystem implements PamSettings { * unit, then set it's reference to zero. */ while (newDataUnits.getQueueSize() > daqControl.acquisitionParameters.nChannels*2) { - if (dontStop == false) break; + if (!dontStop) break; try { Thread.sleep(2); } catch (Exception ex) { @@ -659,7 +655,7 @@ public class SimProcess extends DaqSystem implements PamSettings { @Override public void notifyModelChanged(int changeType) { super.notifyModelChanged(changeType); - if (changeType == PamController.INITIALIZATION_COMPLETE) { + if (changeType == PamControllerInterface.INITIALIZATION_COMPLETE) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { diff --git a/src/simulatedAcquisition/SimSoundDataUnit.java b/src/simulatedAcquisition/SimSoundDataUnit.java index d4aa875e..1ad4840b 100644 --- a/src/simulatedAcquisition/SimSoundDataUnit.java +++ b/src/simulatedAcquisition/SimSoundDataUnit.java @@ -1,7 +1,7 @@ package simulatedAcquisition; -import simulatedAcquisition.sounds.SimSound; import PamguardMVC.PamDataUnit; +import simulatedAcquisition.sounds.SimSound; /** * One of these will be created for every sound produced diff --git a/src/simulatedAcquisition/SimSoundsLogging.java b/src/simulatedAcquisition/SimSoundsLogging.java index 4b0c6ebf..8ae13567 100644 --- a/src/simulatedAcquisition/SimSoundsLogging.java +++ b/src/simulatedAcquisition/SimSoundsLogging.java @@ -2,18 +2,17 @@ package simulatedAcquisition; import java.sql.Types; -import pamMaths.PamVector; -import simulatedAcquisition.sounds.SimSound; import Array.ArrayManager; import GPS.GpsData; import PamUtils.LatLong; import PamUtils.PamUtils; -import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import generalDatabase.PamTableDefinition; import generalDatabase.PamTableItem; import generalDatabase.SQLLogging; import generalDatabase.SQLTypes; +import pamMaths.PamVector; +import simulatedAcquisition.sounds.SimSound; public class SimSoundsLogging extends SQLLogging { diff --git a/src/soundPlayback/FilePlayback.java b/src/soundPlayback/FilePlayback.java index 3c9f15d2..39297198 100644 --- a/src/soundPlayback/FilePlayback.java +++ b/src/soundPlayback/FilePlayback.java @@ -7,6 +7,12 @@ import java.util.List; import javax.swing.SwingUtilities; +import Acquisition.DaqSystem; +import PamDetection.RawDataUnit; +import PamUtils.PamCalendar; +import PamUtils.PlatformInfo; +import PamUtils.PlatformInfo.OSType; +import PamguardMVC.debug.Debug; import asiojni.ASIOFilePlaybackSystem; import nidaqdev.NIFilePlayback; import soundPlayback.fx.FilePlaybackSettingsPane; @@ -14,14 +20,6 @@ import soundPlayback.fx.PlaybackSettingsPane; import soundPlayback.swing.FilePlaybackDialogComponent; import soundPlayback.swing.PlaybackDialogComponent; import warnings.QuickWarning; -import Acquisition.DaqSystem; -import PamController.PamController; -import PamDetection.RawDataUnit; -import PamModel.SMRUEnable; -import PamUtils.PamCalendar; -import PamUtils.PlatformInfo; -import PamUtils.PlatformInfo.OSType; -import PamguardMVC.debug.Debug; /** * Playback of sound from wav files. @@ -79,6 +77,7 @@ public class FilePlayback extends PlaybackSystem { // } } + @Override public int getMaxChannels() { FilePlaybackDevice device = filePBDevices.get(playbackControl.playbackParameters.deviceType); return device.getNumPlaybackChannels(getDeviceNumber()); @@ -121,6 +120,7 @@ public class FilePlayback extends PlaybackSystem { } + @Override synchronized public boolean unPrepareSystem() { if (realTimePlayback) { synchronized (realTimeQueue) { @@ -133,6 +133,7 @@ public class FilePlayback extends PlaybackSystem { return false; } + @Override public boolean playData(RawDataUnit[] data, double gain) { if (currentDevice == null) { @@ -174,9 +175,10 @@ public class FilePlayback extends PlaybackSystem { data = realTimeQueue.remove(0); // double gain = Math.pow(10., playbackControl.playbackParameters.playbackGain/20.); boolean ok = currentDevice.playData(data); - if (ok == false) { + if (!ok) { keepRunning = false; SwingUtilities.invokeLater(new Runnable() { + @Override public void run() { playbackError(); } @@ -213,6 +215,7 @@ public class FilePlayback extends PlaybackSystem { prepareSystem(playbackControl, currentChannels, currentSampleRate); } + @Override public PlaybackDialogComponent getDialogComponent() { return filePlaybackDialogComponent; } diff --git a/src/soundPlayback/PlaybackControl.java b/src/soundPlayback/PlaybackControl.java index f341ec74..bc4338f1 100644 --- a/src/soundPlayback/PlaybackControl.java +++ b/src/soundPlayback/PlaybackControl.java @@ -20,7 +20,6 @@ import PamController.PamControllerInterface; import PamController.PamGUIManager; import PamController.PamSettingManager; import PamController.PamSettings; -import PamUtils.PamCalendar; import PamView.MenuItemEnabler; import PamView.TopToolBar; import PamguardMVC.LoadObserver; @@ -123,14 +122,17 @@ public class PlaybackControl extends PamControlledUnit implements PamSettings { stopButtonEnabler.addMenuItem(button); } + @Override public Serializable getSettingsReference() { return playbackParameters; } + @Override public long getSettingsVersion() { return PlaybackParameters.serialVersionUID; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { playbackParameters = ((PlaybackParameters) pamControlledUnitSettings.getSettings()).clone(); @@ -144,7 +146,7 @@ public class PlaybackControl extends PamControlledUnit implements PamSettings { playbackSystem = findPlaybackSystem(sourceDataBlock); playbackProcess.noteNewSettings(); playbackSidePanel.newSettings(); - if (playBackGUI!=null) playBackGUI.notifyGUIChange(PamController.CHANGED_PROCESS_SETTINGS); + if (playBackGUI!=null) playBackGUI.notifyGUIChange(PamControllerInterface.CHANGED_PROCESS_SETTINGS); // if (this.getSidePanel() != null){ // this.getSidePanel().getPanel().setVisible(!isRealTimePlayback()); // } @@ -182,7 +184,7 @@ public class PlaybackControl extends PamControlledUnit implements PamSettings { if (daqProcess == null) return null; DaqSystem daqSystem = daqProcess.getAcquisitionControl().findDaqSystem(null); if (daqSystem == null) return null; - if (daqSystem.isRealTime() == false || isViewer || isMixed){ + if (!daqSystem.isRealTime() || isViewer || isMixed){ realTimePlayback = false; return filePlayback; } @@ -231,6 +233,7 @@ public class PlaybackControl extends PamControlledUnit implements PamSettings { this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent e) { PlaybackParameters newParams = PlaybackDialog.showDialog(parentFrame, playbackParameters, playbackControl); diff --git a/src/soundPlayback/PlaybackProcess.java b/src/soundPlayback/PlaybackProcess.java index d68c6743..6d488ef9 100644 --- a/src/soundPlayback/PlaybackProcess.java +++ b/src/soundPlayback/PlaybackProcess.java @@ -7,7 +7,6 @@ import PamController.PamController; import PamDetection.RawDataUnit; import PamUtils.FrequencyFormat; import PamUtils.PamUtils; -import PamView.dialog.warn.WarnOnce; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamInstantProcess; @@ -17,9 +16,7 @@ import soundPlayback.preprocess.PlaybackDecimator; import soundPlayback.preprocess.PlaybackFilter; import soundPlayback.preprocess.PlaybackGain; import soundPlayback.preprocess.PlaybackPreprocess; -import warnings.PamWarning; import warnings.QuickWarning; -import warnings.WarningSystem; /** * Pam Process for sound playback (controls data from multiple channels @@ -90,7 +87,7 @@ public class PlaybackProcess extends PamInstantProcess { boolean prepOK = playbackControl.playbackSystem.prepareSystem(playbackControl, runningChannels, (float) sampleRateData.getOutputSampleRate()); - if (prepOK == false) { + if (!prepOK) { showStartWarning(runningChannels, sampleRateData.getOutputSampleRate()); return false; } @@ -234,7 +231,7 @@ public class PlaybackProcess extends PamInstantProcess { RawDataUnit[] playUnits = preprocessData(rawDataUnits); if (playUnits != null) { boolean playOK = playbackControl.playbackSystem.playData(playUnits, 1); - if (playOK == false) { + if (!playOK) { playWarning.setWarning("PlaybackProcess: playData return error", 2); noteNewSettings(); // forces full reset of playback } @@ -298,7 +295,7 @@ public class PlaybackProcess extends PamInstantProcess { @Override synchronized public void noteNewSettings() { - if (PamController.getInstance().isInitializationComplete() == false) { + if (!PamController.getInstance().isInitializationComplete()) { return; } diff --git a/src/soundPlayback/SoundCardFilePlayback.java b/src/soundPlayback/SoundCardFilePlayback.java index 86ed3372..3d2aee19 100644 --- a/src/soundPlayback/SoundCardFilePlayback.java +++ b/src/soundPlayback/SoundCardFilePlayback.java @@ -2,22 +2,12 @@ package soundPlayback; import java.util.ArrayList; -import javax.sound.sampled.AudioFormat; -import javax.sound.sampled.AudioSystem; -import javax.sound.sampled.LineEvent; -import javax.sound.sampled.LineEvent.Type; -import javax.sound.sampled.LineListener; -import javax.sound.sampled.Mixer; -import javax.sound.sampled.SourceDataLine; import javax.sound.sampled.Mixer.Info; import Acquisition.SoundCardSystem; import PamDetection.RawDataUnit; -import PamUtils.PamCalendar; import PamUtils.PamUtils; import PamView.dialog.PamDialogPanel; -import warnings.PamWarning; -import warnings.WarningSystem; public class SoundCardFilePlayback implements FilePlaybackDevice { diff --git a/src/soundPlayback/SoundCardPlayback.java b/src/soundPlayback/SoundCardPlayback.java index cc66f894..c0875da4 100644 --- a/src/soundPlayback/SoundCardPlayback.java +++ b/src/soundPlayback/SoundCardPlayback.java @@ -117,6 +117,7 @@ public class SoundCardPlayback extends PlaybackSystem { // private boolean lastActive = false; // private boolean lastRunning = false; + @Override public boolean playData(RawDataUnit[] data, double gain) { return soundCardPlaybackBase.playData(data); diff --git a/src/soundPlayback/SoundCardPlaybackBase.java b/src/soundPlayback/SoundCardPlaybackBase.java index 2f6f37ea..de167b22 100644 --- a/src/soundPlayback/SoundCardPlaybackBase.java +++ b/src/soundPlayback/SoundCardPlaybackBase.java @@ -7,16 +7,15 @@ import java.util.TimerTask; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.LineEvent; +import javax.sound.sampled.LineEvent.Type; import javax.sound.sampled.LineListener; import javax.sound.sampled.Mixer; -import javax.sound.sampled.SourceDataLine; -import javax.sound.sampled.LineEvent.Type; import javax.sound.sampled.Mixer.Info; +import javax.sound.sampled.SourceDataLine; import Acquisition.SoundCardSystem; import PamDetection.RawDataUnit; import PamUtils.PamCalendar; -import PamguardMVC.debug.Debug; import warnings.PamWarning; import warnings.QuickWarning; import warnings.WarningSystem; diff --git a/src/soundtrap/DWVConverter.java b/src/soundtrap/DWVConverter.java index a476d26f..6f11ddb8 100644 --- a/src/soundtrap/DWVConverter.java +++ b/src/soundtrap/DWVConverter.java @@ -5,22 +5,18 @@ import java.util.List; import javax.swing.SwingWorker; -import binaryFileStorage.BinaryDataSource; -import binaryFileStorage.BinaryFooter; -import binaryFileStorage.BinaryObjectData; -import binaryFileStorage.BinaryOutputStream; -import binaryFileStorage.BinaryStore; import PamController.PamController; import PamUtils.PamCalendar; import PamView.dialog.warn.WarnOnce; import PamguardMVC.debug.Debug; +import binaryFileStorage.BinaryDataSource; +import binaryFileStorage.BinaryFooter; +import binaryFileStorage.BinaryOutputStream; +import binaryFileStorage.BinaryStore; import clickDetector.ClickBinaryDataSource; -import clickDetector.ClickControl; import clickDetector.ClickDataBlock; import clickDetector.ClickDetection; import clickDetector.ClickDetector; -import warnings.PamWarning; -import warnings.WarningSystem; public class DWVConverter { @@ -85,7 +81,7 @@ public class DWVConverter { int nFile = fileGroups.size(); for (STGroupInfo fileGroup:fileGroups) { processFiles(fileGroup, nFile, ++iFile); - if (keepRunning == false) { + if (!keepRunning) { break; } } @@ -98,7 +94,7 @@ public class DWVConverter { private void processFiles(STGroupInfo fileGroup, int nFile, int iFile) { this.publish(new DWVConvertInformation(fileGroup, nFile, iFile, 0, 0)); - if (fileGroup.hasDWV() == false) { + if (!fileGroup.hasDWV()) { /* * Don't do this. In quiet conditions there will be a BCL file with a start and stop time * but if there were no detections there will be no dwv file. We should make the pgdf file @@ -111,7 +107,7 @@ public class DWVConverter { } BCLReader bclReader = new BCLReader(fileGroup.getBclFile()); boolean ok = bclReader.open(); - if (ok == false) return; + if (!ok) return; int nDWV = 0; DWVReader dwvReader = null; if (fileGroup.hasDWV()) { diff --git a/src/soundtrap/DWVReader.java b/src/soundtrap/DWVReader.java index 680e1e4a..dadc27c5 100644 --- a/src/soundtrap/DWVReader.java +++ b/src/soundtrap/DWVReader.java @@ -4,7 +4,6 @@ import java.io.File; import java.io.IOException; import javax.sound.sampled.AudioFormat; -import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.UnsupportedAudioFileException; import Acquisition.pamAudio.WavFileInputStream; @@ -45,7 +44,7 @@ public class DWVReader { } public boolean openDWV() { - if (dwvFile == null || dwvFile.exists() == false) { + if (dwvFile == null || !dwvFile.exists()) { return false; } closeDWV(); diff --git a/src/soundtrap/ImportBCLDialog.java b/src/soundtrap/ImportBCLDialog.java index 3de2e6ee..42ebc72e 100644 --- a/src/soundtrap/ImportBCLDialog.java +++ b/src/soundtrap/ImportBCLDialog.java @@ -20,13 +20,11 @@ import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JProgressBar; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.CompoundBorder; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; -import clickDetector.ClickParameters; -import dataMap.filemaps.OfflineFileParameters; -import soundtrap.xml.CDETInfo; import Acquisition.AcquisitionControl; import Acquisition.FolderInputSystem; import PamController.PamControlledUnit; @@ -41,6 +39,9 @@ import PamView.dialog.PamGridBagContraints; import PamView.dialog.warn.WarnOnce; import PamguardMVC.PamRawDataBlock; import PamguardMVC.debug.Debug; +import clickDetector.ClickParameters; +import dataMap.filemaps.OfflineFileParameters; +import soundtrap.xml.CDETInfo; public class ImportBCLDialog extends PamDialog { @@ -112,7 +113,7 @@ public class ImportBCLDialog extends PamDialog { c.gridx = c.gridy = 0; c.anchor = GridBagConstraints.LINE_START; soundTrapDate.setBorder(new CompoundBorder(new TitledBorder("Soundtrap Date/Time Format "), new EmptyBorder(0, 10, 0, 0))); - soundTrapDate.add(new JLabel("Enter the date/time format to use ", JLabel.LEFT),c); + soundTrapDate.add(new JLabel("Enter the date/time format to use ", SwingConstants.LEFT),c); c.gridx++; soundTrapDate.add(customDateTimeFormat,c); c.gridy++; @@ -121,10 +122,10 @@ public class ImportBCLDialog extends PamDialog { String text = "" + "See https://docs.oracle.com/javase/8/docs/api/java/text/SimpleDateFormat.html for " + "information on date and time codes, as well as examples of common formats."; - soundTrapDate.add(new JLabel(text, JLabel.LEFT),c); + soundTrapDate.add(new JLabel(text, SwingConstants.LEFT),c); c.gridy++; text = "The default format is yyyy-MM-dd'T'HH:mm:ss"; - soundTrapDate.add(new JLabel(text, JLabel.LEFT),c); + soundTrapDate.add(new JLabel(text, SwingConstants.LEFT),c); mainPanel.add(soundTrapDate); mainPanel.add(Box.createRigidArea(new Dimension(0, 5))); @@ -186,7 +187,7 @@ public class ImportBCLDialog extends PamDialog { * Start button has been pressed ! */ protected void startButtton() { - if (getParams() == false) { + if (!getParams()) { return; } /* diff --git a/src/soundtrap/STAcquisitionControl.java b/src/soundtrap/STAcquisitionControl.java index bfad1da2..d22b389c 100644 --- a/src/soundtrap/STAcquisitionControl.java +++ b/src/soundtrap/STAcquisitionControl.java @@ -24,8 +24,6 @@ package soundtrap; -import java.awt.Component; - import Acquisition.AcquisitionControl; import Acquisition.DaqSystem; import PamController.PamControlledUnitSettings; diff --git a/src/soundtrap/STClickControl.java b/src/soundtrap/STClickControl.java index 8e7ca7b0..309d5b08 100644 --- a/src/soundtrap/STClickControl.java +++ b/src/soundtrap/STClickControl.java @@ -37,9 +37,9 @@ import javax.swing.JSeparator; import org.pamguard.x3.sud.SUDClickDetectorInfo; import Acquisition.AcquisitionControl; -import PamController.PamSensor; import PamController.PamControlledUnitSettings; -import PamController.PamController; +import PamController.PamControllerInterface; +import PamController.PamSensor; import PamController.PamSettingManager; import PamController.PamSettings; import PamguardMVC.PamRawDataBlock; @@ -164,7 +164,7 @@ public class STClickControl extends ClickControl implements PamSensor { @Override public void notifyModelChanged(int changeType) { super.notifyModelChanged(changeType); - if (changeType == PamController.INITIALIZATION_COMPLETE) { + if (changeType == PamControllerInterface.INITIALIZATION_COMPLETE) { sudFileDWVHandler.subscribeSUD(); } } diff --git a/src/soundtrap/STGroupInfo.java b/src/soundtrap/STGroupInfo.java index dbb07a79..600ecb9a 100644 --- a/src/soundtrap/STGroupInfo.java +++ b/src/soundtrap/STGroupInfo.java @@ -1,15 +1,7 @@ package soundtrap; import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import javax.sound.sampled.AudioFormat; -import javax.sound.sampled.AudioInputStream; -import javax.sound.sampled.AudioSystem; -import javax.sound.sampled.UnsupportedAudioFileException; - -import Acquisition.pamAudio.WavFileInputStream; import soundtrap.xml.CDETInfo; import soundtrap.xml.DWVInfo; import soundtrap.xml.WAVInfo; diff --git a/src/soundtrap/STToolsControl.java b/src/soundtrap/STToolsControl.java index 136ac0ec..07fbc0fe 100644 --- a/src/soundtrap/STToolsControl.java +++ b/src/soundtrap/STToolsControl.java @@ -58,7 +58,7 @@ public class STToolsControl extends PamControlledUnit implements PamSettings { public void actionPerformed(ActionEvent e) { importBCL(parentFrame); } - }; + } /** * Import data from sound trap detector files. diff --git a/src/soundtrap/STToolsParams.java b/src/soundtrap/STToolsParams.java index 514b96d6..08377259 100644 --- a/src/soundtrap/STToolsParams.java +++ b/src/soundtrap/STToolsParams.java @@ -1,6 +1,5 @@ package soundtrap; -import java.io.File; import java.io.Serializable; import PamModel.parametermanager.ManagedParameters; diff --git a/src/soundtrap/STXMLFile.java b/src/soundtrap/STXMLFile.java index 20ad30a9..0b680d6e 100644 --- a/src/soundtrap/STXMLFile.java +++ b/src/soundtrap/STXMLFile.java @@ -20,15 +20,12 @@ import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; +import PamUtils.PamCalendar; import soundtrap.xml.CDETInfo; import soundtrap.xml.DWVInfo; import soundtrap.xml.SoundTrapXMLTools; import soundtrap.xml.TimeInformation; import soundtrap.xml.WAVInfo; -import PamUtils.FileParts; -import PamUtils.PamCalendar; -import d3.D3XMLFile; -import d3.SoundTrapTime; public class STXMLFile { @@ -214,7 +211,7 @@ public class STXMLFile { * @return an XML file, from which additional information can then be extracted. */ public static STXMLFile openXMLFile(File xmlFile, String dateTimeFormat) { - if (xmlFile == null || xmlFile.exists() == false) { + if (xmlFile == null || !xmlFile.exists()) { return null; } /* diff --git a/src/spectrogramNoiseReduction/SpecNoiseMethod.java b/src/spectrogramNoiseReduction/SpecNoiseMethod.java index afaca475..d14fc56b 100644 --- a/src/spectrogramNoiseReduction/SpecNoiseMethod.java +++ b/src/spectrogramNoiseReduction/SpecNoiseMethod.java @@ -2,11 +2,8 @@ package spectrogramNoiseReduction; import java.io.Serializable; -import org.w3c.dom.Element; - -import PamguardMVC.ProcessAnnotation; import PamguardMVC.PamProcess; - +import PamguardMVC.ProcessAnnotation; import fftManager.FFTDataUnit; import spectrogramNoiseReduction.layoutFX.SpecNoiseNodeFX; diff --git a/src/spectrogramNoiseReduction/SpectrogramNoiseControl.java b/src/spectrogramNoiseReduction/SpectrogramNoiseControl.java index f884a242..8422f763 100644 --- a/src/spectrogramNoiseReduction/SpectrogramNoiseControl.java +++ b/src/spectrogramNoiseReduction/SpectrogramNoiseControl.java @@ -4,6 +4,7 @@ import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.Serializable; + import javax.swing.JMenuItem; import PamController.PamConfiguration; diff --git a/src/spectrogramNoiseReduction/SpectrogramNoiseDialog.java b/src/spectrogramNoiseReduction/SpectrogramNoiseDialog.java index 076ef82f..d3b034ee 100644 --- a/src/spectrogramNoiseReduction/SpectrogramNoiseDialog.java +++ b/src/spectrogramNoiseReduction/SpectrogramNoiseDialog.java @@ -2,13 +2,15 @@ package spectrogramNoiseReduction; import java.awt.Frame; import java.awt.Window; + import javax.swing.BoxLayout; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; -import fftManager.FFTDataUnit; + import PamView.dialog.PamDialog; import PamView.dialog.SourcePanel; import PamguardMVC.PamDataBlock; +import fftManager.FFTDataUnit; public class SpectrogramNoiseDialog extends PamDialog { diff --git a/src/spectrogramNoiseReduction/SpectrogramNoiseDialogPanel.java b/src/spectrogramNoiseReduction/SpectrogramNoiseDialogPanel.java index 4eef76b9..623be2d6 100644 --- a/src/spectrogramNoiseReduction/SpectrogramNoiseDialogPanel.java +++ b/src/spectrogramNoiseReduction/SpectrogramNoiseDialogPanel.java @@ -122,7 +122,7 @@ public class SpectrogramNoiseDialogPanel { dC = methods.get(i).getDialogComponent(); if (dC != null && enableMethod[i].isSelected()) { answer = dC.getParams(); - if (answer == false) { + if (!answer) { return false; } } @@ -147,7 +147,7 @@ public class SpectrogramNoiseDialogPanel { if (done) { enableMethod[i].setSelected(false); } - enableMethod[i].setEnabled(done == false); + enableMethod[i].setEnabled(!done); if (dC != null) { dC.setSelected(enableMethod[i].isSelected()); } diff --git a/src/spectrogramNoiseReduction/SpectrogramNoiseProcess.java b/src/spectrogramNoiseReduction/SpectrogramNoiseProcess.java index 480adc5e..6def2b01 100644 --- a/src/spectrogramNoiseReduction/SpectrogramNoiseProcess.java +++ b/src/spectrogramNoiseReduction/SpectrogramNoiseProcess.java @@ -4,29 +4,25 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Vector; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - +import PamController.PamConfiguration; +import PamController.PamControlledUnit; +import PamController.PamController; +import PamUtils.complex.ComplexArray; +import PamguardMVC.PamDataBlock; +import PamguardMVC.PamDataUnit; +import PamguardMVC.PamObservable; +import PamguardMVC.PamProcess; +import PamguardMVC.ProcessAnnotation; +import PamguardMVC.dataOffline.OfflineDataLoadInfo; +import Spectrogram.SpectrumBackgrounds; +import fftManager.FFTDataBlock; +import fftManager.FFTDataUnit; import spectrogramNoiseReduction.averageSubtraction.AverageSubtraction; import spectrogramNoiseReduction.kernelSmoothing.KernelSmoothing; import spectrogramNoiseReduction.medianFilter.SpectrogramMedianFilter; import spectrogramNoiseReduction.threshold.SpectrogramThreshold; import spectrogramNoiseReduction.threshold.ThresholdParams; -import fftManager.FFTDataBlock; -import fftManager.FFTDataUnit; -import PamController.PamConfiguration; -import PamController.PamControlledUnit; -import PamController.PamController; -import PamUtils.complex.ComplexArray; -import PamguardMVC.ProcessAnnotation; -import PamguardMVC.PamDataBlock; -import PamguardMVC.PamDataUnit; -import PamguardMVC.PamObservable; -import PamguardMVC.PamProcess; -import PamguardMVC.dataOffline.OfflineDataLoadInfo; -import Spectrogram.SpectrumBackgrounds; - public class SpectrogramNoiseProcess extends PamProcess { // private SpectrogramNoiseControl spectrogramNoiseControl; diff --git a/src/spectrogramNoiseReduction/SpectrogramNoiseSettings.java b/src/spectrogramNoiseReduction/SpectrogramNoiseSettings.java index 9cfa3765..b064c6f9 100644 --- a/src/spectrogramNoiseReduction/SpectrogramNoiseSettings.java +++ b/src/spectrogramNoiseReduction/SpectrogramNoiseSettings.java @@ -6,8 +6,8 @@ import java.util.ArrayList; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; -import PamModel.parametermanager.PrivatePamParameterData; import PamModel.parametermanager.PamParameterSet.ParameterSetType; +import PamModel.parametermanager.PrivatePamParameterData; public class SpectrogramNoiseSettings implements Serializable, Cloneable, ManagedParameters { diff --git a/src/targetMotionModule/AbstractTargetMotionInformation.java b/src/targetMotionModule/AbstractTargetMotionInformation.java index 7353a065..32c6a634 100644 --- a/src/targetMotionModule/AbstractTargetMotionInformation.java +++ b/src/targetMotionModule/AbstractTargetMotionInformation.java @@ -1,12 +1,10 @@ package targetMotionModule; import java.util.ArrayList; + import javax.vecmath.Point3d; import javax.vecmath.Point3f; -import pamMaths.PamQuaternion; -import pamMaths.PamVector; -import targetMotionModule.TMManager.TMInfoWorker; import Array.ArrayManager; import Array.PamArray; import GPS.GPSDataBlock; @@ -19,6 +17,9 @@ import PamUtils.PamUtils; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.debug.Debug; +import pamMaths.PamQuaternion; +import pamMaths.PamVector; +import targetMotionModule.TMManager.TMInfoWorker; @SuppressWarnings("rawtypes") @Deprecated @@ -104,6 +105,7 @@ public class AbstractTargetMotionInformation implements TargetMotionInformation speedOfSound = currentArray.getSpeedOfSound(); } + @Override public int getNDetections(){ if (currentDetections==null) return 0; return currentDetections.size(); @@ -420,6 +422,7 @@ public class AbstractTargetMotionInformation implements TargetMotionInformation return v; } + @Override public int getReferenceHydrophones(){ int referenceHydrophones=0; for (int i=0; i streamerPath; ArrayList> streamersAll=new ArrayList>(); + ArrayManager.getArrayManager(); //units to keep track of progress; - int nCount=ArrayManager.getArrayManager().getGPSDataBlock().getUnitsCount(); + int nCount=ArrayManager.getGPSDataBlock().getUnitsCount(); int streamerCount=streamerIndex.size(); double progress; diff --git a/src/targetMotionModule/TargetMotionLocaliser.java b/src/targetMotionModule/TargetMotionLocaliser.java index 6791d819..98fae797 100644 --- a/src/targetMotionModule/TargetMotionLocaliser.java +++ b/src/targetMotionModule/TargetMotionLocaliser.java @@ -13,19 +13,19 @@ import javax.swing.JMenu; import javax.swing.JMenuItem; import javax.swing.SwingWorker; +import Localiser.algorithms.timeDelayLocalisers.bearingLoc.AbstractLocaliser; +import PamguardMVC.PamDataBlock; +import PamguardMVC.PamDataUnit; import targetMotionModule.algorithms.LeastSquares; import targetMotionModule.algorithms.MarkovChain; import targetMotionModule.algorithms.Simplex2D; import targetMotionModule.algorithms.Simplex3D; import targetMotionModule.algorithms.Simplex3DTD; import targetMotionModule.algorithms.TargetMotionModel; -import Localiser.algorithms.timeDelayLocalisers.bearingLoc.AbstractLocaliser; -import PamguardMVC.PamDataBlock; -import PamguardMVC.PamDataUnit; public class TargetMotionLocaliser extends AbstractLocaliser { - public enum Interractive {START, SAVE, BACK, CANCEL, SETNULL, SAVE_ALL}; + public enum Interractive {START, SAVE, BACK, CANCEL, SETNULL, SAVE_ALL} // public enum WorkStatus {IDLE, LOADING, WAITING}; private TargetMotionControl targetMotionControl; @@ -207,7 +207,7 @@ public class TargetMotionLocaliser extends AbstractLocali if (targetMotionList==null) return null; for(int i=0; i extends AbstractLocaliser implements LocalisationAlgorithm, LocalisationAlgorithmInfo { - public enum Interractive {START, SAVE, BACK, CANCEL, SETNULL, KEEPOLD}; + public enum Interractive {START, SAVE, BACK, CANCEL, SETNULL, KEEPOLD} // public enum WorkStatus {IDLE, LOADING, WAITING}; private TargetMotionDialog targetMotionDialog; @@ -459,7 +456,7 @@ public class TargetMotionLocaliser extends AbstractLoc String comment = null; for (eventListIndex = 0; eventListIndex < eventList.length; eventListIndex++) { anEvent = findEvent(eventList[eventListIndex]); - if (processEvent(anEvent, modelList) == false) { + if (!processEvent(anEvent, modelList)) { return null; } if (supervised) { diff --git a/src/targetMotionOld/TargetMotionSQLLogging.java b/src/targetMotionOld/TargetMotionSQLLogging.java index 4f4f133e..e60d5fb4 100644 --- a/src/targetMotionOld/TargetMotionSQLLogging.java +++ b/src/targetMotionOld/TargetMotionSQLLogging.java @@ -1,14 +1,12 @@ package targetMotionOld; import java.sql.Types; -import java.util.HashMap; import java.util.HashSet; import Localiser.LocaliserModel; import Localiser.algorithms.locErrors.LocaliserError; import Localiser.algorithms.locErrors.SimpleError; import Localiser.algorithms.locErrors.json.LocaliserErrorFactory; -import Localiser.algorithms.locErrors.json.ErrorJsonConverter; import Localiser.detectionGroupLocaliser.GroupLocResult; import Localiser.detectionGroupLocaliser.GroupLocalisation; import PamDetection.AbstractLocalisation; @@ -16,7 +14,6 @@ import PamDetection.LocContents; import PamUtils.LatLong; import PamguardMVC.PamDataUnit; import generalDatabase.EmptyTableDefinition; -import generalDatabase.PamTableDefinition; import generalDatabase.PamTableItem; import generalDatabase.SQLLoggingAddon; import generalDatabase.SQLTypes; @@ -376,7 +373,7 @@ public class TargetMotionSQLLogging implements SQLLoggingAddon { GroupLocResult tmr = new GroupLocResult(ll, sideVal, chiVal); tmr.setBeamLatLong(bLL); if (ts != null) { - tmr.setBeamTime(sqlTypes.millisFromTimeStamp(ts)); + tmr.setBeamTime(SQLTypes.millisFromTimeStamp(ts)); } tmr.setChi2((Double) chi2[resultIndex].getValue()); tmr.setAic((Double) aic[resultIndex].getValue()); diff --git a/src/tethys/Collection.java b/src/tethys/Collection.java index 33f5541f..ab62d998 100644 --- a/src/tethys/Collection.java +++ b/src/tethys/Collection.java @@ -65,7 +65,7 @@ public enum Collection { * Otherwise, may need to do a longer search to see if the user has passed * the singular document name. */ - if (name.endsWith("s") == false) { + if (!name.endsWith("s")) { c = Collection.valueOf(name+"s"); if (c != null) { return c; diff --git a/src/tethys/TethysControl.java b/src/tethys/TethysControl.java index df836e57..953a7100 100644 --- a/src/tethys/TethysControl.java +++ b/src/tethys/TethysControl.java @@ -19,7 +19,6 @@ import javax.swing.JFileChooser; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuItem; -import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.Timer; @@ -30,10 +29,7 @@ import PamController.PamControllerInterface; import PamController.PamFolders; import PamController.PamSettingManager; import PamController.PamSettings; -import PamUtils.PamFileChooser; import PamUtils.PamFileFilter; -import PamUtils.worker.PamWorkWrapper; -import PamUtils.worker.PamWorker; import PamView.PamTabPanel; import PamView.dialog.warn.WarnOnce; import PamguardMVC.PamDataBlock; diff --git a/src/tipOfTheDay/PamTipViewer.java b/src/tipOfTheDay/PamTipViewer.java index 5b73e9f9..4edcf50b 100644 --- a/src/tipOfTheDay/PamTipViewer.java +++ b/src/tipOfTheDay/PamTipViewer.java @@ -6,6 +6,7 @@ import java.awt.FlowLayout; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; + import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JCheckBox; @@ -194,17 +195,20 @@ public class PamTipViewer extends PamDialog { } class PrevButton implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { prevButton(); } } class NextButton implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { nextButton(); } } class CloseButton implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { closeButton(); } diff --git a/src/turbineops/TurbineOperationControl.java b/src/turbineops/TurbineOperationControl.java index 2f80c9bf..ea276adb 100644 --- a/src/turbineops/TurbineOperationControl.java +++ b/src/turbineops/TurbineOperationControl.java @@ -6,7 +6,6 @@ import java.util.List; import PamView.GeneralProjector.ParameterType; import PamView.GeneralProjector.ParameterUnits; -import dataPlotsFX.data.TDScaleInfo; import generalDatabase.lineplots.EnhancedTableItem; import generalDatabase.lineplots.LinePlotControl; import generalDatabase.lineplots.LinePlotScaleInfo; diff --git a/src/userDisplay/UserDisplayControl.java b/src/userDisplay/UserDisplayControl.java index 2fe0b39d..b9e0633d 100644 --- a/src/userDisplay/UserDisplayControl.java +++ b/src/userDisplay/UserDisplayControl.java @@ -30,16 +30,6 @@ import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; -import dataPlots.TDDisplayProvider; -import dataPlotsFX.TDDisplayProviderFX; -import radardisplay.RadarDisplayProvider; -import radardisplay.RadarParameters; -import radardisplay.RadarParametersDialog; -import radardisplay.RadarProjector; -import soundPlayback.PlaybackControl; -import fftManager.FFTDataUnit; -import pamScrollSystem.AbstractScrollManager; -import pamScrollSystem.coupling.ScrollerCoupling; //import localiserDisplay.LocaliserDisplayProvider; import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; @@ -54,6 +44,16 @@ import PamView.PamGui; import Spectrogram.SpectrogramDiplayProvider; import Spectrogram.SpectrogramParameters; import Spectrogram.SpectrogramParamsDialog; +import dataPlots.TDDisplayProvider; +import dataPlotsFX.TDDisplayProviderFX; +import fftManager.FFTDataUnit; +import pamScrollSystem.AbstractScrollManager; +import pamScrollSystem.coupling.ScrollerCoupling; +import radardisplay.RadarDisplayProvider; +import radardisplay.RadarParameters; +import radardisplay.RadarParametersDialog; +import radardisplay.RadarProjector; +import soundPlayback.PlaybackControl; public class UserDisplayControl extends PamControlledUnit implements PamSettings { @@ -108,7 +108,7 @@ public class UserDisplayControl extends PamControlledUnit implements // if (changeType == PamController.ADD_CONTROLLEDUNIT) { if (changeType == PamControllerInterface.ADD_CONTROLLEDUNIT) { } - if (changeType == PamController.INITIALIZATION_COMPLETE) { + if (changeType == PamControllerInterface.INITIALIZATION_COMPLETE) { createDisplays(); } @@ -192,6 +192,7 @@ public class UserDisplayControl extends PamControlledUnit implements this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent ev) { /* * First check necessary dependents are all in place @@ -214,6 +215,7 @@ public class UserDisplayControl extends PamControlledUnit implements this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent ev) { RadarParameters params = new RadarParameters(); RadarProjector radarProjector = new RadarProjector(null); @@ -255,6 +257,7 @@ public class UserDisplayControl extends PamControlledUnit implements /* (non-Javadoc) * @see PamModel.PamDependent#addDependency(PamModel.PamDependency) */ + @Override public void addDependency(PamDependency dependancy) { // TODO Auto-generated method stub @@ -263,6 +266,7 @@ public class UserDisplayControl extends PamControlledUnit implements /* (non-Javadoc) * @see PamModel.PamDependent#getDependency() */ + @Override public PamDependency getDependency() { return dependency; } @@ -270,6 +274,7 @@ public class UserDisplayControl extends PamControlledUnit implements /* (non-Javadoc) * @see PamModel.PamDependent#getDependentUserName() */ + @Override public String getDependentUserName() { return "Spectrogram"; } @@ -280,14 +285,17 @@ public class UserDisplayControl extends PamControlledUnit implements * Stuff for settings interface */ + @Override public long getSettingsVersion() { return UserDisplayParameters.serialVersionUID; } + @Override public Serializable getSettingsReference() { return tabPanelControl.getSettingsReference(); } + @Override public boolean restoreSettings( PamControlledUnitSettings pamControlledUnitSettings) { /* @@ -366,7 +374,7 @@ public class UserDisplayControl extends PamControlledUnit implements @Override public boolean canPlayViewerSound() { - if (PlaybackControl.getViewerPlayback().hasPlayDataSource() == false) { + if (!PlaybackControl.getViewerPlayback().hasPlayDataSource()) { return false; } return tabPanelControl.canPlayViewerSound(); diff --git a/src/userDisplay/UserDisplayParameters.java b/src/userDisplay/UserDisplayParameters.java index 9a0dd74f..f666686a 100644 --- a/src/userDisplay/UserDisplayParameters.java +++ b/src/userDisplay/UserDisplayParameters.java @@ -9,7 +9,6 @@ import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet.ParameterSetType; import PamModel.parametermanager.PrivatePamParameterData; import Spectrogram.SpectrogramParameters; - import radardisplay.RadarParameters; public class UserDisplayParameters implements Serializable, Cloneable, ManagedParameters { diff --git a/src/userDisplay/UserDisplayTabPanelControl.java b/src/userDisplay/UserDisplayTabPanelControl.java index a5293bb1..96dd0899 100644 --- a/src/userDisplay/UserDisplayTabPanelControl.java +++ b/src/userDisplay/UserDisplayTabPanelControl.java @@ -30,9 +30,6 @@ import javax.swing.JMenu; import javax.swing.JToolBar; import javax.swing.event.InternalFrameAdapter; import javax.swing.event.InternalFrameEvent; -import radardisplay.RadarDisplayProvider; -import radardisplay.RadarParameters; - import Layout.PamInternalFrame; import PamView.PamPanelTiler; @@ -40,6 +37,8 @@ import PamView.PamTabPanel; import Spectrogram.SpectrogramDiplayProvider; import Spectrogram.SpectrogramDisplay; import Spectrogram.SpectrogramParameters; +import radardisplay.RadarDisplayProvider; +import radardisplay.RadarParameters; public class UserDisplayTabPanelControl implements PamTabPanel { @@ -94,7 +93,7 @@ public class UserDisplayTabPanelControl implements PamTabPanel { * @param dpParams */ public void addUserDisplay(UserDisplayProvider userDisplayProvider, DisplayProviderParameters dpParams) { - if (userDisplayProvider.canCreate() == false) { + if (!userDisplayProvider.canCreate()) { return; } String uniqueName = DisplayNameManager.getInstance().getUniqueName(userDisplayProvider.getName(), dpParams); @@ -181,6 +180,7 @@ public class UserDisplayTabPanelControl implements PamTabPanel { } } + @Override public JMenu createMenu(Frame parentFrame) { return null; } @@ -189,10 +189,12 @@ public class UserDisplayTabPanelControl implements PamTabPanel { * @return Reference to a graphics component that can be added to the view. * This will typically be a JPanel or a JInternalFrame; */ + @Override public JComponent getPanel() { return userDisplayTabPanel; } + @Override public JToolBar getToolBar() { // TODO Auto-generated method stub return null; @@ -214,7 +216,7 @@ public class UserDisplayTabPanelControl implements PamTabPanel { JInternalFrame[] allFrames = userDisplayTabPanel.getAllFrames(); UserFramePlots userDisplay; for (int i = 0; i < allFrames.length; i++) { - if (PamInternalFrame.class.isAssignableFrom(allFrames[i].getClass()) == false) { + if (!PamInternalFrame.class.isAssignableFrom(allFrames[i].getClass())) { continue; } userDisplay = (UserFramePlots) ((PamInternalFrame) allFrames[i]).getFramePlots(); diff --git a/src/userDisplay/UserFramePlots.java b/src/userDisplay/UserFramePlots.java index 40104ae1..a0788566 100644 --- a/src/userDisplay/UserFramePlots.java +++ b/src/userDisplay/UserFramePlots.java @@ -32,36 +32,43 @@ abstract public class UserFramePlots extends PamFramePlots implements InternalFr this.userFrameParameters = userFrameParameters; } + @Override public void internalFrameActivated(InternalFrameEvent e) { // TODO Auto-generated method stub } + @Override public void internalFrameClosed(InternalFrameEvent e) { // TODO Auto-generated method stub } + @Override public void internalFrameClosing(InternalFrameEvent e) { // TODO Auto-generated method stub } + @Override public void internalFrameDeactivated(InternalFrameEvent e) { // TODO Auto-generated method stub } + @Override public void internalFrameDeiconified(InternalFrameEvent e) { // TODO Auto-generated method stub } + @Override public void internalFrameIconified(InternalFrameEvent e) { // TODO Auto-generated method stub } + @Override public void internalFrameOpened(InternalFrameEvent e) { // TODO Auto-generated method stub diff --git a/src/userDisplayFX/UserDisplayProcess.java b/src/userDisplayFX/UserDisplayProcess.java index 867da70a..65f10bc6 100644 --- a/src/userDisplayFX/UserDisplayProcess.java +++ b/src/userDisplayFX/UserDisplayProcess.java @@ -2,7 +2,6 @@ package userDisplayFX; import java.util.ArrayList; -import javafx.collections.ListChangeListener.Change; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamProcess; diff --git a/src/videoRangePanel/LocationManager.java b/src/videoRangePanel/LocationManager.java index 414d71e7..3df563e6 100644 --- a/src/videoRangePanel/LocationManager.java +++ b/src/videoRangePanel/LocationManager.java @@ -78,7 +78,7 @@ public class LocationManager { * @return latlong at timeMillis */ public LatLong getLocation(long timeMillis){ - LatLong latLong=null; ; + LatLong latLong=null; for (int i=0; i @@ -57,7 +57,7 @@ public class WhistleClassifierProcess extends PamProcess { * Need to keep a list of recent whistle times so that the system can be cleared * if there are no longer any whistles. */ - private LinkedList whistleTimes = new LinkedList();; + private LinkedList whistleTimes = new LinkedList(); public WhistleClassifierProcess(WhistleClassifierControl whistleClassifierControl) { @@ -142,7 +142,7 @@ public class WhistleClassifierProcess extends PamProcess { try { AcquisitionProcess sourceProcess = (AcquisitionProcess) getSourceProcess(); Acquisition.DaqSystem daqSystem = sourceProcess.getAcquisitionControl().findDaqSystem(null); - if (daqSystem != null & daqSystem.isRealTime() == false) { + if (daqSystem != null & !daqSystem.isRealTime()) { // assume it's a file name. Acquisition.FileInputSystem fileSystem = (FileInputSystem) daqSystem; soundFile = fileSystem.getCurrentFile(); diff --git a/src/whistleClassifier/WhistleClassifierTabPanelControl.java b/src/whistleClassifier/WhistleClassifierTabPanelControl.java index a9c70e86..e713c2dc 100644 --- a/src/whistleClassifier/WhistleClassifierTabPanelControl.java +++ b/src/whistleClassifier/WhistleClassifierTabPanelControl.java @@ -3,16 +3,17 @@ package whistleClassifier; import java.awt.BorderLayout; import java.awt.Frame; import java.awt.GridLayout; + import javax.swing.JComponent; import javax.swing.JMenu; import javax.swing.JPanel; import javax.swing.JToolBar; import javax.swing.border.TitledBorder; -import pamMaths.HistogramDisplay; import PamView.PamTabPanel; import PamView.panel.CornerLayoutContraint; import PamView.panel.PamBorderPanel; +import pamMaths.HistogramDisplay; public class WhistleClassifierTabPanelControl implements PamTabPanel { @@ -56,15 +57,18 @@ public class WhistleClassifierTabPanelControl implements PamTabPanel { return whistleClassifierControl.whistleClassifierProcess.getFragmentStore(); } + @Override public JMenu createMenu(Frame parentFrame) { // TODO Auto-generated method stub return null; } + @Override public JComponent getPanel() { return whistleClassifierPanel; } + @Override public JToolBar getToolBar() { // TODO Auto-generated method stub return null; diff --git a/src/whistleDetector/BetterPeakDetector.java b/src/whistleDetector/BetterPeakDetector.java index 2314e9c4..c659ec4a 100644 --- a/src/whistleDetector/BetterPeakDetector.java +++ b/src/whistleDetector/BetterPeakDetector.java @@ -24,7 +24,6 @@ import java.util.ArrayList; import PamUtils.complex.ComplexArray; import PamguardMVC.PamObservable; -import fftManager.Complex; import fftManager.FFTDataBlock; import fftManager.FFTDataUnit; @@ -83,7 +82,7 @@ public class BetterPeakDetector extends BasicPeakDetector { for (int i = searchBin0; i <= searchBin1; i++) { magSquareData[i] = newFftData.magsq(i); newval = magSquareData[i] / spectrumAverage[i]; - if ((overThreshold[i] = newval > detectionThreshold) == true) { + if ((overThreshold[i] = newval > detectionThreshold)) { spectrumAverage[i] *= bgndUpdate1_1; spectrumAverage[i] += magSquareData[i] * bgndUpdate1; nOver++; diff --git a/src/whistleDetector/PeakDataUnit.java b/src/whistleDetector/PeakDataUnit.java index f997279c..f2949917 100644 --- a/src/whistleDetector/PeakDataUnit.java +++ b/src/whistleDetector/PeakDataUnit.java @@ -3,7 +3,6 @@ package whistleDetector; import java.util.ArrayList; import PamDetection.PamDetection; -import PamguardMVC.AcousticDataUnit; import PamguardMVC.PamDataUnit; /** diff --git a/src/whistleDetector/PeakDetector.java b/src/whistleDetector/PeakDetector.java index 3ebc4817..fb6a9a43 100644 --- a/src/whistleDetector/PeakDetector.java +++ b/src/whistleDetector/PeakDetector.java @@ -29,8 +29,6 @@ import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; -import autecPhones.AutecGraphics; -import fftManager.Complex; import fftManager.FFTDataBlock; import fftManager.FFTDataUnit; @@ -91,7 +89,7 @@ abstract public class PeakDetector extends PamProcess { enum PeakStatus { PEAK_ON, PEAK_OFF, PEAK_ENDING - }; + } public PeakDetector(WhistleControl whistleControl, WhistleDetector whistleDetector, FFTDataBlock fftDataSource, int groupChannels) { @@ -143,7 +141,7 @@ abstract public class PeakDetector extends PamProcess { bgndUpdate0_1 = 1. - bgndUpdate0; bgndUpdate1 = whistleDetector.fftHop / getSampleRate() / whistleControl.whistleParameters.peakTimeConstant[1]; - ; + bgndUpdate1_1 = 1. - bgndUpdate1; searchBin0 = whistleDetector.hzToBins(whistleControl.whistleParameters.getSearchStartHz()); @@ -225,7 +223,7 @@ abstract public class PeakDetector extends PamProcess { for (int i = 0; i < whistleDetector.fftLength / 2; i++) { magsq = newFftData.magsq(i); newval = magsq / spectrumAverage[i]; - if ((overThreshold[i] = newval > detectionThreshold) == true) { + if ((overThreshold[i] = newval > detectionThreshold)) { spectrumAverage[i] *= bgndUpdate1_1; spectrumAverage[i] += magsq * bgndUpdate1; nOver++; diff --git a/src/whistleDetector/PeakGraphics.java b/src/whistleDetector/PeakGraphics.java index 5b853677..6fec7e6e 100644 --- a/src/whistleDetector/PeakGraphics.java +++ b/src/whistleDetector/PeakGraphics.java @@ -28,12 +28,12 @@ import java.util.ArrayList; import PamUtils.Coordinate3d; import PamView.GeneralProjector; +import PamView.GeneralProjector.ParameterType; +import PamView.GeneralProjector.ParameterUnits; import PamView.PamKeyItem; import PamView.PamSymbol; import PamView.PamSymbolType; import PamView.PanelOverlayDraw; -import PamView.GeneralProjector.ParameterType; -import PamView.GeneralProjector.ParameterUnits; import PamView.symbol.SymbolData; import PamguardMVC.PamDataUnit; @@ -57,6 +57,7 @@ public class PeakGraphics extends PanelOverlayDraw { this.whistleDetector = whistleDetector; } + @Override public boolean canDraw(ParameterType[] parameterTypes, ParameterUnits[] parameterUnits) { if (parameterTypes[0] == ParameterType.TIME && parameterTypes[1] == ParameterType.FREQUENCY) @@ -64,6 +65,7 @@ public class PeakGraphics extends PanelOverlayDraw { return false; } + @Override public Rectangle drawDataUnit(Graphics g, PamDataUnit pamDataUnit, GeneralProjector projector) { if (projector.getParmeterType(0) == ParameterType.TIME diff --git a/src/whistleDetector/WhistleControl.java b/src/whistleDetector/WhistleControl.java index a9675b63..794d5d4d 100644 --- a/src/whistleDetector/WhistleControl.java +++ b/src/whistleDetector/WhistleControl.java @@ -81,7 +81,7 @@ public class WhistleControl extends PamControlledUnit implements PamSettings { PamSettingManager.getInstance().registerSettings(this); - if (whistleParameters.ackOutOfDate == false) { + if (!whistleParameters.ackOutOfDate) { boolean ans = DeprecatedModuleDialog.showDialog(null, "Whistle Detector", "Whistle and Moan Detector", "detectors.whistleMoanHelp.docs.whistleMoan_Overview"); @@ -121,6 +121,7 @@ public class WhistleControl extends PamControlledUnit implements PamSettings { this.parentFrame = parentFrame; } + @Override public void actionPerformed(ActionEvent ev) { WhistleParameters newParams = WhistleParametersDialog.showDialog(parentFrame, THIS, whistleParameters, whistleDetector.getSampleRate()); if (newParams != null) { @@ -131,14 +132,17 @@ public class WhistleControl extends PamControlledUnit implements PamSettings { } } + @Override public Serializable getSettingsReference() { return whistleParameters; } + @Override public long getSettingsVersion() { return WhistleParameters.serialVersionUID; } + @Override public boolean restoreSettings(PamControlledUnitSettings pamControlledUnitSettings) { whistleParameters = ((WhistleParameters) pamControlledUnitSettings.getSettings()).clone(); return true; diff --git a/src/whistleDetector/WhistleDetector.java b/src/whistleDetector/WhistleDetector.java index 23066a03..ce91750a 100644 --- a/src/whistleDetector/WhistleDetector.java +++ b/src/whistleDetector/WhistleDetector.java @@ -22,11 +22,9 @@ package whistleDetector; import java.util.ListIterator; -import whistlesAndMoans.AbstractWhistleDataBlock; import Acquisition.AcquisitionProcess; import Localiser.detectionGroupLocaliser.DetectionGroupLocaliser; import PamController.PamController; -import PamDetection.AbstractLocalisation; import PamDetection.LocContents; import PamUtils.PamUtils; import PamUtils.complex.ComplexArray; @@ -36,12 +34,11 @@ import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; import PamguardMVC.PamProcess; -import autecPhones.AutecGraphics; -import fftManager.Complex; import fftManager.FFTDataBlock; import fftManager.FFTDataUnit; import generalDatabase.PamDetectionLogging; import generalDatabase.SQLLogging; +import whistlesAndMoans.AbstractWhistleDataBlock; /** * @author Doug Gillespie @@ -394,7 +391,7 @@ public class WhistleDetector extends PamProcess { WhistleLocalisation whistleLocalisation = new WhistleLocalisation(shapeDataUnit, hydrophoneList); int delay, detectionChannel, bearingChannel; - detectionChannel = PamUtils.getNthChannel(0, shapeDataUnit.getChannelBitmap());; + detectionChannel = PamUtils.getNthChannel(0, shapeDataUnit.getChannelBitmap()); for (int i = 1; i < nChannels; i++) { // measure as many delays as possible, all relative to channel 0, which will // contain the detection data. diff --git a/src/whistleDetector/WhistleEventDetector.java b/src/whistleDetector/WhistleEventDetector.java index d0f68abd..aab46dda 100644 --- a/src/whistleDetector/WhistleEventDetector.java +++ b/src/whistleDetector/WhistleEventDetector.java @@ -6,12 +6,9 @@ import PamView.symbol.StandardSymbolManager; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; -import PamguardMVC.PamObserver; import PamguardMVC.PamProcess; -import SoundRecorder.RecorderControl; import SoundRecorder.trigger.RecorderTrigger; import SoundRecorder.trigger.RecorderTriggerData; -import autecPhones.AutecGraphics; public class WhistleEventDetector extends PamProcess { @@ -166,6 +163,7 @@ public class WhistleEventDetector extends PamProcess { RecorderTriggerData recorderTriggerData = new RecorderTriggerData(whistleControl.getUnitName() + " Events", 30, 60); + @Override public RecorderTriggerData getDefaultTriggerData() { return recorderTriggerData; } diff --git a/src/whistleDetector/WhistleEventGraphics.java b/src/whistleDetector/WhistleEventGraphics.java index ffc1bfd5..42706014 100644 --- a/src/whistleDetector/WhistleEventGraphics.java +++ b/src/whistleDetector/WhistleEventGraphics.java @@ -1,11 +1,12 @@ package whistleDetector; import java.awt.Color; + import PamView.GeneralProjector; +import PamView.GeneralProjector.ParameterType; import PamView.PamDetectionOverlayGraphics; import PamView.PamSymbol; import PamView.PamSymbolType; -import PamView.GeneralProjector.ParameterType; import PamView.symbol.SymbolData; public class WhistleEventGraphics extends PamDetectionOverlayGraphics { diff --git a/src/whistleDetector/WhistleEventLogger.java b/src/whistleDetector/WhistleEventLogger.java index 267f7993..cc80698d 100644 --- a/src/whistleDetector/WhistleEventLogger.java +++ b/src/whistleDetector/WhistleEventLogger.java @@ -1,18 +1,15 @@ package whistleDetector; +import java.sql.Types; + +import PamguardMVC.PamDataBlock; +import PamguardMVC.PamDataUnit; import generalDatabase.PamConnection; import generalDatabase.PamTableDefinition; import generalDatabase.PamTableItem; import generalDatabase.SQLLogging; import generalDatabase.SQLTypes; -import java.sql.Connection; -import java.sql.Types; - -import PamUtils.PamCalendar; -import PamguardMVC.PamDataBlock; -import PamguardMVC.PamDataUnit; - public class WhistleEventLogger extends SQLLogging { private WhistleEventDetector whistleEventDetector; diff --git a/src/whistleDetector/WhistleGraphics.java b/src/whistleDetector/WhistleGraphics.java index 010dd91b..11001f53 100644 --- a/src/whistleDetector/WhistleGraphics.java +++ b/src/whistleDetector/WhistleGraphics.java @@ -25,6 +25,7 @@ import java.awt.Color; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Rectangle; + import PamUtils.Coordinate3d; import PamView.GeneralProjector; import PamView.PamDetectionOverlayGraphics; diff --git a/src/whistleDetector/WhistleLocaliser.java b/src/whistleDetector/WhistleLocaliser.java index f461a3e8..ee60223e 100644 --- a/src/whistleDetector/WhistleLocaliser.java +++ b/src/whistleDetector/WhistleLocaliser.java @@ -4,7 +4,6 @@ import java.util.ListIterator; import PamUtils.complex.ComplexArray; import PamguardMVC.PamDataBlock; -import fftManager.Complex; import fftManager.FFTDataBlock; import fftManager.FFTDataUnit; import fftManager.FastFFT; diff --git a/src/whistleDetector/WhistleLogger.java b/src/whistleDetector/WhistleLogger.java index 34345e88..e528513b 100644 --- a/src/whistleDetector/WhistleLogger.java +++ b/src/whistleDetector/WhistleLogger.java @@ -1,16 +1,14 @@ package whistleDetector; -import generalDatabase.EmptyTableDefinition; -import generalDatabase.PamDetectionLogging; -import generalDatabase.PamTableDefinition; -import generalDatabase.PamTableItem; -import generalDatabase.SQLLogging; -import generalDatabase.SQLTypes; - import java.sql.Types; import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataUnit; +import generalDatabase.EmptyTableDefinition; +import generalDatabase.PamDetectionLogging; +import generalDatabase.PamTableItem; +import generalDatabase.SQLLogging; +import generalDatabase.SQLTypes; public class WhistleLogger extends PamDetectionLogging { diff --git a/src/whistleDetector/WhistleParametersDialog.java b/src/whistleDetector/WhistleParametersDialog.java index 07e6c341..59cc813e 100644 --- a/src/whistleDetector/WhistleParametersDialog.java +++ b/src/whistleDetector/WhistleParametersDialog.java @@ -8,6 +8,7 @@ import java.awt.GridBagLayout; import java.awt.Window; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; + import javax.swing.BoxLayout; import javax.swing.JButton; import javax.swing.JComboBox; @@ -19,12 +20,11 @@ import javax.swing.JTextField; import javax.swing.border.EmptyBorder; import javax.swing.border.TitledBorder; -import fftManager.FFTDataUnit; - import PamController.PamController; import PamView.dialog.GroupedSourcePanel; import PamView.dialog.PamDialog; import PamguardMVC.PamDataBlock; +import fftManager.FFTDataUnit; public class WhistleParametersDialog extends PamDialog { @@ -391,6 +391,7 @@ public class WhistleParametersDialog extends PamDialog { class DefButtonAction implements ActionListener { + @Override public void actionPerformed(ActionEvent arg0) { if (arg0.getSource() == searchStartButton) { searchStartHz.setText("0"); diff --git a/src/whistleDetector/WhistleShape.java b/src/whistleDetector/WhistleShape.java index 185fbc42..45a20ac6 100644 --- a/src/whistleDetector/WhistleShape.java +++ b/src/whistleDetector/WhistleShape.java @@ -119,6 +119,7 @@ public class WhistleShape implements Comparable { * @return 1 if this whistle is the longer of the two * -1 otherwise. */ + @Override public int compareTo(WhistleShape w) { if (this.whistlePeaks.size() > w.whistlePeaks.size()) return 1; diff --git a/src/whistleDetector/WhistleSidePanel.java b/src/whistleDetector/WhistleSidePanel.java index 7f2f59e5..f4aa5b00 100644 --- a/src/whistleDetector/WhistleSidePanel.java +++ b/src/whistleDetector/WhistleSidePanel.java @@ -14,14 +14,12 @@ import javax.swing.border.TitledBorder; import PamUtils.PamCalendar; import PamView.PamColors; -import PamView.PamSidePanel; import PamView.PamColors.PamColor; +import PamView.PamSidePanel; import PamView.dialog.PamLabel; import PamView.panel.PamBorderPanel; import PamguardMVC.PamDataBlock; -import PamguardMVC.PamDataUnit; import PamguardMVC.PamObservable; -import PamguardMVC.PamObserver; import PamguardMVC.PamObserverAdapter; public class WhistleSidePanel extends PamObserverAdapter implements PamSidePanel { @@ -113,25 +111,30 @@ public class WhistleSidePanel extends PamObserverAdapter implements PamSidePanel } } + @Override public JComponent getPanel() { return sidePanel; } + @Override public void rename(String newName) { titledBorder.setTitle(newName); sidePanel.repaint(); } class TimerEvent implements ActionListener { + @Override public void actionPerformed(ActionEvent e) { sidePanel.fillData(); } } + @Override public String getObserverName() { return "Whistle side panel"; } + @Override public long getRequiredDataHistory(PamObservable o, Object arg) { return countTime * 60000; } diff --git a/src/whistlesAndMoans/AbstractWhistleDataUnit.java b/src/whistlesAndMoans/AbstractWhistleDataUnit.java index 9ec59f9f..c3ed4897 100644 --- a/src/whistlesAndMoans/AbstractWhistleDataUnit.java +++ b/src/whistlesAndMoans/AbstractWhistleDataUnit.java @@ -1,11 +1,9 @@ package whistlesAndMoans; -import whistleClassifier.WhistleContour; import PamDetection.PamDetection; -import PamguardMVC.AcousticDataUnit; import PamguardMVC.DataUnitBaseData; import PamguardMVC.PamDataUnit; -import PamguardMVC.TFContourProvider;; +import whistleClassifier.WhistleContour;; public abstract class AbstractWhistleDataUnit extends PamDataUnit implements WhistleContour, PamDetection { @@ -29,11 +27,13 @@ public abstract class AbstractWhistleDataUnit extends PamDataUnit 0) { + if (!hasHoles && nHoles[i] > 0) { firstHoleSlice = i; hasHoles = true; } @@ -392,9 +392,9 @@ public class ConnectedRegion implements Cloneable{ while (li.hasNext()) { slices[2] = li.next(); for (int i = 0; i < slices[0].sliceLength; i++) { - if (slices[0].slicePixs[i] == false & - slices[1].slicePixs[i] == true & - slices[2].slicePixs[i] == false) { + if (!slices[0].slicePixs[i] & + slices[1].slicePixs[i] & + !slices[2].slicePixs[i]) { slices[1].slicePixs[i] = false; } } @@ -414,9 +414,9 @@ public class ConnectedRegion implements Cloneable{ while (li.hasNext()) { slices[2] = li.next(); for (int i = 0; i < slices[0].sliceLength; i++) { - if (slices[0].slicePixs[i] == true & - slices[1].slicePixs[i] == false & - slices[2].slicePixs[i] == true) { + if (slices[0].slicePixs[i] & + !slices[1].slicePixs[i] & + slices[2].slicePixs[i]) { slices[1].slicePixs[i] = true; } } diff --git a/src/whistlesAndMoans/ConnectedRegionDataBlock.java b/src/whistlesAndMoans/ConnectedRegionDataBlock.java index 1a298fb0..48a99d4b 100644 --- a/src/whistlesAndMoans/ConnectedRegionDataBlock.java +++ b/src/whistlesAndMoans/ConnectedRegionDataBlock.java @@ -1,10 +1,5 @@ package whistlesAndMoans; -import whistlesAndMoans.alarm.WMAlarmCounterProvider; -import whistlesAndMoans.dataSelector.WMDDataSelectCreator; -import whistlesAndMoans.species.WhistleMoanTethysProvider; -import whistlesAndMoans.species.WhistleSpeciesManager; -import whistlesAndMoans.toad.WSLToadCalculator; import PamView.GroupedDataSource; import PamView.GroupedSourceParameters; import PamguardMVC.DataAutomation; @@ -17,6 +12,11 @@ import alarm.AlarmDataSource; import tethys.TethysControl; import tethys.pamdata.TethysDataProvider; import tethys.species.DataBlockSpeciesManager; +import whistlesAndMoans.alarm.WMAlarmCounterProvider; +import whistlesAndMoans.dataSelector.WMDDataSelectCreator; +import whistlesAndMoans.species.WhistleMoanTethysProvider; +import whistlesAndMoans.species.WhistleSpeciesManager; +import whistlesAndMoans.toad.WSLToadCalculator; public class ConnectedRegionDataBlock extends AbstractWhistleDataBlock implements AlarmDataSource, GroupedDataSource, FFTDataHolderBlock { diff --git a/src/whistlesAndMoans/FragmentingFragmenter.java b/src/whistlesAndMoans/FragmentingFragmenter.java index 69ea120e..7189fe69 100644 --- a/src/whistlesAndMoans/FragmentingFragmenter.java +++ b/src/whistlesAndMoans/FragmentingFragmenter.java @@ -99,7 +99,7 @@ public class FragmentingFragmenter extends DiscardingFragmenter { */ matchAll = true; for (int iP = 0; iP < prevSlice.nPeaks; iP++) { - if (matchPeak(prevSlice.peakInfo[iP], thisSlice.peakInfo[iP], conType) == false) { + if (!matchPeak(prevSlice.peakInfo[iP], thisSlice.peakInfo[iP], conType)) { matchAll = false; } } @@ -109,7 +109,7 @@ public class FragmentingFragmenter extends DiscardingFragmenter { } } } - if (matchAll == false) { + if (!matchAll) { /* * Be bit more individualistic about it. */ diff --git a/src/whistlesAndMoans/SliceData.java b/src/whistlesAndMoans/SliceData.java index 9600de7b..f02b1b80 100644 --- a/src/whistlesAndMoans/SliceData.java +++ b/src/whistlesAndMoans/SliceData.java @@ -1,7 +1,6 @@ package whistlesAndMoans; import PamUtils.complex.ComplexArray; -import fftManager.Complex; import fftManager.FFTDataUnit; public class SliceData { @@ -90,7 +89,7 @@ public class SliceData { iR = 0; } for (int i = 0; i < sliceLength; i++) { - if (slicePixs[i] == false) { + if (!slicePixs[i]) { continue; } temp = fftData.magsq(i); diff --git a/src/whistlesAndMoans/StubRemover.java b/src/whistlesAndMoans/StubRemover.java index 3667b179..e14420e8 100644 --- a/src/whistlesAndMoans/StubRemover.java +++ b/src/whistlesAndMoans/StubRemover.java @@ -1,7 +1,6 @@ package whistlesAndMoans; import java.util.List; -import java.util.ListIterator; public class StubRemover { @@ -33,7 +32,7 @@ public class StubRemover { } int diagGap = whistleControl.getWhistleToneParameters().getConnectType() == 4 ? 0 : 1; - SliceData aSlice;; + SliceData aSlice; for (int i = 0; i < nSlice; i++) { aSlice = sliceData.get(i); if (aSlice.nPeaks > 1) { diff --git a/src/whistlesAndMoans/WMDatagramProvider.java b/src/whistlesAndMoans/WMDatagramProvider.java index 0f3922bf..49e1d965 100644 --- a/src/whistlesAndMoans/WMDatagramProvider.java +++ b/src/whistlesAndMoans/WMDatagramProvider.java @@ -30,7 +30,7 @@ public class WMDatagramProvider implements DatagramProvider { @Override public int addDatagramData(PamDataUnit dataUnit, float[] dataGramLine) { - if (dataUnit instanceof ConnectedRegionDataUnit == false) { + if (!(dataUnit instanceof ConnectedRegionDataUnit)) { return 0; } ConnectedRegionDataUnit crDataUnit = (ConnectedRegionDataUnit) dataUnit; diff --git a/src/whistlesAndMoans/WMRecordTriggerdialog.java b/src/whistlesAndMoans/WMRecordTriggerdialog.java index f4bbaee0..7b925b3b 100644 --- a/src/whistlesAndMoans/WMRecordTriggerdialog.java +++ b/src/whistlesAndMoans/WMRecordTriggerdialog.java @@ -8,6 +8,7 @@ import java.awt.Window; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; import PamView.dialog.PamDialog; @@ -34,18 +35,18 @@ public class WMRecordTriggerdialog extends PamDialog { freqPanel.setLayout(new GridBagLayout()); freqPanel.setBorder(new TitledBorder("Trigger Options")); GridBagConstraints c = new PamGridBagContraints(); - addComponent(freqPanel, new JLabel("Minimum Frequency ", JLabel.RIGHT), c); + addComponent(freqPanel, new JLabel("Minimum Frequency ", SwingConstants.RIGHT), c); c.gridx++; addComponent(freqPanel, minFreq = new JTextField(6), c); c.gridx++; - addComponent(freqPanel, new JLabel(" Hz", JLabel.LEFT), c); + addComponent(freqPanel, new JLabel(" Hz", SwingConstants.LEFT), c); c.gridx = 0; c.gridy++; - addComponent(freqPanel, new JLabel("Maximum Frequency ", JLabel.RIGHT), c); + addComponent(freqPanel, new JLabel("Maximum Frequency ", SwingConstants.RIGHT), c); c.gridx++; addComponent(freqPanel, maxFreq = new JTextField(6), c); c.gridx++; - addComponent(freqPanel, new JLabel(" Hz", JLabel.LEFT), c); + addComponent(freqPanel, new JLabel(" Hz", SwingConstants.LEFT), c); setDialogComponent(mainPanel); diff --git a/src/whistlesAndMoans/WMRecorderTrigger.java b/src/whistlesAndMoans/WMRecorderTrigger.java index 64d8a703..d2c22dde 100644 --- a/src/whistlesAndMoans/WMRecorderTrigger.java +++ b/src/whistlesAndMoans/WMRecorderTrigger.java @@ -1,9 +1,5 @@ package whistlesAndMoans; -import java.awt.Window; -import java.io.Serializable; - -import PamguardMVC.PamDataUnit; import SoundRecorder.trigger.RecorderTrigger; import SoundRecorder.trigger.RecorderTriggerData; diff --git a/src/whistlesAndMoans/WhistleBearingInfo.java b/src/whistlesAndMoans/WhistleBearingInfo.java index 0c6eb418..2d0e2b5f 100644 --- a/src/whistlesAndMoans/WhistleBearingInfo.java +++ b/src/whistlesAndMoans/WhistleBearingInfo.java @@ -1,8 +1,6 @@ package whistlesAndMoans; -import pamMaths.PamVector; import Array.ArrayManager; -import Array.HydrophoneLocator; import Array.PamArray; import Localiser.algorithms.timeDelayLocalisers.bearingLoc.BearingLocaliser; import PamDetection.AbstractLocalisation; @@ -10,6 +8,7 @@ import PamDetection.LocContents; import PamDetection.LocalisationInfo; import PamUtils.PamUtils; import PamguardMVC.PamDataUnit; +import pamMaths.PamVector; public class WhistleBearingInfo extends AbstractLocalisation { diff --git a/src/whistlesAndMoans/WhistleBinaryDataSource.java b/src/whistlesAndMoans/WhistleBinaryDataSource.java index bfe24f24..15aaf99b 100644 --- a/src/whistlesAndMoans/WhistleBinaryDataSource.java +++ b/src/whistlesAndMoans/WhistleBinaryDataSource.java @@ -8,7 +8,6 @@ import java.io.File; import java.io.IOException; import java.util.List; -import whistlesAndMoans.WhistleToneConnectProcess.ShapeConnector; import Localiser.algorithms.timeDelayLocalisers.bearingLoc.BearingLocaliser; import PamController.PamController; import PamUtils.PamUtils; @@ -19,7 +18,7 @@ import binaryFileStorage.BinaryHeader; import binaryFileStorage.BinaryObjectData; import binaryFileStorage.ModuleFooter; import binaryFileStorage.ModuleHeader; -import binaryFileStorage.PackedBinaryObject; +import whistlesAndMoans.WhistleToneConnectProcess.ShapeConnector; public class WhistleBinaryDataSource extends BinaryDataSource { diff --git a/src/whistlesAndMoans/WhistleBinaryModuleHeader.java b/src/whistlesAndMoans/WhistleBinaryModuleHeader.java index e76ad76e..e1c32720 100644 --- a/src/whistlesAndMoans/WhistleBinaryModuleHeader.java +++ b/src/whistlesAndMoans/WhistleBinaryModuleHeader.java @@ -2,7 +2,6 @@ package whistlesAndMoans; import java.io.Serializable; -import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet.ParameterSetType; import binaryFileStorage.BinaryHeader; diff --git a/src/whistlesAndMoans/WhistleDelays.java b/src/whistlesAndMoans/WhistleDelays.java index 1f4afae5..4c39c054 100644 --- a/src/whistlesAndMoans/WhistleDelays.java +++ b/src/whistlesAndMoans/WhistleDelays.java @@ -8,13 +8,11 @@ import PamUtils.PamUtils; import PamUtils.complex.ComplexArray; import PamguardMVC.PamConstants; import PamguardMVC.PamDataBlock; -import PamguardMVC.PamDataUnit; import PamguardMVC.PamRawDataBlock; import fftManager.Complex; import fftManager.FFTDataBlock; import fftManager.FFTDataUnit; import fftManager.FastFFT; -import PamguardMVC.PamRawDataBlock; /** * Class for estimating whistle delays from a whistle shape. @@ -63,7 +61,7 @@ public class WhistleDelays { sourceData = (FFTDataBlock) whProcess.getParentDataBlock(); if (nDelays <= 0) { return; - }; + } delayMeasures = new DelayMeasure[nDelays]; for (int i = 0; i < nDelays; i++) { delayMeasures[i] = new DelayMeasure(sourceData.getFftLength()); diff --git a/src/whistlesAndMoans/WhistleJSONDataSource.java b/src/whistlesAndMoans/WhistleJSONDataSource.java index efb89945..ebaed9d9 100644 --- a/src/whistlesAndMoans/WhistleJSONDataSource.java +++ b/src/whistlesAndMoans/WhistleJSONDataSource.java @@ -56,7 +56,7 @@ public class WhistleJSONDataSource extends JSONObjectDataSource objectData.contour[i] = objectData.sliceData[i].peakData[0][1]; objectData.contWidth[i] = objectData.sliceData[i].peakData[0][2]-objectData.sliceData[i].peakData[0][0] + 1; } - objectData.meanWidth = Arrays.stream(objectData.contWidth).average().orElse(Double.NaN);; + objectData.meanWidth = Arrays.stream(objectData.contWidth).average().orElse(Double.NaN); } diff --git a/src/whistlesAndMoans/WhistleLocationDataBlock.java b/src/whistlesAndMoans/WhistleLocationDataBlock.java index ab12ff46..f5ca03f0 100644 --- a/src/whistlesAndMoans/WhistleLocationDataBlock.java +++ b/src/whistlesAndMoans/WhistleLocationDataBlock.java @@ -1,7 +1,6 @@ package whistlesAndMoans; import PamguardMVC.PamDataBlock; -import PamguardMVC.PamProcess; public class WhistleLocationDataBlock extends PamDataBlock { diff --git a/src/whistlesAndMoans/WhistleMoanControl.java b/src/whistlesAndMoans/WhistleMoanControl.java index aa36c48a..0186f4c1 100644 --- a/src/whistlesAndMoans/WhistleMoanControl.java +++ b/src/whistlesAndMoans/WhistleMoanControl.java @@ -7,21 +7,8 @@ import java.io.Serializable; import javax.swing.JMenuItem; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - import Localiser.LocalisationAlgorithm; import Localiser.LocalisationAlgorithmInfo; -import dataPlots.data.TDDataProviderRegister; -import dataPlotsFX.data.TDDataProviderRegisterFX; -import dataPlotsFX.whistlePlotFX.WhistleMoanProviderFX; -import detectionPlotFX.data.DDPlotRegister; -import detectionPlotFX.rawDDPlot.ClickDDPlotProvider; -import detectionPlotFX.whistleDDPlot.WhistleDDPlotProvider; -import spectrogramNoiseReduction.SpectrogramNoiseProcess; -import tethys.localization.LocalizationCreator; -import whistlesAndMoans.layoutFX.WhistleMoanGUIFX; -import whistlesAndMoans.plots.WhistlePlotProvider; import PamController.PamConfiguration; import PamController.PamControlledUnit; import PamController.PamControlledUnitGUI; @@ -32,6 +19,15 @@ import PamController.PamSettingManager; import PamController.PamSettings; import PamView.PamSidePanel; import PamView.WrapperControlledGUISwing; +import dataPlots.data.TDDataProviderRegister; +import dataPlotsFX.data.TDDataProviderRegisterFX; +import dataPlotsFX.whistlePlotFX.WhistleMoanProviderFX; +import detectionPlotFX.data.DDPlotRegister; +import detectionPlotFX.whistleDDPlot.WhistleDDPlotProvider; +import spectrogramNoiseReduction.SpectrogramNoiseProcess; +import tethys.localization.LocalizationCreator; +import whistlesAndMoans.layoutFX.WhistleMoanGUIFX; +import whistlesAndMoans.plots.WhistlePlotProvider; public class WhistleMoanControl extends PamControlledUnit implements PamSettings, LocalisationAlgorithm { @@ -212,6 +208,7 @@ public class WhistleMoanControl extends PamControlledUnit implements PamSettings * @param flag. The GUI type flag defined in PAMGuiManager. * @return the GUI for the PamControlledUnit unit. */ + @Override public PamControlledUnitGUI getGUI(int flag) { if (flag==PamGUIManager.FX) { if (whistleMoanGUIFX ==null) { diff --git a/src/whistlesAndMoans/WhistleToneConnectProcess.java b/src/whistlesAndMoans/WhistleToneConnectProcess.java index 6c2b5e42..acc293d7 100644 --- a/src/whistlesAndMoans/WhistleToneConnectProcess.java +++ b/src/whistlesAndMoans/WhistleToneConnectProcess.java @@ -5,15 +5,6 @@ import java.util.LinkedList; import java.util.List; import java.util.ListIterator; -import networkTransfer.receive.BuoyStatusDataUnit; -import spectrogramNoiseReduction.SpectrogramNoiseProcess; -import spectrogramNoiseReduction.SpectrogramNoiseSettings; -import whistlesAndMoans.plots.WhistleSymbolManager; -import eventCounter.DataCounter; -import fftManager.FFTDataBlock; -import fftManager.FFTDataUnit; -import generalDatabase.PamDetectionLogging; -import generalDatabase.SQLLogging; import Array.ArrayManager; import Localiser.LocalisationAlgorithmInfo; import Localiser.algorithms.Correlations; @@ -37,6 +28,15 @@ import PamguardMVC.PamProcess; import PamguardMVC.background.SpecBackgroundDataUnit; import PamguardMVC.background.SpecBackgroundManager; import Spectrogram.SpectrumBackgrounds; +import eventCounter.DataCounter; +import fftManager.FFTDataBlock; +import fftManager.FFTDataUnit; +import generalDatabase.PamDetectionLogging; +import generalDatabase.SQLLogging; +import networkTransfer.receive.BuoyStatusDataUnit; +import spectrogramNoiseReduction.SpectrogramNoiseProcess; +import spectrogramNoiseReduction.SpectrogramNoiseSettings; +import whistlesAndMoans.plots.WhistleSymbolManager; public class WhistleToneConnectProcess extends PamProcess { @@ -349,7 +349,7 @@ public class WhistleToneConnectProcess extends PamProcess { if (sbProcess == null) { return sourceBlock; } - if (sbProcess instanceof SpectrogramNoiseProcess == false) { + if (!(sbProcess instanceof SpectrogramNoiseProcess)) { return sourceBlock; } else { @@ -559,7 +559,7 @@ public class WhistleToneConnectProcess extends PamProcess { // loop over new data for (int i = space; i < dataLen+space; i++) { - if (spacedArray[i] == false) { + if (!spacedArray[i]) { continue; // continue of this pixel is not set. } /* @@ -606,7 +606,7 @@ public class WhistleToneConnectProcess extends PamProcess { * this region, but didn't get assigned. */ for (int ii = i-1; ii >0; ii--) { - if (spacedArray[ii] == false || regionArray[1][ii] != null) { + if (!spacedArray[ii] || regionArray[1][ii] != null) { break; } regionArray[1][ii] = regionArray[1][i]; @@ -619,7 +619,7 @@ public class WhistleToneConnectProcess extends PamProcess { * need to run up the column again creating new regions. */ for (int i = space; i < dataLen+space; i++) { - if (spacedArray[i] == false || regionArray[1][i] != null) { + if (!spacedArray[i] || regionArray[1][i] != null) { continue; // continue of this pixel is not set. } /* @@ -734,9 +734,9 @@ public class WhistleToneConnectProcess extends PamProcess { ConnectedRegion r; while(rl.hasNext()) { r=rl.next(); - if (r.isGrowing() == false) { + if (!r.isGrowing()) { rl.remove(); - if (completeRegion(r) == false) { + if (!completeRegion(r)) { recycleRegion(r); } } @@ -753,7 +753,7 @@ public class WhistleToneConnectProcess extends PamProcess { // if (region.getFirstSlice() == 44647) { // System.out.println("Defrag big one"); - if (whistleMoanControl.getWhistleToneParameters().keepShapeStubs == false) { + if (!whistleMoanControl.getWhistleToneParameters().keepShapeStubs) { stubRemover.removeStubs(region); } // } diff --git a/src/whistlesAndMoans/WhistleToneDialog.java b/src/whistlesAndMoans/WhistleToneDialog.java index 2d0fbdcc..8a9f34cb 100644 --- a/src/whistlesAndMoans/WhistleToneDialog.java +++ b/src/whistlesAndMoans/WhistleToneDialog.java @@ -14,19 +14,19 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.JTextField; +import javax.swing.SwingConstants; import javax.swing.border.TitledBorder; import PamController.PamController; -import spectrogramNoiseReduction.SpectrogramNoiseDialogPanel; -import spectrogramNoiseReduction.SpectrogramNoiseSettings; -import fftManager.FFTDataBlock; -import fftManager.FFTDataUnit; import PamView.dialog.GroupedSourcePanel; import PamView.dialog.PamDialog; import PamView.dialog.PamGridBagContraints; import PamguardMVC.PamDataBlock; import PamguardMVC.PamProcess; import cepstrum.CepstrumProcess; +import fftManager.FFTDataUnit; +import spectrogramNoiseReduction.SpectrogramNoiseDialogPanel; +import spectrogramNoiseReduction.SpectrogramNoiseSettings; public class WhistleToneDialog extends PamDialog { @@ -104,7 +104,7 @@ public class WhistleToneDialog extends PamDialog { addComponent(e, new JLabel(" pixels"), c); c.gridy++; c.gridx=0; - addComponent(e, new JLabel(" Shape 'stubs' ", JLabel.RIGHT), c); + addComponent(e, new JLabel(" Shape 'stubs' ", SwingConstants.RIGHT), c); c.gridx++; addComponent(e, removeStubs = new JCheckBox("Remove small stubs"), c); c.gridy++; @@ -196,7 +196,7 @@ public class WhistleToneDialog extends PamDialog { @Override public boolean getParams() { - if (sourcePanel.getParams(whistleToneParameters) == false) { + if (!sourcePanel.getParams(whistleToneParameters)) { return false; } if (whistleToneParameters.getChanOrSeqBitmap() == 0) { @@ -212,7 +212,7 @@ public class WhistleToneDialog extends PamDialog { catch (NumberFormatException e) { return false; } - whistleToneParameters.keepShapeStubs = (removeStubs.isSelected() == false); + whistleToneParameters.keepShapeStubs = !removeStubs.isSelected(); if (connectType.getSelectedIndex() == 1) { whistleToneParameters.setConnectType(8); } @@ -220,7 +220,7 @@ public class WhistleToneDialog extends PamDialog { whistleToneParameters.setConnectType(4); } whistleToneParameters.fragmentationMethod = fragmentation.getSelectedIndex(); - if (spectrogramNoiseDialogPanel.getParams(whistleToneParameters.getSpecNoiseSettings()) == false) { + if (!spectrogramNoiseDialogPanel.getParams(whistleToneParameters.getSpecNoiseSettings())) { return false; } // PamDataBlock dataSource = sourcePanel.getSource(); @@ -229,7 +229,7 @@ public class WhistleToneDialog extends PamDialog { // whistleToneParameters.channelList = dataSource.getChannelMap(); // } boolean ok = checkMethods(); - if (ok == false) { + if (!ok) { String msg = "For the Whistle and tone detector to work, you must use \n" + "the following spectrogram noise reduction methods:\n" + "Median filter\n" + @@ -257,7 +257,7 @@ public class WhistleToneDialog extends PamDialog { // the Gaussian smoothing is optional. int[] required = {0, 1, 3}; for (int i = 0; i < required.length; i++) { - if (spectrogramNoiseDialogPanel.hasProcessed(required[i]) == false) { + if (!spectrogramNoiseDialogPanel.hasProcessed(required[i])) { return false; } } diff --git a/src/whistlesAndMoans/WhistleToneLogging.java b/src/whistlesAndMoans/WhistleToneLogging.java index 5c9c9dab..e0ef6e75 100644 --- a/src/whistlesAndMoans/WhistleToneLogging.java +++ b/src/whistlesAndMoans/WhistleToneLogging.java @@ -1,9 +1,7 @@ package whistlesAndMoans; import PamguardMVC.PamDataBlock; -import PamguardMVC.PamDataUnit; import generalDatabase.PamDetectionLogging; -import generalDatabase.SQLTypes; public class WhistleToneLogging extends PamDetectionLogging { diff --git a/src/whistlesAndMoans/WhistleToneParameters.java b/src/whistlesAndMoans/WhistleToneParameters.java index a0f7503d..7fb89b3e 100644 --- a/src/whistlesAndMoans/WhistleToneParameters.java +++ b/src/whistlesAndMoans/WhistleToneParameters.java @@ -5,9 +5,8 @@ import java.io.Serializable; import PamModel.parametermanager.ManagedParameters; import PamModel.parametermanager.PamParameterSet; import PamModel.parametermanager.PamParameterSet.ParameterSetType; -import spectrogramNoiseReduction.SpectrogramNoiseSettings; - import PamView.GroupedSourceParameters; +import spectrogramNoiseReduction.SpectrogramNoiseSettings; public class WhistleToneParameters extends GroupedSourceParameters implements Serializable, Cloneable, ManagedParameters { diff --git a/src/zipUnpacker/ZipSettings.java b/src/zipUnpacker/ZipSettings.java index 06d8fbb3..368158ac 100644 --- a/src/zipUnpacker/ZipSettings.java +++ b/src/zipUnpacker/ZipSettings.java @@ -4,12 +4,10 @@ import java.io.File; import java.io.Serializable; import java.util.ArrayList; -import PamController.PamControlledUnit; import PamController.PamControlledUnitSettings; import PamController.PamController; import PamController.PamSettingManager; import PamUtils.FileParts; -import PamUtils.PamCalendar; import binaryFileStorage.BinaryStore; import binaryFileStorage.BinaryStoreSettings; diff --git a/src/zipUnpacker/ZipUnpacker.java b/src/zipUnpacker/ZipUnpacker.java index 720b2116..c192ba20 100644 --- a/src/zipUnpacker/ZipUnpacker.java +++ b/src/zipUnpacker/ZipUnpacker.java @@ -49,10 +49,10 @@ public class ZipUnpacker implements PamSettings { if (zipSettings.getArchiveFolder() == null || zipSettings.getDataFolder() == null) { return; } - if (new File(zipSettings.getArchiveFolder()).exists() == false) { + if (!new File(zipSettings.getArchiveFolder()).exists()) { return; } - if (new File(zipSettings.getDataFolder()).exists() == false) { + if (!new File(zipSettings.getDataFolder()).exists()) { return; } ArrayList newDoneFiles = new ArrayList<>(); @@ -90,8 +90,8 @@ public class ZipUnpacker implements PamSettings { outFolderName += FileParts.getFileSeparator() + dataType; } File outFolder = new File(outFolderName); - if (outFolder.exists() == false) { - if (outFolder.mkdirs() == false) { + if (!outFolder.exists()) { + if (!outFolder.mkdirs()) { System.err.println("Error creating data folder " + outFolderName); } else { @@ -135,7 +135,7 @@ public class ZipUnpacker implements PamSettings { int lastSep = folderName.lastIndexOf('\\'); if (lastSep > 0) { File folder = new File(folderName.substring(0, lastSep)); - if (folder.exists() == false) { + if (!folder.exists()) { folder.mkdirs(); FileFunctions.setNonIndexingBit(folder); }