Package com.starpoints.state
Class ThingState
- java.lang.Object
-
- com.starpoints.state.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
-
-
Constructor Summary
Constructors Constructor Description ThingState(java.lang.String className, int ID, java.lang.String imageName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProperty(java.lang.String key, java.lang.Object val)
Adds a property.boolean
equals(java.lang.Object o)
boolean
getBooleanProperty(java.lang.String key)
Gets the state property for the given key as int.java.lang.String
getClassName()
int
getColor()
int
getEnergy()
int
getEnergyMaxCount()
int
getExplosionCounter()
int
getID()
java.lang.String
getImageName()
int
getIntProperty(java.lang.String key)
Gets the state property for the given key as int.int
getMaxEnergy()
java.lang.String
getName()
int
getOuterColor()
java.util.Map<java.lang.String,java.lang.Object>
getProperties()
Gets the states properties.java.lang.Object
getProperty(java.lang.String key)
Gets the state property for the given key.Status
getStatus()
java.lang.String
getText()
int
getTextColor()
int
getTextCounter()
int
getX()
int
getY()
int
hashCode()
boolean
isDestroyed()
boolean
isExploding()
boolean
isInvulnerable()
Checks, if the thing is invulnerable.boolean
isOK()
Checks if the figure is ok.void
setColor(int color)
void
setEnergy(int energy)
void
setEnergyMaxCount(int energyMaxCount)
void
setExplosionCounter(int explosionCounter)
void
setID(int iD)
void
setImageName(java.lang.String imageName)
void
setMaxEnergy(int maxEnergy)
void
setName(java.lang.String name)
void
setOK(boolean ok)
Sets if the figure is ok.void
setOuterColor(int outerColor)
void
setStatus(Status status)
void
setText(java.lang.String drawText)
void
setTextColor(int textColor)
void
setTextCounter(int textCounter)
void
setX(int x)
void
setY(int y)
java.lang.String
toString()
Returns a string representation of this item
-
-
-
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 classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.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 classjava.lang.Object
- Returns:
- String representation.
-
-