/** * Copyright 2011 Oliver Buchtala * * This file is part of ndogen. * * ndogen is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * ndogen is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with ndogen. If not, see <http://www.gnu.org/licenses/>. */ package org.ndogen.substance; import java.util.Iterator; import java.util.LinkedList; import java.util.List; import com.google.gson.annotations.Expose; public abstract class NestedNode extends SubstanceNode implements Iterable<SubstanceNode> { @Expose List<String> children; List<SubstanceNode> childNodes; public NestedNode() { childNodes = new LinkedList<SubstanceNode>(); } public List<String> getChildren() { return children; } public void setChildren(List<String> children) { this.children = children; } public void addChild(SubstanceNode child) { this.childNodes.add(child); } @Override public Iterator<SubstanceNode> iterator() { return this.childNodes.iterator(); } }