1 22 23 package org.xquark.xquery.parser; 24 25 import org.xquark.xquery.typing.TypeException; 26 27 public class CastTreatExpression extends XQueryUnaryOperatorExpression implements Cloneable { 28 29 private static final String RCSRevision = "$Revision: 1.12 $"; 30 private static final String RCSName = "$Name: $"; 31 32 protected SequenceType sequenceType = null; 36 protected int operator = -1; 38 39 43 public void accept(ParserVisitor visitor) throws XQueryException { 44 visitor.visit(this); 45 } 46 47 51 public CastTreatExpression(int operator, SequenceType sequenceType, XQueryExpression expression, XQueryModule parentModule) throws TypeException, XQueryException { 52 super(expression); 53 setSequenceType(sequenceType); 54 setOperator(operator); 55 setParentModule(parentModule); 56 if (parentModule != null && parentModule.getStaticContext().getTypeVisitor() != null) 57 accept(parentModule.getStaticContext().getTypeVisitor()); 58 } 59 60 64 public SequenceType getSequenceType() { 66 return sequenceType; 67 } 68 public int getOperator() { 69 return operator; 70 } 71 72 public void setSequenceType(SequenceType sequenceType) throws XQueryException { 73 if (sequenceType == null) 75 throw new XQueryException("sequenceType of CastTreatExpression cannot be null"); 76 this.sequenceType = sequenceType; 77 this.sequenceType.setParentExpression(this); 79 this.sequenceType.setParentModule(parentModule); 80 } 81 82 public void setOperator(int operator) throws XQueryException { 83 if (operator == -1) 85 throw new XQueryException("operator of CastTreatExpression cannot be -1"); 86 this.operator = operator; 87 } 88 89 93 public void addParentExpression(XQueryExpression parentExpression) { 94 addParentExpression(parentExpression); 95 sequenceType.addParentExpression(parentExpression); 96 expression.addParentExpression(parentExpression); 97 } 98 99 } 100 | Popular Tags |