public class TLcdFeaturedMultiShapeList extends TLcdFeatureArray implementsILcdFeatured, ILcdEditableShapeList, ILcdDataObject, ILcdInvalidateable
ILcdDataObject
,
and ILcdShapeList
that contains one or more shapes. It also implements
ILcdFeatured
. Features are directly mapped one-on-one on
data properties.
An optional index can specify the feature that determines the identity of
the object (through equals
and hashCode
). This index
is typically derived from the data type using the TLcdPrimaryKeyAnnotation
.
Because of this, this class is mostly useful when used to represent objects that are
lazily retrieved from a database.
Constructor and Description |
---|
TLcdFeaturedMultiShapeList(ILcdShape[] aShapes,
Object[] aFeatures)
Deprecated.
|
TLcdFeaturedMultiShapeList(ILcdShape[] aShapes,
Object[] aFeatures,
int aPrimaryFeatureIndex)
Deprecated.
|
TLcdFeaturedMultiShapeList(ILcdShape[] aShapes,
Object[] aFeatures,
TLcdDataType aDataType)
Constructs a
TLcdFeaturedSingleShapeList . |
TLcdFeaturedMultiShapeList(TLcdFeaturedMultiShapeList aFeaturedMultiShapeList)
Constructs a
TLcdFeaturedSingleShapeList that is a copy of
the given instance. |
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[] aShapes)
Appends the specified array of shapes to the end of this
ILcdShapeList . |
void |
clearShapes()
Removes all of the shapes from this
ILcdShapeList . |
Object |
clone()
Makes
Object.clone() public. |
boolean |
contains2D(double aX,
double aY)
Checks whether this
ILcdShape contains the given point in
the 2D space. |
boolean |
contains2D(ILcdPoint aPoint)
Checks whether this
ILcdShape contains the given ILcdPoint in the 2D space. |
boolean |
contains3D(double aX,
double aY,
double aZ)
Checks whether this
ILcdShape contains the given point in
the 3D space. |
boolean |
contains3D(ILcdPoint aPoint)
Checks whether this
ILcdShape contains the given ILcdPoint in the 3D space. |
boolean |
equals(Object aObject) |
ILcdBounds |
getBounds()
Returns the
ILcdBounds by which the geometry of this ILcdBounded object
is bounded. |
TLcdDataType |
getDataType()
Returns the type of this data object.
|
ILcdPoint |
getFocusPoint()
Returns the focus point of this
ILcdShape . |
Object |
getPrimaryFeature()
Returns the primary feature, or
null if there is no such
feature. |
int |
getPrimaryFeatureIndex()
Returns the index of the primary feature, which identifies the object.
|
ILcdShape |
getShape(int aIndex)
Returns the
ILcdShape at the given index. |
int |
getShapeCount()
Returns the number of
ILcdShape objects in the list. |
Object |
getValue(String aPropertyName)
Convenience method that returns the value of the property with the given name.
|
Object |
getValue(TLcdDataProperty aProperty)
Returns the value of the given property.
|
int |
hashCode() |
boolean |
hasValue(String aPropertyName)
Indicates whether this data object has a value for the given property.
|
boolean |
hasValue(TLcdDataProperty aProperty)
Indicates whether this data object has a value for the given property.
|
void |
invalidateBounds()
Notifies this object that its bounds have changed because one of its shapes
has changed.
|
void |
invalidateObject()
Invalidates all cached values of this object.
|
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. |
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 |
setValue(String aPropertyName,
Object aValue)
Convenience method that sets the value of the property with the given name.
|
void |
setValue(TLcdDataProperty aProperty,
Object aValue)
Sets the value of the given property for this data object.
|
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. |
canSetFeature, getFeature, getFeatureCount, setFeature, setFeatures
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
canSetFeature, getFeature, getFeatureCount, setFeature
@Deprecated public TLcdFeaturedMultiShapeList(ILcdShape[] aShapes, Object[] aFeatures)
TLcdFeaturedMultiShapeList(ILcdShape[], Object[], TLcdDataType)
TLcdFeaturedSingleShapeList
, without a primary
feature.@Deprecated public TLcdFeaturedMultiShapeList(ILcdShape[] aShapes, Object[] aFeatures, int aPrimaryFeatureIndex)
TLcdFeaturedMultiShapeList(ILcdShape[], Object[], TLcdDataType)
TLcdFeaturedSingleShapeList
, with the specified
primary feature.public TLcdFeaturedMultiShapeList(ILcdShape[] aShapes, Object[] aFeatures, TLcdDataType aDataType)
TLcdFeaturedSingleShapeList
. The primary feature index of
this object is defined by the TLcdPrimaryKeyAnnotation
on the given
data type.public TLcdFeaturedMultiShapeList(TLcdFeaturedMultiShapeList aFeaturedMultiShapeList)
TLcdFeaturedSingleShapeList
that is a copy of
the given instance.public int getPrimaryFeatureIndex()
public Object getPrimaryFeature()
null
if there is no such
feature.public void invalidateObject()
ILcdInvalidateable
invalidateObject
in interface ILcdInvalidateable
public void invalidateBounds()
public int getShapeCount()
ILcdShapeList
ILcdShape
objects in the list.getShapeCount
in interface ILcdShapeList
ILcdShape
objects in the list.public 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 boolean contains2D(ILcdPoint aPoint)
ILcdShape
ILcdShape
contains the given ILcdPoint
in the 2D space.
Only the first two dimensions of the ILcdShape
and the ILcdPoint
are considered.contains2D
in interface ILcdShape
aPoint
- the ILcdPoint
to test.ILcdShape.contains2D(double, double)
public boolean contains2D(double aX, double aY)
ILcdShape
ILcdShape
contains the given point in
the 2D space. Only the first two dimensions of the ILcdShape
are considered.contains2D
in interface ILcdShape
aX
- the x coordinate of the point.aY
- the y coordinate of the point.public boolean contains3D(ILcdPoint aPoint)
ILcdShape
ILcdShape
contains the given ILcdPoint
in the 3D space.contains3D
in interface ILcdShape
aPoint
- the ILcdPoint
to test.ILcdShape.contains3D(double, double, double)
public boolean contains3D(double aX, double aY, double aZ)
ILcdShape
ILcdShape
contains the given point in
the 3D space.contains3D
in interface ILcdShape
aX
- the x coordinate of the point.aY
- the y coordinate of the point.aZ
- the z coordinate of the point.public ILcdPoint getFocusPoint()
ILcdShape
ILcdShape
.getFocusPoint
in interface ILcdShape
ILcdShape
.public ILcdBounds getBounds()
ILcdBounded
ILcdBounds
by which the geometry of this ILcdBounded
object
is bounded.
If the geometry does not allow retrieving valid bounds (for example a polyline with 0 points)
the return value is unspecified.
It is highly recommended to return an undefined
bounds.
You can create undefined bounds using the default constructors
of TLcdLonLatBounds
or TLcdXYBounds
.
getBounds
in interface ILcdBounded
ILcdBounds
by which the geometry of this ILcdBounded
object
is bounded.public Object clone()
ILcdCloneable
Makes Object.clone()
public.
java.lang.Object
, it can be implemented like this:
public Object clone() {
try {
return super.clone();
} catch ( CloneNotSupportedException e ) {
// Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
throw new RuntimeException( e );
}
}
clone
in interface ILcdCloneable
clone
in class Object
Object.clone()
public TLcdDataType getDataType()
ILcdDataObject
null
.getDataType
in interface ILcdDataObject
public Object getValue(TLcdDataProperty aProperty)
ILcdDataObject
Returns the value of the given property.
If the property is a collection, the returned value will never be null. If the property has not been set, an empty collection of the appropriate type will be returned (Set, List or Map).
The property must not be null, and must be declared in the data object's type
or in one of its super types.
Otherwise an IllegalArgumentException
is thrown.
getValue
in interface ILcdDataObject
aProperty
- the property for which the value is to be returnedpublic Object getValue(String aPropertyName)
ILcdDataObject
Convenience method that returns the value of the property with the given name.
If more than one property exists with the given name, the most specific property should be used (this is the property defined by the most specialized type in this object's data type hierarchy). SeeILcdDataObject.getValue(TLcdDataProperty)
for more information.getValue
in interface ILcdDataObject
aPropertyName
- the name of the property of which the value is to be returnedTLcdDataType.getProperty(String)
public void setValue(TLcdDataProperty aProperty, Object aValue)
ILcdDataObject
Sets the value of the given property for this data object. The implementation is allowed to throw an exception if the given value can't be set.
The given property must be declared in thedata object's type
or in one of its super types. In
other words, getDataType().getProperties().contains( aProperty ) should always be true.
Otherwise, the implementation should throw an IllegalArgumentException
.setValue
in interface ILcdDataObject
aProperty
- the property for which the value is to be setaValue
- the value to setTLcdDataType.getProperty(String)
public void setValue(String aPropertyName, Object aValue)
ILcdDataObject
Convenience method that sets the value of the property with the given name.
If more than one property exists with the given name, the most specific property should be used (this is the property defined by the most specialized type in this object's data type hierarchy). SeeILcdDataObject.setValue(TLcdDataProperty, Object)
for more information.setValue
in interface ILcdDataObject
aPropertyName
- the name of the property of which the value is to be setaValue
- the value to setpublic boolean hasValue(TLcdDataProperty aProperty)
ILcdDataObject
aProperty
is from the right data type
, and this instance has a value for it: returns true
aProperty
is from the right data type
, and this instance has no value for it: returns false
aProperty
is not from the right data type
: not allowed, you will get IllegalArgumentExceptionaProperty
is null
: not allowed, you will get NullPointerExceptionhasValue
in interface ILcdDataObject
aProperty
- the property for which to return whether a value is present or not.true
if this data object has a value for the given property, false
otherwise.public boolean hasValue(String aPropertyName)
ILcdDataObject
ILcdDataObject.hasValue(TLcdDataProperty)
for more information.hasValue
in interface ILcdDataObject
aPropertyName
- the name of the property for which to return whether a value is present
or not.true
if this data object has a value for the property with the given name,
false
otherwise.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[] aShapes)
ILcdEditableShapeList
ILcdShapeList
.addShapes
in interface ILcdEditableShapeList
aShapes
- 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