?? sortnodes.java
字號:
// Copyright (c) 2003 Per M.A. Bothner.// This is free software; for terms and warranty disclaimer see ./COPYING.package gnu.kawa.xml;import gnu.bytecode.*;import gnu.mapping.*;import gnu.expr.*;/** Sort argument nodes in document order. * Uses the SortedNodes class to do the actual work. */public class SortNodes extends Procedure1 implements Inlineable{ public static final SortNodes sortNodes = new SortNodes(); public Object apply1 (Object values) { SortedNodes nodes = new SortedNodes(); Values.writeValues(values, nodes); if (nodes.count > 1) return nodes; else if (nodes.count == 0) return Values.empty; else return nodes.get(0); } public void compile (ApplyExp exp, Compilation comp, Target target) { Expression[] args = exp.getArgs(); if (args.length != 1 || ! comp.mustCompile) ApplyExp.compile(exp, comp, target); else { Method resultMethod; if (target instanceof ConsumerTarget || (target instanceof StackTarget && target.getType().isSubtype(Compilation.typeValues))) resultMethod = null; else resultMethod = canonicalizeMethod; ConsumerTarget.compileUsingConsumer(args[0], comp, target, makeSortedNodesMethod, resultMethod); } } public Type getReturnType (Expression[] args) { return Compilation.typeObject; } public static final ClassType typeSortedNodes = ClassType.make("gnu.kawa.xml.SortedNodes"); public static final Method makeSortedNodesMethod = typeSortedNodes.getDeclaredMethod("<init>", 0); public static final Method canonicalizeMethod = Compilation.typeValues.getDeclaredMethod("canonicalize", 0);}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -