Class AbstractActionDevice

    • Constructor Detail

      • AbstractActionDevice

        public AbstractActionDevice​(Floor floor,
                                    java.lang.String deviceName,
                                    int durationOfUsing,
                                    Consumption consumption)
    • Method Detail

      • action

        public void action​(Creature creature)
        The method implemented by the state pattern. Depending on the state of the device, a different interaction of the device with a person is performed.
        Parameters:
        creature - A person who interacts with device.
      • isFree

        public boolean isFree()
        The method determines if the device is not occupied by any person.
        Returns:
      • isRightDevice

        public boolean isRightDevice​(Creature creature)
        Checks if a person's desire matches the device's classification.
        Parameters:
        creature - person
        Returns:
        true if it matches
      • usage

        public void usage()
        The method reduces the period of use of this device by a specific person.
      • isUsageLimit

        public boolean isUsageLimit()
        The method determines whether the use of this device by a specific person has expired.
        Returns:
      • updateDuration

        public void updateDuration()
        Method that changes durationOfUsing. Help to simulate different times of using for different persons.