mirror of
https://github.com/PAMGuard/PAMGuard.git
synced 2024-11-22 07:02:29 +00:00
Binary store
Fix err in binary footer where count of objects also included the count of noise measurements.
This commit is contained in:
parent
156952bafe
commit
e6c2f325b2
@ -165,7 +165,7 @@ public class PamController implements PamControllerInterface, PamSettings {
|
|||||||
/**
|
/**
|
||||||
* The current PAM status
|
* The current PAM status
|
||||||
*/
|
*/
|
||||||
private transient int pamStatus = PAM_IDLE;
|
private volatile int pamStatus = PAM_IDLE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PamGuard view params.
|
* PamGuard view params.
|
||||||
@ -1382,6 +1382,7 @@ public class PamController implements PamControllerInterface, PamSettings {
|
|||||||
* @param sayEmpties dump info even if a buffer is empty (otherwise, only ones that have stuff still)
|
* @param sayEmpties dump info even if a buffer is empty (otherwise, only ones that have stuff still)
|
||||||
*/
|
*/
|
||||||
public void dumpBufferStatus(String message, boolean sayEmpties) {
|
public void dumpBufferStatus(String message, boolean sayEmpties) {
|
||||||
|
if (2 >1) return;
|
||||||
System.out.println("**** Dumping process buffer status: " + message);
|
System.out.println("**** Dumping process buffer status: " + message);
|
||||||
ArrayList<PamControlledUnit> pamControlledUnits = pamConfiguration.getPamControlledUnits();
|
ArrayList<PamControlledUnit> pamControlledUnits = pamConfiguration.getPamControlledUnits();
|
||||||
for (PamControlledUnit aUnit : pamControlledUnits) {
|
for (PamControlledUnit aUnit : pamControlledUnits) {
|
||||||
@ -1430,7 +1431,6 @@ public class PamController implements PamControllerInterface, PamSettings {
|
|||||||
pamControlledUnits.get(iU).flushDataBlockBuffers(2000);
|
pamControlledUnits.get(iU).flushDataBlockBuffers(2000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setPamStatus(PAM_IDLE);
|
|
||||||
dumpBufferStatus("In pamStopped, now idle", true);
|
dumpBufferStatus("In pamStopped, now idle", true);
|
||||||
|
|
||||||
// wait here until the status has changed to Pam_Idle, so that we know
|
// wait here until the status has changed to Pam_Idle, so that we know
|
||||||
@ -1455,6 +1455,8 @@ public class PamController implements PamControllerInterface, PamSettings {
|
|||||||
long stopTime = PamCalendar.getTimeInMillis();
|
long stopTime = PamCalendar.getTimeInMillis();
|
||||||
saveEndSettings(stopTime);
|
saveEndSettings(stopTime);
|
||||||
|
|
||||||
|
setPamStatus(PAM_IDLE);
|
||||||
|
|
||||||
// no good having this here since it get's called at the end of every file.
|
// no good having this here since it get's called at the end of every file.
|
||||||
// if (GlobalArguments.getParam(PamController.AUTOEXIT) != null) {
|
// if (GlobalArguments.getParam(PamController.AUTOEXIT) != null) {
|
||||||
//// can exit here, since we've auto started, can auto exit.
|
//// can exit here, since we've auto started, can auto exit.
|
||||||
@ -2064,7 +2066,8 @@ public class PamController implements PamControllerInterface, PamSettings {
|
|||||||
/*
|
/*
|
||||||
* This only get's called once when set idle at viewer mode startup.
|
* This only get's called once when set idle at viewer mode startup.
|
||||||
*/
|
*/
|
||||||
// System.out.printf("******* PamController.setPamStatus to %d, real status is %d\n", pamStatus, getRealStatus());
|
System.out.printf("******* PamController.setPamStatus to %d, real status is %d set in thread %s\n",
|
||||||
|
pamStatus, getRealStatus(), Thread.currentThread().toString());
|
||||||
if (getRunMode() != RUN_PAMVIEW) {
|
if (getRunMode() != RUN_PAMVIEW) {
|
||||||
TopToolBar.enableStartButton(pamStatus == PAM_IDLE);
|
TopToolBar.enableStartButton(pamStatus == PAM_IDLE);
|
||||||
TopToolBar.enableStopButton(pamStatus == PAM_RUNNING);
|
TopToolBar.enableStopButton(pamStatus == PAM_RUNNING);
|
||||||
|
@ -2164,7 +2164,7 @@ public class PamDataBlock<Tunit extends PamDataUnit> extends PamObservable {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return getDataName();
|
return getLongDataName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,7 +49,7 @@ public class BinaryOutputStream {
|
|||||||
|
|
||||||
private DataOutputStream noiseOutputStream;
|
private DataOutputStream noiseOutputStream;
|
||||||
|
|
||||||
private int storedObjects;
|
private int storedObjects, storedNoiseCount;
|
||||||
|
|
||||||
private String mainFileName, indexFileName;
|
private String mainFileName, indexFileName;
|
||||||
|
|
||||||
@ -219,6 +219,7 @@ public class BinaryOutputStream {
|
|||||||
else {
|
else {
|
||||||
noiseOutputStream = null;
|
noiseOutputStream = null;
|
||||||
}
|
}
|
||||||
|
storedNoiseCount = 0;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -450,6 +451,7 @@ public class BinaryOutputStream {
|
|||||||
footer.setHighestUID(parentDataBlock.getUidHandler().getCurrentUID());
|
footer.setHighestUID(parentDataBlock.getUidHandler().getCurrentUID());
|
||||||
boolean ok = footer.writeFooter(dataOutputStream, BinaryStore.getCurrentFileFormat());
|
boolean ok = footer.writeFooter(dataOutputStream, BinaryStore.getCurrentFileFormat());
|
||||||
if (noiseOutputStream != null) {
|
if (noiseOutputStream != null) {
|
||||||
|
footer.setnObjects(storedNoiseCount);
|
||||||
ok &= footer.writeFooter(noiseOutputStream, BinaryStore.getCurrentFileFormat());
|
ok &= footer.writeFooter(noiseOutputStream, BinaryStore.getCurrentFileFormat());
|
||||||
}
|
}
|
||||||
lastObjectType = BinaryTypes.FILE_FOOTER;
|
lastObjectType = BinaryTypes.FILE_FOOTER;
|
||||||
@ -487,12 +489,20 @@ public class BinaryOutputStream {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
public synchronized boolean storeData(int objectId, DataUnitBaseData baseData, BinaryObjectData binaryObjectData) {
|
public synchronized boolean storeData(int objectId, DataUnitBaseData baseData, BinaryObjectData binaryObjectData) {
|
||||||
|
boolean ok;
|
||||||
if (objectId == BinaryTypes.BACKGROUND_DATA & noiseOutputStream != null) {
|
if (objectId == BinaryTypes.BACKGROUND_DATA & noiseOutputStream != null) {
|
||||||
return storeData(noiseOutputStream, objectId, baseData, binaryObjectData);
|
ok = storeData(noiseOutputStream, objectId, baseData, binaryObjectData);
|
||||||
|
if (ok) {
|
||||||
|
storedNoiseCount++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return storeData(dataOutputStream, objectId, baseData, binaryObjectData);
|
ok = storeData(dataOutputStream, objectId, baseData, binaryObjectData);
|
||||||
|
if (ok) {
|
||||||
|
storedObjects++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Writes data to a file. Note that the length of data may be greater than
|
* Writes data to a file. Note that the length of data may be greater than
|
||||||
@ -562,7 +572,6 @@ public class BinaryOutputStream {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
storedObjects++;
|
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package pamScrollSystem;
|
package pamScrollSystem;
|
||||||
|
|
||||||
|
import PamUtils.PamCalendar;
|
||||||
import PamguardMVC.PamDataBlock;
|
import PamguardMVC.PamDataBlock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -70,4 +71,12 @@ public class DataLoadQueData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
String str = String.format("%s %s - %s", pamDataBlock.getLongDataName(),
|
||||||
|
PamCalendar.formatDBDateTime(dataStart),PamCalendar.formatDBDateTime(dataEnd));
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user