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.XPathVisitor; 25 26 30 public class FunctionOneArg extends Function implements ExpressionOwner 31 { 32 33 35 Expression m_arg0; 36 37 43 public Expression getArg0() 44 { 45 return m_arg0; 46 } 47 48 57 public void setArg(Expression arg, int argNum) 58 throws WrongNumberArgsException 59 { 60 61 if (0 == argNum) 62 { 63 m_arg0 = arg; 64 arg.exprSetParent(this); 65 } 66 else 67 reportWrongNumberArgs(); 68 } 69 70 78 public void checkNumberArgs(int argNum) throws WrongNumberArgsException 79 { 80 if (argNum != 1) 81 reportWrongNumberArgs(); 82 } 83 84 90 protected void reportWrongNumberArgs() throws WrongNumberArgsException { 91 throw new WrongNumberArgsException(XSLMessages.createXPATHMessage("one", null)); 92 } 93 94 100 public boolean canTraverseOutsideSubtree() 101 { 102 return m_arg0.canTraverseOutsideSubtree(); 103 } 104 105 115 public void fixupVariables(java.util.Vector vars, int globalsSize) 116 { 117 if(null != m_arg0) 118 m_arg0.fixupVariables(vars, globalsSize); 119 } 120 121 124 public void callArgVisitors(XPathVisitor visitor) 125 { 126 if(null != m_arg0) 127 m_arg0.callVisitors(this, visitor); 128 } 129 130 131 134 public Expression getExpression() 135 { 136 return m_arg0; 137 } 138 139 142 public void setExpression(Expression exp) 143 { 144 exp.exprSetParent(this); 145 m_arg0 = exp; 146 } 147 148 151 public boolean deepEquals(Expression expr) 152 { 153 if(!super.deepEquals(expr)) 154 return false; 155 156 if(null != m_arg0) 157 { 158 if(null == ((FunctionOneArg)expr).m_arg0) 159 return false; 160 161 if(!m_arg0.deepEquals(((FunctionOneArg)expr).m_arg0)) 162 return false; 163 } 164 else if(null != ((FunctionOneArg)expr).m_arg0) 165 return false; 166 167 return true; 168 } 169 170 171 } 172 | Popular Tags |