/** * @return all blocks in all drawers. If no blocks found, return an empty set. Ifno drawers exists * in either factories, return an empty set. */ public Collection<RenderableBlock> getBlocks() { ArrayList<RenderableBlock> blocks = new ArrayList<RenderableBlock>(); for (FactoryCanvas canvas : this.staticCanvases) { blocks.addAll(canvas.getBlocks()); } for (FactoryCanvas canvas : this.dynamicCanvases) { blocks.addAll(canvas.getBlocks()); } return blocks; }
/** * Returns a collection of the subsets within this * * @return a collection of the subsets within this */ public Collection<Subset> getSubsets() { Collection<Subset> subsets = new ArrayList<Subset>(); for (FactoryCanvas subset : subsetCanvases) { Iterable<RenderableBlock> blocks = subset.getBlocks(); subsets.add(new Subset(subset.getName(), subset.getColor(), blocks)); } return subsets; }
public Collection<RenderableBlock> getDynamicBlocks(String name) { ArrayList<RenderableBlock> blocks = new ArrayList<RenderableBlock>(); for (FactoryCanvas canvas : this.dynamicCanvases) { if (canvas.getName().equals(name)) { blocks.addAll(canvas.getBlocks()); return blocks; } } this.printError("Drawer not found: " + name); return blocks; }