From d44a50f13b37b7408a6d5255b0e51e3622e8858c Mon Sep 17 00:00:00 2001 From: Jim Bowring Date: Fri, 26 Feb 2021 12:06:28 -0500 Subject: [PATCH] Fixed #589 --- common.gradle | 2 +- .../squidReportColumns/SquidReportColumn.java | 14 ++++++------- .../expressionTrees/ExpressionTree.java | 21 +++++++++++++------ 3 files changed, 22 insertions(+), 15 deletions(-) diff --git a/common.gradle b/common.gradle index 89029a4ae..0dcb336fd 100644 --- a/common.gradle +++ b/common.gradle @@ -6,7 +6,7 @@ apply plugin: 'java' apply plugin: 'maven' String mavenGroupId = 'org.cirdles' -String mavenVersion = '1.7.3' +String mavenVersion = '1.7.4' sourceCompatibility = '1.8' [compileJava, compileTestJava]*.options*.encoding = 'UTF-8' diff --git a/squidCore/src/main/java/org/cirdles/squid/squidReports/squidReportColumns/SquidReportColumn.java b/squidCore/src/main/java/org/cirdles/squid/squidReports/squidReportColumns/SquidReportColumn.java index 84e67c50f..ee62a0aca 100644 --- a/squidCore/src/main/java/org/cirdles/squid/squidReports/squidReportColumns/SquidReportColumn.java +++ b/squidCore/src/main/java/org/cirdles/squid/squidReports/squidReportColumns/SquidReportColumn.java @@ -23,7 +23,6 @@ import org.cirdles.squid.tasks.expressions.expressionTrees.ExpressionTree; import org.cirdles.squid.tasks.expressions.expressionTrees.ExpressionTreeInterface; import org.cirdles.squid.tasks.expressions.isotopes.ShrimpSpeciesNode; -import org.cirdles.squid.tasks.expressions.operations.Divide; import org.cirdles.squid.tasks.expressions.spots.SpotFieldNode; import org.cirdles.squid.tasks.expressions.variables.VariableNodeForSummary; @@ -37,7 +36,6 @@ import static org.cirdles.squid.squidReports.squidReportColumns.SquidReportColumnInterface.formatBigDecimalForPublicationSigDigMode; import static org.cirdles.squid.squidReports.squidReportTables.SquidReportTable.DEFAULT_COUNT_OF_SIGNIFICANT_DIGITS; import static org.cirdles.squid.squidReports.squidReportTables.SquidReportTable.HEADER_ROW_COUNT; -import static org.cirdles.squid.tasks.expressions.builtinExpressions.BuiltInExpressionsDataDictionary.R204PB_206PB; /** * @author James F. Bowring, CIRDLES.org, and Earth-Time.org @@ -121,11 +119,11 @@ public void initReportColumn(TaskInterface task) { expressionNameCustom = "total_" + expressionName + "_cts_/sec"; } - amIsotopicRatio = false; - if (((ExpressionTree) expTree).getLeftET() instanceof ShrimpSpeciesNode) { - // Check for isotopic ratios - amIsotopicRatio = (((ExpressionTree) expTree).getOperation() instanceof Divide); - } + amIsotopicRatio = ((ExpressionTree) expTree).amIsotopicRatio(); +// if (((ExpressionTree) expTree).getLeftET() instanceof ShrimpSpeciesNode) { +// // Check for isotopic ratios +// amIsotopicRatio = (((ExpressionTree) expTree).getOperation() instanceof Divide); +// } // propose column headers by splitting on underscores in name // row 0 is reserved for category displayname @@ -180,7 +178,7 @@ public void initReportColumn(TaskInterface task) { uncertaintyColumn = null; if ((uncertaintyDirective.length() == 0) - && expTree.builtAsValueModel() + && ( expTree.builtAsValueModel() || amIsotopicRatio) // && (!expressionName.toUpperCase().contains("PCT")) // && (!expressionName.toUpperCase().contains("ERR")) // && (!expressionName.toUpperCase().contains("CONCEN")) diff --git a/squidCore/src/main/java/org/cirdles/squid/tasks/expressions/expressionTrees/ExpressionTree.java b/squidCore/src/main/java/org/cirdles/squid/tasks/expressions/expressionTrees/ExpressionTree.java index a43324e32..45d9501bb 100644 --- a/squidCore/src/main/java/org/cirdles/squid/tasks/expressions/expressionTrees/ExpressionTree.java +++ b/squidCore/src/main/java/org/cirdles/squid/tasks/expressions/expressionTrees/ExpressionTree.java @@ -127,7 +127,7 @@ public class ExpressionTree protected String uncertaintyDirective; protected int index; - + protected transient boolean hasNoTargetSpots; public void setHasNoTargetSpots(boolean hasNoTargetSpots) { @@ -137,7 +137,6 @@ public void setHasNoTargetSpots(boolean hasNoTargetSpots) { public boolean doesHaveNoTargetSpots() { return hasNoTargetSpots; } - /** * @@ -468,6 +467,16 @@ public boolean amAnonymous() { return name.compareTo(ANONYMOUS_NAME) == 0; } + public boolean amIsotopicRatio() { + boolean retVal = false; + if (childrenET.size() > 1) { + retVal = (childrenET.get(0) instanceof ShrimpSpeciesNode) + && (childrenET.get(1) instanceof ShrimpSpeciesNode) + && (operation instanceof Divide); + } + return retVal; + } + /** * * @param xstream @@ -572,18 +581,18 @@ public boolean isTypeFunction() { public boolean isTypeFunctionOrOperation() { return (operation instanceof Function) || (operation instanceof Operation); } - + /** * * @return true if this expressionTree is built as a ValueModel */ @Override - public boolean builtAsValueModel(){ + public boolean builtAsValueModel() { boolean retVal = false; - if (isTypeFunction()){ + if (isTypeFunction()) { retVal = operation.getColCount() > 1; } - + return retVal; }