Package marauroa.common.game
Class SlotOwner
java.lang.Object
marauroa.common.game.Attributes
marauroa.common.game.SlotOwner
- All Implemented Interfaces:
Cloneable
,Iterable<String>
,Serializable
interface for RP-classes that own slots
- Author:
- hendrik
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
This method add the slot to the objectvoid
This method add the slot to the objectprotected void
fill(Attributes attr)
This method fills this object with data from the attributes object passed as paramThis method returns a slot whose name is nameboolean
This method returns true if the object has that slotremoveSlot(String name)
This method is used to remove an slot of the objectprotected void
serializeRPSlots(OutputSerializer out, DetailLevel level)
slots()
Returns an unmodifiable list of the slotsReturns a iterator over the slotstoString()
This method returns a String that represent the objectvoid
writeToJson(StringBuilder out, DetailLevel level)
This method serialize the object with the given level of detail.Methods inherited from class marauroa.common.game.Attributes
add, applyDifferences, clearVisible, clone, equals, get, getBool, getDouble, getInt, getList, getLong, getRPClass, has, hashCode, instanceOf, isEmpty, iterator, put, put, put, put, put, readFromMap, readObject, remove, resetAddedAndDeletedAttributes, setAddedAttributes, setDeletedAttributes, setRPClass, setRPClass, size, toAttributeString, writeObject, writeObject
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
slots
a list of slots that this object contains
-
-
Constructor Details
-
SlotOwner
creates a new SlowOwner- Parameters:
rpclass
- RPClass definition
-
-
Method Details
-
fill
Description copied from class:Attributes
This method fills this object with data from the attributes object passed as param- Overrides:
fill
in classAttributes
- Parameters:
attr
- the attribute object to use to fill this one.- Returns:
- the object itself.
-
hasSlot
This method returns true if the object has that slot- Parameters:
name
- the name of the slot- Returns:
- true if slot exists or false otherwise
-
addSlot
This method add the slot to the object- Parameters:
name
- the RPSlot name to be added- Throws:
SlotAlreadyAddedException
- if the slot already exists
-
addSlot
This method add the slot to the object- Parameters:
slot
- the RPSlot to be added- Throws:
SlotAlreadyAddedException
- if the slot already exists
-
removeSlot
This method is used to remove an slot of the object- Parameters:
name
- the name of the slot- Returns:
- the removed slot if it is found or null if it is not found.
-
getSlot
This method returns a slot whose name is name- Parameters:
name
- the name of the slot- Returns:
- the slot or null if the slot is not found
-
slotsIterator
Returns a iterator over the slots- Returns:
- an iterator over the slots
-
slots
Returns an unmodifiable list of the slots- Returns:
- a list of the slots
-
serializeRPSlots
- Throws:
IOException
-
writeToJson
This method serialize the object with the given level of detail.- Overrides:
writeToJson
in classAttributes
- Parameters:
out
- the output bufferlevel
- the level of Detail
-
deserializeRPSlots
- Throws:
IOException
-
toString
Description copied from class:Attributes
This method returns a String that represent the object- Overrides:
toString
in classAttributes
- Returns:
- a string representing the object.
-