Class AbstractGISElement<C extends GISContainer<?>,T extends AbstractGISElement<C,T>>
- java.lang.Object
-
- org.arakhne.afc.gis.primitive.AbstractGISElement<C,T>
-
- Type Parameters:
C
- is the type of the container of this element.T
- is the type of this element, used by the cloning feature.
- All Implemented Interfaces:
Serializable
,Cloneable
,EventListener
,AttributeChangeListener
,AttributeCollection
,AttributeProvider
,GISCloneable<T>
,GISElement
,GISPrimitive
,JsonableObject
- Direct Known Subclasses:
AbstractBoundedGISElement
public abstract class AbstractGISElement<C extends GISContainer<?>,T extends AbstractGISElement<C,T>> extends Object implements GISElement, AttributeChangeListener, GISCloneable<T>
Element of a GIS application.- Since:
- 14.0
- Version:
- 17.0 2020-01-04 14:41:53
- Author:
- Stéphane GALLAND
- See Also:
- Serialized Form
- Maven Group Id:
- org.arakhne.afc.gis
- Maven Artifact Id:
- giscore
-
-
Field Summary
Fields Modifier and Type Field Description (package private) AttributeCollection
attributeSource
Source of attributes.(package private) WeakReference<C>
mapContainer
the layer that contains this element.-
Fields inherited from interface org.arakhne.afc.gis.primitive.GISElement
ATTR_NAME, NAME_COMPARATOR
-
Fields inherited from interface org.arakhne.afc.gis.primitive.GISPrimitive
COMPARATOR
-
-
Constructor Summary
Constructors Constructor Description AbstractGISElement(UUID id, AttributeCollection attributeSource)
Create a GISElement with the specified attribute provider.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttributeChangeListener(AttributeChangeListener listener)
Add a listener on the attribute value changes.void
addAttributes(Map<String,Object> content)
Put the values given as parameter in this attribute provider.void
addAttributes(AttributeProvider content)
Put the values given as parameter in this attribute provider.Iterable<Attribute>
attributes()
Replies all the attributes.T
clone()
Clone this object to obtain a valid copy.int
copyAttributes(GISElement container)
Copy all the attributes of the specified container.void
flush()
Force this provider to synchronized the memory state of the attributes with a remote storage area.void
freeMemory()
Clean the internal memory-storage structures if they exist.Collection<String>
getAllAttributeNames()
Replies all the attribute names.Collection<Attribute>
getAllAttributes()
Replies all the attributes.Map<AttributeType,Collection<Attribute>>
getAllAttributesByType()
Replies all the attributes sorted by type.AttributeValue
getAttribute(String name)
Replies the value for the given attribute.boolean
getAttribute(String name, boolean defaultValue)
Replies the value for the given attribute.double
getAttribute(String name, double defaultValue)
Replies the value for the given attribute.float
getAttribute(String name, float defaultValue)
Replies the value for the given attribute.int
getAttribute(String name, int defaultValue)
Replies the value for the given attribute.long
getAttribute(String name, long defaultValue)
Replies the value for the given attribute.<ET extends Enum<ET>>
ETgetAttribute(String name, ET defaultValue)
Replies the value for the given attribute.Class<?>
getAttribute(String name, Class<?> defaultValue)
Replies the value for the given attribute.String
getAttribute(String name, String defaultValue)
Replies the value for the given attribute.InetAddress
getAttribute(String name, InetAddress defaultValue)
Replies the value for the given attribute.InetAddress
getAttribute(String name, InetSocketAddress defaultValue)
Replies the value for the given attribute.URI
getAttribute(String name, URI defaultValue)
Replies the value for the given attribute.URL
getAttribute(String name, URL defaultValue)
Replies the value for the given attribute.Date
getAttribute(String name, Date defaultValue)
Replies the value for the given attribute.UUID
getAttribute(String name, UUID defaultValue)
Replies the value for the given attribute.AttributeValue
getAttribute(String name, AttributeValue default_value)
Replies the value for the given attribute.boolean
getAttributeAsBool(String name)
Replies the value for the given attribute.Date
getAttributeAsDate(String name)
Replies the value for the given attribute.double
getAttributeAsDouble(String name)
Replies the value for the given attribute.Enum<?>
getAttributeAsEnumeration(String name)
Replies the value for the given attribute.<ET extends Enum<ET>>
ETgetAttributeAsEnumeration(String name, Class<ET> type)
Replies the value for the given attribute.float
getAttributeAsFloat(String name)
Replies the value for the given attribute.InetAddress
getAttributeAsInetAddress(String name)
Replies the value for the given attribute.int
getAttributeAsInt(String name)
Replies the value for the given attribute.Class<?>
getAttributeAsJavaClass(String name)
Replies the value for the given attribute.long
getAttributeAsLong(String name)
Replies the value for the given attribute.String
getAttributeAsString(String name)
Replies the value for the given attribute.URI
getAttributeAsURI(String name)
Replies the value for the given attribute.URL
getAttributeAsURL(String name)
Replies the value for the given attribute.UUID
getAttributeAsUUID(String name)
Replies the value for the given attribute.AttributeCollection
getAttributeCollection()
Replies the attribute provider associated to this element.int
getAttributeCount()
Replies the count of attributes.Attribute
getAttributeObject(String name)
Replies the attribute with the given name.AttributeProvider
getAttributeProvider()
Replies the attribute container associated to this element.C
getContainer()
Replies the object which contains this MapElement.GeoId
getGeoId()
Replies an unique identifier for primitive.String
getName()
Replies the name of the element.Object
getTopContainer()
Replies the top-most object which contains this MapElement.UUID
getUUID()
Replies an unique identifier for element.boolean
hasAttribute(String name)
Replies if the given attribute exists.String
hashKey()
Replies a string suitable for hashtables.boolean
isEventFirable()
Replies if the events are fired by this container.void
onAttributeChangeEvent(AttributeChangeEvent event)
Invoked when the attribute's value changed.boolean
removeAllAttributes()
Remove all the attributes.boolean
removeAttribute(String name)
Remove the given attribute.void
removeAttributeChangeListener(AttributeChangeListener listener)
Remove a listener on the attribute value changes.boolean
renameAttribute(String oldname, String newname)
Rename the attribute.boolean
renameAttribute(String oldname, String newname, boolean overwrite)
Rename the attribute .Attribute
setAttribute(String name, boolean value)
Set the value for the given attribute.Attribute
setAttribute(String name, double value)
Set the value for the given attribute.Attribute
setAttribute(String name, float value)
Set the value for the given attribute.Attribute
setAttribute(String name, int value)
Set the value for the given attribute.Attribute
setAttribute(String name, long value)
Set the value for the given attribute.Attribute
setAttribute(String name, Class<?> value)
Set the value for the given attribute.Attribute
setAttribute(String name, Enum<?> value)
Set the value for the given attribute.Attribute
setAttribute(String name, String value)
Set the value for the given attribute.Attribute
setAttribute(String name, InetAddress value)
Set the value for the given attribute.Attribute
setAttribute(String name, InetSocketAddress value)
Set the value for the given attribute.Attribute
setAttribute(String name, URI value)
Set the value for the given attribute.Attribute
setAttribute(String name, URL value)
Set the value for the given attribute.Attribute
setAttribute(String name, Date value)
Set the value for the given attribute.Attribute
setAttribute(String name, UUID value)
Set the value for the given attribute.Attribute
setAttribute(String name, AttributeValue value)
Set the value for the given attribute.Attribute
setAttribute(Attribute value)
Set the value for the given attribute.void
setAttributes(Map<String,Object> content)
Set the content of this collection from the given map.void
setAttributes(AttributeProvider content)
Set the content of this collection from the given map.Attribute
setAttributeType(String name, AttributeType type)
Set the type of the attribute with the given name.boolean
setContainer(C container)
Sets the container of this MapElement.void
setEventFirable(boolean isFirable)
Set if the events are fired by this container.void
setName(String name)
Set the name of the element.protected void
setUUID(UUID id)
Set the unique identifier for element.void
toJson(JsonBuffer buffer)
Replies the Json representation of this node.Map<String,Object>
toMap()
Replies the map of the values stored in this attribute provider.void
toMap(Map<String,Object> mapToFill)
Fill the given map with the values stored in this attribute provider.String
toString()
-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.arakhne.afc.gis.primitive.GISPrimitive
getGeoLocation
-
-
-
-
Field Detail
-
attributeSource
AttributeCollection attributeSource
Source of attributes.
-
mapContainer
transient WeakReference<C extends GISContainer<?>> mapContainer
the layer that contains this element.
-
-
Constructor Detail
-
AbstractGISElement
public AbstractGISElement(UUID id, AttributeCollection attributeSource)
Create a GISElement with the specified attribute provider.- Parameters:
id
- is the unique identifier of this element, ornull
if unknown.attributeSource
- is the attribute provider to use. Ifnull
was specified the new GISElement will use a default attribute provider (most of the time anHeapAttributeCollection
- Since:
- 4.0
-
-
Method Detail
-
isEventFirable
@Pure public boolean isEventFirable()
Description copied from interface:AttributeCollection
Replies if the events are fired by this container.- Specified by:
isEventFirable
in interfaceAttributeCollection
- Returns:
true
if the events are fired; otherwisefalse
if events are not fired.
-
setEventFirable
public void setEventFirable(boolean isFirable)
Description copied from interface:AttributeCollection
Set if the events are fired by this container.- Specified by:
setEventFirable
in interfaceAttributeCollection
- Parameters:
isFirable
- istrue
if the events are fired; otherwisefalse
if events are not fired.
-
clone
@Pure public T clone()
Clone this object to obtain a valid copy.- Specified by:
clone
in interfaceAttributeCollection
- Specified by:
clone
in interfaceAttributeProvider
- Specified by:
clone
in interfaceGISCloneable<C extends GISContainer<?>>
- Specified by:
clone
in interfaceGISElement
- Overrides:
clone
in classObject
- Returns:
- a copy
-
onAttributeChangeEvent
public void onAttributeChangeEvent(AttributeChangeEvent event)
Description copied from interface:AttributeChangeListener
Invoked when the attribute's value changed.- Specified by:
onAttributeChangeEvent
in interfaceAttributeChangeListener
- Parameters:
event
- describes the changes.
-
setContainer
public boolean setContainer(C container)
Sets the container of this MapElement.- Parameters:
container
- the new container.- Returns:
- the success state of the operation.
-
getContainer
@Pure public C getContainer()
Replies the object which contains this MapElement.- Returns:
- the container or
null
-
getTopContainer
@Pure public Object getTopContainer()
Replies the top-most object which contains this MapElement.- Returns:
- the top container or
null
-
getAttributeCollection
@Pure public AttributeCollection getAttributeCollection()
Replies the attribute provider associated to this element.- Returns:
- the attribute provider
-
getAttributeProvider
@Pure public AttributeProvider getAttributeProvider()
Replies the attribute container associated to this element.- Returns:
- the attribute container
-
getGeoId
@Pure public final GeoId getGeoId()
Description copied from interface:GISPrimitive
Replies an unique identifier for primitive.A Geo-Id is unique according to the geo-location of the element. If two elements have the same points in the same order, or if two elements have the same points in a reverse order, they must have the same Geo-Id.
- Specified by:
getGeoId
in interfaceGISPrimitive
- Returns:
- an identifier
- See Also:
GISPrimitive.getGeoLocation()
-
getUUID
@Pure public UUID getUUID()
Replies an unique identifier for element.A Unique IDentifier (UID) must be unique for all the object instances.
The following code is always true (where the arguments of the constructors are the list of points of the polyline). It illustrates that for two elements with the same geo-localized points, they have the same geo-location identifier (Geo-Id) and they have different unique ientifier (Uid):
GISElement obj1 = new MapPolyline(100,10,200,30,300,4); GISElement obj2 = new MapPolyline(100,10,200,30,300,4); assert( obj1.getGeoId().equals(obj2.getGeoId()) ); assert( obj2.getGeoId().equals(obj1.getGeoId()) ); assert( ! obj1.getUid().equals(obj2.getUid()) ); assert( ! obj2.getUid().equals(obj1.getUid()) );
- Specified by:
getUUID
in interfaceGISPrimitive
- Returns:
- an identifier
- Since:
- 4.0
-
setUUID
protected void setUUID(UUID id)
Set the unique identifier for element.A Unique IDentifier (UID) must be unique for all the object instances.
- Parameters:
id
- is the new identifier- Since:
- 4.0
-
addAttributeChangeListener
public void addAttributeChangeListener(AttributeChangeListener listener)
Description copied from interface:AttributeCollection
Add a listener on the attribute value changes.- Specified by:
addAttributeChangeListener
in interfaceAttributeCollection
- Parameters:
listener
- the listener.
-
removeAttributeChangeListener
public void removeAttributeChangeListener(AttributeChangeListener listener)
Description copied from interface:AttributeCollection
Remove a listener on the attribute value changes.- Specified by:
removeAttributeChangeListener
in interfaceAttributeCollection
- Parameters:
listener
- the listener.
-
copyAttributes
public int copyAttributes(GISElement container)
Description copied from interface:GISElement
Copy all the attributes of the specified container.- Specified by:
copyAttributes
in interfaceGISElement
- Parameters:
container
- is the object from which the attributes must be extracted.- Returns:
- count of copied attributes
-
getName
@Pure public String getName()
Description copied from interface:GISElement
Replies the name of the element.- Specified by:
getName
in interfaceGISElement
- Returns:
- the name
-
setName
public void setName(String name)
Description copied from interface:GISElement
Set the name of the element.- Specified by:
setName
in interfaceGISElement
- Parameters:
name
- the new name.
-
getAttributeCount
@Pure public int getAttributeCount()
Description copied from interface:AttributeProvider
Replies the count of attributes.- Specified by:
getAttributeCount
in interfaceAttributeProvider
- Returns:
- the count of attributes.
-
hasAttribute
@Pure public boolean hasAttribute(String name)
Description copied from interface:AttributeProvider
Replies if the given attribute exists.- Specified by:
hasAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
true
is an attribute with the given name exists, otherwisefalse
-
getAllAttributes
@Pure public Collection<Attribute> getAllAttributes()
Description copied from interface:AttributeProvider
Replies all the attributes.- Specified by:
getAllAttributes
in interfaceAttributeProvider
- Returns:
- the list of all attributes
-
attributes
@Pure public Iterable<Attribute> attributes()
Description copied from interface:AttributeProvider
Replies all the attributes.- Specified by:
attributes
in interfaceAttributeProvider
- Returns:
- an iterable object that contains the attributes.
-
getAllAttributesByType
@Pure public Map<AttributeType,Collection<Attribute>> getAllAttributesByType()
Description copied from interface:AttributeProvider
Replies all the attributes sorted by type.The keys of the returned hashtable are the types and the values are array of attributes (
Vector
).- Specified by:
getAllAttributesByType
in interfaceAttributeProvider
- Returns:
- the attributes grouped by type.
-
getAllAttributeNames
@Pure public Collection<String> getAllAttributeNames()
Description copied from interface:AttributeProvider
Replies all the attribute names. This function never load the attribute values even if they are not inside the storage layer.- Specified by:
getAllAttributeNames
in interfaceAttributeProvider
- Returns:
- the list of all attribute names.
-
getAttribute
@Pure public AttributeValue getAttribute(String name)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value or
null
-
getAttribute
@Pure public boolean getAttribute(String name, boolean defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public int getAttribute(String name, int defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public long getAttribute(String name, long defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public float getAttribute(String name, float defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public double getAttribute(String name, double defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public String getAttribute(String name, String defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public UUID getAttribute(String name, UUID defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public URL getAttribute(String name, URL defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public URI getAttribute(String name, URI defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public Date getAttribute(String name, Date defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public InetAddress getAttribute(String name, InetAddress defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public InetAddress getAttribute(String name, InetSocketAddress defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public <ET extends Enum<ET>> ET getAttribute(String name, ET defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Type Parameters:
ET
- is the type of the enumeration.- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public Class<?> getAttribute(String name, Class<?> defaultValue)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.defaultValue
- is the default value replied if the attribute has no value.- Returns:
- the value
-
getAttribute
@Pure public AttributeValue getAttribute(String name, AttributeValue default_value)
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttribute
in interfaceAttributeProvider
- Parameters:
name
- the name.default_value
- is the default value replied if the attribute has no value.- Returns:
- the value or
null
-
getAttributeObject
@Pure public Attribute getAttributeObject(String name)
Description copied from interface:AttributeProvider
Replies the attribute with the given name.- Specified by:
getAttributeObject
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the attribute or
null
-
getAttributeAsBool
@Pure public boolean getAttributeAsBool(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsBool
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsInt
@Pure public int getAttributeAsInt(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsInt
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsLong
@Pure public long getAttributeAsLong(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsLong
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsFloat
@Pure public float getAttributeAsFloat(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsFloat
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsDouble
@Pure public double getAttributeAsDouble(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsDouble
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsString
@Pure public String getAttributeAsString(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsString
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsUUID
@Pure public UUID getAttributeAsUUID(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsUUID
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsURL
@Pure public URL getAttributeAsURL(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsURL
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsURI
@Pure public URI getAttributeAsURI(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsURI
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsDate
@Pure public Date getAttributeAsDate(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsDate
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsInetAddress
@Pure public InetAddress getAttributeAsInetAddress(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsInetAddress
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsEnumeration
@Pure public <ET extends Enum<ET>> ET getAttributeAsEnumeration(String name, Class<ET> type) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsEnumeration
in interfaceAttributeProvider
- Type Parameters:
ET
- is the type of the enumeration to retreive.- Parameters:
name
- the name.type
- is the type of the enumeration to retreive.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsEnumeration
@Pure public Enum<?> getAttributeAsEnumeration(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsEnumeration
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
getAttributeAsJavaClass
@Pure public Class<?> getAttributeAsJavaClass(String name) throws AttributeException
Description copied from interface:AttributeProvider
Replies the value for the given attribute.- Specified by:
getAttributeAsJavaClass
in interfaceAttributeProvider
- Parameters:
name
- the name.- Returns:
- the value
- Throws:
AttributeException
- if the attribute was never set.
-
setAttribute
public Attribute setAttribute(String name, AttributeValue value) throws AttributeException
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
- Throws:
AttributeException
- on error.
-
setAttribute
public Attribute setAttribute(String name, boolean value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, int value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, long value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, float value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, double value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, String value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, UUID value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, URL value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, URI value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, Date value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, InetAddress value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, InetSocketAddress value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, Enum<?> value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(String name, Class<?> value)
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to set.value
- is the value to store.- Returns:
- the changed attribute or
null
-
setAttribute
public Attribute setAttribute(Attribute value) throws AttributeException
Description copied from interface:AttributeCollection
Set the value for the given attribute.- Specified by:
setAttribute
in interfaceAttributeCollection
- Parameters:
value
- is the value to store.- Returns:
- the changed attribute or
null
- Throws:
AttributeException
- on error.
-
setAttributeType
public Attribute setAttributeType(String name, AttributeType type) throws AttributeException
Description copied from interface:AttributeCollection
Set the type of the attribute with the given name.- Specified by:
setAttributeType
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attributetype
- is the desired type.- Returns:
- the changed attribute or
null
- Throws:
AttributeException
- on error.
-
removeAttribute
public boolean removeAttribute(String name)
Description copied from interface:AttributeCollection
Remove the given attribute.- Specified by:
removeAttribute
in interfaceAttributeCollection
- Parameters:
name
- is the name of the attribute to remove.- Returns:
true
on success, otherwhisefalse
-
removeAllAttributes
public boolean removeAllAttributes()
Description copied from interface:AttributeCollection
Remove all the attributes.- Specified by:
removeAllAttributes
in interfaceAttributeCollection
- Returns:
false
if something wrong appends
-
renameAttribute
public final boolean renameAttribute(String oldname, String newname)
Description copied from interface:AttributeCollection
Rename the attribute.If a attribute named
newname
already exists, this function will replyfalse
.This function is equivalent to
renameAttribute(oldname, newname, false)
.- Specified by:
renameAttribute
in interfaceAttributeCollection
- Parameters:
oldname
- is the name of the attribute to rename.newname
- is the new name of the attribute.- Returns:
false
if something wrong appends
-
renameAttribute
public boolean renameAttribute(String oldname, String newname, boolean overwrite)
Description copied from interface:AttributeCollection
Rename the attribute .- Specified by:
renameAttribute
in interfaceAttributeCollection
- Parameters:
oldname
- is the name of the attribute to rename.newname
- is the new name of the attribute.overwrite
- must betrue
if the value of an existing attribute named bynewname
must be overwritten by the value of the attribute namedoldname
.- Returns:
false
if something wrong appends
-
freeMemory
public void freeMemory()
Description copied from interface:AttributeProvider
Clean the internal memory-storage structures if they exist.This function permits to limit the memory usage without removing the attribute value from a hard storage area (database, files...). The attribute which are freed by this method could be reloaded in memory with a call to a getting method.
- Specified by:
freeMemory
in interfaceAttributeProvider
-
setAttributes
public void setAttributes(Map<String,Object> content)
Description copied from interface:AttributeCollection
Set the content of this collection from the given map. Any previous content of this attribute collection will be lost. This function is equivalent to:this.removeAllAttributes(); this.addAttributes(content);
- Specified by:
setAttributes
in interfaceAttributeCollection
- Parameters:
content
- is the content.- See Also:
AttributeCollection.addAttributes(Map)
-
setAttributes
public void setAttributes(AttributeProvider content) throws AttributeException
Description copied from interface:AttributeCollection
Set the content of this collection from the given map. Any previous content of this attribute collection will be lost. This function is equivalent to:this.removeAllAttributes(); this.addAttributes(content);
- Specified by:
setAttributes
in interfaceAttributeCollection
- Parameters:
content
- is the content.- Throws:
AttributeException
- if one attribute from the content cannot be inserted.- See Also:
AttributeCollection.addAttributes(AttributeProvider)
-
addAttributes
public void addAttributes(Map<String,Object> content)
Description copied from interface:AttributeCollection
Put the values given as parameter in this attribute provider. Any previous content of this attribute collection will remain if the keys are not inside the given content. If the values from the given content will be used to overwrite any existing value.- Specified by:
addAttributes
in interfaceAttributeCollection
- Parameters:
content
- is the content to add inside.- See Also:
AttributeCollection.setAttributes(Map)
-
addAttributes
public void addAttributes(AttributeProvider content) throws AttributeException
Description copied from interface:AttributeCollection
Put the values given as parameter in this attribute provider. Any previous content of this attribute collection will remain if the keys are not inside the given content. If the values from the given content will be used to overwrite any existing value.- Specified by:
addAttributes
in interfaceAttributeCollection
- Parameters:
content
- is the content to add inside.- Throws:
AttributeException
- if one attribute from the content cannot be inserted.- See Also:
AttributeCollection.addAttributes(AttributeProvider)
-
flush
public void flush()
Description copied from interface:AttributeCollection
Force this provider to synchronized the memory state of the attributes with a remote storage area.- Specified by:
flush
in interfaceAttributeCollection
-
toMap
@Pure public Map<String,Object> toMap()
Description copied from interface:AttributeProvider
Replies the map of the values stored in this attribute provider. The replied map is a copy of or an unmodifiable version of the internal map, if it exists.q- Specified by:
toMap
in interfaceAttributeProvider
- Returns:
- the map, never
null
.
-
toMap
public void toMap(Map<String,Object> mapToFill)
Description copied from interface:AttributeProvider
Fill the given map with the values stored in this attribute provider.- Specified by:
toMap
in interfaceAttributeProvider
- Parameters:
mapToFill
- is the map to fill, nevernull
.
-
hashKey
@Pure public String hashKey()
Description copied from interface:GISElement
Replies a string suitable for hashtables.- Specified by:
hashKey
in interfaceGISElement
- Returns:
- a string suitable for hashtables.
-
toJson
@Pure public void toJson(JsonBuffer buffer)
Description copied from interface:JsonableObject
Replies the Json representation of this node.- Specified by:
toJson
in interfaceJsonableObject
- Parameters:
buffer
- the Json buffer.
-
-