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.SerializableBase 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 voidaddProperty(java.lang.String key, java.lang.Object val)Adds a property.booleanequals(java.lang.Object o)booleangetBooleanProperty(java.lang.String key)Gets the state property for the given key as int.java.lang.StringgetClassName()intgetColor()intgetEnergy()intgetEnergyMaxCount()intgetExplosionCounter()intgetID()java.lang.StringgetImageName()intgetIntProperty(java.lang.String key)Gets the state property for the given key as int.intgetMaxEnergy()java.lang.StringgetName()intgetOuterColor()java.util.Map<java.lang.String,java.lang.Object>getProperties()Gets the states properties.java.lang.ObjectgetProperty(java.lang.String key)Gets the state property for the given key.StatusgetStatus()java.lang.StringgetText()intgetTextColor()intgetTextCounter()intgetX()intgetY()inthashCode()booleanisDestroyed()booleanisExploding()booleanisInvulnerable()Checks, if the thing is invulnerable.booleanisOK()Checks if the figure is ok.voidsetColor(int color)voidsetEnergy(int energy)voidsetEnergyMaxCount(int energyMaxCount)voidsetExplosionCounter(int explosionCounter)voidsetID(int iD)voidsetImageName(java.lang.String imageName)voidsetMaxEnergy(int maxEnergy)voidsetName(java.lang.String name)voidsetOK(boolean ok)Sets if the figure is ok.voidsetOuterColor(int outerColor)voidsetStatus(Status status)voidsetText(java.lang.String drawText)voidsetTextColor(int textColor)voidsetTextCounter(int textCounter)voidsetX(int x)voidsetY(int y)java.lang.StringtoString()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:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein 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:
toStringin classjava.lang.Object- Returns:
- String representation.
-
-