org.starhope.appius.game
Class ClothingItem

java.lang.Object
  extended by org.starhope.appius.sql.SQLPeerDatum
      extended by org.starhope.appius.game.InventoryItem
          extended by org.starhope.appius.game.ClothingItem
All Implemented Interfaces:
Serializable

public class ClothingItem
extends InventoryItem

Author:
brpocock
See Also:
Serialized Form

Field Summary
private  Colour color
          The colour filter to apply to this clothing item's first layer.
private static long serialVersionUID
          Java serialization ID serialVersionUID (long)
 
Fields inherited from class org.starhope.appius.game.InventoryItem
active, CLOTHES, FURNITURE, GAME_EQUIP_ITEM, id, MUSIC, ownerID, PATTERNS, PIVITZ, slotNumber, STATIONERY, STRUCTURE, T_Backpacks, T_Ceiling, T_Ceiling_Furniture, T_Dresses, T_Ears, T_Eyes, T_Floor_Furniture, T_Flooring, T_Game_Equip_Item, T_Music, T_Neck, T_Orbitz, T_Pants, T_Pattern, T_Pet, T_Pivitz, T_Shirts, T_Stationery, T_TootBook_Avatar_BG, T_TootBook_Box_Style, T_TootBook_Icon, T_TootBook_Page_BG, T_TootBook_Title_BG, T_TootBookTheme, T_Tops, T_Vehicle, T_Wall_Furniture, T_Wallpaper, TB_AVATAR_BG, TB_BOX_STYLES, TB_ICON, TB_PAGE_BG, TB_TITLE_BG, type, Type_Backpacks, Type_Ceiling, Type_Ceiling_Furniture, Type_Dresses, Type_Ears, Type_Eyes, Type_Floor_Furniture, Type_Flooring, Type_Music, Type_Neck, Type_Orbitz, Type_Pants, Type_Pattern, Type_Pivitz, Type_Shirts, Type_Tops, Type_Wall_Furniture, Type_Wallpaper
 
Fields inherited from class org.starhope.appius.sql.SQLPeerDatum
hackyDatabaseConnection
 
Constructor Summary
ClothingItem()
          Create a non-specific clothing item instance.
ClothingItem(int getID, Colour colour, int slot)
           
 
Method Summary
protected  void assertValidType(InventoryItemType t)
          TODO: document this method (brpocock, Nov 19, 2009)
protected  void assertValidTypeID(long testTypeID)
          This is an overriding method.
static String[] getClothingLayerNames()
          get the names of layers/mount points for clothing
 Colour getColor()
           
 String getMountPoint()
           
 boolean isADress()
           
 boolean isAShirt()
           
 boolean isPants()
           
protected  void set(ResultSet rs)
          This is an overriding method.
 void setColor(Colour color1)
           
protected  void setFromInventory(ResultSet inv)
          TODO: document this method (brpocock, Nov 19, 2009)
 org.json.JSONObject toJSON()
          This is an overriding method.
 String toString()
          This is an overriding method.
 
Methods inherited from class org.starhope.appius.game.InventoryItem
asClothing, asHomeDecorItem, equals, equip, flush, getByID, getByID, getCacheUniqueID, getClassForThisType, getClassForType, getClassForType, getFromInventory, getID, getItemClass, getOwner, getOwnerID, getSlotNumber, getType, getTypeID, getTypesOfClothingT, getTypesOfFurnitureT, getTypesOfHomeDecorT, getTypesOfStructureT, getTypesOfWearablesT, hasANomen, hashCode, identifiesAs, isActive, isAPet, isClothingOnly, isFurniture, isMusic, isPattern, isPet, isPivitz, isStructure, isVehicle, isWearable, pullFromInventory, setActive, setOwner, setOwnerID, setSlotHarsh, setSlotNumber, setType, setTypeID, unequip
 
Methods inherited from class org.starhope.appius.sql.SQLPeerDatum
changed, findInCache, get, prepareX, prepareX, saveInCache, set
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
Java serialization ID serialVersionUID (long)

See Also:
Constant Field Values

color

private Colour color
The colour filter to apply to this clothing item's first layer. This is typically used only for patterns, and can be null for all non-colorised items.

Constructor Detail

ClothingItem

ClothingItem()
Create a non-specific clothing item instance.


ClothingItem

public ClothingItem(int getID,
                    Colour colour,
                    int slot)
             throws GameLogicException,
                    NotFoundException
Parameters:
getID - the item ID
colour - The colour filter to apply to this item (if any); or null to remain uncolored
slot - the unique slot number in inventory for this particular instance of the type of item
Throws:
GameLogicException - if the item isn't clothing
NotFoundException - if the item can't be found in the database
Method Detail

getClothingLayerNames

public static String[] getClothingLayerNames()
get the names of layers/mount points for clothing

Returns:
an array of valid names

assertValidType

protected void assertValidType(InventoryItemType t)
                        throws GameLogicException
Description copied from class: InventoryItem
TODO: document this method (brpocock, Nov 19, 2009)

Specified by:
assertValidType in class InventoryItem
Parameters:
t - WRITEME
Throws:
GameLogicException - WRITEME
See Also:
InventoryItem.assertValidType(org.starhope.appius.types.InventoryItemType)

assertValidTypeID

protected void assertValidTypeID(long testTypeID)
                          throws GameLogicException
This is an overriding method.

Overrides:
assertValidTypeID in class InventoryItem
Parameters:
testTypeID - The type ID to be checked
Throws:
GameLogicException - if the type ID is not of the types supported by this class
See Also:
InventoryItem.assertValidTypeID(long)

getColor

public Colour getColor()
Returns:
the colour

getMountPoint

public String getMountPoint()
Overrides:
getMountPoint in class InventoryItem
Returns:
the mount point of the clothing item, or the encoded string describing the location of a furniture item
See Also:
InventoryItem.getMountPoint()

isADress

public boolean isADress()
Returns:
true, if and only if the item is a dress

isAShirt

public boolean isAShirt()
Returns:
true, if and only if the item is a shirt (and not a dress)

isPants

public boolean isPants()
Returns:
true, if this item is a pair of pants or equivalent (e.g. skirt, shorts, whatever).

set

protected void set(ResultSet rs)
            throws SQLException
This is an overriding method.

Specified by:
set in class SQLPeerDatum
Parameters:
rs - The result of an SQL query, with the cursor already pointed at the row describing this specific instance of the object.
Throws:
SQLException - if the database fails somehow
See Also:
SQLPeerDatum.set(java.sql.ResultSet)

setColor

public void setColor(Colour color1)
Parameters:
color1 - the colour

setFromInventory

protected void setFromInventory(ResultSet inv)
                         throws SQLException
Description copied from class: InventoryItem
TODO: document this method (brpocock, Nov 19, 2009)

Specified by:
setFromInventory in class InventoryItem
Parameters:
inv - WRITEME
Throws:
SQLException - if the inventory record can't be interpreted
See Also:
InventoryItem.setFromInventory(java.sql.ResultSet)

toJSON

public org.json.JSONObject toJSON()
This is an overriding method.

Overrides:
toJSON in class InventoryItem
Returns:
This object's data, serialized into JSON form.
See Also:
InventoryItem.toJSON()

toString

public String toString()
This is an overriding method.

Overrides:
toString in class InventoryItem
See Also:
Object.toString()