1 package com.icl.saxon.functions; 2 import com.icl.saxon.*; 3 import com.icl.saxon.expr.*; 4 import com.icl.saxon.om.NodeInfo; 5 import java.util.*; 6 7 8 public class Current extends Function { 9 10 13 14 public String getName() { 15 return "current"; 16 }; 17 18 22 23 public int getDataType() { 24 return Value.NODESET; 25 } 26 27 32 33 public boolean isContextDocumentNodeSet() { 34 return true; 35 } 36 37 40 41 public Expression simplify() throws XPathException { 42 checkArgumentCount(0, 0); 43 return this; 44 } 45 46 49 50 public NodeSetValue evaluateAsNodeSet(Context c) throws XPathException { 51 return new SingletonNodeSet(c.getCurrentNodeInfo()); 52 } 53 54 57 58 public Value evaluate(Context c) throws XPathException { 59 return evaluateAsNodeSet(c); 60 } 61 62 65 66 public int getDependencies() { 67 return Context.CURRENT_NODE; 68 } 69 70 73 74 public Expression reduce(int dep, Context c) throws XPathException { 75 if ((dep & Context.CURRENT_NODE) != 0) { 76 return evaluateAsNodeSet(c); 77 } else { 78 return this; 79 } 80 } 81 82 } 83 84 85 86 87 | Popular Tags |