cz.cuni.amis.pogamut.ut2004.communication.translator.itemdescriptor
Class ItemTranslator

java.lang.Object
  extended by cz.cuni.amis.pogamut.ut2004.communication.translator.itemdescriptor.ItemTranslator

public class ItemTranslator
extends java.lang.Object

Main class responsible for the item decoration.

Items in UT2004 has a lots of characteristics which don't change over the time (at least during one game). As it is pointless to send all those information every time an item is perceived by a bot, those information are sent through the ITCMsgs (ItemCategory). This message is used in ItemTranslator as a configuration message for an ItemDescriptor.

ItemDescriptor contains all characteristics available for the corresponding UTClass of items and is returned by the ItemTranslator. This description is then attached to the item (in fact to all item events like AIN, INV, IPK).

Now how does it work insight? ItemTranslator uses a set of DescriptorFactories (one for each type of an item). ITCMsg messages are usually sent at the beginning of the game (classes for all items in the map). But they can arrive in the middle of the game for a new category of an item. TODO: maybe it is rather ItemDecorator.


Constructor Summary
ItemTranslator()
           
 
Method Summary
 void addCustomUserDescriptor(GeneralDescriptor userDescriptor)
          Adds custom user descriptor.
 ItemDescriptor createDescriptor(ItemCategory message)
          Default Pogamut descriptors will be created for all UT2004 items.
 ItemDescriptor getDefaultDescriptor(ItemType type)
          Gets default Pogamut descriptor for this item.
 ItemDescriptor getDescriptor(ItemType type)
          Gets descriptor for this item.
 ItemDescriptor getDescriptor(ItemTyped msg)
           
 ItemType[] getItemTypes()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ItemTranslator

public ItemTranslator()
Method Detail

getItemTypes

public ItemType[] getItemTypes()

getDescriptor

public ItemDescriptor getDescriptor(ItemTyped msg)

getDescriptor

public ItemDescriptor getDescriptor(ItemType type)
Gets descriptor for this item. NOTE: User descriptors will override default Pogamut descriptors.

Parameters:
type -
Returns:

getDefaultDescriptor

public ItemDescriptor getDefaultDescriptor(ItemType type)
Gets default Pogamut descriptor for this item.

Parameters:
type -
Returns:

addCustomUserDescriptor

public void addCustomUserDescriptor(GeneralDescriptor userDescriptor)
Adds custom user descriptor.

Parameters:
userDescriptor -

createDescriptor

public ItemDescriptor createDescriptor(ItemCategory message)
Default Pogamut descriptors will be created for all UT2004 items.

Parameters:
message -