1 22 23 24 package org.xquark.xquery.parser; 25 26 import org.xquark.xquery.typing.TypeException; 27 28 29 30 public class ITEExpression extends XQueryExpression implements Cloneable { 31 32 private static final String RCSRevision = "$Revision: 1.12 $"; 33 private static final String RCSName = "$Name: $"; 34 35 protected XQueryExpression ifExpression = null; 37 protected XQueryExpression thenExpression = null; 39 protected XQueryExpression elseExpression = null; 41 42 46 public void accept(ParserVisitor visitor) throws XQueryException { 47 visitor.visit(this); 48 } 49 50 54 public ITEExpression(XQueryExpression ifExpression, XQueryExpression thenExpression, XQueryExpression elseExpression, XQueryModule parentModule) throws TypeException, XQueryException { 55 setIfExpression(ifExpression); 56 setThenExpression(thenExpression); 57 setElseExpression(elseExpression); 58 setParentModule(parentModule); 59 if (parentModule != null && parentModule.getStaticContext().getTypeVisitor() != null) 60 accept(parentModule.getStaticContext().getTypeVisitor()); 61 } 62 63 67 public XQueryExpression getIfExpression() { return ifExpression; } 68 public void setIfExpression(XQueryExpression expression) throws XQueryException { 69 if (expression == null) throw new XQueryException("ifExpression of ITEExpression cannot be null"); 71 this.ifExpression = expression; 72 this.ifExpression.setParentModule(parentModule); 73 this.ifExpression.setParentExpression(this); 74 } 75 76 public XQueryExpression getThenExpression() { return thenExpression; } 77 public void setThenExpression(XQueryExpression expression) throws XQueryException { 78 if (expression == null) throw new XQueryException("thenExpression of ITEExpression cannot be null"); 80 this.thenExpression = expression; 81 this.thenExpression.setParentModule(parentModule); 82 this.thenExpression.setParentExpression(this); 83 } 84 85 public XQueryExpression getElseExpression() { return elseExpression; } 86 public void setElseExpression(XQueryExpression expression) throws XQueryException { 87 if (expression == null) throw new XQueryException("elseExpression of ITEExpression cannot be null"); 89 this.elseExpression = expression; 90 this.elseExpression.setParentModule(parentModule); 91 this.elseExpression.setParentExpression(this); 92 } 93 94 public void addParentExpression(XQueryExpression parentExpression) { 98 addParentExpression(parentExpression) ; 99 ifExpression.addParentExpression(parentExpression); 100 thenExpression.addParentExpression(parentExpression); 101 elseExpression.addParentExpression(parentExpression); 102 } 103 104 } 105 106 107 108 | Popular Tags |