Package org.locationtech.jtstest.geomop
Class BaseGeometryFunction
- java.lang.Object
-
- org.locationtech.jtstest.geomop.BaseGeometryFunction
-
- All Implemented Interfaces:
Comparable
,GeometryFunction
- Direct Known Subclasses:
StaticMethodGeometryFunction
public abstract class BaseGeometryFunction extends Object implements GeometryFunction, Comparable
A base for implementations ofGeometryFunction
which 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 String
category
protected String
description
protected String
name
protected String[]
parameterNames
protected Class[]
parameterTypes
protected Class
returnType
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
compareTo(Object o)
boolean
equals(Object obj)
Two functions are the same if they have the same signature (name, parameter types and return type).String
getCategory()
String
getDescription()
protected static Double
getDoubleOrNull(Object[] args, int index)
protected static Integer
getIntegerOrNull(Object[] args, int index)
String
getName()
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.Class
getReturnType()
Gets the return type of this functionabstract Object
invoke(Geometry geom, Object[] args)
Invokes this function.boolean
isBinary()
static boolean
isBinaryGeomFunction(GeometryFunction func)
-
-
-
Method Detail
-
isBinaryGeomFunction
public static boolean isBinaryGeomFunction(GeometryFunction func)
-
getCategory
public String getCategory()
-
getName
public String getName()
Description copied from interface:GeometryFunction
Gets the name of this function- Specified by:
getName
in interfaceGeometryFunction
- Returns:
- the name of the function
-
getDescription
public String getDescription()
-
getParameterNames
public String[] getParameterNames()
Description copied from interface:GeometryFunction
Gets the parameter names for this function- Specified by:
getParameterNames
in interfaceGeometryFunction
- Returns:
- the names of the function parameters
-
getParameterTypes
public Class[] getParameterTypes()
Gets the types of the other function arguments, if any.- Specified by:
getParameterTypes
in interfaceGeometryFunction
- Returns:
- the types
-
getReturnType
public Class getReturnType()
Description copied from interface:GeometryFunction
Gets the return type of this function- Specified by:
getReturnType
in interfaceGeometryFunction
- Returns:
- the type of the value returned by this function
-
isBinary
public boolean isBinary()
- Specified by:
isBinary
in interfaceGeometryFunction
-
invoke
public abstract Object invoke(Geometry geom, Object[] args)
Description copied from interface:GeometryFunction
Invokes this function. Note that any exceptions returned must beRuntimeException
s.- Specified by:
invoke
in 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:
equals
in interfaceGeometryFunction
- Overrides:
equals
in classObject
- Parameters:
obj
-- Returns:
- true if this object is the same as the obj argument
-
compareTo
public int compareTo(Object o)
- Specified by:
compareTo
in interfaceComparable
-
-