com.planet_ink.coffee_mud.core.interfaces
Interface ItemCollection

All Superinterfaces:
java.lang.Cloneable, CMObject, java.lang.Comparable<CMObject>
All Known Subinterfaces:
Deity, GridLocale, ItemPossessor, LocationRoom, MOB, Room
All Known Implementing Classes:
Alligator, AngryCitizen, Ape, Assassin, Beaver, Bee, BlackBear, BlackDragon, BlueDragon, BrassDragon, BronzeDragon, BrownBear, BrownSnake, Buck, Buffalo, Bugbear, Bull, Cat, CaveGrid, CaveMaze, CaveRoom, CaveSurface, Centaur, Centipede, Cheetah, Chicken, Chimp, Citizen, CityStreet, ClimbableLedge, ClimbableSurface, Cobra, CommonBat, CopperDragon, Cougar, Cow, Coyote, Crocodile, Deer, DefaultItemCollection, Desert, DesertGrid, DesertMaze, DesertThinGrid, DireWolf, Doe, Dog, Dolphin, Doppleganger, Dragon, DrowElf, DrowPriestess, DrowWarrior, DrowWizard, Duck, Elephant, EndlessOcean, EndlessSky, EndlessThinOcean, EndlessThinSky, Falcon, FireGiant, FlyingInsect, Fox, Frog, FrostGiant, FrozenMountains, FrozenPlains, GardenSnake, GenAuctioneer, GenBanker, GenCow, GenDeity, GenHorse, GenLibrarian, GenMob, GenPostman, GenRideable, GenShopkeeper, GenUndead, GiantBat, GiantScorpion, Gnoll, Goat, GoatDoe, Goblin, GoldDragon, Gorilla, GreatLake, GreatThinLake, GreenDragon, Hawk, HeavenlyServent, HideoutShelter, HillGiant, Hills, HillsGrid, HillsThinGrid, Hornet, Horse, HotRoom, IcePlains, IceRoom, IndoorInTheAir, IndoorShallowWater, IndoorUnderWater, IndoorUnderWaterColumnGrid, IndoorUnderWaterGrid, IndoorUnderWaterThinGrid, IndoorWaterSurface, IndoorWaterSurfaceColumn, IndoorWaterThinSurface, InTheAir, InvisibleStalker, Jaguar, Jungle, JungleGrid, JungleThinGrid, Kitten, LargeBat, LargeCaveRoom, LargeStoneRoom, LargeWoodRoom, Lion, Lizard, LizardMan, LizardManShaman, LongerRoad, LongestRoad, LongRoad, MagicFreeRoom, MagicShelter, MetalRoom, MetalRoomMaze, Minotaur, Monkey, MountainLion, Mountains, MountainsGrid, MountainsMaze, MountainsThinGrid, MountainSurface, MountainSurfaceGrid, MountainSurfaceThinGrid, Mouse, Naga, OceanGrid, OceanThinGrid, Ogre, Orc, OverTheLedge, Owl, Panther, Parakeet, Pegasus, PegasusGreater, Penguin, Pig, Plains, PlainsGrid, PlainsThinGrid, Puppy, Python, Rabbit, Rat, Rattlesnake, Raven, RedDragon, Road, RoadGrid, RoadThinGrid, SaltWaterSurface, SaltWaterSurfaceColumn, SaltWaterThinSurface, Scorpion, Seal, SeaPort, SewerMaze, SewerRoom, ShallowWater, Shark, Sheep, Shore, SilverDragon, Skeleton, Snake, SpacePort, Spider, Squirrel, StdAuctioneer, StdBanker, StdDeity, StdFactoryMOB, StdGrid, StdLibrarian, StdMaze, StdMOB, StdPostman, StdRideable, StdRoom, StdShopKeeper, StdThinGrid, StoneGiant, StoneGolem, StoneGrid, StoneMaze, StoneRoom, StoneThinGrid, Swamp, SwampGrid, SwampThinGrid, Swordfish, Teacher, ThinRoom, Tiger, Toad, TreeSurface, Troll, Turtle, UmberHulk, Undead, UnderSaltWater, UnderSaltWaterColumnGrid, UnderSaltWaterGrid, UnderSaltWaterMaze, UnderSaltWaterThinGrid, UnderWater, UnderWaterColumnGrid, UnderWaterGrid, UnderWaterMaze, UnderWaterThinGrid, Vulture, Walrus, WaterSurface, WaterSurfaceColumn, WaterThinSurface, WeakItemCollection, WetCaveGrid, WetCaveMaze, WetCaveRoom, Whale, Whirlpool, WhiteBear, WhiteDragon, WildEagle, Wolf, Wolverine, WoodenDeck, WoodRoom, WoodRoomGrid, WoodRoomMaze, WoodRoomThinGrid, Woods, WoodsGrid, WoodsMaze, WoodsThinGrid, Worm, Wyvern, Zombie

public interface ItemCollection
extends CMObject

An abstract interface for something capable of grouping items together


Method Summary
 void addItem(Item item)
          Adds a new item to its possessor.
 void delAllItems(boolean destroy)
          Removes all items from this collection
 void delItem(Item item)
          Removes the item from this possessor.
 void eachItem(EachApplicable<Item> applier)
          Applies the given code to each item in this collection
 Item findItem(Item goodLocation, java.lang.String itemID)
          Returns the item in the given container that matches the given itemID, whether by full name, description, class ID, or partial name (if no fuller name is found).
 Item findItem(java.lang.String itemID)
          Returns the item in this possessor that matches the given itemID, whether by full name, description, class ID, or partial name (if no fuller name is found).
 java.util.List<Item> findItems(Item goodLocation, java.lang.String itemID)
          Returns all items in the given container that matches the given itemID, whether by full name, description, class ID, or partial name (if no fuller names are found).
 java.util.List<Item> findItems(java.lang.String itemID)
          Returns all items in this possessor that matches the given itemID, whether by full name, description, class ID, or partial name (if no fuller names are found).
 Item getItem(int i)
          Returns the item at the given index, regardless of container status, visibility, or other modifiers.
 Item getRandomItem()
          Returns a random item in this collection, or null
 boolean isContent(Item item)
          Returns whether the given item is in this possessors list.
 java.util.Enumeration<Item> items()
          An enumeration of all the items at this possessor.
 int numItems()
          Returns the total number of items at this possessor, regardless of container status.
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, ID, initializeClass, name, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

addItem

void addItem(Item item)
Adds a new item to its possessor. By default, the item is added in a default resting state -- no containers, timeouts, or other modifiers are set. Duplicates will not be permitted.

Parameters:
item - the item to add
See Also:
delItem(Item)

delItem

void delItem(Item item)
Removes the item from this possessor.

Parameters:
item - the item to remove

numItems

int numItems()
Returns the total number of items at this possessor, regardless of container status.

Returns:
the total number of items

getItem

Item getItem(int i)
Returns the item at the given index, regardless of container status, visibility, or other modifiers.

Parameters:
i - the index of the item
Returns:
the item at that index, or null if its not found

getRandomItem

Item getRandomItem()
Returns a random item in this collection, or null

Returns:
a random item in this collection, or null

items

java.util.Enumeration<Item> items()
An enumeration of all the items at this possessor.

Returns:
enumeration of all the items at this possessor.

findItem

Item findItem(Item goodLocation,
              java.lang.String itemID)
Returns the item in the given container that matches the given itemID, whether by full name, description, class ID, or partial name (if no fuller name is found). Handles indexing for duplicate-named items.

Parameters:
goodLocation - the container to look in, or null for none
itemID - the name or partial name of the item to fetch
Returns:
the item found, or null

findItem

Item findItem(java.lang.String itemID)
Returns the item in this possessor that matches the given itemID, whether by full name, description, class ID, or partial name (if no fuller name is found). Handles indexing for duplicate-named items.

Parameters:
itemID - the name or partial name of the item to fetch
Returns:
the item found, or null

findItems

java.util.List<Item> findItems(Item goodLocation,
                               java.lang.String itemID)
Returns all items in the given container that matches the given itemID, whether by full name, description, class ID, or partial name (if no fuller names are found).

Parameters:
goodLocation - the container to look in, or null for none
itemID - the name or partial name of the item to fetch
Returns:
the item found, or null

findItems

java.util.List<Item> findItems(java.lang.String itemID)
Returns all items in this possessor that matches the given itemID, whether by full name, description, class ID, or partial name (if no fuller names are found).

Parameters:
itemID - the name or partial name of the item to fetch
Returns:
the item found, or null

isContent

boolean isContent(Item item)
Returns whether the given item is in this possessors list.

Parameters:
item - the item to check
Returns:
true if the item was found, and false otherwise

delAllItems

void delAllItems(boolean destroy)
Removes all items from this collection

Parameters:
destroy - true to also destroy the items

eachItem

void eachItem(EachApplicable<Item> applier)
Applies the given code to each item in this collection

Parameters:
applier - code to execute against each object