de.fhpotsdam.unfolding.data
Class Feature

java.lang.Object
  extended by de.fhpotsdam.unfolding.data.Feature
Direct Known Subclasses:
MultiFeature, PointFeature, ShapeFeature

public class Feature
extends java.lang.Object

A feature stores one or more locations, its type, and additional data properties.


Nested Class Summary
static class Feature.FeatureType
           
 
Field Summary
 java.util.HashMap<java.lang.String,java.lang.Object> properties
          Stores data properties.
 
Constructor Summary
Feature(Feature.FeatureType type)
          Creates a feature for a specific type.
 
Method Summary
 java.lang.Object addProperty(java.lang.String key, java.lang.Object value)
          Adds a property to this feature.
 java.lang.String getId()
          Returns the ID of this feature.
 java.util.HashMap<java.lang.String,java.lang.Object> getProperties()
          Returns all data properties.
 java.lang.Object getProperty(java.lang.String key)
          Returns a property for the key.
 java.lang.String getStringProperty(java.lang.String key)
          Returns the value of a String property.
 Feature.FeatureType getType()
          Returns the type of this feature.
 void putProperty(java.lang.String key, java.lang.Object value)
          Adds a property to this feature.
 void setId(java.lang.String id)
          Sets the ID of this feature.
 void setProperties(java.util.HashMap<java.lang.String,java.lang.Object> properties)
          Sets all properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

properties

public java.util.HashMap<java.lang.String,java.lang.Object> properties
Stores data properties. A feature does not know about the semantics though, this has to be done in the display.

Constructor Detail

Feature

public Feature(Feature.FeatureType type)
Creates a feature for a specific type.

Parameters:
type - The type of this feature.
Method Detail

getType

public Feature.FeatureType getType()
Returns the type of this feature.

Returns:
The type.

getProperties

public java.util.HashMap<java.lang.String,java.lang.Object> getProperties()
Returns all data properties.

Returns:
The properties.

getProperty

public java.lang.Object getProperty(java.lang.String key)
Returns a property for the key.

Parameters:
key - The key of the property.
Returns:
A property or null if not found.

addProperty

public java.lang.Object addProperty(java.lang.String key,
                                    java.lang.Object value)
Adds a property to this feature.

Parameters:
key - The key of this property.
value - The value of this property.

putProperty

public void putProperty(java.lang.String key,
                        java.lang.Object value)
Adds a property to this feature.

Parameters:
key - The key of this property.
value - The value of this property.

getStringProperty

public java.lang.String getStringProperty(java.lang.String key)
Returns the value of a String property. This only returns a non-null value if the value is a String. For String representations of other objects use getProperty(String) and convert it yourself.

Parameters:
key - The key of the property.
Returns:
The value as String, or null if not found or if property is not a String.

setProperties

public void setProperties(java.util.HashMap<java.lang.String,java.lang.Object> properties)
Sets all properties. All previously existing ones will be removed.

Parameters:
properties - The data properties.

getId

public java.lang.String getId()
Returns the ID of this feature.

Returns:
The ID.

setId

public void setId(java.lang.String id)
Sets the ID of this feature.

Parameters:
id - The ID.