es.unex.sextante.parameters
Class Parameter

java.lang.Object
  extended by es.unex.sextante.parameters.Parameter
Direct Known Subclasses:
ParameterBand, ParameterBoolean, ParameterDataObject, ParameterFilepath, ParameterFixedTable, ParameterMultipleInput, ParameterNumericalValue, ParameterPoint, ParameterSelection, ParameterString, ParameterTableField

public abstract class Parameter
extends java.lang.Object

A parameter in a ParametersSet, needed to run a GeoAlgorithm

Author:
volaya

Constructor Summary
Parameter()
           
 
Method Summary
static Parameter deserialize(org.kxml2.io.KXmlParser parser)
          Creates an instance of a parameter from an XML string
abstract  java.lang.String getCommandLineParameter()
          Returns the value of the parameter as a command-line parameter
 Parameter getNewInstance()
          Returns a copy of this parameter
 AdditionalInfo getParameterAdditionalInfo()
          Returns the additional information of this parameter
abstract  java.lang.Class getParameterClass()
          Returns the class of the value represented by this parameter
 java.lang.String getParameterDescription()
          Returns the description of the parameter
 java.lang.String getParameterName()
          Returns the name of the parameter
abstract  java.lang.String getParameterTypeName()
          Returns the name used to identify the parameter in the parameters set
 java.util.ArrayList getParameterValueAsArrayList()
          Returns the value of the parameter as an array list.
abstract  boolean getParameterValueAsBoolean()
          Returns the value of the parameter as a boolean value
abstract  double getParameterValueAsDouble()
          Returns the value of the parameter as a double
abstract  int getParameterValueAsInt()
          Returns the value of the parameter as an integer
 java.lang.Object getParameterValueAsObject()
          Returns the value of the parameter, not casting it to any particular type
abstract  java.awt.geom.Point2D getParameterValueAsPoint()
          Returns the value of the parameter as a point
abstract  IRasterLayer getParameterValueAsRasterLayer()
          Returns the value of the parameter as a raster layer
abstract  java.lang.String getParameterValueAsString()
          Returns the value of the parameter as a string
abstract  ITable getParameterValueAsTable()
          Returns the value of the parameter as a table
abstract  IVectorLayer getParameterValueAsVectorLayer()
          Returns the value of the parameter as a vector layer
abstract  boolean isParameterValueCorrect()
          Returns true if the value assigned to this parameter is valid
 void serialize(org.kxml2.io.KXmlSerializer serializer, java.lang.String sCoords)
          Serializes the description of this parameter (not its value)
abstract  boolean setParameterAdditionalInfo(AdditionalInfo additionalInfo)
          Set the additional information for this parameter
 void setParameterDescription(java.lang.String sDescription)
          Sets a new description of the parameter
 void setParameterName(java.lang.String sName)
          Sets a new name for this parameter
abstract  boolean setParameterValue(java.lang.Object value)
          Sets the value of the parameter
 java.lang.String toString()
          Returns a text description of the parameter
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Parameter

public Parameter()
Method Detail

getParameterTypeName

public abstract java.lang.String getParameterTypeName()
Returns the name used to identify the parameter in the parameters set

Returns:
the name of the parameter

setParameterValue

public abstract boolean setParameterValue(java.lang.Object value)
Sets the value of the parameter

Parameters:
value - the new value of the parameter
Returns:
true if the value is a correct one and could be assigned

setParameterAdditionalInfo

public abstract boolean setParameterAdditionalInfo(AdditionalInfo additionalInfo)
Set the additional information for this parameter

Parameters:
additionalInfo - the additional info for this parameter
Returns:
true it the passed additional info can be assigned to this parameter
See Also:
AdditionalInfo

getParameterValueAsInt

public abstract int getParameterValueAsInt()
                                    throws WrongParameterTypeException,
                                           NullParameterValueException
Returns the value of the parameter as an integer

Returns:
the value of the parameter as an integer
Throws:
WrongParameterTypeException - if the value cannot be returned as an integer
NullParameterValueException - if the parameter is null

getParameterValueAsDouble

public abstract double getParameterValueAsDouble()
                                          throws WrongParameterTypeException,
                                                 NullParameterValueException
Returns the value of the parameter as a double

Returns:
the value of the parameter as a double
Throws:
WrongParameterTypeException - if the parameter cannot be returned as an double
NullParameterValueException - if the value is null

getParameterValueAsBoolean

public abstract boolean getParameterValueAsBoolean()
                                            throws WrongParameterTypeException,
                                                   NullParameterValueException
Returns the value of the parameter as a boolean value

Returns:
the value of the parameter as a boolean value
Throws:
WrongParameterTypeException - if the value cannot be returned as a boolean value
NullParameterValueException - if the parameter is null

getParameterValueAsString

public abstract java.lang.String getParameterValueAsString()
                                                    throws WrongParameterTypeException,
                                                           NullParameterValueException,
                                                           NullParameterAdditionalInfoException
Returns the value of the parameter as a string

Returns:
the value of the parameter as a string
Throws:
WrongParameterTypeException - if the parameter cannot be returned as a string
NullParameterValueException - if the value is null
NullParameterAdditionalInfoException - if the additional info of the parameter is null

getParameterValueAsVectorLayer

public abstract IVectorLayer getParameterValueAsVectorLayer()
                                                     throws WrongParameterTypeException,
                                                            NullParameterValueException
Returns the value of the parameter as a vector layer

Returns:
the value of the parameter as a vector layer
Throws:
WrongParameterTypeException - if the parameter cannot be returned as a vector layer
NullParameterValueException - if the value is null and it is a mandatory vector layer
NullParameterAdditionalInfoException - if the additional info of the parameter is null

getParameterValueAsRasterLayer

public abstract IRasterLayer getParameterValueAsRasterLayer()
                                                     throws WrongParameterTypeException,
                                                            NullParameterValueException
Returns the value of the parameter as a raster layer

Returns:
the value of the parameter as a raster layer
Throws:
WrongParameterTypeException - if the parameter cannot be returned as a raster layer
NullParameterValueException - if the value is null and it is a mandatory raster layer
NullParameterAdditionalInfoException - if the additional info of the parameter is null

getParameterValueAsTable

public abstract ITable getParameterValueAsTable()
                                         throws WrongParameterTypeException,
                                                NullParameterValueException
Returns the value of the parameter as a table

Returns:
the value of the parameter as a table
Throws:
WrongParameterTypeException - if the parameter cannot be returned as a table
NullParameterValueException - if the value is null and it is a mandatory table
NullParameterAdditionalInfoException - if the additional info of the parameter is null

getParameterValueAsPoint

public abstract java.awt.geom.Point2D getParameterValueAsPoint()
                                                        throws WrongParameterTypeException,
                                                               NullParameterValueException
Returns the value of the parameter as a point

Returns:
the value of the parameter as a point
Throws:
WrongParameterTypeException - if the parameter cannot be returned as a point
NullParameterValueException - if the parameter is null

getParameterClass

public abstract java.lang.Class getParameterClass()
Returns the class of the value represented by this parameter

Returns:
the class of the value represented by this parameter

getCommandLineParameter

public abstract java.lang.String getCommandLineParameter()
Returns the value of the parameter as a command-line parameter

Returns:
then value of the parameter as a command-line parameter

getParameterAdditionalInfo

public AdditionalInfo getParameterAdditionalInfo()
                                          throws NullParameterAdditionalInfoException
Returns the additional information of this parameter

Returns:
the additional information of this parameter
Throws:
NullParameterAdditionalInfoException - if there is no additional information

getParameterName

public java.lang.String getParameterName()
Returns the name of the parameter

Returns:
the name (machine-readable) of the parameter

getParameterDescription

public java.lang.String getParameterDescription()
Returns the description of the parameter

Returns:
the description(human-readable) of the parameter

setParameterDescription

public void setParameterDescription(java.lang.String sDescription)
Sets a new description of the parameter

Parameters:
sDescription - the description of the parameter

setParameterName

public void setParameterName(java.lang.String sName)
Sets a new name for this parameter

Parameters:
sName - the name of the parameter

getParameterValueAsObject

public java.lang.Object getParameterValueAsObject()
Returns the value of the parameter, not casting it to any particular type

Returns:
the value of the parameter

getParameterValueAsArrayList

public java.util.ArrayList getParameterValueAsArrayList()
                                                 throws NullParameterValueException
Returns the value of the parameter as an array list. This is a generic implementation, which simply returns an ArrayList with a single object

Returns:
the value of the a parameter as an array list
Throws:
NullParameterValueException

toString

public java.lang.String toString()
Returns a text description of the parameter

Overrides:
toString in class java.lang.Object
See Also:
getParameterTypeName()

deserialize

public static Parameter deserialize(org.kxml2.io.KXmlParser parser)
                             throws org.xmlpull.v1.XmlPullParserException,
                                    java.io.IOException
Creates an instance of a parameter from an XML string

Parameters:
parser - a parser to take the parameter data from
Returns:
a new instance of a parameter
Throws:
org.xmlpull.v1.XmlPullParserException
java.io.IOException

serialize

public void serialize(org.kxml2.io.KXmlSerializer serializer,
                      java.lang.String sCoords)
               throws java.io.IOException,
                      NullParameterAdditionalInfoException
Serializes the description of this parameter (not its value)

Parameters:
serializer - a serializer
sCoords - The coords for representing it if it is part of a model
Throws:
java.io.IOException
NullParameterAdditionalInfoException

getNewInstance

public Parameter getNewInstance()
Returns a copy of this parameter

Returns:
a copy of this parameter

isParameterValueCorrect

public abstract boolean isParameterValueCorrect()
Returns true if the value assigned to this parameter is valid

Returns:
true if the value assigned to this parameter is valid