1 22 23 24 package org.xquark.xquery.parser; 25 26 import org.xquark.xquery.typing.TypeException; 27 28 29 public class ValueBoolean 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 ValueBoolean(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 boolean getBooleanValue() { if (value.equalsIgnoreCase("true")) return true; else return false; } 59 public Object getObjectValue() { return null; } 60 public void setValue(String value) throws XQueryException { 61 if (!value.equalsIgnoreCase("true") && !value.equalsIgnoreCase("false")) throw new XQueryException("value of ValueBoolean must be a Valid Boolean"); 63 this.value = value; 64 } 65 public void setValue(boolean value) throws XQueryException { 66 setValue(String.valueOf(value)); 67 } 68 69 } 70 71 72 73 | Popular Tags |