Class AllBeastsPack

java.lang.Object
  extended by AllBeastsPack
All Implemented Interfaces:
IPackFinder

public class AllBeastsPack
extends java.lang.Object
implements IPackFinder

A pack that just gives back all the beasts in the world.

Author:
CPSC 111 instructors

Constructor Summary
AllBeastsPack(IBeastProvider provider)
          Construct a new AllBeastsPack.
 
Method Summary
 BeastInfo getLeader(BeastInfo beast)
          Return the leader of the pack: whoever goes first.
 BeastInfo[] getPack(BeastInfo beast)
          Return a pack of all the beasts in the world.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AllBeastsPack

public AllBeastsPack(IBeastProvider provider)
Construct a new AllBeastsPack.

Parameters:
provider - a non-null provider defining the world of beasts available
Method Detail

getPack

public BeastInfo[] getPack(BeastInfo beast)
Return a pack of all the beasts in the world.

Specified by:
getPack in interface IPackFinder
Parameters:
beast - info about the beast whose pack we're constructing
Returns:
a non-null (but possibly empty) list of non-null BeastInfo objects for the beasts in the given beast's pack. Note: the pack may or may not contain the provided beast.

getLeader

public BeastInfo getLeader(BeastInfo beast)
Return the leader of the pack: whoever goes first. Note: this may be the same as the Beast requesting a pack. Returns null for an empty world.

Specified by:
getLeader in interface IPackFinder
Parameters:
beast - info about the beast whose pack leader we're finding
Returns:
the leader of the given beast's pack, or null if no leader was found. Note: the leader may or may not be the provided beast.