Class AbstractOperation
Object
AbstractIdentifiedType
AbstractOperation
- All Implemented Interfaces:
Serializable
,BiFunction<AbstractFeature, ParameterValueGroup, Object>
,Deprecable
public abstract class AbstractOperation
extends AbstractIdentifiedType
implements BiFunction<AbstractFeature, ParameterValueGroup, Object>
Describes the behaviour of a feature type as a function or a method.
Operations can:
- Compute values from the attributes.
- Perform actions that change the attribute values.
Example: a mutator operation may raise the height of a dam. This changes
may affect other properties like the watercourse and the reservoir associated with the dam.
The value is computed, or the operation is executed, by apply(Feature, ParameterValueGroup)
.
If the value is modifiable, new value can be set by call to Attribute.setValue(Object)
.- Since:
- 0.6
- See Also:
-
Field Summary
Fields inherited from class AbstractIdentifiedType
DEFINITION_KEY, DEPRECATED_KEY, DESCRIPTION_KEY, DESIGNATION_KEY, INHERIT_FROM_KEY, NAME_KEY
-
Constructor Summary
ConstructorsConstructorDescriptionAbstractOperation
(Map<String, ?> identification) Constructs an operation from the given properties. -
Method Summary
Modifier and TypeMethodDescriptionabstract Object
apply
(AbstractFeature feature, ParameterValueGroup parameters) Executes the operation on the specified feature with the specified parameters.boolean
Compares this operation with the given object for equality.Returns the names of feature properties that this operation needs for performing its task.abstract ParameterDescriptorGroup
Returns a description of the input parameters.abstract AbstractIdentifiedType
Returns the expected result type, ornull
if none.int
Returns a hash code value for this operation.Returns a string representation of this operation.updateDependencies
(Map<String, AbstractIdentifiedType> dependencies) Returns the same operation but using different properties as inputs.Methods inherited from class AbstractIdentifiedType
getDefinition, getDescription, getDesignation, getName, getRemarks, isDeprecated
Methods inherited from class Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface BiFunction
andThen
-
Constructor Details
-
AbstractOperation
Constructs an operation from the given properties. The identification map is given unchanged to the super-class constructor. The following table is a reminder of main (not all) recognized map entries:Recognized map entries (non exhaustive list) Map key Value type Returned by "name" GenericName
orString
AbstractIdentifiedType.getName()
"definition" InternationalString
orString
AbstractIdentifiedType.getDefinition()
"designation" InternationalString
orString
AbstractIdentifiedType.getDesignation()
"description" InternationalString
orString
AbstractIdentifiedType.getDescription()
"deprecated" Boolean
AbstractIdentifiedType.isDeprecated()
- Parameters:
identification
- the name and other information to be given to this operation.
-
-
Method Details
-
getParameters
Returns a description of the input parameters.- Returns:
- description of the input parameters.
-
getResult
Returns the expected result type, ornull
if none.Warning: In a future SIS version, the return type may be changed toorg.opengis.feature.IdentifiedType
. This change is pending GeoAPI revision.- Returns:
- the type of the result, or
null
if none.
-
apply
Executes the operation on the specified feature with the specified parameters. The value returned by this method depends on the value returned bygetResult()
:- If
getResult()
returnsnull
, then this method should returnnull
. - If
getResult()
returns an instance ofAttributeType
, then this method shall return an instance ofAttribute
and theAttribute.getType() == getResult()
relation should hold. - If
getResult()
returns an instance ofFeatureAssociationRole
, then this method shall return an instance ofFeatureAssociation
and theFeatureAssociation.getRole() == getResult()
relation should hold.
Analogy: if we compareOperation
toMethod
in the Java language, then this method is equivalent toMethod.invoke(Object, Object...)
. TheFeature
argument is equivalent tothis
in the Java language, and may benull
if the operation does not need a feature instance (like static methods in the Java language).Warning: In a future SIS version, the parameter type and return value may be changed toorg.opengis.feature.Feature
andorg.opengis.feature.Property
respectively. This change is pending GeoAPI revision.- Specified by:
apply
in interfaceBiFunction<AbstractFeature, ParameterValueGroup, Object>
- Parameters:
feature
- the feature on which to execute the operation. Can benull
if the operation does not need feature instance.parameters
- the parameters to use for executing the operation. Can benull
if the operation does not take any parameters.- Returns:
- the operation result, or
null
if this operation does not produce any result.
- If
-
getDependencies
Returns the names of feature properties that this operation needs for performing its task. This method does not resolve transitive dependencies, i.e. if a dependency is itself an operation having other dependencies, the returned set will contain the name of that operation but not the names of the dependencies of that operation (unless they are the same that the direct dependencies ofthis
).Purpose
This information is needed for writing theSELECT
SQL statement to send to a database server. The requested columns will typically be all attributes declared in aFeatureType
, but also any additional columns needed for the operation while not necessarily included in theFeatureType
.Default implementation
The default implementation returns an empty set.- Returns:
- the names of feature properties needed by this operation for performing its task.
-
updateDependencies
Returns the same operation but using different properties as inputs. The keys in the given map should be values returned bygetDependencies()
, and the associated values shall be the properties to use instead of the current dependencies. If any key in the given map is not a member of the dependency set, then the entry is ignored. Conversely, if any member of the dependency set is not contained in the given map, then the associated dependency is unchanged.Warning: In a future SIS version, the return type may be changed toorg.opengis.feature.Operation
. This change is pending GeoAPI revision.Purpose
This method is needed byFeatureTypeBuilder
when some properties are operations inherited from another feature type. Even if the dependencies are properties of the same name, somecharacteristics
may be different. For example, the CRS may change as a result of a change of CRS.Default implementation
The default implementation returnsthis
. This is consistent with the default implementation ofgetDependencies()
returning an empty set.- Parameters:
dependencies
- the new properties to use as operation inputs.- Returns:
- the new operation, or
this
if unchanged. - Since:
- 1.5
- See Also:
-
hashCode
public int hashCode()Returns a hash code value for this operation. The default implementation computes a hash code from the parameters descriptor and result type.- Overrides:
hashCode
in classAbstractIdentifiedType
- Returns:
- the hash code for this type.
-
equals
Compares this operation with the given object for equality. The default implementation compares the parameters descriptor and result type.- Overrides:
equals
in classAbstractIdentifiedType
- Parameters:
obj
- the object to compare with this type.- Returns:
true
if the given object is equal to this type.
-
toString
-