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 FunctionFLOAT 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 FunctionFLOAT(ArrayList args, XQueryModule parentModule) throws TypeException, XQueryException { 48 super(new QName("float",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 float should have one argument"); 60 super.setArguments(arguments); 61 } 62 63 private ValueFloat convert(ValueString valString,XQueryModule parentModule) throws XQueryException { 64 String val = valString.getStringValue(); 65 ValueFloat valInt = new ValueFloat(val,parentModule); 66 return valInt; 67 } 68 69 } 70 71 | Popular Tags |