Class BaseGeometryFunction

  • All Implemented Interfaces:
    GeometryFunction, java.lang.Comparable
    Direct Known Subclasses:
    StaticMethodGeometryFunction

    public abstract class BaseGeometryFunction
    extends java.lang.Object
    implements GeometryFunction, java.lang.Comparable
    A base for implementations of GeometryFunction which provides most of the required structure. Extenders must supply the behaviour for the actual function invocation.
    Author:
    Martin Davis
    • Constructor Summary

      Constructors 
      Constructor Description
      BaseGeometryFunction​(java.lang.String category, java.lang.String name, java.lang.String[] parameterNames, java.lang.Class[] parameterTypes, java.lang.Class returnType)  
      BaseGeometryFunction​(java.lang.String category, 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
      int compareTo​(java.lang.Object o)  
      boolean equals​(java.lang.Object obj)
      Two functions are the same if they have the same signature (name, parameter types and return type).
      java.lang.String getCategory()
      Gets the category name of this function
      java.lang.String getDescription()
      Gets the description of this function
      protected static java.lang.Double getDoubleOrNull​(java.lang.Object[] args, int index)  
      protected static java.lang.Integer getIntegerOrNull​(java.lang.Object[] args, int index)  
      java.lang.String getName()
      Gets the name of this function
      java.lang.String[] getParameterNames()
      Gets the parameter names for this function
      java.lang.Class[] getParameterTypes()
      Gets the types of the other function arguments, if any.
      java.lang.Class getReturnType()
      Gets the return type of this function
      java.lang.String getSignature()
      Gets a string representing the signature of this function.
      abstract java.lang.Object invoke​(Geometry geom, java.lang.Object[] args)
      Invokes this function.
      boolean isBinary()  
      static boolean isBinaryGeomFunction​(GeometryFunction func)  
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 category,
                                    java.lang.String name,
                                    java.lang.String[] parameterNames,
                                    java.lang.Class[] parameterTypes,
                                    java.lang.Class returnType)
      • BaseGeometryFunction

        public BaseGeometryFunction​(java.lang.String category,
                                    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()
        Description copied from interface: GeometryFunction
        Gets the category name of this function
        Specified by:
        getCategory in interface GeometryFunction
        Returns:
        the category name of the function
      • getName

        public java.lang.String getName()
        Description copied from interface: GeometryFunction
        Gets the name of this function
        Specified by:
        getName in interface GeometryFunction
        Returns:
        the name of the function
      • getDescription

        public java.lang.String getDescription()
        Description copied from interface: GeometryFunction
        Gets the description of this function
        Specified by:
        getDescription in interface GeometryFunction
        Returns:
        the name of the function
      • getParameterNames

        public java.lang.String[] getParameterNames()
        Description copied from interface: GeometryFunction
        Gets the parameter names for this function
        Specified by:
        getParameterNames in interface GeometryFunction
        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:
        getParameterTypes in interface GeometryFunction
        Returns:
        the types
      • getReturnType

        public java.lang.Class getReturnType()
        Description copied from interface: GeometryFunction
        Gets the return type of this function
        Specified by:
        getReturnType in interface GeometryFunction
        Returns:
        the type of the value returned by this function
      • getSignature

        public java.lang.String getSignature()
        Description copied from interface: GeometryFunction
        Gets a string representing the signature of this function.
        Specified by:
        getSignature in interface GeometryFunction
        Returns:
        the string for the function signature
      • 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: GeometryFunction
        Invokes this function. Note that any exceptions returned must be RuntimeExceptions.
        Specified by:
        invoke in interface GeometryFunction
        Parameters:
        geom - the target geometry
        args - 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:
        equals in interface GeometryFunction
        Overrides:
        equals in class java.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:
        compareTo in interface java.lang.Comparable