Class TimeChecker

java.lang.Object
microsim.statistics.TimeChecker

public class TimeChecker extends Object
The time checker is used by all the classes implementing the IUpdatableSource interface to avoid repetitive updates.
Every time the updateSource method of the user class is invoked, it asks to TimeChecker if the update has been done yet at the current simulation time.
If the time checker is disabled it force the users to always update themselves.

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 Details

    • TimeChecker

      public TimeChecker()
  • Method Details

    • isUpToDate

      public boolean isUpToDate()
      The method checks if a call has been already done at current simulation time. In case it has not yet invoked it updates to current time.
      Returns:
      True if the method has not yet been invoked at the current time, false otherwise
    • isEnabled

      public boolean isEnabled()
      Return the current enabling state.
      Returns:
      True if the time checking is enabled, false otherwise.
    • setEnabled

      public void setEnabled(boolean b)
      Enable/disable the time checking.
      Parameters:
      b - True to enable and false to diable time checking.