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

Method allowArgs

code/src/java/plugin/function/InputFunction.java:58–85  ·  view source on GitHub ↗
(SemanticsVisitor visitor, Node[] args, FormulaSemantics semantics)

Source from the content-addressed store, hash-verified

56 }
57
58 @Override
59 public final FormatManager<?> allowArgs(SemanticsVisitor visitor, Node[] args, FormulaSemantics semantics)
60 {
61 int argCount = args.length;
62 if (argCount != 1)
63 {
64 throw new SemanticsFailureException("Function " + getFunctionName()
65 + " received incorrect # of arguments, expected: 1 got " + args.length + ' ' + Arrays.asList(args));
66 }
67 //String node (name)
68 Node inputNode = args[0];
69 if (inputNode.getId() != FormulaParserTreeConstants.JJTQUOTSTRING)
70 {
71 throw new SemanticsFailureException("Parse Error: Invalid Value: " + ((SimpleNode) inputNode).getText()
72 + " found in " + inputNode.getClass().getName() + " found in location requiring a literal"
73 + " String (cannot be evaluated)");
74 }
75 String inputName = ((SimpleNode) inputNode).getText();
76 String varName = ChannelUtilities.createVarName(inputName);
77 VariableLibrary varLib = semantics.get(FormulaSemantics.FMANAGER).getFactory();
78 LegalScope scope = semantics.get(FormulaSemantics.SCOPE);
79 FormatManager<?> formatManager = varLib.getVariableFormat(scope, varName);
80 if (formatManager == null)
81 {
82 throw new SemanticsFailureException("Input Channel: " + varName + " was not found");
83 }
84 return formatManager;
85 }
86
87 @Override
88 public Object evaluate(EvaluateVisitor visitor, Node[] args, EvaluationManager manager)

Callers

nothing calls this directly

Calls 8

getFunctionNameMethod · 0.95
createVarNameMethod · 0.95
getVariableFormatMethod · 0.95
getIdMethod · 0.65
getNameMethod · 0.65
getFactoryMethod · 0.65
getMethod · 0.65
getTextMethod · 0.45

Tested by

no test coverage detected