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

Method evaluateIIF

code/src/java/pcgen/io/ExportHandler.java:721–738  ·  view source on GitHub ↗

Helper method to evaluate a IIF token @param node The IIFNode to evaluate @param output The output to write to (character sheet template) @param aPC The PC we are outputting

(final IIFNode node, final BufferedWriter output, final PlayerCharacter aPC)

Source from the content-addressed store, hash-verified

719 * @param aPC The PC we are outputting
720 */
721 private void evaluateIIF(final IIFNode node, final BufferedWriter output, final PlayerCharacter aPC)
722 {
723 // Comma is a delimiter for a higher-level parser, so
724 // we'll use a semicolon and replace it with a comma for
725 // expressions like:
726 // |IIF(VAR.IF(var("COUNT[SKILLTYPE=Strength]")>0;1;0):1)|
727 final String aString = node.expr().replaceAll(Pattern.quote(";"), ",");
728
729 // If we can evaluate the expression then evaluate its children
730 if (evaluateExpression(aString, aPC))
731 {
732 evaluateIIFChildren(node.trueChildren(), output, aPC);
733 }
734 else
735 {
736 evaluateIIFChildren(node.falseChildren(), output, aPC);
737 }
738 }
739
740 /**
741 * Helper method to evaluate the results of a IIF child node

Callers 2

evaluateIIFChildrenMethod · 0.95
processLoopMethod · 0.95

Calls 6

evaluateExpressionMethod · 0.95
evaluateIIFChildrenMethod · 0.95
exprMethod · 0.80
trueChildrenMethod · 0.80
falseChildrenMethod · 0.80
replaceAllMethod · 0.45

Tested by

no test coverage detected