Skip to content

Commit 22bdc8e

Browse files
authored
Merge pull request #731 from bowring/issue729
Fixed #729
2 parents 12bb75c + de26cd2 commit 22bdc8e

File tree

9 files changed

+295
-265
lines changed

9 files changed

+295
-265
lines changed

common.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ apply plugin: 'maven-publish'
77

88

99
String mavenGroupId = 'org.cirdles'
10-
String mavenVersion = '1.10.4'
10+
String mavenVersion = '1.10.5'
1111

1212
[compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
1313

squidApp/src/main/java/org/cirdles/squid/gui/TaskManagerController.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
import javafx.scene.layout.GridPane;
2525
import javafx.util.StringConverter;
2626
import org.cirdles.squid.constants.Squid3Constants;
27-
import org.cirdles.squid.gui.dialogs.SquidMessageDialog;
2827
import org.cirdles.squid.exceptions.SquidException;
28+
import org.cirdles.squid.gui.dialogs.SquidMessageDialog;
2929
import org.cirdles.squid.gui.utilities.fileUtilities.FileHandler;
3030
import org.cirdles.squid.tasks.TaskInterface;
3131
import org.cirdles.squid.tasks.expressions.Expression;
@@ -259,7 +259,7 @@ public void changed(ObservableValue<? extends String> observable, String oldValu
259259
private void toggleParentNuclideAction(ActionEvent event) {
260260
task.setParentNuclide(((RadioButton) event.getSource()).getId());
261261
try {
262-
task.applyDirectives();
262+
task.applyDirectives(false);
263263
} catch (SquidException squidException) {
264264
SquidMessageDialog.showWarningDialog(squidException.getMessage(), primaryStageWindow);
265265
}
@@ -271,7 +271,7 @@ private void toggleParentNuclideAction(ActionEvent event) {
271271
private void toggleDirectAltAction(ActionEvent event) {
272272
task.setDirectAltPD(((RadioButton) event.getSource()).getId().compareToIgnoreCase("DIRECT") == 0);
273273
try {
274-
task.applyDirectives();
274+
task.applyDirectives(false);
275275
} catch (SquidException squidException) {
276276
SquidMessageDialog.showWarningDialog(squidException.getMessage(), primaryStageWindow);
277277
}

squidApp/src/main/java/org/cirdles/squid/gui/dateInterpretations/plots/plotControllers/RefMatCalibrationConstantWMToolBoxNode.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public void changed(ObservableValue<? extends Toggle> observable, Toggle oldValu
166166
// updated dec 2021 to change task and recalculate all - somehow this got dropped and not noticed.
167167
squidProject.getTask().setParentNuclide(flavor.contains("238") ? "238" : "232");
168168
try {
169-
squidProject.getTask().applyDirectives();
169+
squidProject.getTask().applyDirectives(false);
170170
} catch (SquidException squidException) {
171171
SquidMessageDialog.showWarningDialog(squidException.getMessage(), primaryStageWindow);
172172
}

squidCore/src/main/java/org/cirdles/squid/projects/SquidProject.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@
6666
public final class SquidProject implements Squid3ProjectBasicAPI, Squid3ProjectReportingAPI, Squid3ProjectParametersAPI {
6767

6868
private static final long serialVersionUID = 7099919411562934142L;
69-
public static transient boolean sampleNamingNotStandard = false;
69+
public static boolean sampleNamingNotStandard = false;
7070
private static boolean projectChanged;
7171
// issue #714
7272
// methods: 1 = commonLeadModel, 0 = StaceyKramer, 2 = StaceyKramer per group (asterisk - uses sampleSKAge)
73-
protected int commonLeadForUnknownsMethodSelected;
73+
private int commonLeadForUnknownsMethodSelected;
7474
private transient SquidPrefixTree prefixTree;
7575
private PrawnXMLFileHandler prawnFileHandler;
7676
private String projectName;
@@ -240,7 +240,7 @@ public void createNewTask() throws SquidException {
240240
this.task.setReferenceMaterialModel(referenceMaterialModel);
241241
this.task.setConcentrationReferenceMaterialModel(concentrationReferenceMaterialModel);
242242
this.task.setChanged(true);
243-
this.task.applyDirectives();
243+
this.task.applyDirectives(false);
244244
initializeTaskAndReduceData(false);
245245
}
246246

@@ -329,7 +329,7 @@ public void replaceCurrentTaskWithImportedSquid25Task(File squidTaskFile) throws
329329
// first pass
330330
task.setChanged(true);
331331
task.setupSquidSessionSpecsAndReduceAndReport(false);
332-
this.task.applyDirectives();
332+
this.task.applyDirectives(false);
333333

334334
initializeTaskAndReduceData(false);
335335
}
@@ -865,8 +865,8 @@ public int compare(Run run1, Run run2) {
865865
String run1DateTime = generateDateTimeMillisecondsStringForRun(run1);
866866
String run2DateTime = generateDateTimeMillisecondsStringForRun(run2);
867867

868-
long run1DateTimeMilliseconds = 0l;
869-
long run2DateTimeMilliseconds = 0l;
868+
long run1DateTimeMilliseconds = 0L;
869+
long run2DateTimeMilliseconds = 0L;
870870
try {
871871
run1DateTimeMilliseconds = dateFormat.parse(run1DateTime).getTime();
872872
run2DateTimeMilliseconds = dateFormat.parse(run2DateTime).getTime();
@@ -903,8 +903,8 @@ public SquidPrefixTree generatePrefixTreeFromSpotNames() {
903903
* the original.
904904
*
905905
* @param run
906-
* @param useOriginalData when true, the original unedited file is used,
907-
* otherwise the edited file is used.
906+
* @param useOriginalData when true, the original unedited file is used,
907+
* otherwise the edited file is used.
908908
* @return String [2] containing the file names of the two Prawn XML files
909909
* written as a result of the split.
910910
*/

squidCore/src/main/java/org/cirdles/squid/tasks/Task.java

+36-41
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public class Task implements TaskInterface, Serializable, XMLSerializerInterface
166166
protected ShrimpDataFileInterface prawnFile;
167167
protected CalamariReportsEngine reportsEngine;
168168
protected boolean changed;
169-
protected boolean useCalculatedAv_ParentElement_ConcenConst;
169+
protected boolean useCalculatedAvParentElementConcenConst;
170170
protected IndexIsoptopesEnum selectedIndexIsotope;
171171
// next 7 fields used to track user's choice of displayed options in mass audits
172172
protected List<MassStationDetail> massMinuends;
@@ -279,7 +279,7 @@ public Task(String name, ShrimpDataFileInterface prawnFile, CalamariReportsEngin
279279
this.changed = true;
280280
SquidProject.setProjectChanged(true);
281281

282-
this.useCalculatedAv_ParentElement_ConcenConst = false;
282+
this.useCalculatedAvParentElementConcenConst = false;
283283

284284
this.massMinuends = new ArrayList<>();
285285
this.massSubtrahends = new ArrayList<>();
@@ -355,7 +355,7 @@ public boolean synchronizeTaskVersion() throws SquidException {
355355
}
356356
if (taskSquidVersion.compareTo(Squid.VERSION) != 0) {
357357
taskSquidVersion = Squid.VERSION;
358-
updateTask();
358+
updateTask(true);
359359
retVal = true;
360360
}
361361

@@ -370,7 +370,6 @@ public List<ParametersModel> verifySquidLabDataParameters() throws SquidExceptio
370370
ParametersModel physConst = getPhysicalConstantsModel();
371371
ParametersModel commonPbMod = getCommonPbModel();
372372

373-
// SquidLabData squidLabData = SquidLabData.getExistingSquidLabData();
374373
if (physConst == null) {
375374
setPhysicalConstantsModel(squidLabData.getPhysConstDefault());
376375
} else if (!squidLabData.getPhysicalConstantsModels().contains(physConst)) {
@@ -450,7 +449,8 @@ public void updateTaskFromTaskDesign(TaskDesign taskDesign, boolean taskSkeleton
450449
methodName.replaceFirst("is", "set"),
451450
gettersAndSetters[i].getReturnType()).invoke(this, gettersAndSetters[i].invoke(taskDesign));
452451
}
453-
} catch (NoSuchMethodException | IllegalArgumentException | IllegalAccessException | InvocationTargetException e) {
452+
} catch (NoSuchMethodException | IllegalArgumentException | IllegalAccessException |
453+
InvocationTargetException e) {
454454
System.out.println(">>> " + methodName + " " + e.getMessage());
455455
}
456456
}
@@ -543,7 +543,8 @@ public void updateTaskDesignFromTask(TaskDesign taskDesign, boolean includeCusto
543543
methodName);
544544
methSetPref.invoke(taskDesign, methGetTask.invoke(this));
545545
}
546-
} catch (NoSuchMethodException | IllegalArgumentException | IllegalAccessException | InvocationTargetException e) {
546+
} catch (NoSuchMethodException | IllegalArgumentException | IllegalAccessException |
547+
InvocationTargetException e) {
547548
System.out.println(">>> " + methodName + " " + e.getMessage());
548549
}
549550
}
@@ -1163,9 +1164,7 @@ public void setupSquidSessionSkeleton()
11631164
@Override
11641165
public void updateRatioNames(String[] ratioNames) throws SquidException {
11651166
this.ratioNames.clear();
1166-
for (String rn : ratioNames) {
1167-
this.ratioNames.add(rn);
1168-
}
1167+
Collections.addAll(this.ratioNames, ratioNames);
11691168

11701169
populateTableOfSelectedRatiosFromRatiosList();
11711170

@@ -1315,9 +1314,7 @@ private void reorderExpressions() {
13151314
}
13161315

13171316
taskExpressionsOrdered.clear();
1318-
for (Expression listedExp : expArray) {
1319-
taskExpressionsOrdered.add(listedExp);
1320-
}
1317+
Collections.addAll(taskExpressionsOrdered, expArray);
13211318
}
13221319

13231320
/**
@@ -1436,7 +1433,7 @@ public ExpressionTreeInterface retrieveAliasedExpression(ExpressionTreeInterface
14361433
&& !((VariableNodeForSummary) lookupExpTree).isUsesArrayIndex()) {
14371434
aliasedExpTree = getExpressionByName(lookupExpTree.getName()).getExpressionTree();
14381435
}
1439-
} else if ((lookupExpTree instanceof VariableNodeForIsotopicRatios) && (((ExpressionTree) aliasedExpTree).getOperation() instanceof Value)){
1436+
} else if ((lookupExpTree instanceof VariableNodeForIsotopicRatios) && (((ExpressionTree) aliasedExpTree).getOperation() instanceof Value)) {
14401437
aliasedExpTree = namedExpressionsMap.get(lookupExpTree.getName());
14411438
}
14421439
}
@@ -1538,20 +1535,17 @@ private void updateRefMatCalibConstWMeanExpression(String wmWxpressionName, bool
15381535
wmExp.setExcelExpressionString(wmExp.getExcelExpressionString()
15391536
.replaceFirst("\\s*,\\s*(TRUE|FALSE)\\s*,\\s*",
15401537
"," + String.valueOf(!squidAllowsAutoExclusionOfSpots).toUpperCase(Locale.ENGLISH) + ","));
1541-
completeUpdateRefMatCalibConstWMeanExpressions(wmExp);
1542-
}
1543-
}
15441538

1545-
private void completeUpdateRefMatCalibConstWMeanExpressions(Expression listedExp) {
1546-
listedExp.parseOriginalExpressionStringIntoExpressionTree(namedExpressionsMap);
1547-
listedExp.getExpressionTree().setSquidSpecialUPbThExpression(true);
1548-
listedExp.getExpressionTree().setSquidSwitchSTReferenceMaterialCalculation(true);
1549-
listedExp.getExpressionTree().setSquidSwitchSCSummaryCalculation(true);
1539+
wmExp.parseOriginalExpressionStringIntoExpressionTree(namedExpressionsMap);
1540+
wmExp.getExpressionTree().setSquidSpecialUPbThExpression(true);
1541+
wmExp.getExpressionTree().setSquidSwitchSTReferenceMaterialCalculation(true);
1542+
wmExp.getExpressionTree().setSquidSwitchSCSummaryCalculation(true);
15501543

1551-
// Aug 2018 change logic to clear the spots list now that task manager has checkbox for auto reject
1552-
SpotSummaryDetails spotSummaryDetails = taskExpressionsEvaluationsPerSpotSet.get(listedExp.getName());
1553-
if (spotSummaryDetails != null) {
1554-
spotSummaryDetails.rejectNone();
1544+
// Aug 2018 change logic to clear the spots list now that task manager has checkbox for auto reject
1545+
SpotSummaryDetails spotSummaryDetails = taskExpressionsEvaluationsPerSpotSet.get(wmExp.getName());
1546+
if ((spotSummaryDetails != null) && squidAllowsAutoExclusionOfSpots) {
1547+
spotSummaryDetails.rejectNone();
1548+
}
15551549
}
15561550
}
15571551

@@ -1623,10 +1617,10 @@ public void resetMassStationGraphViews() {
16231617
@Override
16241618
public void applyTaskIsotopeLabelsToMassStationsAndUpdateTask() throws SquidException {
16251619
applyTaskIsotopeLabelsToMassStations();
1626-
updateTask();
1620+
updateTask(false);
16271621
}
16281622

1629-
private void updateTask() throws SquidException {
1623+
private void updateTask(boolean customizeTaskExpressions) throws SquidException {
16301624
changed = true;
16311625

16321626
// Sept 2020 - need to comb out bad ratios accidentally introduced
@@ -1640,7 +1634,7 @@ private void updateTask() throws SquidException {
16401634
ratioNames.remove(ratio);
16411635
}
16421636

1643-
applyDirectives();
1637+
applyDirectives(customizeTaskExpressions);
16441638

16451639
}
16461640

@@ -1740,7 +1734,7 @@ private void alignTaskMassStationsWithPrawnFile() {
17401734
for (int i = 0; i < nominalMasses.size(); i++) {// String taskIsotopeLabel : nominalMasses) {
17411735
String taskIsotopeLabel = nominalMasses.get(i);
17421736
boolean matched = false;
1743-
int intTaskIsotopeLabel = new BigDecimal(taskIsotopeLabel).add(new BigDecimal(0.5)).intValue();
1737+
int intTaskIsotopeLabel = new BigDecimal(taskIsotopeLabel).add(new BigDecimal("0.5")).intValue();
17441738
for (Map.Entry<Integer, MassStationDetail> entry : mapOfIndexToMassStationDetails.entrySet()) {
17451739
if (!matched) {
17461740
int intPrawnIsoptopeLabel = new BigDecimal(entry.getValue().getIsotopeLabel()).setScale(0, RoundingMode.HALF_EVEN).intValue();// Integer.parseInt(entry.getValue().getIsotopeLabel());
@@ -1992,7 +1986,7 @@ public List<ShrimpFractionExpressionInterface> processRunFractions(ShrimpDataFil
19921986
concentrationReferenceMaterialSpots = new ArrayList<>();
19931987
unknownSpots = new ArrayList<>();
19941988
boolean firstReferenceMaterial = true;
1995-
long baseTimeOfFirstRefMatForCalcHoursField = 0l;
1989+
long baseTimeOfFirstRefMatForCalcHoursField = 0L;
19961990
int refMatSpotIndex = 1;
19971991
for (ShrimpFractionExpressionInterface spot : shrimpFractions) {
19981992
// spots that are concentrationReferenceMaterialModel will also be in one of the other two buckets
@@ -2282,11 +2276,12 @@ public void evaluateExpressionForSpotSet(
22822276
}
22832277

22842278
// if the spotsForExpression are the same, then preserve list of indices of rejected
2285-
// otherwise reset the list of indices to empty
2286-
if (!spotSummaryDetails.getSelectedSpots().equals(spotsForExpression)) {
2279+
// otherwise reset the list of indices
2280+
// issue #729 reworked logic here
2281+
if (!SpotSummaryDetails.compareTwoSpotLists(spotSummaryDetails.getSelectedSpots(), spotsForExpression)) {
22872282
spotSummaryDetails.setRejectedIndices(new boolean[spotsForExpression.size()]);
2288-
spotSummaryDetails.setSelectedSpots(spotsForExpression);
22892283
}
2284+
spotSummaryDetails.setSelectedSpots(spotsForExpression);
22902285

22912286
if (((expressionTree instanceof ConstantNode) || ((ExpressionTree) expressionTree).getOperation().isScalarResult())
22922287
&& !expressionTree.isRootExpressionTree()) {
@@ -3368,20 +3363,20 @@ public void setReportsEngine(CalamariReportsEngine reportsEngine) {
33683363
}
33693364

33703365
/**
3371-
* @return the useCalculatedAv_ParentElement_ConcenConst
3366+
* @return the useCalculatedAvParentElementConcenConst
33723367
*/
33733368
@Override
3374-
public boolean isUseCalculatedAv_ParentElement_ConcenConst() {
3375-
return useCalculatedAv_ParentElement_ConcenConst;
3369+
public boolean isUseCalculatedAvParentElementConcenConst() {
3370+
return useCalculatedAvParentElementConcenConst;
33763371
}
33773372

33783373
/**
3379-
* @param useCalculatedAv_ParentElement_ConcenConst the
3380-
* useCalculatedAv_ParentElement_ConcenConst to set
3374+
* @param useCalculatedAvParentElementConcenConst the
3375+
* useCalculatedAvParentElementConcenConst to set
33813376
*/
33823377
@Override
3383-
public void setUseCalculatedAv_ParentElement_ConcenConst(boolean useCalculatedAv_ParentElement_ConcenConst) {
3384-
this.useCalculatedAv_ParentElement_ConcenConst = useCalculatedAv_ParentElement_ConcenConst;
3378+
public void setUseCalculatedAvParentElementConcenConst(boolean useCalculatedAvParentElementConcenConst) {
3379+
this.useCalculatedAvParentElementConcenConst = useCalculatedAvParentElementConcenConst;
33853380
}
33863381

33873382
/**
@@ -3867,7 +3862,7 @@ public int hashCode() {
38673862
namedExpressionsMap, namedOvercountExpressionsMap, namedConstantsMap, namedParametersMap, namedSpotLookupFieldsMap, shrimpFractions,
38683863
referenceMaterialSpots, concentrationReferenceMaterialSpots, unknownSpots,
38693864
mapOfUnknownsBySampleNames, prawnChanged, taskExpressionsEvaluationsPerSpotSet,
3870-
prawnFile, reportsEngine, changed, useCalculatedAv_ParentElement_ConcenConst,
3865+
prawnFile, reportsEngine, changed, useCalculatedAvParentElementConcenConst,
38713866
selectedIndexIsotope, massMinuends, massSubtrahends, showTimeNormalized,
38723867
showPrimaryBeam, showQt1y, showQt1z, squidAllowsAutoExclusionOfSpots,
38733868
extPErrU, extPErrTh, physicalConstantsModel, referenceMaterialModel, commonPbModel,

0 commit comments

Comments
 (0)