couple of final neatenings up of CTD

This commit is contained in:
Douglas Gillespie 2022-09-30 14:49:33 +01:00
parent de809b6572
commit 682715018f
4 changed files with 24 additions and 4 deletions

View File

@ -36,7 +36,7 @@ public class CTClassifierParams implements Cloneable, Serializable, ManagedParam
/**
* A unique ID for the classifier that never changes. This is important for accessing data selectors.
*/
public String uniqueID = UUID.randomUUID().toString();
private String uniqueID = UUID.randomUUID().toString();
/**
@ -72,4 +72,21 @@ public class CTClassifierParams implements Cloneable, Serializable, ManagedParam
return ps;
}
/**
* @return the uniqueID
*/
public String getUniqueID() {
if (uniqueID == null) {
uniqueID = UUID.randomUUID().toString();
}
return uniqueID;
}
/**
* @param uniqueID the uniqueID to set
*/
public void setUniqueID(String uniqueID) {
this.uniqueID = uniqueID;
}
}

View File

@ -119,14 +119,13 @@ public class Chi2ThresholdClassifier implements CTClassifier {
public void createDataSelector(PamDataBlock<?> source) {
//System.out.println("Create data selector " +" " + clssfrParams.classifierName + " " + clssfrParams.speciesFlag + " " + clssfrParams.uniqueID );
if (clssfrParams.uniqueID==null) clssfrParams.newUniqueID();
if (dataSelector==null || dataSelector.getPamDataBlock()!=source) {
//create the data selector
//System.out.println("Data selector: " + dataSelector);
if (source!=null) {
dataSelector=source.getDataSelectCreator().getDataSelector(clickTrainControl.getUnitName() + "_" + clssfrParams.uniqueID
dataSelector=source.getDataSelectCreator().getDataSelector(clickTrainControl.getUnitName() + "_" + clssfrParams.getUniqueID()
+ "_X2_threshold_classifier", false, null);
}
else {

View File

@ -131,6 +131,10 @@ public class CTDataSelector extends DataSelector {
CTDataUnit clickTrain = (CTDataUnit) ctDataUnit;
if (clickTrain.ctClassifications==null) return false;
if (ctSelectParams.classifier == null) {
return false;
}
int nClass = clickTrain.ctClassifications.size();
if (ctSelectParams.allowMultipleChoices == false) {

View File

@ -229,7 +229,7 @@ public class SimpleCTClassifierPane extends SettingsPane<Chi2ThresholdParams> {
simpleChi2Classifier.getDataSelector().getDialogPaneFX().getParams(true);
}
if (this.currParams != null) {
currParams.uniqueID = this.currParams.uniqueID;
currParams.setUniqueID(this.currParams.getUniqueID());
}
return this.currParams=currParams;