本文整理汇总了Java中gnu.mapping.Procedure类的典型用法代码示例。如果您正苦于以下问题:Java Procedure类的具体用法?Java Procedure怎么用?Java Procedure使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Procedure类属于gnu.mapping包,在下文中一共展示了Procedure类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: validateApply
import gnu.mapping.Procedure; //导入依赖的package包/类
public Expression validateApply(ApplyExp exp, InlineCalls visitor,
Type required, Declaration decl) {
Expression[] initial = this.getArgs();
Expression[] xargs = exp.getArgs();
int nargs = initial.length + xargs.length;
int num = actual.numArgs();
int min = Procedure.minArgs(num);
int max = Procedure.maxArgs(num);
if (nargs < min || (max >= 0 && nargs > max)) {
// Future: optionally allow re-curry if nargs < min?
return super.validateApply(exp, visitor, required, decl);
}
Expression[] targs = new Expression[nargs];
System.arraycopy(initial, 0, targs, 0, initial.length);
System.arraycopy(xargs, 0, targs, initial.length, xargs.length);
return visitor.visit(new ApplyExp(actual, targs), required);
}
开发者ID:spurious,项目名称:kawa-mirror,代码行数:18,代码来源:CurryExp.java
示例2: if
import gnu.mapping.Procedure; //导入依赖的package包/类
/** Inliner for the Compare procedure. */
public static Expression validateCompare
(ApplyExp exp, InlineCalls visitor, Type required, Procedure proc)
{
exp.visitArgs(visitor);
Expression folded = exp.inlineIfConstant(proc, visitor);
if (folded != exp)
return folded;
Compare cproc = (Compare) proc;
if ((cproc.flags & Compare.VALUE_COMPARISON) != 0)
{
}
else
{
exp = new ApplyExp(ClassType.make("gnu.xquery.util.Compare")
.getDeclaredMethod("apply", 4),
new Expression[] { new QuoteExp(IntNum.make(cproc.flags)),
exp.getArg(0),
exp.getArg(1),
QuoteExp.nullExp });
}
if (exp.getTypeRaw() == null)
exp.setType(XDataType.booleanType);
return exp;
}
开发者ID:spurious,项目名称:kawa-mirror,代码行数:26,代码来源:CompileMisc.java
示例3: compileOrderedMap
import gnu.mapping.Procedure; //导入依赖的package包/类
public static void compileOrderedMap (ApplyExp exp, Compilation comp, Target target, Procedure proc)
{
Expression[] args = exp.getArgs();
if (args.length != 2)
{
ApplyExp.compile(exp, comp, target);
return;
}
CodeAttr code = comp.getCode();
Scope scope = code.pushScope();
Variable consumer = scope.addVariable(code, typeTuples, null);
args[1].compile(comp, Target.pushValue(typeTuples));
code.emitStore(consumer);
ConsumerTarget ctarget = new ConsumerTarget(consumer);
args[0].compile(comp, ctarget);
Method mm = typeTuples.getDeclaredMethod("run$X", 1);
code.emitLoad(consumer);
PrimProcedure.compileInvoke(comp, mm, target, exp.isTailCall(),
182/*invokevirtual*/, Type.pointer_type, false);
code.popScope();
}
开发者ID:spurious,项目名称:kawa-mirror,代码行数:22,代码来源:CompileMisc.java
示例4: apply1
import gnu.mapping.Procedure; //导入依赖的package包/类
public Object apply1 (Object arg)
{
if (! (arg instanceof Procedure))
{
/* #ifdef JAVA2 */
if (arg instanceof java.util.List)
return new SetList((java.util.List) arg);
/* #else */
// if (arg instanceof gnu.lists.Sequence)
// return new SetList((gnu.lists.Sequence) arg);
/* #endif */
Class cl = arg.getClass();
if (cl.isArray())
return new SetArray(arg, Language.getDefaultLanguage()/*FIXME*/);
}
return ((Procedure)arg).getSetter();
}
开发者ID:mit-cml,项目名称:ai2-kawa,代码行数:18,代码来源:Setter.java
示例5: compileOrderedMap
import gnu.mapping.Procedure; //导入依赖的package包/类
public static void compileOrderedMap (ApplyExp exp, Compilation comp, Target target, Procedure proc)
{
Expression[] args = exp.getArgs();
if (args.length != 2)
{
ApplyExp.compile(exp, comp, target);
return;
}
CodeAttr code = comp.getCode();
Scope scope = code.pushScope();
Variable consumer = scope.addVariable(code, typeTuples, null);
args[1].compile(comp, Target.pushValue(typeTuples));
code.emitStore(consumer);
ConsumerTarget ctarget = new ConsumerTarget(consumer);
args[0].compile(comp, ctarget);
Method mm = typeTuples.getDeclaredMethod("run$X", 1);
code.emitLoad(consumer);
PrimProcedure.compileInvoke(comp, mm, target, exp.isTailCall(),
182/*invokevirtual*/, Type.pointer_type);
code.popScope();
}
开发者ID:mit-cml,项目名称:ai2-kawa,代码行数:22,代码来源:CompileMisc.java
示例6: callMethod
import gnu.mapping.Procedure; //导入依赖的package包/类
private void callMethod(Symbol procedureName) throws Exception {
if (SchemeEnvironment.isDefined(context.getEnvironmentName(), procedureName.toString())) {
Procedure p = (Procedure) SchemeEnvironment.eval(context.getEnvironmentName(),
procedureName.toString());
if (p.maxArgs() == 2) {
SchemeEnvironment.applyProcedure(context.getEnvironmentName(),
procedureName.toString(),
context, latch);
} else {
SchemeEnvironment.applyProcedure(context.getEnvironmentName(),
procedureName.toString(),
context);
latch.countDown(context.getName());
log.debug("Latch countdowned={}, at task={}", latch, task);
}
} else {
if (ReflectionMethodInvoker.isDefined(context, procedureName.toString(), latch)) {
ReflectionMethodInvoker.invoke(context, procedureName.toString(), latch);
} else {
ReflectionMethodInvoker.invoke(context, procedureName.toString());
latch.countDown(context.getName());
log.debug("Latch countdowned={}, at task={}", latch, task);
}
}
}
开发者ID:MAGCruise,项目名称:magcruise-core,代码行数:27,代码来源:ContextTask.java
示例7: callMethod
import gnu.mapping.Procedure; //导入依赖的package包/类
private void callMethod(Symbol procedureName, Player self) throws Exception {
if (SchemeEnvironment.isDefined(context.getEnvironmentName(), procedureName.toString())) {
Procedure p = (Procedure) SchemeEnvironment.eval(context.getEnvironmentName(),
procedureName.toString());
if (p.maxArgs() == 3) {
SchemeEnvironment.applyProcedure(context.getEnvironmentName(),
procedureName.toString(),
context, self, latch);
} else {
SchemeEnvironment.applyProcedure(context.getEnvironmentName(),
procedureName.toString(),
context, self);
latch.countDown(self.getName());
log.debug("Latch countdowned={}, at task={}", latch, task);
}
} else {
if (ReflectionMethodInvoker.isDefined(self, procedureName.toString(), context, latch)) {
ReflectionMethodInvoker.invoke(self, procedureName.toString(), context, latch);
} else {
ReflectionMethodInvoker.invoke(self, procedureName.toString(), context);
latch.countDown(self.getName());
log.debug("Latch countdowned={}, at task={}", latch, task);
}
}
}
开发者ID:MAGCruise,项目名称:magcruise-core,代码行数:26,代码来源:PlayerTask.java
示例8: applyProcedure
import gnu.mapping.Procedure; //导入依赖的package包/类
public static Object applyProcedure(Procedure procedure, Object... args) {
try {
switch (args.length) {
case 0:
return procedure.apply0();
case 1:
return procedure.apply1(args[0]);
case 2:
return procedure.apply2(args[0], args[1]);
case 3:
return procedure.apply3(args[0], args[1], args[2]);
case 4:
return procedure.apply4(args[0], args[1], args[2], args[3]);
default:
return procedure.applyN(args);
}
} catch (Throwable e) {
throw new ApplyException(procedure, e, args);
}
}
开发者ID:MAGCruise,项目名称:magcruise-core,代码行数:23,代码来源:SchemeEnvironment.java
示例9: enter
import gnu.mapping.Procedure; //导入依赖的package包/类
public void enter(String pattern, double priority, Procedure procedure)
{
TemplateEntry entry = new TemplateEntry();
entry.procedure = procedure;
entry.priority = priority;
entry.pattern = pattern;
entry.next = entries;
entries = entry;
}
开发者ID:spurious,项目名称:kawa-mirror,代码行数:10,代码来源:TemplateTable.java
示例10: find
import gnu.mapping.Procedure; //导入依赖的package包/类
public Procedure find (String name)
{
for (TemplateEntry entry = entries; entry != null; entry = entry.next)
{
if (entry.pattern.equals(name))
return entry.procedure;
}
return null;
}
开发者ID:spurious,项目名称:kawa-mirror,代码行数:10,代码来源:TemplateTable.java
示例11: apply1
import gnu.mapping.Procedure; //导入依赖的package包/类
public Object apply1(Object arg){
if (! (arg instanceof Procedure)) {
if (arg instanceof java.util.List)
return new SetList((java.util.List) arg);
if (arg instanceof Array)
return new SetGArray((Array) arg);
Class cl = arg.getClass();
if (cl.isArray())
return new SetArray(arg,
Language.getDefaultLanguage()/*FIXME*/);
}
return ((Procedure)arg).getSetter();
}
开发者ID:spurious,项目名称:kawa-mirror,代码行数:14,代码来源:Setter.java
示例12: for
import gnu.mapping.Procedure; //导入依赖的package包/类
/** Type-check and optimize RunProcess (i.e. 'run-process'). */
public static Expression validateApplyRunProcess
(ApplyExp exp, InlineCalls visitor, Type required, Procedure proc) {
exp.visitArgs(visitor);
Expression[] args = exp.getArgs();
int nargs = args.length;
int inArg = -1;
for (int i = 0; i < nargs; i++) {
Expression arg = args[i];
Keyword key = arg.checkLiteralKeyword();
if (key != null && i+1 < nargs) {
String name = key.getName();
if ("in".equals(name))
inArg = i+1;
i++;
} else if (inArg < 0 && i+1 < nargs)
inArg = i;
}
if (inArg >= 0) {
if (args[inArg] instanceof ApplyExp) {
ApplyExp inApp = (ApplyExp) args[inArg];
Object inFun = inApp.getFunction().valueIfConstant();
if (inFun instanceof RunProcess) {
Expression[] inArgs = inApp.getArgs();
Expression[] xargs = new Expression[inArgs.length+2];
xargs[0] = QuoteExp.getInstance(Keyword.make("out-to"));
xargs[1] = QuoteExp.getInstance(RunProcess.pipeSymbol);
System.arraycopy(inArgs, 0, xargs, 2, inArgs.length);
inApp.setArgs(xargs);
}
}
}
return exp;
}
开发者ID:spurious,项目名称:kawa-mirror,代码行数:35,代码来源:CompileProcess.java
示例13:
import gnu.mapping.Procedure; //导入依赖的package包/类
/** Inliner for the ArithOp procedure. */
public static Expression validateArithOp
(ApplyExp exp, InlineCalls visitor, Type required, Procedure proc)
{
exp.visitArgs(visitor);
// FUTURE
return exp;
}
开发者ID:spurious,项目名称:kawa-mirror,代码行数:9,代码来源:CompileMisc.java
示例14: validateApply
import gnu.mapping.Procedure; //导入依赖的package包/类
public Expression validateApply (ApplyExp exp, InlineCalls visitor,
Type required, Declaration decl)
{
decl = this.binding; // We don't use the passed-in Declaration.
if (decl != null && ! decl.getFlag(Declaration.IS_UNKNOWN))
{
decl = Declaration.followAliases(decl);
if (! (decl.isIndirectBinding()))
{
Expression dval = decl.getValue();
if (dval != null)
return dval.validateApply(exp, visitor, required, decl);
Type dtype = decl.type;
if (dtype instanceof ClassType
&& ((ClassType) dtype).isSubclass("kawa.lang.Continuation"))
exp.setType(Type.neverReturnsType);
}
}
else if (getSymbol() instanceof Symbol)
{
Symbol symbol = (Symbol) getSymbol();
Object fval = Environment.getCurrent().getFunction(symbol, null);
if (fval instanceof Procedure)
return new QuoteExp(fval).validateApply(exp, visitor, required, null);
}
exp.visitArgs(visitor);
return exp;
}
开发者ID:spurious,项目名称:kawa-mirror,代码行数:29,代码来源:ReferenceExp.java
注:本文中的gnu.mapping.Procedure类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论