Merge branch 'main' into Tethys

This commit is contained in:
Douglas Gillespie 2024-03-28 16:41:30 +00:00 committed by GitHub
commit b48c1e7574
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 104 additions and 5 deletions

View File

@ -196,7 +196,7 @@ public class PamController implements PamControllerInterface, PamSettings {
private Timer diagnosticTimer;
private boolean debugDumpBufferAtRestart = true;
private boolean debugDumpBufferAtRestart = false;
private NetworkController networkController;
private int nNetPrepared;

View File

@ -16,7 +16,7 @@ public class PamguardVersionInfo {
* @return release type
*/
static public ReleaseType getReleaseType() {
return ReleaseType.OTHER;
return ReleaseType.BETA;
}
/**

View File

@ -636,7 +636,7 @@ public class PamDataBlock<Tunit extends PamDataUnit> extends PamObservable {
/**
* Find a dataunit based on it's database index. If there have been no updates,
* then database indexes should be in order and a fast find canbe used. If
* then database indexes should be in order and a fast find can be used. If
* however, there have been updates, then things will not be in order so it's
* necessary to go through everything from start to end.
*

View File

@ -63,6 +63,13 @@ public class SubdetectionInfo<T extends PamDataUnit> implements Comparable<Subde
*/
private int childDatabaseIndex;
private int binaryFileIndex;
/**
* Only exists for click data.
*/
private Integer clickNumber;
/**
* @param subDetection2
@ -106,6 +113,7 @@ public class SubdetectionInfo<T extends PamDataUnit> implements Comparable<Subde
binaryFilename = subTableData.getBinaryFilename();
parentID = subTableData.getParentID();
parentUID = subTableData.getParentUID();
clickNumber = subTableData.getClickNumber();
}
public T getSubDetection() {
@ -210,4 +218,32 @@ public class SubdetectionInfo<T extends PamDataUnit> implements Comparable<Subde
this.childDatabaseIndex = childDatabaseIndex;
}
/**
* @return the binaryFileIndex
*/
public int getBinaryFileIndex() {
return binaryFileIndex;
}
/**
* @param binaryFileIndex the binaryFileIndex to set
*/
public void setBinaryFileIndex(int binaryFileIndex) {
this.binaryFileIndex = binaryFileIndex;
}
/**
* @return the clickNumber
*/
public Integer getClickNumber() {
return clickNumber;
}
/**
* @param childUID the childUID to set
*/
public void setChildUID(long childUID) {
this.childUID = childUID;
}
}

View File

@ -1,5 +1,6 @@
package PamguardMVC.superdet;
import java.io.File;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collections;
@ -15,6 +16,7 @@ import PamguardMVC.PamDataBlock;
import PamguardMVC.PamDataUnit;
import PamguardMVC.PamProcess;
import PamguardMVC.debug.Debug;
import binaryFileStorage.DataUnitFileInformation;
import clickDetector.offlineFuncs.OfflineEventDataUnit;
import generalDatabase.PamSubtableData;
import generalDatabase.SQLLogging;
@ -514,8 +516,47 @@ public class SuperDetDataBlock<Tunit extends SuperDetection, TSubDet extends Pam
return Long.signum(comp);
}
comp = subTableData.getChildUID() - dataUnit.getUID();
if (comp == 0) {
return 0;
}
/**
* Some problems in some datasets where the uid is corrupt. So also check
* on binary file information. This is slower, but since we've already matched on
* time, it doesn't get called very often.
*/
String dbBin = subTableData.getBinaryFilename();
DataUnitFileInformation duFileInfo = dataUnit.getDataUnitFileInformation();
if (dbBin == null || duFileInfo == null) {
return Long.signum(comp);
}
// String duBin = duFileInfo.get
/*
* Note that some bin names are truncated, so need to match on startswith.
*/
File binFile = duFileInfo.getFile();
if (binFile == null) {
return Long.signum(comp);
}
String fName = binFile.getName();
if (fName.startsWith(dbBin) == false) {
return Long.signum(comp);
}
/*
* hope for a non null click number. If there isn't onw, then we'll just have to
* go with the bin file being the same and the millis being the same. It's important
* for clicks though since there can be >1 in a millisecond.
*/
Integer clickNo = subTableData.getClickNumber();
if (clickNo == null) {
return 0;
}
else {
subTableData.setChildUID(dataUnit.getUID());
dataUnit.updateDataUnit(System.currentTimeMillis());
return (int) (clickNo - duFileInfo.getIndexInFile());
}
}
}

View File

@ -82,6 +82,11 @@ public class PamSubtableData {
*/
private long dbIndex;
/**
* Click number. only exists for clicks table, but needed for corrupt database.
*/
private Integer clickNumber;
/**
*
*/
@ -158,5 +163,18 @@ public class PamSubtableData {
this.childUTC = childUTC;
}
/**
* @return the clickNumber
*/
public Integer getClickNumber() {
return clickNumber;
}
/**
* @param clickNumber the clickNumber to set
*/
public void setClickNumber(Integer clickNumber) {
this.clickNumber = clickNumber;
}
}

View File

@ -2077,8 +2077,9 @@ public abstract class SQLLogging {
ArrayList<PamSubtableData> tableList = new ArrayList<PamSubtableData>();
int n = 0;
try {
while (subtableResults.next()) {
PamSubtableDefinition subtableTableDef = (PamSubtableDefinition) getTableDefinition();
PamTableItem clickNoItem = subtableTableDef.findTableItem("ClickNo");
while (subtableResults.next()) {
PamTableItem tableItem;
// transferDataFromResult(con.getSqlTypes(), subtableResults);
for (int i = 0; i < subtableTableDef.getTableItemCount(); i++) {
@ -2102,6 +2103,9 @@ public abstract class SQLLogging {
subtableData.setLongName(subtableTableDef.getLongName().getStringValue());
subtableData.setBinaryFilename(subtableTableDef.getBinaryfile().getStringValue());
subtableData.setDbIndex(subtableTableDef.getIndexItem().getIntegerValue());
if (clickNoItem != null) {
subtableData.setClickNumber(clickNoItem.getIntegerValue());
}
try {
subtableData.setChildUID(subtableTableDef.getUidItem().getLongObject());
}