Package model
Class DrawingModel
- java.lang.Object
-
- model.DrawingModel
-
- All Implemented Interfaces:
java.io.Serializable
public class DrawingModel extends java.lang.Object implements java.io.SerializableRepresent model in MVC architectural pattern. Contains application data.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static longserialVersionUIDprivate java.util.ArrayList<Shape>shapes
-
Constructor Summary
Constructors Constructor Description DrawingModel()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Shape shape)Add new shape.voidaddMultiple(java.util.ArrayList<Shape> shapes)Add multiple shapes to list of shapes.voidaddToIndex(int index, Shape shape)Add new shape to specified index.java.util.ArrayList<Shape>getAll()ShapegetByIndex(int index)intgetIndexOf(Shape shape)voidremove(Shape shape)Remove shape from list of shapes.voidremoveAll()Remove all shapes from list of shapes.voidremoveAtIndex(int index)Remove shape at specified index.voidremoveMultiple(java.util.ArrayList<Shape> shapes)Remove multiple shapes from list of shapes.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
shapes
private java.util.ArrayList<Shape> shapes
-
-
Method Detail
-
add
public void add(Shape shape)
Add new shape.- Parameters:
shape- Represent shape which will be added.
-
addToIndex
public void addToIndex(int index, Shape shape)Add new shape to specified index.- Parameters:
index- Represent index on which shape will be added.shape- Represent shape which will be added.
-
addMultiple
public void addMultiple(java.util.ArrayList<Shape> shapes)
Add multiple shapes to list of shapes.- Parameters:
list- Elements that are be added.
-
remove
public void remove(Shape shape)
Remove shape from list of shapes.- Parameters:
shape- Shape to be removed.
-
removeAtIndex
public void removeAtIndex(int index)
Remove shape at specified index.- Parameters:
index- Represent index of shape that will be removed.
-
removeMultiple
public void removeMultiple(java.util.ArrayList<Shape> shapes)
Remove multiple shapes from list of shapes.- Parameters:
shapes- Shapes to be removed.
-
removeAll
public void removeAll()
Remove all shapes from list of shapes.
-
getByIndex
public Shape getByIndex(int index)
-
getIndexOf
public int getIndexOf(Shape shape)
-
getAll
public java.util.ArrayList<Shape> getAll()
-
-