1 22 23 24 package org.xquark.xquery.parser; 25 26 import org.xquark.xquery.typing.TypeException; 27 28 29 public class ValueDouble extends Value implements Cloneable { 30 private static final String RCSRevision = "$Revision: 1.7 $"; 31 private static final String RCSName = "$Name: $"; 32 33 34 38 public void accept(ParserVisitor visitor) throws XQueryException { 39 visitor.visit(this); 40 } 41 42 46 public ValueDouble( String value, XQueryModule parentModule) throws TypeException, XQueryException { 47 super(value); 48 setValue(value); 49 setParentModule(parentModule); 50 if (parentModule != null && parentModule.getStaticContext().getTypeVisitor() != null) 51 accept(parentModule.getStaticContext().getTypeVisitor()); 52 } 53 54 58 public Double getDoubleValue() { return new Double (value); } 59 public Object getObjectValue() { return getDoubleValue(); } 60 public void setValue(String value) throws XQueryException { 61 try { 63 Double.parseDouble(value); 64 } 65 catch (NumberFormatException e) { 66 throw new XQueryException("value of valueDouble must be a valid Double"); 67 } 68 this.value = (new Double (value)).toString(); 69 } 70 public void setValue(double value) throws XQueryException { 71 setValue(String.valueOf(value)); 72 } 73 74 } 75 | Popular Tags |