| /* Generated By:JJTree: Do not edit this line. OccurrenceIndicator.java */ |
| |
| package org.apache.xpath.parser; |
| |
| import java.util.Vector; |
| import javax.xml.transform.TransformerException; |
| import org.apache.xpath.Expression; |
| import org.apache.xpath.ExpressionOwner; |
| import org.apache.xpath.XPathContext; |
| import org.apache.xpath.XPathVisitor; |
| import org.apache.xpath.objects.XObject; |
| import org.apache.xpath.operations.Add; |
| import org.apache.xpath.types.InstanceofExpr; |
| |
| public class OccurrenceIndicator extends NonExecutableExpression |
| { |
| int m_occuranceType; |
| |
| /** |
| * Constructor for OccurrenceIndicator. |
| * @param parser |
| * @param value |
| */ |
| public OccurrenceIndicator(XPath parser, String value) |
| { |
| super(parser, value); |
| } |
| |
| /** |
| * Constructor for OccurrenceIndicator. |
| * @param parser |
| */ |
| public OccurrenceIndicator(XPath parser) |
| { |
| super(parser); |
| } |
| |
| /** |
| * @see org.apache.xpath.parser.Node#jjtAddChild(Node, int) |
| */ |
| public void jjtAddChild(Node n, int i) |
| { |
| if(n instanceof Add) // Hack... there should be a PlusOccuranceIndicator token!.. |
| m_occuranceType = InstanceofExpr.ONE_OR_MORE; |
| else |
| { |
| // Assume NEE |
| char c = ((NonExecutableExpression)n).m_value.charAt(0); |
| if('*' == c) |
| m_occuranceType = InstanceofExpr.ZERO_OR_MORE; |
| else if('?' == c) |
| m_occuranceType = InstanceofExpr.ZERO_OR_ONE; |
| else |
| this.flagProblem("The occurance indicator value is unknown! Value: "+c); |
| } |
| } |
| |
| /** |
| * Returns the occuranceType. |
| * @return int |
| */ |
| public int getOccuranceType() |
| { |
| return m_occuranceType; |
| } |
| |
| /** |
| * Sets the occuranceType. |
| * @param occuranceType The occuranceType to set |
| */ |
| public void setOccuranceType(int occuranceType) |
| { |
| m_occuranceType = occuranceType; |
| } |
| |
| |
| |
| /** |
| * @see org.apache.xpath.parser.Node#jjtSetParent(Node) |
| */ |
| public void jjtSetParent(Node n) |
| { |
| if(n instanceof SequenceType) |
| ((SequenceType)n).setOccurrenceIndicator(m_occuranceType); |
| super.jjtSetParent(n); |
| } |
| |
| } |