Evaluates the variable string passed in and returns its value. This should probably be refactored to return a String instead. @param variableString the variable to evaluate @param isMax if multiple values are stored, whether to return the largest value found or th
(final String variableString, final boolean isMax)
| 2090 | * @return the value of the variable. |
| 2091 | */ |
| 2092 | public Float getVariable(final String variableString, final boolean isMax) |
| 2093 | { |
| 2094 | double value = 0.0; |
| 2095 | boolean found = false; |
| 2096 | |
| 2097 | if (lastVariable != null) |
| 2098 | { |
| 2099 | if (lastVariable.equals(variableString)) |
| 2100 | { |
| 2101 | if (Logging.isDebugMode()) |
| 2102 | { |
| 2103 | String sb = "This is a deliberate warning message, not an error - " |
| 2104 | + "Avoiding infinite loop in getVariable: repeated lookup " + "of \"" + lastVariable |
| 2105 | + "\" at " + value; |
| 2106 | Logging.debugPrint(sb); |
| 2107 | } |
| 2108 | lastVariable = null; |
| 2109 | return (float) value; |
| 2110 | } |
| 2111 | } |
| 2112 | |
| 2113 | try |
| 2114 | { |
| 2115 | VariableKey vk = VariableKey.valueOf(variableString); |
| 2116 | Double val = variableFacet.getVariableValue(id, vk, isMax); |
| 2117 | if (val != null) |
| 2118 | { |
| 2119 | value = val; |
| 2120 | found = true; |
| 2121 | } |
| 2122 | } catch (IllegalArgumentException e) |
| 2123 | { |
| 2124 | //This variable is not in the data - must be builtin? |
| 2125 | } |
| 2126 | |
| 2127 | boolean includeBonus = true; |
| 2128 | if (!found) |
| 2129 | { |
| 2130 | lastVariable = variableString; |
| 2131 | value = getVariableValue(variableString, Constants.EMPTY_STRING); |
| 2132 | includeBonus = false; |
| 2133 | lastVariable = null; |
| 2134 | } |
| 2135 | |
| 2136 | if (includeBonus) |
| 2137 | { |
| 2138 | value += getTotalBonusTo("VAR", variableString); |
| 2139 | } |
| 2140 | |
| 2141 | return (float) value; |
| 2142 | } |
| 2143 | |
| 2144 | public void setPointBuyPoints(final int argPointBuyPoints) |
| 2145 | { |
nothing calls this directly
no test coverage detected