Class ThingState

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    FigureState, FogState, ItemState

    public class ThingState
    extends java.lang.Object
    implements java.io.Serializable
    Base class for thing states.
    See Also:
    Serialized Form
    • Field Detail

      • name

        protected java.lang.String name
        Things name.
      • energy

        protected int energy
        Energy.
      • maxEnergy

        protected int maxEnergy
        Max. energy.
    • Constructor Detail

      • ThingState

        public ThingState​(java.lang.String className,
                          int ID,
                          java.lang.String imageName)
    • Method Detail

      • getProperties

        public java.util.Map<java.lang.String,​java.lang.Object> getProperties()
        Gets the states properties.
        Returns:
        The properties.
      • getProperty

        public java.lang.Object getProperty​(java.lang.String key)
        Gets the state property for the given key.
        Parameters:
        key - The property key.
        Returns:
        The property value.
      • getIntProperty

        public int getIntProperty​(java.lang.String key)
        Gets the state property for the given key as int.
        Parameters:
        key - The property key.
        Returns:
        The property value.
      • getBooleanProperty

        public boolean getBooleanProperty​(java.lang.String key)
        Gets the state property for the given key as int.
        Parameters:
        key - The property key.
        Returns:
        The property value. false, if none is contained.
      • addProperty

        public void addProperty​(java.lang.String key,
                                java.lang.Object val)
        Adds a property.
        Parameters:
        key - The key.
        val - The value.
      • getClassName

        public java.lang.String getClassName()
        Returns:
        the className
      • getName

        public java.lang.String getName()
        Returns:
        the name
      • setName

        public void setName​(java.lang.String name)
        Parameters:
        name - the name to set
      • getX

        public int getX()
        Returns:
        the x
      • setX

        public void setX​(int x)
        Parameters:
        x - the x to set
      • getY

        public int getY()
        Returns:
        the y
      • setY

        public void setY​(int y)
        Parameters:
        y - the y to set
      • isOK

        public boolean isOK()
        Checks if the figure is ok.
        Returns:
      • setOK

        public void setOK​(boolean ok)
        Sets if the figure is ok.
        Parameters:
        ok -
      • getColor

        public int getColor()
        Returns:
        the color
      • setColor

        public void setColor​(int color)
        Parameters:
        color - the color to set
      • getOuterColor

        public int getOuterColor()
        Returns:
        the outerColor
      • setOuterColor

        public void setOuterColor​(int outerColor)
        Parameters:
        outerColor - the outerColor to set
      • getText

        public java.lang.String getText()
        Returns:
        the drawText
      • setText

        public void setText​(java.lang.String drawText)
        Parameters:
        drawText - the drawText to set
      • getTextColor

        public int getTextColor()
        Returns:
        the textColor
      • setTextColor

        public void setTextColor​(int textColor)
        Parameters:
        textColor - the textColor to set
      • getTextCounter

        public int getTextCounter()
        Returns:
        the textCounter
      • setTextCounter

        public void setTextCounter​(int textCounter)
        Parameters:
        textCounter - the textCounter to set
      • getEnergy

        public int getEnergy()
        Returns:
        the energy
      • setEnergy

        public void setEnergy​(int energy)
        Parameters:
        energy - the energy to set
      • getMaxEnergy

        public int getMaxEnergy()
        Returns:
        the maxEnergy
      • setMaxEnergy

        public void setMaxEnergy​(int maxEnergy)
        Parameters:
        maxEnergy - the maxEnergy to set
      • getStatus

        public Status getStatus()
        Returns:
        the status
      • setStatus

        public void setStatus​(Status status)
        Parameters:
        status - the status to set
      • getExplosionCounter

        public int getExplosionCounter()
        Returns:
        the explosionCounter
      • setExplosionCounter

        public void setExplosionCounter​(int explosionCounter)
        Parameters:
        explosionCounter - the explosionCounter to set
      • getEnergyMaxCount

        public int getEnergyMaxCount()
        Returns:
        the energyMaxCount
      • setEnergyMaxCount

        public void setEnergyMaxCount​(int energyMaxCount)
        Parameters:
        energyMaxCount - the energyMaxCount to set
      • getID

        public int getID()
        Returns:
        the iD
      • setID

        public void setID​(int iD)
        Parameters:
        iD - the iD to set
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • isExploding

        public boolean isExploding()
      • isDestroyed

        public boolean isDestroyed()
      • isInvulnerable

        public boolean isInvulnerable()
        Checks, if the thing is invulnerable.
        Returns:
        true, if the thing is invulnerable.
      • getImageName

        public java.lang.String getImageName()
        Returns:
        the imageName
      • setImageName

        public void setImageName​(java.lang.String imageName)
        Parameters:
        imageName - the imageName to set
      • toString

        public java.lang.String toString()
        Returns a string representation of this item
        Overrides:
        toString in class java.lang.Object
        Returns:
        String representation.