Package adams.core

Class StoppableUtils


  • public class StoppableUtils
    extends Object
    Methods for objects implementing the Stoppable interface.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    • Field Detail

      • LOGGER

        protected static Logger LOGGER
        the logger in use.
    • Constructor Detail

      • StoppableUtils

        public StoppableUtils()
    • Method Detail

      • listStoppable

        public static List<Object> listStoppable​(Object obj)
        Determines all the objects that implement the Stoppable interface.
        Parameters:
        obj - the object to inspect, can be null
        Returns:
        the list of objects
      • isStoppable

        public static boolean isStoppable​(Object obj)
        Checks whether the object is stoppable.
        Parameters:
        obj - the object to check, can be null
        Returns:
        true if stoppable
      • isAnyStoppable

        public static boolean isAnyStoppable​(Object obj)
        Checks whether the object or any of its sub-objects are stoppable.
        Parameters:
        obj - the object to check, can be null
        Returns:
        true if stoppable
      • stopExecution

        public static boolean stopExecution​(Object obj)
        Stops the execution of the object if itself implements the Stoppable interface.
        Parameters:
        obj - the object to stop, can be null
        Returns:
        true if stopped
      • stopAnyExecution

        public static boolean stopAnyExecution​(Object obj)
        Stops the execution of the object and its children of they implement the Stoppable interface.
        Parameters:
        obj - the object to stop itself and its children, can be null
        Returns:
        true if at least one execution was stopped