001    package org.mesopotamia.lang.java;
002    
003    import org.mesopotamia.MesopotamiaException;
004    import org.mesopotamia.NodeData;
005    import org.mesopotamia.RepositoryLanguage;
006    import org.mesopotamia.Scan;
007    import org.w3c.dom.Element;
008    
009    import biz.hammurapi.util.Visitable;
010    import biz.hammurapi.util.Visitor;
011    
012    public class InstanceOf extends RelationalExpression {
013    
014            public InstanceOf(NodeData xData, Class<?> context, Scan scan,
015                            RepositoryLanguage language, Object environment) throws MesopotamiaException {
016                    super(xData, context, scan, language, environment);
017    
018                    // Select attributes
019                    Expression = selectSingleElement(ShiftExpression.class,
020                                    "#org.mesopotamia.lang.java.ShiftExpression");
021                    TypeSpecification = selectSingleElement(TypeSpecification.class, "TYPE");
022    
023            }
024    
025            public void toDom(Element holder) {
026                    super.toDom(holder);
027    
028                    // Serialize attributes
029                    setElement(holder, "Expression", Expression);
030                    setElement(holder, "TypeSpecification", TypeSpecification);
031            }
032    
033            // Attributes
034            private ShiftExpression Expression;
035    
036            private TypeSpecification TypeSpecification;
037    
038            // Accessors
039            public ShiftExpression getExpression() {
040                    return Expression;
041            }
042    
043            public TypeSpecification getTypeSpecification() {
044                    return TypeSpecification;
045            }
046    
047            protected void acceptChildren(Visitor visitor) {
048                    super.acceptChildren(visitor);
049                    // Visiting non-text attributes
050                    if (Expression instanceof Visitable) {
051                            ((Visitable) Expression).accept(visitor);
052                    }
053                    if (TypeSpecification instanceof Visitable) {
054                            ((Visitable) TypeSpecification).accept(visitor);
055                    }
056            }
057    
058    }