}
public Object invoke(final Context context, final Object[] args) {
final int len;
if (args == null || (len = args.length) == 0) {
throw new ScriptRuntimeException("This method need 1 argument at least.");
}
final CachingEntry cachingEntry;
final Object firstArgument = args[0];
if (firstArgument instanceof MethodDeclare) {
cachingEntry = buildIfAbent(context, firstArgument, (MethodDeclare) firstArgument, args, 1);
} else if (len > 1) {
final Object secondArgument;
if ((secondArgument = args[1]) instanceof MethodDeclare) {
cachingEntry = buildIfAbent(context, firstArgument, (MethodDeclare) secondArgument, args, 2);
} else {
throw new ScriptRuntimeException("This method need a function argument at index 0 or 1.");
}
} else {
throw new ScriptRuntimeException("This method need a function argument.");
}
context.out(cachingEntry.outted);
return cachingEntry.returned;
}