wyvern.kernel.combat
Interface PartsList

All Known Implementing Classes:
Body

public interface PartsList

This interface is shared by things that have body parts that can serve as slots for weapons and armor.

Version:
1.0, Jun 08, 1998
Author:
Steve Yegge

Method Summary
 void addPart(BodyPart part)
          Adds the specified body-part to the list.
 void addPartFirst(BodyPart part)
          Adds the specified body-part to the front of the list.
 BodyPart chooseRandomPart()
          Asks for a body-part to use as a hit location, computed using the relative "weight" (size) of each body part.
 BodyPart find(GenericPredicate p)
          Iterates over the parts, looking for one that satisfies the passed predicate.
 BodyPart get(int index)
          Returns the part at the specified index, or null if the index is out of bounds.
 BodyPart getByHashcode(int hashcode)
          Retrieves a part from the list by its hashcode.
 java.util.List getParts()
          Returns the underlying list of parts in this body.
 boolean isEmpty()
          Returns true if there are no parts in the list.
 java.util.Iterator iterator()
          Returns an iterator over the parts-list.
 void removePart(BodyPart part)
          Removes the specified body-part from the list.
 int size()
          Returns the number of items in the list.
 

Method Detail

getByHashcode

public BodyPart getByHashcode(int hashcode)
Retrieves a part from the list by its hashcode.

Returns:
the part, or null

addPart

public void addPart(BodyPart part)
Adds the specified body-part to the list.


addPartFirst

public void addPartFirst(BodyPart part)
Adds the specified body-part to the front of the list.


removePart

public void removePart(BodyPart part)
Removes the specified body-part from the list.


find

public BodyPart find(GenericPredicate p)
Iterates over the parts, looking for one that satisfies the passed predicate.

Parameters:
p - the Predicate function

iterator

public java.util.Iterator iterator()
Returns an iterator over the parts-list.


get

public BodyPart get(int index)
Returns the part at the specified index, or null if the index is out of bounds.


isEmpty

public boolean isEmpty()
Returns true if there are no parts in the list.


size

public int size()
Returns the number of items in the list.


getParts

public java.util.List getParts()
Returns the underlying list of parts in this body.


chooseRandomPart

public BodyPart chooseRandomPart()
Asks for a body-part to use as a hit location, computed using the relative "weight" (size) of each body part.