com.vividsolutions.jump.feature
Class AbstractBasicFeature

java.lang.Object
  extended by com.vividsolutions.jump.feature.AbstractBasicFeature
All Implemented Interfaces:
Feature, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable
Direct Known Subclasses:
BasicFeature

public abstract class AbstractBasicFeature
extends java.lang.Object
implements Feature, java.io.Serializable

Default implementation of the Feature interface. Subclasses need implement only the four remaining Feature methods: #getAttribute, #setAttribute, #getAttributes, #setAttributes

See Also:
Serialized Form

Constructor Summary
AbstractBasicFeature(FeatureSchema featureSchema)
          Creates a new Feature based on the given metadata.
 
Method Summary
 java.lang.Object clone()
          Clones this Feature.
 Feature clone(boolean deep)
          Clones this Feature.
static BasicFeature clone(Feature feature, boolean deep)
           
static int compare(Feature a, Feature b)
           
 int compareTo(java.lang.Object o)
           
 java.lang.Object getAttribute(java.lang.String name)
          Returns the specified attribute.
 double getDouble(int attributeIndex)
          Returns a double attribute.
 com.vividsolutions.jts.geom.Geometry getGeometry()
          Convenience method for returning the spatial attribute.
 int getID()
          Returns a number that uniquely identifies this feature.
 int getInteger(int attributeIndex)
          Returns a integer attribute.
 FeatureSchema getSchema()
          Returns the feature's metadata
 java.lang.String getString(int attributeIndex)
          Returns a String attribute.
 java.lang.String getString(java.lang.String attributeName)
          Returns a String attribute.
 void setAttribute(java.lang.String attributeName, java.lang.Object newAttribute)
          Sets the specified attribute.
 void setGeometry(com.vividsolutions.jts.geom.Geometry geometry)
          Convenience method for setting the spatial attribute.
 void setSchema(FeatureSchema schema)
          A low-level accessor that is not normally used.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.vividsolutions.jump.feature.Feature
getAttribute, getAttributes, setAttribute, setAttributes
 

Constructor Detail

AbstractBasicFeature

public AbstractBasicFeature(FeatureSchema featureSchema)
Creates a new Feature based on the given metadata.

Parameters:
featureSchema - the metadata containing information on each column
Method Detail

setSchema

public void setSchema(FeatureSchema schema)
A low-level accessor that is not normally used.

Specified by:
setSchema in interface Feature

getID

public int getID()
Returns a number that uniquely identifies this feature. This number is not persistent.

Specified by:
getID in interface Feature
Returns:
n, where this feature is the nth Feature created by this application

setAttribute

public void setAttribute(java.lang.String attributeName,
                         java.lang.Object newAttribute)
Sets the specified attribute.

Specified by:
setAttribute in interface Feature
Parameters:
attributeName - the name of the attribute to set
newAttribute - the new attribute

setGeometry

public void setGeometry(com.vividsolutions.jts.geom.Geometry geometry)
Convenience method for setting the spatial attribute. JUMP Workbench PlugIns and CursorTools should not use this method directly, but should use an EditTransaction, so that the proper events are fired.

Specified by:
setGeometry in interface Feature
Parameters:
geometry - the new spatial attribute

getAttribute

public java.lang.Object getAttribute(java.lang.String name)
Returns the specified attribute.

Specified by:
getAttribute in interface Feature
Parameters:
name - the name of the attribute to get
Returns:
the attribute

getString

public java.lang.String getString(int attributeIndex)
Returns a String attribute. The attribute at the given index must be a String.

Specified by:
getString in interface Feature
Parameters:
attributeIndex - the array index of the attribute
Returns:
the String attribute at the given index

getInteger

public int getInteger(int attributeIndex)
Returns a integer attribute.

Specified by:
getInteger in interface Feature
Parameters:
attributeIndex - the index of the attribute to retrieve
Returns:
the integer attribute with the given name

getDouble

public double getDouble(int attributeIndex)
Returns a double attribute.

Specified by:
getDouble in interface Feature
Parameters:
attributeIndex - the index of the attribute to retrieve
Returns:
the double attribute with the given name

getString

public java.lang.String getString(java.lang.String attributeName)
Returns a String attribute. The attribute with the given name must be a String.

Specified by:
getString in interface Feature
Parameters:
attributeName - the name of the attribute to retrieve
Returns:
the String attribute with the given name

getGeometry

public com.vividsolutions.jts.geom.Geometry getGeometry()
Convenience method for returning the spatial attribute.

Specified by:
getGeometry in interface Feature
Returns:
the feature's spatial attribute

getSchema

public FeatureSchema getSchema()
Returns the feature's metadata

Specified by:
getSchema in interface Feature
Returns:
the metadata describing the names and types of the attributes

clone

public java.lang.Object clone()
Clones this Feature. The geometry will also be cloned.

Specified by:
clone in interface Feature
Overrides:
clone in class java.lang.Object
Returns:
a new Feature with the same attributes as this Feature

clone

public Feature clone(boolean deep)
Clones this Feature.

Specified by:
clone in interface Feature
Parameters:
deep - whether or not to clone the geometry
Returns:
a new Feature with the same attributes as this Feature

clone

public static BasicFeature clone(Feature feature,
                                 boolean deep)

compareTo

public int compareTo(java.lang.Object o)
Specified by:
compareTo in interface java.lang.Comparable

compare

public static int compare(Feature a,
                          Feature b)