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