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

Method run

code/src/java/pcgen/util/PJEP.java:193–280  ·  view source on GitHub ↗
(Stack inStack)

Source from the content-addressed store, hash-verified

191 */
192 // @SuppressWarnings("unchecked") //Uses JEP, which doesn't use generics
193 @Override
194 public void run(Stack inStack) throws ParseException
195 {
196 LstUtils.deprecationWarning("Jep function cl deprecated, use classlevel instead");
197
198 // check the stack
199 checkStack(inStack);
200
201 // get the parameter from the stack
202
203 int paramCount = curNumberOfParameters;
204
205 // If there are no parameters and this is used in a CLASS file,
206 // then use the class name
207
208 if (paramCount == 0)
209 {
210 String src = getVariableSource();
211 if (src.startsWith("CLASS:"))
212 {
213 src = src.substring(6);
214 inStack.push(src);
215 ++paramCount;
216 }
217 }
218
219 //
220 // have to do this in reverse order...this is a stack afterall
221 //
222 Object param1;
223 Object param2 = null;
224 if (paramCount == 1)
225 {
226 param1 = inStack.pop();
227 }
228 else if (paramCount == 2)
229 {
230 param2 = inStack.pop();
231 param1 = inStack.pop();
232
233 if (param2 instanceof Integer)
234 {
235 // Nothing to do, it's already an Integer
236 Logging.debugPrint("Nothing to do, it's already an Integer.");
237 }
238 else if (param2 instanceof Double)
239 {
240 param2 = ((Double) param2).intValue();
241 }
242 else
243 {
244 throw new ParseException("Invalid parameter type");
245 }
246 }
247 else
248 {
249 throw new ParseException("Invalid parameter count");
250 }

Callers

nothing calls this directly

Calls 11

deprecationWarningMethod · 0.95
debugPrintMethod · 0.95
getClassLevelStringMethod · 0.95
pushMethod · 0.80
popMethod · 0.80
intValueMethod · 0.80
getNameMethod · 0.65
toStringMethod · 0.65
getVariableSourceMethod · 0.45
getPcMethod · 0.45
valueOfMethod · 0.45

Tested by

no test coverage detected