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