Skip to content

Commit 80c5193

Browse files
authored
Bug fixes and addressed issue #667 (#668)
* fixed bug in function return value count * New version * Added stacey-kramer metadata details to report manager * Addressed issue #667 * updated examples * Fixed display bug * Refined landf or report manager
1 parent 3478f87 commit 80c5193

File tree

15 files changed

+282
-50
lines changed

15 files changed

+282
-50
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.9.1'
10+
String mavenVersion = '1.9.2'
1111

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

squidApp/src/main/java/org/cirdles/squid/gui/squidReportTable/SquidReportSettingsController.java

+16-6
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,9 @@ public class SquidReportSettingsController implements Initializable {
159159
@FXML
160160
private Button makeDefaultButton;
161161

162+
@FXML
163+
private Button createCategoryButton;
164+
162165
//INIT
163166
@Override
164167
public void initialize(URL url, ResourceBundle rb) {
@@ -215,7 +218,8 @@ public void initialize(URL url, ResourceBundle rb) {
215218
private void initCategoryTextField() {
216219
categoryTextField.setOnKeyPressed(val -> {
217220
if (val.getCode() == KeyCode.ENTER) {
218-
createCategory();
221+
createCategoryButton.requestFocus();
222+
createCategoryButton.fire();
219223
}
220224
});
221225
}
@@ -430,12 +434,12 @@ public void changed(ObservableValue<? extends String> observable, String oldValu
430434
spotMetaDataExpressionsListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<String>() {
431435
@Override
432436
public void changed(ObservableValue<? extends String> observable, String oldValue, String newValue) {
433-
if (newValue != null) {
437+
if ((oldValue != null) && (newValue != null)) {
434438
Expression exp = new Expression(task.getNamedExpressionsMap().get(newValue),
435439
newValue, false, false, false);
436-
exp.getExpressionTree().setSquidSpecialUPbThExpression(true);
437-
exp.getExpressionTree().setSquidSwitchSTReferenceMaterialCalculation(true);
438-
exp.getExpressionTree().setSquidSwitchSAUnknownCalculation(true);
440+
exp.getExpressionTree().setSquidSpecialUPbThExpression(task.getNamedExpressionsMap().get(oldValue).isSquidSpecialUPbThExpression());
441+
exp.getExpressionTree().setSquidSwitchSTReferenceMaterialCalculation(task.getNamedExpressionsMap().get(oldValue).isSquidSwitchSTReferenceMaterialCalculation());
442+
exp.getExpressionTree().setSquidSwitchSAUnknownCalculation(task.getNamedExpressionsMap().get(oldValue).isSquidSwitchSAUnknownCalculation());
439443
selectedExpression.set(exp);
440444
selectInAllPanes(exp, false);
441445
}
@@ -544,7 +548,13 @@ private void populateIsotopesListView() {
544548
private void populateSpotMetaDataListView() {
545549
final ObservableList<String> obList = FXCollections.observableArrayList();
546550
task.getNamedSpotLookupFieldsMap().forEach((key, value) -> obList.add(value.getName()));
547-
task.getNamedSpotMetaDataFieldsMap().forEach((key, value) -> obList.add(value.getName()));
551+
task.getNamedSpotMetaDataFieldsMap().forEach((key, exp) -> {
552+
if (!exp.isSquidSwitchSCSummaryCalculation()
553+
&& ((exp.isSquidSwitchSTReferenceMaterialCalculation() && isRefMat)
554+
|| (exp.isSquidSwitchSAUnknownCalculation() && !isRefMat))) {
555+
obList.add(exp.getName());
556+
}
557+
});
548558
obList.sort(new IntuitiveStringComparator<>());
549559
spotMetaDataExpressionsListView.setItems(obList);
550560
}

squidApp/src/main/resources/org/cirdles/squid/gui/squidReportTable/SquidReportSettings.fxml

+5-5
Original file line numberDiff line numberDiff line change
@@ -189,14 +189,14 @@
189189
</VBox>
190190
<SplitPane dividerPositions="0.3333, 0.6667" orientation="VERTICAL" prefHeight="693.0" prefWidth="777.0">
191191
<items>
192-
<TitledPane animated="false" collapsible="false" maxHeight="700.0" text="Categories - used to organize template columns. Drag as needed to organize Categories. Right mouse click to rename or delete.">
192+
<TitledPane animated="false" collapsible="false" maxHeight="700.0" text="Categories - use to organize template columns. Drag to re-order. Right click to rename or delete." textFill="#0f0fd1">
193193
<content>
194194
<VBox>
195195
<children>
196196
<HBox alignment="CENTER_LEFT" maxHeight="700.0" VBox.vgrow="NEVER">
197197
<children>
198-
<TextField fx:id="categoryTextField" prefHeight="27.0" prefWidth="540.0" promptText="Create additional category names here as needed, then select to add columns." HBox.hgrow="ALWAYS" />
199-
<Button mnemonicParsing="false" onAction="#createCategoryOnAction" text="Create Category" />
198+
<TextField fx:id="categoryTextField" prefHeight="27.0" prefWidth="540.0" promptText="Type a new category name here, then click &quot;Create Category&quot; button." style="-fx-font-weight: bold; -fx-background-color: aqua;" HBox.hgrow="ALWAYS" />
199+
<Button fx:id="createCategoryButton" mnemonicParsing="false" onAction="#createCategoryOnAction" prefHeight="31.0" prefWidth="221.0" text="&lt;&lt;&lt; Create Category" />
200200
</children>
201201
<opaqueInsets>
202202
<Insets />
@@ -213,7 +213,7 @@
213213
<Insets right="5.0" />
214214
</padding>
215215
</TitledPane>
216-
<TitledPane fx:id="colunmnsTitledPane" animated="false" collapsible="false" maxHeight="700.0" text="Columns - for a category, drag and drop expression(s) from the the lists on left and then drag as needed within the column.">
216+
<TitledPane fx:id="colunmnsTitledPane" animated="false" collapsible="false" maxHeight="700.0" text="Columns - for a category, drag 'n drop expression(s) from the the lists on left and then drag to re-order them. Right click to delete." textFill="#0f0fd1">
217217
<content>
218218
<VBox>
219219
<children>
@@ -225,7 +225,7 @@
225225
<Insets right="5.0" />
226226
</padding>
227227
</TitledPane>
228-
<TitledPane animated="false" collapsible="false" maxHeight="700.0" prefHeight="208.0" prefWidth="687.0" text="Column Details - peek at the values in each column.">
228+
<TitledPane animated="false" collapsible="false" maxHeight="700.0" prefHeight="208.0" prefWidth="687.0" text="Column Details - peek at the values in each column." textFill="#0f0fd1">
229229
<content>
230230
<VBox>
231231
<children>

squidCore/src/main/java/org/cirdles/squid/shrimp/CommonLeadSpecsForSpot.java

+19
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public class CommonLeadSpecsForSpot implements Serializable {
5252
private SampleAgeTypesEnum sampleAgeType;
5353
private ReferenceMaterialAgeTypesEnum refMatAgeType;
5454
private double sampleAgeSK;
55+
private double targetAge;
5556

5657
private ParametersModel commonLeadModel;
5758

@@ -86,7 +87,23 @@ public String correctionMetaData() {
8687
metaData.append("SK @ " + (new BigDecimal(sampleAgeSK)).movePointLeft(6).setScale(0, RoundingMode.HALF_UP) + " Ma");
8788
break;
8889
}
90+
return metaData.toString();
91+
}
92+
93+
public String correctionSKTargetAge() {
94+
StringBuilder metaData = new StringBuilder();
8995

96+
switch (methodSelected) {
97+
case METHOD_COMMON_LEAD_MODEL:
98+
metaData.append("n/a");
99+
break;
100+
case METHOD_STACEY_KRAMER:
101+
metaData.append((new BigDecimal(targetAge)).movePointLeft(6).setScale(0, RoundingMode.HALF_UP) + " Ma");
102+
break;
103+
case METHOD_STACEY_KRAMER_BY_GROUP:
104+
metaData.append((new BigDecimal(sampleAgeSK)).movePointLeft(6).setScale(0, RoundingMode.HALF_UP) + " Ma");
105+
break;
106+
}
90107
return metaData.toString();
91108
}
92109

@@ -258,6 +275,8 @@ public void updateCommonLeadRatiosFromModel() {
258275
* @param targetAge the value of targetAge
259276
*/
260277
public void updateCommonLeadRatiosFromSK(double targetAge) {
278+
// save target age for metadata report
279+
this.targetAge = targetAge;
261280
// Output is a 3-element vector of model [206Pb/204Pb, 207Pb/204Pb,
262281
// 208Pb/204Pb] corresponding to TargetAge, as per Stacey & Kramers (1975).
263282
double[] staceyKramerSingleStagePbR

squidCore/src/main/java/org/cirdles/squid/shrimp/ShrimpFraction.java

+5
Original file line numberDiff line numberDiff line change
@@ -1014,6 +1014,11 @@ public String getCommonPbCorrMetaData() {
10141014
return commonLeadSpecsForSpot.correctionMetaData();
10151015
}
10161016

1017+
@Override
1018+
public String getComPbCorrSKTargetAge() {
1019+
return commonLeadSpecsForSpot.correctionSKTargetAge();
1020+
}
1021+
10171022
@Override
10181023
public String getSelectedAgeExpressionName() throws SquidException {
10191024
if (commonLeadSpecsForSpot == null) {

squidCore/src/main/java/org/cirdles/squid/shrimp/ShrimpFractionExpressionInterface.java

+2
Original file line numberDiff line numberDiff line change
@@ -297,5 +297,7 @@ public interface ShrimpFractionExpressionInterface {
297297

298298
public String getCommonPbCorrMetaData();
299299

300+
public String getComPbCorrSKTargetAge();
301+
300302
public String getSelectedAgeExpressionName() throws SquidException;
301303
}

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

+15
Original file line numberDiff line numberDiff line change
@@ -3039,6 +3039,21 @@ public String getParentNuclide() {
30393039
return parentNuclide;
30403040
}
30413041

3042+
@Override
3043+
public String getPrimaryDaughterParentRatio() {
3044+
return parentNuclide.startsWith("238")? "206Pb/238U" : "208Pb/232Th";
3045+
}
3046+
3047+
@Override
3048+
public String getSecondaryDaughterParentCalculation() {
3049+
return directAltPD ? "Direct" : "Indirect";
3050+
}
3051+
3052+
@Override
3053+
public String getIndexIsotope() {
3054+
return selectedIndexIsotope.getIsotope() + "Pb";
3055+
}
3056+
30423057
/**
30433058
* @param parentNuclide
30443059
*/

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

+3
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,9 @@ public interface TaskInterface {
376376
* @return
377377
*/
378378
public String getParentNuclide();
379+
public String getPrimaryDaughterParentRatio();
380+
public String getSecondaryDaughterParentCalculation();
381+
public String getIndexIsotope();
379382

380383
/**
381384
* @param parentNuclide

squidCore/src/main/java/org/cirdles/squid/tasks/expressions/builtinExpressions/BuiltInExpressionsFactory.java

+15
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import static org.cirdles.squid.tasks.expressions.builtinExpressions.BuiltinExpressionsCountCorrection204.buildCountCorrectionExpressionFrom207;
4141
import static org.cirdles.squid.tasks.expressions.builtinExpressions.BuiltinExpressionsCountCorrection204.buildCountCorrectionExpressionFrom208;
4242
import static org.cirdles.squid.tasks.expressions.spots.SpotFieldNode.buildSpotNode;
43+
import static org.cirdles.squid.tasks.expressions.spots.SpotTaskMetaDataNode.buildTaskMetaDataNode;
4344

4445
/**
4546
* @author James F. Bowring
@@ -144,6 +145,20 @@ public static Map<String, ExpressionTreeInterface> generateSpotMetaDataFields()
144145
ExpressionTreeInterface commPbCorrMetaData = buildSpotNode("getCommonPbCorrMetaData");
145146
spotMetaDataFields.put(commPbCorrMetaData.getName(), commPbCorrMetaData);
146147

148+
// nov 2021 add age for SK column
149+
ExpressionTreeInterface comPbCorrSKTargetAge = buildSpotNode("getComPbCorrSKTargetAge");
150+
spotMetaDataFields.put(comPbCorrSKTargetAge.getName(), comPbCorrSKTargetAge);
151+
152+
// dec 2021 issue # 667
153+
ExpressionTreeInterface primaryDaughterParentRatio = buildTaskMetaDataNode("getPrimaryDaughterParentRatio");
154+
spotMetaDataFields.put(primaryDaughterParentRatio.getName(), primaryDaughterParentRatio);
155+
156+
ExpressionTreeInterface secondaryDaughterParentCalculation = buildTaskMetaDataNode("getSecondaryDaughterParentCalculation");
157+
spotMetaDataFields.put(secondaryDaughterParentCalculation.getName(), secondaryDaughterParentCalculation);
158+
159+
ExpressionTreeInterface indexIsotope = buildTaskMetaDataNode("getIndexIsotope");
160+
spotMetaDataFields.put(indexIsotope.getName(), indexIsotope);
161+
147162
ExpressionTreeInterface overCountCorrMetaData = buildSpotNode("getOverCtCorr");
148163
spotMetaDataFields.put(overCountCorrMetaData.getName(), overCountCorrMetaData);
149164

squidCore/src/main/java/org/cirdles/squid/tasks/expressions/expressionTrees/ExpressionTree.java

+28-30
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,8 @@ public class ExpressionTree
6262
Serializable,
6363
XMLSerializerInterface {
6464

65-
private static final long serialVersionUID = 69881766695649050L;
66-
6765
public static final String ANONYMOUS_NAME = "Anonymous";
68-
66+
private static final long serialVersionUID = 69881766695649050L;
6967
/**
7068
*
7169
*/
@@ -127,14 +125,6 @@ public class ExpressionTree
127125

128126
protected transient boolean hasNoTargetSpots;
129127

130-
public void setHasNoTargetSpots(boolean hasNoTargetSpots) {
131-
this.hasNoTargetSpots = hasNoTargetSpots;
132-
}
133-
134-
public boolean doesHaveNoTargetSpots() {
135-
return hasNoTargetSpots;
136-
}
137-
138128
/**
139129
*
140130
*/
@@ -192,6 +182,14 @@ private ExpressionTree(String prettyName, ExpressionTreeInterface leftET, Expres
192182
this.hasNoTargetSpots = false;
193183
}
194184

185+
public void setHasNoTargetSpots(boolean hasNoTargetSpots) {
186+
this.hasNoTargetSpots = hasNoTargetSpots;
187+
}
188+
189+
public boolean doesHaveNoTargetSpots() {
190+
return hasNoTargetSpots;
191+
}
192+
195193
public ExpressionTree copy() {
196194
ExpressionTree target = new ExpressionTree();
197195
target.setName(name);
@@ -358,9 +356,9 @@ public String auditOperationArgumentCount() {
358356
if (operation == null) {
359357
if (!(this instanceof ConstantNode)
360358
&& !(this instanceof SpotFieldNode)
361-
&& !(((ExpressionTreeInterface) this) instanceof ShrimpSpeciesNode)
362-
&& !(((ExpressionTreeInterface) this) instanceof VariableNodeForIsotopicRatios)
363-
&& !(((ExpressionTreeInterface) this) instanceof VariableNodeForSummary)) {
359+
&& !(this instanceof ShrimpSpeciesNode)
360+
&& !(this instanceof VariableNodeForIsotopicRatios)
361+
&& !(this instanceof VariableNodeForSummary)) {
364362
audit.append(" ").append(this.getName()).append(" is unhealthy expression");
365363
} else {
366364
if (this.amHealthy()) {
@@ -389,7 +387,7 @@ public String auditOperationArgumentCount() {
389387
if (child instanceof ShrimpSpeciesNode) {
390388
if (!(((ExpressionTree) child.getParentET()).getOperation() instanceof ShrimpSpeciesNodeFunction)
391389
&& (((ShrimpSpeciesNode) child).getMethodNameForShrimpFraction().length() == 0)) {
392-
audit.append("\n Expression '").append((String) ((ShrimpSpeciesNode) child).getName()).append("' is not a valid argument.");
390+
audit.append("\n Expression '").append(child.getName()).append("' is not a valid argument.");
393391
}
394392
}
395393

@@ -552,10 +550,25 @@ public String getUncertaintyDirective() {
552550
return uncertaintyDirective;
553551
}
554552

553+
/**
554+
* @param uncertaintyDirective the uncertaintyDirective to set
555+
*/
556+
@Override
557+
public void setUncertaintyDirective(String uncertaintyDirective) {
558+
this.uncertaintyDirective = uncertaintyDirective;
559+
}
560+
555561
public int getIndex() {
556562
return index;
557563
}
558564

565+
/**
566+
* @param index the index to set
567+
*/
568+
public void setIndex(int index) {
569+
this.index = index;
570+
}
571+
559572
/**
560573
* @return true if instance of Function class
561574
*/
@@ -900,19 +913,4 @@ public boolean isSquidSwitchConcentrationReferenceMaterialCalculation() {
900913
public void setSquidSwitchConcentrationReferenceMaterialCalculation(boolean squidSwitchConcentrationReferenceMaterialCalculation) {
901914
this.squidSwitchConcentrationReferenceMaterialCalculation = squidSwitchConcentrationReferenceMaterialCalculation;
902915
}
903-
904-
/**
905-
* @param uncertaintyDirective the uncertaintyDirective to set
906-
*/
907-
@Override
908-
public void setUncertaintyDirective(String uncertaintyDirective) {
909-
this.uncertaintyDirective = uncertaintyDirective;
910-
}
911-
912-
/**
913-
* @param index the index to set
914-
*/
915-
public void setIndex(int index) {
916-
this.index = index;
917-
}
918916
}

squidCore/src/main/java/org/cirdles/squid/tasks/expressions/functions/Rad8corConcRho.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public Rad8corConcRho() {
4949
argumentCount = 9;
5050
precedence = 4;
5151
rowCount = 1;
52-
colCount = 2;
52+
colCount = 1;
5353
labelsForOutputValues = new String[][]{{"rho"}};
5454
labelsForInputValues = new String[]{
5555
"Total 206/238, Total 206/238 1%Unct,"
@@ -134,4 +134,4 @@ public String toStringMathML(List<ExpressionTreeInterface> childrenET) {
134134
return retVal.toString();
135135
}
136136

137-
}
137+
}

squidCore/src/main/java/org/cirdles/squid/tasks/expressions/spots/SpotFieldNode.java

+10-6
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,13 @@ private SpotFieldNode(String fieldName, String methodNameForShrimpFraction) {
5050
this.squidSwitchSAUnknownCalculation = true;
5151
}
5252

53+
/**
54+
*
55+
* @param methodNameForShrimpFraction
56+
* @return SpotFieldNode using getter name with leading get removed as name
57+
*/
5358
public static SpotFieldNode buildSpotNode(String methodNameForShrimpFraction) {
54-
SpotFieldNode spotNode = new SpotFieldNode(methodNameForShrimpFraction.replace("get", ""), methodNameForShrimpFraction);
55-
return spotNode;
59+
return new SpotFieldNode(methodNameForShrimpFraction.replaceFirst("get", ""), methodNameForShrimpFraction);
5660
}
5761

5862
@Override
@@ -95,11 +99,11 @@ public Object[][] eval(List<ShrimpFractionExpressionInterface> shrimpFractions,
9599

96100
try {
97101
Method method = ShrimpFractionExpressionInterface.class.getMethod(//
98-
methodNameForShrimpFraction,
99-
new Class[]{});
102+
methodNameForShrimpFraction
103+
);
100104
for (int i = 0; i < shrimpFractions.size(); i++) {
101105
// this generalization handles various types
102-
retVal[i] = new Object[]{method.invoke(shrimpFractions.get(i), new Object[]{})};
106+
retVal[i] = new Object[]{method.invoke(shrimpFractions.get(i))};
103107
}
104108

105109
} catch (NoSuchMethodException | SecurityException | IllegalAccessException | InvocationTargetException | NullPointerException methodException) {
@@ -154,4 +158,4 @@ public boolean isTypeFunction() {
154158
public boolean isTypeFunctionOrOperation() {
155159
return false;
156160
}
157-
}
161+
}

0 commit comments

Comments
 (0)