use of pcgen.cdom.formula.FixedSizeFormula in project pcgen by PCGen.
the class SizeToken method process.
@Override
public boolean process(LoadContext context, PCTemplate template) {
String value = template.get(StringKey.SIZEFORMULA);
if (value == null) {
return true;
}
SizeAdjustment size = context.getReferenceContext().silentlyGetConstructedCDOMObject(SizeAdjustment.class, value);
Formula sizeFormula;
if (size == null) {
sizeFormula = FormulaFactory.getFormulaFor(value);
} else {
sizeFormula = new FixedSizeFormula(CDOMDirectSingleRef.getRef(size));
}
if (!sizeFormula.isValid()) {
Logging.errorPrint("Size in " + getTokenName() + " was not valid: " + sizeFormula.toString(), context);
return false;
}
context.getObjectContext().put(template, FormulaKey.SIZE, sizeFormula);
return false;
}
Aggregations