Class DoubleInvoker

  • All Implemented Interfaces:
    IDoubleSource

    public class DoubleInvoker
    extends java.lang.Object
    implements IDoubleSource
    Not of interest for users. It uses java reflection to call objects' methods which return double values. It is used by Statistics objects.

    Title: JAS

    Description: Java Agent-based Simulation library

    Copyright (C) 2002 Michele Sonnessa

    This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
    Author:
    Michele Sonnessa

    • Constructor Summary

      Constructors 
      Constructor Description
      DoubleInvoker​(java.lang.Class<?> target, java.lang.String fieldName, boolean isMethod)
      Constructor.
      DoubleInvoker​(java.lang.Object target, java.lang.String fieldName, boolean isMethod)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      double[] getCollectionValue​(java.util.Collection<?> c)  
      double getDouble()
      Invoke the method of the object passed to constructor and return its double result.
      double getDouble​(java.lang.Object target)
      Invoke the method of the target object and return its double result.
      double getDoubleValue​(java.lang.Enum<?> valueID)
      This is an implementation of the IDblSource interface.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DoubleInvoker

        public DoubleInvoker​(java.lang.Object target,
                             java.lang.String fieldName,
                             boolean isMethod)
        Constructor.
        Parameters:
        target - It is the target object.
        fieldName - A string representing the name of the method to invoke.
        isMethod - If true the fieldName is a method, otherwise it is a property of the object.
      • DoubleInvoker

        public DoubleInvoker​(java.lang.Class<?> target,
                             java.lang.String fieldName,
                             boolean isMethod)
        Constructor.
        Parameters:
        target - It is the class of the target object.
        fieldName - A string representing the name of the method to invoke.
        isMethod - If true the fieldName is a method, otherwise it is a property of the object.
    • Method Detail

      • getDouble

        public double getDouble​(java.lang.Object target)
        Invoke the method of the target object and return its double result.
        Parameters:
        target - Object to be invoked.
        Returns:
        The requested double value.
      • getDouble

        public double getDouble()
        Invoke the method of the object passed to constructor and return its double result.
        Returns:
        The requested double value.
      • getDoubleValue

        public double getDoubleValue​(java.lang.Enum<?> valueID)
        This is an implementation of the IDblSource interface. It calls the getDouble() method.
        Specified by:
        getDoubleValue in interface IDoubleSource
        Parameters:
        valueID - This parameter is ignored. It is put for compatibility with the IDblSource interface.
        Returns:
        The requested double value.
      • getCollectionValue

        public double[] getCollectionValue​(java.util.Collection<?> c)