MCPcopy Create free account
hub / github.com/PCGen/pcgen / JEPFormula

Class JEPFormula

code/src/java/pcgen/cdom/base/JEPFormula.java:28–139  ·  view source on GitHub ↗

JEPFormula is a variable-value Formula designed to be run through the JEP formula evaluation system.

Source from the content-addressed store, hash-verified

26 * formula evaluation system.
27 */
28public class JEPFormula implements Formula
29{
30
31 /**
32 * The value of this JEPFormula
33 */
34 private final String formula;
35
36 /**
37 * Creates a new JEPFormula from the given String.
38 *
39 * @param formulaString
40 * The String value of this JEPFormula.
41 */
42 JEPFormula(String formulaString)
43 {
44 formula = formulaString;
45 }
46
47 /**
48 * Returns a String representation of this JEPFormula.
49 */
50 @Override
51 public String toString()
52 {
53 return formula;
54 }
55
56 @Override
57 public int hashCode()
58 {
59 return formula.hashCode();
60 }
61
62 @Override
63 public boolean equals(Object obj)
64 {
65 return obj instanceof JEPFormula && ((JEPFormula) obj).formula.equals(formula);
66 }
67
68 /**
69 * Resolves this JEPFormula, returning the value of this JEPFormula in the
70 * context of the given PlayerCharacter and source.
71 *
72 * @param character
73 * The PlayerCharacter relative to which the JEPFormula should be
74 * resolved.
75 * @param source
76 * The source object of the JEPFormula, for purposes of
77 * resolution.
78 * @return The value of this JEPFormula in the context of the given
79 * PlayerCharacter and source.
80 * @throws NullPointerException
81 * if the given PlayerCharacter is null
82 */
83 @Override
84 public Float resolve(PlayerCharacter character, String source)
85 {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected