static void removeFromLayers(Shape shape) { if (!layerOf.containsKey(shape)) return; int oldLayer = layerOf.get(shape); layerContents.get(oldLayer).remove(shape); if (layerContents.get(oldLayer).isEmpty()) { layerContents.remove(oldLayer); layers.remove((Integer) oldLayer); } layerOf.remove(shape); }
/** * Get the layer that the given shape is in. See {@link #setLayer} for more information about * layers. * * @param shape the shape whose layer index will be returned. * @return the index of the layer that <code>shape</code> is contained in. * @see #setLayer */ static int getLayerOf(Shape shape) { return layerOf.get(shape); }