Class BaseGeometryFunction
- java.lang.Object
-
- org.locationtech.jtstest.geomfunction.BaseGeometryFunction
-
- All Implemented Interfaces:
Comparable,GeometryFunction
- Direct Known Subclasses:
StaticMethodGeometryFunction
public abstract class BaseGeometryFunction extends Object implements GeometryFunction, Comparable
A base for implementations ofGeometryFunctionwhich provides most of the required structure. Extenders must supply the behaviour for the actual function invocation.- Author:
- Martin Davis
-
-
Field Summary
Fields Modifier and Type Field Description protected Stringcategoryprotected Stringdescriptionprotected booleanisRequiredBprotected Stringnameprotected String[]parameterNamesprotected Class[]parameterTypesprotected ClassreturnType
-
Constructor Summary
Constructors Constructor Description BaseGeometryFunction(String category, String name, String[] parameterNames, Class[] parameterTypes, Class returnType)BaseGeometryFunction(String category, String name, String description, String[] parameterNames, Class[] parameterTypes, Class returnType)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description intcompareTo(Object o)booleanequals(Object obj)Two functions are the same if they have the same signature (name, parameter types and return type).static intfirstScalarParamIndex(GeometryFunction func)StringgetCategory()Gets the category name of this functionStringgetDescription()Gets the description of this functionprotected static DoublegetDoubleOrNull(Object[] args, int index)protected static IntegergetIntegerOrNull(Object[] args, int index)StringgetName()Gets the name of this functionString[]getParameterNames()Gets the parameter names for this functionClass[]getParameterTypes()Gets the types of the other function arguments, if any.ClassgetReturnType()Gets the return type of this functionStringgetSignature()Gets a string representing the signature of this function.inthashCode()abstract Objectinvoke(Geometry geom, Object[] args)Invokes this function.booleanisBinary()static booleanisBinaryGeomFunction(GeometryFunction func)booleanisRequiredB()
-
-
-
Method Detail
-
isBinaryGeomFunction
public static boolean isBinaryGeomFunction(GeometryFunction func)
-
firstScalarParamIndex
public static int firstScalarParamIndex(GeometryFunction func)
-
getCategory
public String getCategory()
Description copied from interface:GeometryFunctionGets the category name of this function- Specified by:
getCategoryin interfaceGeometryFunction- Returns:
- the category name of the function
-
getName
public String getName()
Description copied from interface:GeometryFunctionGets the name of this function- Specified by:
getNamein interfaceGeometryFunction- Returns:
- the name of the function
-
getDescription
public String getDescription()
Description copied from interface:GeometryFunctionGets the description of this function- Specified by:
getDescriptionin interfaceGeometryFunction- Returns:
- the name of the function
-
getParameterNames
public String[] getParameterNames()
Description copied from interface:GeometryFunctionGets the parameter names for this function- Specified by:
getParameterNamesin interfaceGeometryFunction- Returns:
- the names of the function parameters
-
getParameterTypes
public Class[] getParameterTypes()
Gets the types of the other function arguments, if any.- Specified by:
getParameterTypesin interfaceGeometryFunction- Returns:
- the types
-
getReturnType
public Class getReturnType()
Description copied from interface:GeometryFunctionGets the return type of this function- Specified by:
getReturnTypein interfaceGeometryFunction- Returns:
- the type of the value returned by this function
-
isBinary
public boolean isBinary()
- Specified by:
isBinaryin interfaceGeometryFunction
-
isRequiredB
public boolean isRequiredB()
- Specified by:
isRequiredBin interfaceGeometryFunction
-
getSignature
public String getSignature()
Description copied from interface:GeometryFunctionGets a string representing the signature of this function.- Specified by:
getSignaturein interfaceGeometryFunction- Returns:
- the string for the function signature
-
invoke
public abstract Object invoke(Geometry geom, Object[] args)
Description copied from interface:GeometryFunctionInvokes this function. Note that any exceptions returned must beRuntimeExceptions.- Specified by:
invokein interfaceGeometryFunction- Parameters:
geom- the target geometryargs- the other arguments to the function- Returns:
- the value computed by the function
-
equals
public boolean equals(Object obj)
Two functions are the same if they have the same signature (name, parameter types and return type).- Specified by:
equalsin interfaceGeometryFunction- Overrides:
equalsin classObject- Parameters:
obj-- Returns:
- true if this object is the same as the obj argument
-
compareTo
public int compareTo(Object o)
- Specified by:
compareToin interfaceComparable
-
-