jp.ac.nagoyau.is.ss.kishii.suntori.message
Class RCRSCSMessage

java.lang.Object
  extended by jp.ac.nagoyau.is.ss.kishii.suntori.message.RCRSCSMessage
All Implemented Interfaces:
IMessage
Direct Known Subclasses:
ReportMessage, TaskMessage, WorldInformation

public abstract class RCRSCSMessage
extends java.lang.Object
implements IMessage

This class represent the transmitted message.

Author:
takefumi

Field Summary
protected static DataType[] COMMON_DATA_TYPE
           
protected  java.util.List<RCRSCSData<?>> data
           
protected  BaseMessageType messageType
           
 
Constructor Summary
RCRSCSMessage(BaseMessageType type, int time)
          Constructor
RCRSCSMessage(BaseMessageType type, java.util.List<java.lang.Integer> bitList, int offset, java.util.EnumMap<DataType,java.lang.Integer> bitSizeMap)
          The method that the library use to convert the message.
RCRSCSMessage(java.util.List<RCRSCSData<?>> data, BaseMessageType type)
          Constructor
 
Method Summary
 boolean equals(java.lang.Object obj)
           
protected  int getBrokenness(int index)
           
protected  int getBuriedness(int index)
           
protected  rescuecore2.misc.Pair<java.lang.Integer,java.lang.Integer> getCoodinate(int index)
           
protected  int getDamage(int index)
           
 java.util.List<RCRSCSData<?>> getData()
          Return list of data registered on the message.
protected  RCRSCSData<?> getData(DataType dType, int index)
          Return data that have specified DataType and index.
This method is only used in the class extending this class.
protected  DataType[] getDataTypeArray()
           
protected  java.util.List<rescuecore2.worldmodel.EntityID> getEntityIDList(DataType type, int index)
           
protected  int getFieryness(int index)
           
protected  int getHP(int index)
           
protected  rescuecore2.worldmodel.EntityID getID(DataType dType, int index)
          Return data(EntityID) that have specified DataType and index.
This method is only used in the class extending this class.
 int getMessageBitSize(java.util.EnumMap<DataType,java.lang.Integer> bitSizeMap)
          Return bit num of this message.
 BaseMessageType getMessageType()
          Return type of this message.
protected  int getRepairCost(int index)
           
 int getSendTime()
          Return stem num that the message is created.
protected  int getSendTime(int index)
          Return stem num that the message is created.
protected  int getWater(int index)
           
protected  int getWaterPower(int index)
           
 int hashCode()
           
 boolean isSendable()
          This method confirm whether data necessary for sending message are existing.
If not, return false.
protected  void setCoorinate(rescuecore2.misc.Pair<java.lang.Integer,java.lang.Integer> cor)
           
 void setData(RCRSCSData<?> data)
          Register data on the message.
 void setData(RCRSCSData<?> data, int index)
          Register data on the message using specified index.
If message have some DataType.AREA, we can assign where to be setted the adding data.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messageType

protected BaseMessageType messageType

COMMON_DATA_TYPE

protected static final DataType[] COMMON_DATA_TYPE

data

protected java.util.List<RCRSCSData<?>> data
Constructor Detail

RCRSCSMessage

public RCRSCSMessage(BaseMessageType type,
                     int time)

Constructor

Parameters:
type -
time -

RCRSCSMessage

public RCRSCSMessage(java.util.List<RCRSCSData<?>> data,
                     BaseMessageType type)

Constructor

Parameters:
data -
type -

RCRSCSMessage

public RCRSCSMessage(BaseMessageType type,
                     java.util.List<java.lang.Integer> bitList,
                     int offset,
                     java.util.EnumMap<DataType,java.lang.Integer> bitSizeMap)
The method that the library use to convert the message.

Parameters:
type -
bitList -
offset -
bitSizeMap -
Method Detail

getMessageBitSize

public int getMessageBitSize(java.util.EnumMap<DataType,java.lang.Integer> bitSizeMap)
Return bit num of this message.

Parameters:
bitSizeMap -
Returns:
ビットサイズ
bit num

getData

public java.util.List<RCRSCSData<?>> getData()
Description copied from interface: IMessage
Return list of data registered on the message.

Specified by:
getData in interface IMessage
Returns:

setData

public void setData(RCRSCSData<?> data)
Description copied from interface: IMessage
Register data on the message.

Specified by:
setData in interface IMessage
Parameters:
data - setted data

setData

public void setData(RCRSCSData<?> data,
                    int index)
Description copied from interface: IMessage
Register data on the message using specified index.
If message have some DataType.AREA, we can assign where to be setted the adding data.

Specified by:
setData in interface IMessage
Parameters:
data - setted data

isSendable

public boolean isSendable()
This method confirm whether data necessary for sending message are existing.
If not, return false.

Returns:
this message is senndable : true
otherwise : false

getMessageType

public BaseMessageType getMessageType()
Return type of this message.

Returns:
type of message

hashCode

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

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getData

protected RCRSCSData<?> getData(DataType dType,
                                int index)
Return data that have specified DataType and index.
This method is only used in the class extending this class.

Parameters:
dType -
index -
Returns:

getID

protected rescuecore2.worldmodel.EntityID getID(DataType dType,
                                                int index)
Return data(EntityID) that have specified DataType and index.
This method is only used in the class extending this class.

Parameters:
dType -
index -
Returns:
EntityID

getHP

protected int getHP(int index)
Parameters:
index -
Returns:

getSendTime

protected int getSendTime(int index)
Return stem num that the message is created.

Parameters:
index -
Returns:

getSendTime

public int getSendTime()
Return stem num that the message is created.

Returns:
stem num

getDamage

protected int getDamage(int index)

getBuriedness

protected int getBuriedness(int index)

getFieryness

protected int getFieryness(int index)

getWaterPower

protected int getWaterPower(int index)

getWater

protected int getWater(int index)

getRepairCost

protected int getRepairCost(int index)

getBrokenness

protected int getBrokenness(int index)

getCoodinate

protected rescuecore2.misc.Pair<java.lang.Integer,java.lang.Integer> getCoodinate(int index)

getEntityIDList

protected java.util.List<rescuecore2.worldmodel.EntityID> getEntityIDList(DataType type,
                                                                          int index)

setCoorinate

protected void setCoorinate(rescuecore2.misc.Pair<java.lang.Integer,java.lang.Integer> cor)

getDataTypeArray

protected DataType[] getDataTypeArray()