001    /**
002     * Copyright (c) 2000-2013 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(CollectionNode collectionNode, int level) {
026                    super(collectionNode);
027    
028                    _level = level;
029            }
030    
031            public HeadingNode(int level) {
032                    _level = level;
033            }
034    
035            @Override
036            public void accept(ASTVisitor astVisitor) {
037                    astVisitor.visit(this);
038            }
039    
040            @Override
041            public int compareTo(HeadingNode headingNode) {
042                    if (_level < headingNode.getLevel()) {
043                            return -1;
044                    }
045                    else if (_level > headingNode.getLevel()) {
046                            return 1;
047                    }
048                    else {
049                            return 0;
050                    }
051            }
052    
053            public int getLevel() {
054                    return _level;
055            }
056    
057            public void setLevel(int level) {
058                    _level = level;
059            }
060    
061            private int _level;
062    
063    }