1 16 19 package com.sun.org.apache.xpath.internal.functions; 20 21 import com.sun.org.apache.xalan.internal.res.XSLMessages; 22 import com.sun.org.apache.xpath.internal.Expression; 23 import com.sun.org.apache.xpath.internal.ExpressionOwner; 24 import com.sun.org.apache.xpath.internal.XPathContext; 25 import com.sun.org.apache.xpath.internal.XPathVisitor; 26 import com.sun.org.apache.xpath.internal.compiler.Compiler; 27 import com.sun.org.apache.xpath.internal.objects.XObject; 28 29 39 public abstract class Function extends Expression 40 { 41 42 52 public void setArg(Expression arg, int argNum) 53 throws WrongNumberArgsException 54 { 55 reportWrongNumberArgs(); 57 } 58 59 69 public void checkNumberArgs(int argNum) throws WrongNumberArgsException 70 { 71 if (argNum != 0) 72 reportWrongNumberArgs(); 73 } 74 75 82 protected void reportWrongNumberArgs() throws WrongNumberArgsException { 83 throw new WrongNumberArgsException(XSLMessages.createXPATHMessage("zero", null)); 84 } 85 86 94 public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException 95 { 96 97 System.out.println("Error! Function.execute should not be called!"); 99 100 return null; 101 } 102 103 106 public void callArgVisitors(XPathVisitor visitor) 107 { 108 } 109 110 111 114 public void callVisitors(ExpressionOwner owner, XPathVisitor visitor) 115 { 116 if(visitor.visitFunction(owner, this)) 117 { 118 callArgVisitors(visitor); 119 } 120 } 121 122 125 public boolean deepEquals(Expression expr) 126 { 127 if(!isSameClass(expr)) 128 return false; 129 130 return true; 131 } 132 133 137 public void postCompileStep(Compiler compiler) 138 { 139 } 141 } 142 | Popular Tags |