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

Method allowArgs

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

Source from the content-addressed store, hash-verified

59 }
60
61 @Override
62 public FormatManager<?> allowArgs(SemanticsVisitor visitor, Node[] args, FormulaSemantics semantics)
63 {
64 int argCount = args.length;
65 if (argCount != 2)
66 {
67 throw new SemanticsFailureException("Function " + getFunctionName()
68 + " received incorrect # of arguments, expected: 2 got " + args.length + ' ' + Arrays.asList(args));
69 }
70 if (!(args[0] instanceof ASTQuotString))
71 {
72 //Error
73 throw new SemanticsFailureException("Parse Error: Invalid first argument: Must be a String");
74 }
75 if (!(args[1] instanceof ASTQuotString))
76 {
77 //Error
78 throw new SemanticsFailureException("Parse Error: Invalid first argument: Must be a String");
79 }
80
81 //This will be a format
82 return semantics.get(ManagerKey.CONTEXT).getReferenceContext()
83 .getFormatManager(((ASTQuotString) args[0]).getText());
84 }
85
86 @Override
87 public Object evaluate(EvaluateVisitor visitor, Node[] args, EvaluationManager manager)

Callers

nothing calls this directly

Calls 5

getFunctionNameMethod · 0.95
getFormatManagerMethod · 0.65
getReferenceContextMethod · 0.65
getMethod · 0.65
getTextMethod · 0.45

Tested by

no test coverage detected