Java Reference
In-Depth Information
/**
* Return the name of the player, as a <code>String</code>
*/
String getName();
/**
* Return a <code>String</code> that is the name of the
* team for this player.
*/
Team getTeam();
/**
* Return the <code>Position</code> played by this player
* @return the <code>Position</code> of this player,
* which will be used to determine the roles that the
* player has.
*/
Position getPosition();
/**
* Set the <code>Position</code> of the player
* @param pos the <code>Position</code> played
* by this player.
*/
void setPosition(Position pos);
}
We can now collect a group of players into a Team , a container type that might have an inter-
face something like:
package org.oreilly.javaGoodParts.examples.statistics;
import java.util.List;
/**
* The <code>Team</code> interface, which defines
* the notion of a team for our statistics package. A
* team is, at first incarnation, simply a collection of
* players. All teams have a name.
*/
public interface Team {
/**
* Return a <code>String</code> that is the name of
* this team.
Search WWH ::




Custom Search