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 java.util.List;
018    
019    /**
020     * @author Miguel Pastor
021     */
022    public abstract class BaseParentableNode extends ASTNode {
023    
024            public BaseParentableNode() {
025            }
026    
027            public BaseParentableNode(CollectionNode collectionNode) {
028                    if (collectionNode != null) {
029                            _collectionNode = collectionNode;
030                    }
031            }
032    
033            public BaseParentableNode(int tokenType) {
034                    super(tokenType);
035            }
036    
037            public void addChildASTNode(ASTNode astNode) {
038                    _collectionNode.add(astNode);
039            }
040    
041            public ASTNode getChildASTNode(int position) {
042                    return _collectionNode.get(position);
043            }
044    
045            public List<ASTNode> getChildASTNodes() {
046                    return _collectionNode.getASTNodes();
047            }
048    
049            public int getChildASTNodesCount() {
050                    return _collectionNode.size();
051            }
052    
053            private CollectionNode _collectionNode = new CollectionNode();
054    
055    }