|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcz.cuni.pogamut.MessageObjects.MessageObject
public class MessageObject
MessageObject serves as a parent of all messages passed from GB to agent.
Its children are entities which represent the objects of the game (player, inventory, noise, etc.).
It has two methods essential for delta compression during networking - diff and update
diff - it is called by Parser when it has seen the object before, so it uses diff to create object that is much smaller and therefore less load the network diff also updates old object in the database
update - after receiving diffed object, Client call Update to obtain updated object
NOTE!!! : MessageObject doesn't implement HashCode. Its blank constructor is used in Parser during parsing of messages, so it is not possible to use it as a key in hash maps but there is a unique ID, which is able to serve as a key :)
Field Summary | |
---|---|
int |
ID
int ID in Parser. |
MessageType |
type
type of message from GameBot |
static java.lang.String[] |
types
static final structure which serves to make people happy;) just for more readable printout NOTE!!! |
java.lang.String |
UnrealID
|
boolean |
visible
|
Constructor Summary | |
---|---|
MessageObject()
|
|
MessageObject(MessageType type)
|
|
MessageObject(MessageType type,
int ID,
java.lang.String UnrealID)
constructor |
|
MessageObject(MessageType type,
int ID,
java.lang.String UnrealID,
boolean visible)
copy constructor |
Method Summary | |
---|---|
java.lang.Object |
clone()
clone object - for hard copying |
boolean |
diff(MessageObject old)
change this object that all properties that are same as old will be set to null or 0 or similar. |
boolean |
equals(java.lang.Object arg)
|
int |
getID()
|
MessageType |
getType()
getters |
java.lang.String |
getUnrealID()
|
boolean |
getVisibility()
|
boolean |
hasID()
|
boolean |
isVisible()
|
void |
setID(int id)
|
void |
setType(MessageType type)
|
void |
setUnrealID(java.lang.String unrealID)
|
void |
setVisible(boolean visible)
|
java.lang.String |
toString()
|
void |
update(MessageObject newMsgObj)
Writes non-null information from newMsgObj to current one. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String[] types
NOTE!!! when you add some new message, you must add it to as the constant here and add its description string to this field as well!!!
public MessageType type
public int ID
public java.lang.String UnrealID
public boolean visible
Constructor Detail |
---|
public MessageObject(MessageType type, int ID, java.lang.String UnrealID)
type
- ID
- UnrealID
- public MessageObject(MessageType type, int ID, java.lang.String UnrealID, boolean visible)
type
- ID
- UnrealID
- visible
- public MessageObject()
public MessageObject(MessageType type)
Method Detail |
---|
public java.lang.Object clone()
clone
in class java.lang.Object
public MessageType getType()
public int getID()
public java.lang.String getUnrealID()
public boolean getVisibility()
getVisibility
in interface Visible
public boolean diff(MessageObject old)
old
- Object we use as reference for change.
public java.lang.String toString()
toString
in class java.lang.Object
public void update(MessageObject newMsgObj)
newMsgObj
- public boolean equals(java.lang.Object arg)
equals
in class java.lang.Object
public boolean isVisible()
public void setVisible(boolean visible)
public void setID(int id)
public void setType(MessageType type)
public void setUnrealID(java.lang.String unrealID)
public boolean hasID()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |