|
|
|
|
|
*/ |
|
/* |
|
* Licensed to the Apache Software Foundation (ASF) under one or more |
|
* contributor license agreements. See the NOTICE file distributed with |
|
* this work for additional information regarding copyright ownership. |
|
* The ASF licenses this file to You under the Apache License, Version 2.0 |
|
* (the "License"); you may not use this file except in compliance with |
|
* the License. You may obtain a copy of the License at |
|
* |
|
* http://www.apache.org/licenses/LICENSE-2.0 |
|
* |
|
* Unless required by applicable law or agreed to in writing, software |
|
* distributed under the License is distributed on an "AS IS" BASIS, |
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
* See the License for the specific language governing permissions and |
|
* limitations under the License. |
|
*/ |
|
|
|
package com.sun.org.apache.xpath.internal.functions; |
|
|
|
import com.sun.org.apache.xalan.internal.res.XSLMessages; |
|
import com.sun.org.apache.xml.internal.utils.QName; |
|
import com.sun.org.apache.xpath.internal.Expression; |
|
import com.sun.org.apache.xpath.internal.ExpressionOwner; |
|
import com.sun.org.apache.xpath.internal.XPathVisitor; |
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
public class Function2Args extends FunctionOneArg |
|
{ |
|
static final long serialVersionUID = 5574294996842710641L; |
|
|
|
|
|
* @serial */ |
|
Expression m_arg1; |
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
public Expression getArg1() |
|
{ |
|
return m_arg1; |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
public void fixupVariables(List<QName> vars, int globalsSize) |
|
{ |
|
super.fixupVariables(vars, globalsSize); |
|
if(null != m_arg1) |
|
m_arg1.fixupVariables(vars, globalsSize); |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
public void setArg(Expression arg, int argNum) |
|
throws WrongNumberArgsException |
|
{ |
|
|
|
|
|
if (argNum == 0) |
|
super.setArg(arg, argNum); |
|
else if (1 == argNum) |
|
{ |
|
m_arg1 = arg; |
|
arg.exprSetParent(this); |
|
} |
|
else |
|
reportWrongNumberArgs(); |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
public void checkNumberArgs(int argNum) throws WrongNumberArgsException |
|
{ |
|
if (argNum != 2) |
|
reportWrongNumberArgs(); |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
protected void reportWrongNumberArgs() throws WrongNumberArgsException { |
|
throw new WrongNumberArgsException(XSLMessages.createXPATHMessage("two", null)); |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
public boolean canTraverseOutsideSubtree() |
|
{ |
|
return super.canTraverseOutsideSubtree() |
|
? true : m_arg1.canTraverseOutsideSubtree(); |
|
} |
|
|
|
class Arg1Owner implements ExpressionOwner |
|
{ |
|
|
|
|
|
*/ |
|
public Expression getExpression() |
|
{ |
|
return m_arg1; |
|
} |
|
|
|
|
|
|
|
|
|
*/ |
|
public void setExpression(Expression exp) |
|
{ |
|
exp.exprSetParent(Function2Args.this); |
|
m_arg1 = exp; |
|
} |
|
} |
|
|
|
|
|
|
|
|
|
*/ |
|
public void callArgVisitors(XPathVisitor visitor) |
|
{ |
|
super.callArgVisitors(visitor); |
|
if(null != m_arg1) |
|
m_arg1.callVisitors(new Arg1Owner(), visitor); |
|
} |
|
|
|
|
|
|
|
*/ |
|
public boolean deepEquals(Expression expr) |
|
{ |
|
if(!super.deepEquals(expr)) |
|
return false; |
|
|
|
if(null != m_arg1) |
|
{ |
|
if(null == ((Function2Args)expr).m_arg1) |
|
return false; |
|
|
|
if(!m_arg1.deepEquals(((Function2Args)expr).m_arg1)) |
|
return false; |
|
} |
|
else if(null != ((Function2Args)expr).m_arg1) |
|
return false; |
|
|
|
return true; |
|
} |
|
|
|
} |