1 22 23 24 package org.xquark.xquery.parser.primitivefunctions.xsfunctions; 25 26 import java.util.ArrayList ; 27 28 import org.xquark.xquery.parser.*; 29 import org.xquark.xquery.typing.TypeException; 30 31 public class FunctionINTEGER extends PrimitiveFunctionCall { 32 private static final String RCSRevision = "$Revision: 1.6 $"; 33 private static final String RCSName = "$Name: $"; 34 35 39 public void accept(ParserVisitor visitor) throws XQueryException { 40 visitor.visit(this); 41 } 42 43 47 public FunctionINTEGER(ArrayList args, XQueryModule parentModule) throws TypeException, XQueryException { 48 super(new QName("integer",null),args); 49 if (args.get(0) instanceof ValueString) 50 args.set(0, convert((ValueString)args.get(0),parentModule)); 51 else if (parentModule != null && parentModule.getStaticContext().getTypeVisitor() != null) 52 accept(parentModule.getStaticContext().getTypeVisitor()); 53 setParentModule(parentModule); 54 setArguments(args); 55 } 56 57 public void setArguments(ArrayList arguments) throws XQueryException { 59 if (arguments == null || arguments.size() != 1) throw new XQueryException("Function integer should have one argument"); 60 super.setArguments(arguments); 61 } 62 63 private ValueInteger convert(ValueString valString,XQueryModule parentModule) throws XQueryException { 64 String val = valString.getStringValue(); 65 ValueInteger valInt = new ValueInteger(val,parentModule); 66 return valInt; 67 } 68 69 } 70 71 72 | Popular Tags |