package layer; import java.util.*; /** * The abstract class LayersGroup holds a collection of layers and represents * any grouping of numerous layers. */ abstract class LayersGroup { /** * A group of logically-connected layers. */ static List layers; } /** * The class AllLayers acts as a container holding all of the layers in- * use in the class. */ class AllLayers extends LayersGroup { } /** * The class VisibleLayers acts as a container holding all of the layers * in a class that are visible to the whole class. */ class VisibleLayers extends LayersGroup { /** * The makeVisible method makes a student's public layer visible to the * whole class by setting its isVisible boolean to true and placing it * in the VisibleLayers class's collection of Layers. * @param layer The Layer to show to the class. */ /*@ // // No requirements // ensures // // The layer should be added to the visible layers collection // layers.contains(layer); @*/ static void makeVisible(PublicLayer layer){} /** * Hides a layer from the class. * @param layer The Layer to hide. */ /*@ requires // // Layer needs to be contained in the collection // layers.contains(layer); ensures // // The layer should be removed from the collection and all the other // layers should remain // !layers.contains(layer) && (\forall Layer oldLayer ; \old(layers.contains(oldLayer)) ; oldLayer != layer <==> layers.contains(oldLayer)); @*/ static void hide(Layer layer) {} /** * Moves a layer to a different position relative to other Layers, which * changes how they appear on the screen. * @param layer The Layer to move. * @param position The desired location to move the Layer to (lower numbers * appear above higher numbers) */ /*@ requires // // Position needs to be a valid index in the collection, // and layer needs to be contained in the collection // (position >= 0 && position < layers.size()) && layers.contains(layer); ensures // // The layer should be in the desired position // (\forall int i ; i >= 0 && i < layers.size() ; ((i == position) <==> (layers.get(i) == layer))); @*/ static void move(Layer layer, int position) {} }