Package org.locationtech.jtstest.geomop
Class BaseGeometryFunction
- java.lang.Object
-
- org.locationtech.jtstest.geomop.BaseGeometryFunction
-
- All Implemented Interfaces:
java.lang.Comparable,GeometryFunction
- Direct Known Subclasses:
StaticMethodGeometryFunction
public abstract class BaseGeometryFunction extends java.lang.Object implements GeometryFunction, java.lang.Comparable
A base for implementations ofGeometryFunctionwhich provides most of the required structure. Extenders must supply the behaviour for the actual function invocation.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Stringcategoryprotected java.lang.Stringdescriptionprotected java.lang.Stringnameprotected java.lang.String[]parameterNamesprotected java.lang.Class[]parameterTypesprotected java.lang.ClassreturnType
-
Constructor Summary
Constructors Constructor Description BaseGeometryFunction(java.lang.String name, java.lang.String[] parameterNames, java.lang.Class[] parameterTypes, java.lang.Class returnType)BaseGeometryFunction(java.lang.String name, java.lang.String description, java.lang.String[] parameterNames, java.lang.Class[] parameterTypes, java.lang.Class returnType)
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description private static intcompareTo(java.lang.Class c1, java.lang.Class c2)intcompareTo(java.lang.Object o)booleanequals(java.lang.Object obj)Two functions are the same if they have the same signature (name, parameter types and return type).java.lang.StringgetCategory()java.lang.StringgetDescription()protected static java.lang.DoublegetDoubleOrNull(java.lang.Object[] args, int index)protected static java.lang.IntegergetIntegerOrNull(java.lang.Object[] args, int index)java.lang.StringgetName()Gets the name of this functionjava.lang.String[]getParameterNames()Gets the parameter names for this functionjava.lang.Class[]getParameterTypes()Gets the types of the other function arguments, if any.java.lang.ClassgetReturnType()Gets the return type of this functionabstract java.lang.Objectinvoke(Geometry geom, java.lang.Object[] args)Invokes this function.booleanisBinary()static booleanisBinaryGeomFunction(GeometryFunction func)
-
-
-
Field Detail
-
category
protected java.lang.String category
-
name
protected java.lang.String name
-
description
protected java.lang.String description
-
parameterNames
protected java.lang.String[] parameterNames
-
parameterTypes
protected java.lang.Class[] parameterTypes
-
returnType
protected java.lang.Class returnType
-
-
Constructor Detail
-
BaseGeometryFunction
public BaseGeometryFunction(java.lang.String name, java.lang.String[] parameterNames, java.lang.Class[] parameterTypes, java.lang.Class returnType)
-
BaseGeometryFunction
public BaseGeometryFunction(java.lang.String name, java.lang.String description, java.lang.String[] parameterNames, java.lang.Class[] parameterTypes, java.lang.Class returnType)
-
-
Method Detail
-
isBinaryGeomFunction
public static boolean isBinaryGeomFunction(GeometryFunction func)
-
getCategory
public java.lang.String getCategory()
-
getName
public java.lang.String getName()
Description copied from interface:GeometryFunctionGets the name of this function- Specified by:
getNamein interfaceGeometryFunction- Returns:
- the name of the function
-
getDescription
public java.lang.String getDescription()
-
getParameterNames
public java.lang.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 java.lang.Class[] getParameterTypes()
Gets the types of the other function arguments, if any.- Specified by:
getParameterTypesin interfaceGeometryFunction- Returns:
- the types
-
getReturnType
public java.lang.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
-
getDoubleOrNull
protected static java.lang.Double getDoubleOrNull(java.lang.Object[] args, int index)
-
getIntegerOrNull
protected static java.lang.Integer getIntegerOrNull(java.lang.Object[] args, int index)
-
invoke
public abstract java.lang.Object invoke(Geometry geom, java.lang.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(java.lang.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 classjava.lang.Object- Parameters:
obj-- Returns:
- true if this object is the same as the obj argument
-
compareTo
public int compareTo(java.lang.Object o)
- Specified by:
compareToin interfacejava.lang.Comparable
-
compareTo
private static int compareTo(java.lang.Class c1, java.lang.Class c2)
-
-