NumberFormula is a fixed-value formula for a specific Integer.
| 112 | * NumberFormula is a fixed-value formula for a specific Integer. |
| 113 | */ |
| 114 | private static final class NumberFormula implements Formula |
| 115 | { |
| 116 | |
| 117 | /** |
| 118 | * The Number value of this NumberFormula |
| 119 | */ |
| 120 | private final Number number; |
| 121 | |
| 122 | /** |
| 123 | * Creates a new NumberFormula from the given Number. |
| 124 | * |
| 125 | * @param intValue |
| 126 | * The Number value of this NumberFormula. |
| 127 | * @throws IllegalArgumentException |
| 128 | * if the given Number is null |
| 129 | */ |
| 130 | private NumberFormula(Number intValue) |
| 131 | { |
| 132 | Objects.requireNonNull(intValue, "Cannot create an NumberFormula with a null Number"); |
| 133 | number = intValue; |
| 134 | } |
| 135 | |
| 136 | /** |
| 137 | * Resolves this NumberFormula, returning the Number in this |
| 138 | * NumberFormula. |
| 139 | * |
| 140 | * @return the Number in this NumberFormula. |
| 141 | */ |
| 142 | @Override |
| 143 | public Number resolve(PlayerCharacter pc, String source) |
| 144 | { |
| 145 | return number; |
| 146 | } |
| 147 | |
| 148 | /** |
| 149 | * Resolves this NumberFormula, returning the Number in this |
| 150 | * NumberFormula. |
| 151 | * |
| 152 | * @return the Number in this NumberFormula. |
| 153 | */ |
| 154 | @Override |
| 155 | public Number resolve(Equipment equipment, boolean primary, PlayerCharacter pc, String source) |
| 156 | { |
| 157 | return number; |
| 158 | } |
| 159 | |
| 160 | /** |
| 161 | * Returns a String representation of this NumberFormula. |
| 162 | */ |
| 163 | @Override |
| 164 | public String toString() |
| 165 | { |
| 166 | return number.toString(); |
| 167 | } |
| 168 | |
| 169 | /** |
| 170 | * Returns the consistent-with-equals hashCode for this NumberFormula |
| 171 | */ |
nothing calls this directly
no outgoing calls
no test coverage detected