public class TLcdShapeList extends ALcdShapeList implements ILcdEditableShapeList
ILcdShapeList
.
This implementation uses an array of the right size to store the list of
shapes, which is memory efficient, but inefficient for adding and
removing shapes.
This class is thread-safe for concurrent read-only access of its contents. For read-write access, external locking must be used. Such locking is typically done at the model level.
Constructor and Description |
---|
TLcdShapeList()
Constructs a
TLcdShapeList that doesn't have any ILcdShape objects. |
TLcdShapeList(ILcdShape[] aShapeArray)
Constructs a
TLcdShapeList containing the given
ILcdShape objects. |
TLcdShapeList(ILcdShape[] aShapeArray,
ILcdBounds aBounds)
Constructs a
TLcdShapeList containing the given
ILcdShape objects. |
TLcdShapeList(TLcdShapeList aShapeList)
Constructs a
TLcdShapeList that is a clone of the given
TLcdShapeList . |
Modifier and Type | Method and Description |
---|---|
void |
addShape(ILcdShape aShape)
Appends the specified shape to the end of this
ILcdShapeList . |
void |
addShape(int aIndex,
ILcdShape aShape)
Inserts the specified shape at the specified position in this
ILcdShapeList . |
void |
addShapes(ILcdShape[] aShape)
Appends the specified array of shapes to the end of this
ILcdShapeList . |
void |
clearShapes()
Removes all of the shapes from this
ILcdShapeList . |
Object |
clone()
Creates and returns a copy of this object.
|
ILcdShape |
getShape(int aIndex)
Returns the
ILcdShape at the given index. |
int |
getShapeCount()
Returns the number of
ILcdShape objects in the list. |
boolean |
removeShape(ILcdShape aShape)
Removes the first occurrence of the specified shape in this
ILcdShapeList . |
ILcdShape |
removeShape(int aIndex)
Removes the shape at the specified position in this
ILcdShapeList . |
void |
removeShapes(ILcdShape[] aShapes)
Removes all shapes from this
ILcdShapeList that are contained in the specified
array of shapes. |
void |
setShape(ILcdShape[] aShapeArray)
Sets the
ILcdShape objects associated with this ILcdShapeList . |
ILcdShape |
setShape(int aIndex,
ILcdShape aShape)
Replaces the shape at the specified position in this
ILcdShapeList with the
specified shape. |
void |
setShapes(ILcdShape[] aShapes)
Replace the list of shapes contained in this
ILcdShapeList with the specified
array of shapes. |
void |
shapeChanged(ILcdShape aShape)
Notifies this
ILcdShapeList that the specified shape has changed. |
void |
shapeChanged(int aIndex)
Notifies this
ILcdShapeList that the shape at the specified position has changed. |
void |
shapesChanged()
Notifies this
ILcdShapeList that some (possibly all) of its shapes have changed. |
calculateFocusPoint, clearCache, contains2D, contains3D, equals, getBounds, getCachedObject, getFocusPoint, hashCode, insertIntoCache, invalidateBounds, invalidateObject, removeCachedObject, setFocusPoint, toString
contains2D, contains3D, fromDomainObject
finalize, getClass, notify, notifyAll, wait, wait, wait
contains2D, contains2D, contains3D, contains3D, getFocusPoint
getBounds
public TLcdShapeList()
TLcdShapeList
that doesn't have any ILcdShape
objects.public TLcdShapeList(ILcdShape[] aShapeArray)
TLcdShapeList
containing the given
ILcdShape
objects.aShapeArray
- an array of shape objects to put in this shape list.public TLcdShapeList(ILcdShape[] aShapeArray, ILcdBounds aBounds)
TLcdShapeList
containing the given
ILcdShape
objects.aShapeArray
- an array of shape objects to put in this shape list.aBounds
- the total bounds of this shape list, if already known at construction time, or null
if
unknown.public TLcdShapeList(TLcdShapeList aShapeList)
TLcdShapeList
that is a clone of the given
TLcdShapeList
.aShapeList
- the shape list to clone.public void setShape(ILcdShape[] aShapeArray)
ILcdShape
objects associated with this ILcdShapeList
.
This method does exactly the same as setShapes(ILcdShape[])
.aShapeArray
- the ILcdShape
objects associated with this ILcdShapeList
.getShape(int)
public final int getShapeCount()
ILcdShapeList
ILcdShape
objects in the list.getShapeCount
in interface ILcdShapeList
ILcdShape
objects in the list.public final ILcdShape getShape(int aIndex) throws IndexOutOfBoundsException
ILcdShapeList
ILcdShape
at the given index.getShape
in interface ILcdShapeList
aIndex
- a valid index in the list of ILcdShape
objects.ILcdShape
at the given index.IndexOutOfBoundsException
- when the index is not valid.public Object clone()
clone
in interface ILcdCloneable
clone
in class ALcdShapeList
Object.clone()
public void addShape(int aIndex, ILcdShape aShape)
ILcdEditableShapeList
ILcdShapeList
.addShape
in interface ILcdEditableShapeList
aIndex
- the index at which the shape is to be inserted.aShape
- the shape to be inserted.public void addShape(ILcdShape aShape)
ILcdEditableShapeList
ILcdShapeList
.addShape
in interface ILcdEditableShapeList
aShape
- the shape to be appended to this ILcdShapeList
.public void addShapes(ILcdShape[] aShape)
ILcdEditableShapeList
ILcdShapeList
.addShapes
in interface ILcdEditableShapeList
aShape
- the array of shapes to be appended to this ILcdShapeList
.public void clearShapes()
ILcdEditableShapeList
ILcdShapeList
.clearShapes
in interface ILcdEditableShapeList
public ILcdShape removeShape(int aIndex)
ILcdEditableShapeList
ILcdShapeList
. Shifts any
subsequent shapes to the left. Returns the shape that was removed from this
ILcdShapeList
.removeShape
in interface ILcdEditableShapeList
aIndex
- the index of the shape to removed.public boolean removeShape(ILcdShape aShape)
ILcdEditableShapeList
ILcdShapeList
. If this
ILcdShapeList
does not contain the shape, it is unchanged.removeShape
in interface ILcdEditableShapeList
aShape
- the shape to be removed, if present.true
if this ILcdShapeList
contained the specified element.public void removeShapes(ILcdShape[] aShapes)
ILcdEditableShapeList
ILcdShapeList
that are contained in the specified
array of shapes.removeShapes
in interface ILcdEditableShapeList
aShapes
- the array of shapes to be removed from this ILcdShapeList
.public ILcdShape setShape(int aIndex, ILcdShape aShape)
ILcdEditableShapeList
ILcdShapeList
with the
specified shape.setShape
in interface ILcdEditableShapeList
aIndex
- index of shape to replace.aShape
- the shape to be stored at the specified position.public void setShapes(ILcdShape[] aShapes)
ILcdEditableShapeList
ILcdShapeList
with the specified
array of shapes.setShapes
in interface ILcdEditableShapeList
aShapes
- the array of shapes to be stored in this ILcdShapeList
.public void shapeChanged(int aIndex)
ILcdEditableShapeList
ILcdShapeList
that the shape at the specified position has changed.shapeChanged
in interface ILcdEditableShapeList
aIndex
- the index of the shape that has changed.public void shapeChanged(ILcdShape aShape)
ILcdEditableShapeList
ILcdShapeList
that the specified shape has changed.shapeChanged
in interface ILcdEditableShapeList
aShape
- the shape that has changed.public void shapesChanged()
ILcdEditableShapeList
ILcdShapeList
that some (possibly all) of its shapes have changed.shapesChanged
in interface ILcdEditableShapeList