// XAAL toolkit // Copyright (C) 2009 Ville Karavirta // // This program 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. // // This program 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 this program. If not, see . package xaal.objects.animation; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedList; import xaal.objects.AddStructure; import xaal.objects.Xaal; import xaal.objects.graphical.GraphicalPrimitive; import xaal.objects.structures.DataStructure; import xaal.objects.structures.Structure; /** * @author vkaravir * * To change the template for this generated type comment go to * Window>Preferences>Java>Code Generation>Code and Comments */ public class CreateOperation extends StructureOperation implements AddStructure, FDTOperation { private Structure target; private LinkedList structures; /** * */ public CreateOperation(Xaal xaalDoc) { super(xaalDoc); structures = new LinkedList(); } /* * (non-Javadoc) * * @see xaal.parser.AddStructure#addStructure(xaal.parser.structures.DataStructure) */ public void addStructure(Structure s) { // System.out.println("insert:" + s); structures.add(s); } /** * @return Returns the target. */ public Structure getTarget() { return target; } /** * @param target * The target to set. */ public void setTarget(Structure target) { this.target = target; } /** * @return */ public Iterator getStructures() { return structures.iterator(); } /* * (non-Javadoc) * * @see xaal.parser.AddDataStructure#addStructure(xaal.parser.structures.DataStructure) */ public void addStructure(DataStructure ds) { addStructure((Structure) ds); } public void apply(HashMap state) { Iterator i = getGraphicals(); int count = 0; while (i.hasNext()) { GraphicalPrimitive gp = (GraphicalPrimitive) i.next(); state.put(gp.getId(), gp); count++; } i = getStructures(); while (i.hasNext()) { Structure str = (Structure) i.next(); state.put(str.getId(), str); count++; } } }