Class NearestVisitor

    • Constructor Summary

      Constructors 
      Constructor Description
      NearestVisitor​(Expression expression, Object valueToMatch)
      Creates a NearestVisitor instance for the given attribute and a value to match.
    • Constructor Detail

      • NearestVisitor

        public NearestVisitor​(Expression expression,
                              Object valueToMatch)
        Creates a NearestVisitor instance for the given attribute and a value to match.
        Parameters:
        valueToMatch - The target value to match
    • Method Detail

      • visit

        public void visit​(Feature feature)
        Visitor function, which looks at each feature and finds the value of the attribute given attribute nearest to the given comparison value.
        Specified by:
        visit in interface FeatureVisitor
        Parameters:
        feature - the feature to be visited
      • reset

        public void reset()
      • setValue

        public void setValue​(Comparable nearest)
      • setValue

        public void setValue​(Comparable maxBelow,
                             Comparable minAbove)
      • getResult

        public CalcResult getResult()
        Description copied from interface: FeatureCalc
        Returns the result of the calculation as a handy object which can be merged and modified.
        Specified by:
        getResult in interface FeatureCalc
        Returns:
        the results of the calculation
      • getExpression

        public Expression getExpression()
        Expression used to access collection content.
        Returns:
        expr used to access collection
      • getValueToMatch

        public Object getValueToMatch()
        Provided value to match against.
        Returns:
        value to match against.
      • getResultType

        public Optional<List<Class>> getResultType​(List<Class> inputTypes)
        Description copied from interface: FeatureAttributeVisitor
        Returns the expected output type given the input type.
        Specified by:
        getResultType in interface FeatureAttributeVisitor
        Parameters:
        inputTypes - The type of the input expressions