org.geotools.graph
Class GraphComponent

java.lang.Object
  extended byorg.geotools.graph.GraphComponent
All Implemented Interfaces:
org.geotools.feature.Feature
Direct Known Subclasses:
Edge, Node

public abstract class GraphComponent
extends java.lang.Object
implements org.geotools.feature.Feature

A GraphElement represents a component of a graph.


Nested Class Summary
 
Nested classes inherited from class org.geotools.feature.Feature
org.geotools.feature.Feature.NULL
 
Constructor Summary
GraphComponent(org.geotools.feature.Feature feature)
          Creates a graph component.
 
Method Summary
abstract  com.vividsolutions.jts.geom.Geometry buildGeometry()
          Builds the geometry used to represent the component spatially.
 int compareTo(java.lang.Object other)
          Compares this graph component to another
abstract  java.util.Collection getAdjacentElements()
          Returns any adjacent components of similar type.
 java.lang.Object getAttribute(int index)
          Implementation of getAttribute.
 java.lang.Object getAttribute(java.lang.String xPath)
          Implementation of getAttribute.
 java.lang.Object[] getAttributes(java.lang.Object[] attributes)
          Implementation of getAttributes.
 com.vividsolutions.jts.geom.Envelope getBounds()
          Implementation of getBounds.
 int getCount()
          Returns the count associated with this component.
 com.vividsolutions.jts.geom.Geometry getDefaultGeometry()
          Implementation of getDefaultGeometry.
 org.geotools.feature.Feature getFeature()
          Returns the underlying feature represented by the component.
 org.geotools.feature.FeatureType getFeatureType()
          Implementation of getFeatureType.
 java.lang.String getID()
          Implementation of getID.
 int getNumberOfAttributes()
          Implementation of getNumberOfAttributes.
 org.geotools.feature.FeatureCollection getParent()
          Implementation of getParent.
 org.geotools.feature.FeatureType getSchema()
          Returns the FeatureSchema used to represent the graph component as a Feature.
 boolean isVisited()
          Determines if the componenet has been marked as visited.
static org.geotools.feature.FeatureType schema()
          Returns a FeatureSchema used to represent the graph component as a Feature.
 void setAttribute(int position, java.lang.Object val)
          Implementation of setAttribute.
 void setAttribute(java.lang.String xPath, java.lang.Object attribute)
          Implementation of setAttribute.
 void setAttributes(java.lang.Object[] attributes)
          Implementation of setAttributes.
 void setCount(int count)
          Sets the count associated with the component.
 void setDefaultGeometry(com.vividsolutions.jts.geom.Geometry geometry)
          Implementation of setDefaultGeometry.
 void setParent(org.geotools.feature.FeatureCollection collection)
          Implementation of setParent.
 void setVisited(boolean visited)
          Marks the component as being visited/unvisited.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphComponent

public GraphComponent(org.geotools.feature.Feature feature)
Creates a graph component.

Parameters:
feature - Underlying Feature represented by the component.
See Also:
Feature
Method Detail

schema

public static org.geotools.feature.FeatureType schema()
Returns a FeatureSchema used to represent the graph component as a Feature.

Returns:
FeatureSchema
See Also:
FeatureSchema, Feature

getFeature

public org.geotools.feature.Feature getFeature()
Returns the underlying feature represented by the component.

Returns:
Feature

isVisited

public boolean isVisited()
Determines if the componenet has been marked as visited.

Returns:
True if visited, false if unvisited.

setVisited

public void setVisited(boolean visited)
Marks the component as being visited/unvisited.

Parameters:
visited - True = visited, false = unvisited.

getCount

public int getCount()
Returns the count associated with this component. Used mostly by traversals that visit components more then once.

Returns:
int

setCount

public void setCount(int count)
Sets the count associated with the component.

Parameters:
count -

getSchema

public org.geotools.feature.FeatureType getSchema()
Returns the FeatureSchema used to represent the graph component as a Feature.

See Also:
Feature#getSchema()

compareTo

public int compareTo(java.lang.Object other)
Compares this graph component to another

See Also:
Comparable#compareTo(jObject)

buildGeometry

public abstract com.vividsolutions.jts.geom.Geometry buildGeometry()
Builds the geometry used to represent the component spatially.

Returns:
Geometry

getAdjacentElements

public abstract java.util.Collection getAdjacentElements()
Returns any adjacent components of similar type.

Returns:
Collection

getParent

public org.geotools.feature.FeatureCollection getParent()
Implementation of getParent.

Specified by:
getParent in interface org.geotools.feature.Feature
Returns:
See Also:
Feature.getParent()

setParent

public void setParent(org.geotools.feature.FeatureCollection collection)
Implementation of setParent.

Specified by:
setParent in interface org.geotools.feature.Feature
Parameters:
collection -
See Also:
Feature.setParent(org.geotools.feature.FeatureCollection)

getFeatureType

public org.geotools.feature.FeatureType getFeatureType()
Implementation of getFeatureType.

Specified by:
getFeatureType in interface org.geotools.feature.Feature
Returns:
See Also:
Feature.getFeatureType()

getID

public java.lang.String getID()
Implementation of getID.

Specified by:
getID in interface org.geotools.feature.Feature
Returns:
See Also:
Feature.getID()

getAttributes

public java.lang.Object[] getAttributes(java.lang.Object[] attributes)
Implementation of getAttributes.

Specified by:
getAttributes in interface org.geotools.feature.Feature
Parameters:
attributes -
Returns:
See Also:
Feature.getAttributes(java.lang.Object[])

getAttribute

public java.lang.Object getAttribute(java.lang.String xPath)
Implementation of getAttribute.

Specified by:
getAttribute in interface org.geotools.feature.Feature
Parameters:
xPath -
Returns:
See Also:
Feature.getAttribute(java.lang.String)

getAttribute

public java.lang.Object getAttribute(int index)
Implementation of getAttribute.

Specified by:
getAttribute in interface org.geotools.feature.Feature
Parameters:
index -
Returns:
See Also:
Feature.getAttribute(int)

setAttribute

public void setAttribute(int position,
                         java.lang.Object val)
                  throws org.geotools.feature.IllegalAttributeException,
                         java.lang.ArrayIndexOutOfBoundsException
Implementation of setAttribute.

Specified by:
setAttribute in interface org.geotools.feature.Feature
Parameters:
position -
val -
Throws:
org.geotools.feature.IllegalAttributeException
java.lang.ArrayIndexOutOfBoundsException
See Also:
Feature.setAttribute(int, java.lang.Object)

getNumberOfAttributes

public int getNumberOfAttributes()
Implementation of getNumberOfAttributes.

Specified by:
getNumberOfAttributes in interface org.geotools.feature.Feature
Returns:
See Also:
Feature.getNumberOfAttributes()

setAttributes

public void setAttributes(java.lang.Object[] attributes)
                   throws org.geotools.feature.IllegalAttributeException
Implementation of setAttributes.

Specified by:
setAttributes in interface org.geotools.feature.Feature
Parameters:
attributes -
Throws:
org.geotools.feature.IllegalAttributeException
See Also:
Feature.setAttributes(java.lang.Object[])

setAttribute

public void setAttribute(java.lang.String xPath,
                         java.lang.Object attribute)
                  throws org.geotools.feature.IllegalAttributeException
Implementation of setAttribute.

Specified by:
setAttribute in interface org.geotools.feature.Feature
Parameters:
xPath -
attribute -
Throws:
org.geotools.feature.IllegalAttributeException
See Also:
Feature.setAttribute(java.lang.String, java.lang.Object)

getDefaultGeometry

public com.vividsolutions.jts.geom.Geometry getDefaultGeometry()
Implementation of getDefaultGeometry.

Specified by:
getDefaultGeometry in interface org.geotools.feature.Feature
Returns:
See Also:
Feature.getDefaultGeometry()

setDefaultGeometry

public void setDefaultGeometry(com.vividsolutions.jts.geom.Geometry geometry)
                        throws org.geotools.feature.IllegalAttributeException
Implementation of setDefaultGeometry.

Specified by:
setDefaultGeometry in interface org.geotools.feature.Feature
Parameters:
geometry -
Throws:
org.geotools.feature.IllegalAttributeException
See Also:
Feature.setDefaultGeometry(com.vividsolutions.jts.geom.Geometry)

getBounds

public com.vividsolutions.jts.geom.Envelope getBounds()
Implementation of getBounds.

Specified by:
getBounds in interface org.geotools.feature.Feature
Returns:
See Also:
Feature.getBounds()