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 SynchronizedStatement extends JavaLanguageElement implements Statement {
013    
014            public SynchronizedStatement(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 = (Expression) selectSingleElement(Expression.class, "EXPR");
020                    CompoundStatement = selectSingleElement(CompoundStatement.class, "SLIST");
021    
022            }
023    
024            public void toDom(Element holder) {
025                    super.toDom(holder);
026    
027                    // Serialize attributes
028                    setElement(holder, "Expression", Expression);
029                    setElement(holder, "CompoundStatement", CompoundStatement);
030            }
031    
032            // Attributes
033            private Expression Expression;
034    
035            private CompoundStatement CompoundStatement;
036    
037            // Accessors
038            public Expression getExpression() {
039                    return Expression;
040            }
041    
042            public CompoundStatement getCompoundStatement() {
043                    return CompoundStatement;
044            }
045    
046            protected void acceptChildren(Visitor visitor) {
047                    super.acceptChildren(visitor);
048                    // Visiting non-text attributes
049                    if (Expression instanceof Visitable) {
050                            ((Visitable) Expression).accept(visitor);
051                    }
052                    if (CompoundStatement instanceof Visitable) {
053                            ((Visitable) CompoundStatement).accept(visitor);
054                    }
055            }
056    
057    }