001    /**
002     * Copyright (c) 2000-2011 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.parsers.creole.ast;
016    
017    import com.liferay.portal.parsers.creole.visitor.ASTVisitor;
018    
019    /**
020     * @author Miguel Pastor
021     */
022    public class HeadingNode
023            extends BaseParentableNode implements Comparable<HeadingNode> {
024    
025            public HeadingNode(int level) {
026                    _level = level;
027            }
028    
029            public HeadingNode(CollectionNode collectionNode, int level) {
030                    super(collectionNode);
031    
032                    _level = level;
033            }
034    
035            @Override
036            public void accept(ASTVisitor astVisitor) {
037                    astVisitor.visit(this);
038            }
039    
040            public int compareTo(HeadingNode headingNode) {
041                    if (_level < headingNode.getLevel()) {
042                            return -1;
043                    }
044                    else if (_level > headingNode.getLevel()) {
045                            return 1;
046                    }
047                    else {
048                            return 0;
049                    }
050            }
051    
052            public int getLevel() {
053                    return _level;
054            }
055    
056            public void setLevel(int level) {
057                    _level = level;
058            }
059    
060            private int _level;
061    
062    }