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

Method getFormulaFor

code/src/java/pcgen/cdom/base/FormulaFactory.java:72–95  ·  view source on GitHub ↗

Returns a Formula for the given String. @param formulaString The String to be converted to a Formula @return A Formula for the given String. @throws IllegalArgumentException if the given String is null or empty

(String formulaString)

Source from the content-addressed store, hash-verified

70 * if the given String is null or empty
71 */
72 public static Formula getFormulaFor(String formulaString)
73 {
74 if (formulaString == null || formulaString.isEmpty())
75 {
76 throw new IllegalArgumentException("Formula cannot be empty");
77 }
78 try
79 {
80 return getFormulaFor(Integer.valueOf(formulaString));
81 }
82 catch (NumberFormatException e)
83 {
84 // Okay, just not an integer
85 try
86 {
87 return getFormulaFor(Double.valueOf(formulaString));
88 }
89 catch (NumberFormatException e2)
90 {
91 // Okay, just not a double
92 return new JEPFormula(formulaString);
93 }
94 }
95 }
96
97 /**
98 * Returns a Formula for the given Number.

Callers 15

setUpMethod · 0.95
setUpMethod · 0.95
setUpMethod · 0.95
setUpMethod · 0.95
setUpMethod · 0.95
setUpMethod · 0.95
testMinValueStatMethod · 0.95
testKnownMethod · 0.95

Calls 2

isEmptyMethod · 0.65
valueOfMethod · 0.45

Tested by 15

setUpMethod · 0.76
setUpMethod · 0.76
setUpMethod · 0.76
setUpMethod · 0.76
setUpMethod · 0.76
setUpMethod · 0.76
testMinValueStatMethod · 0.76
testKnownMethod · 0.76