Class StableForSteps

  • All Implemented Interfaces:
    java.util.function.Predicate

    
    public final class StableForSteps<T extends Object>
     implements Predicate<Environment<T, ?>>
                        

    A Predicate that tests if an environment's nodes (meaning their position and concentration) have remained unchanged for a certain amount of steps.

    The check isn't performed on every step of a simulation, instead an interval that determines how many steps are to be skipped between each check is specified. For test to return true, an environment must remain unchanged for checkInterval * equalIntervals steps. This result might not be entirely consistent, since the check isn't performed every step so as not to cause performance issues. Therefore it might happen that some changes occur in the environment but are reverted before the next check is performed.

    test should be called at every step of the simulation in order to avoid missing checks.

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      Boolean test(Environment<T, ?> environment)
      • Methods inherited from class java.util.function.Predicate

        and, negate, or
      • Methods inherited from class java.lang.Object

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

      • StableForSteps

        StableForSteps(Long checkInterval, Long equalIntervals)
        Creates a new StableForSteps with the given values.
        Parameters:
        checkInterval - The recurrence of the test
        equalIntervals - The amount of checkInterval intervals that need to pass (during which the environment doesn't change) for test to return true