From df87c443ee9da6f0625c1d196f271ae0c9ccebba Mon Sep 17 00:00:00 2001 From: Lars Ivar Hatledal Date: Thu, 26 Sep 2019 23:00:20 +0200 Subject: [PATCH] Fix regression --- .../ihb/fmi4j/modeldescription/fmi2/Fmi2Causality.java | 2 +- .../fmi4j/modeldescription/fmi2/JaxbScalarVariable.kt | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/fmi-md/src/main/java/no/ntnu/ihb/fmi4j/modeldescription/fmi2/Fmi2Causality.java b/fmi-md/src/main/java/no/ntnu/ihb/fmi4j/modeldescription/fmi2/Fmi2Causality.java index 4f9021b3..d02d5dcb 100644 --- a/fmi-md/src/main/java/no/ntnu/ihb/fmi4j/modeldescription/fmi2/Fmi2Causality.java +++ b/fmi-md/src/main/java/no/ntnu/ihb/fmi4j/modeldescription/fmi2/Fmi2Causality.java @@ -16,7 +16,7 @@ public enum Fmi2Causality { * be "fixed" or "tunable". initial must be "approx", "calculated" or not * present (meaning calculated). */ - calculated_parameter, + calculatedParameter, /** * The variable value can be provided from another model or slave. It is not diff --git a/fmi-model/src/main/kotlin/no/ntnu/ihb/fmi4j/modeldescription/fmi2/JaxbScalarVariable.kt b/fmi-model/src/main/kotlin/no/ntnu/ihb/fmi4j/modeldescription/fmi2/JaxbScalarVariable.kt index e1553fc6..d41f918c 100644 --- a/fmi-model/src/main/kotlin/no/ntnu/ihb/fmi4j/modeldescription/fmi2/JaxbScalarVariable.kt +++ b/fmi-model/src/main/kotlin/no/ntnu/ihb/fmi4j/modeldescription/fmi2/JaxbScalarVariable.kt @@ -37,7 +37,14 @@ class JaxbScalarVariable internal constructor( override val description: String? get() = v.description override val causality: Causality? - get() = v.causality?.let { Causality.valueOf(it.name.toUpperCase()) } + get() = v.causality?.let { + var causalityString = it.name + val upperCaseIndex = causalityString.indexOfFirst { it.isUpperCase() } + if (upperCaseIndex != -1) { + causalityString = causalityString.substring(0, upperCaseIndex) + "_" + causalityString.substring(upperCaseIndex, causalityString.length) + } + Causality.valueOf(causalityString.toUpperCase()) + } override val variability: Variability? get() = v.variability?.let { Variability.valueOf(it.name.toUpperCase()) } override val initial: Initial?