dip.world
Class Power

java.lang.Object
  extended bydip.world.Power
All Implemented Interfaces:
java.lang.Comparable, java.io.Serializable

public class Power
extends java.lang.Object
implements java.lang.Comparable, java.io.Serializable

A Power represents player in the game.

See Also:
Serialized Form

Constructor Summary
Power(java.lang.String[] names, java.lang.String adjective, boolean isActive)
          Create a new Power.
 
Method Summary
 int compareTo(java.lang.Object obj)
          Implementation of Comparable interface
 java.lang.String getAdjective()
          Returns the adjective of the power (e.g., power France, adjective is French)
 java.lang.String getName()
          Returns the name of the power.
 java.lang.String[] getNames()
          Get all names.
 int hashCode()
          Implementation of Object.hashCode()
 boolean isActive()
          Determines if this power is active.
 java.lang.String toString()
          Implementation of Object.toString()
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Power

public Power(java.lang.String[] names,
             java.lang.String adjective,
             boolean isActive)
Create a new Power.

The first name in the names array (index position 0) must be the full display name of the power. Names beyond index 0 are optional, and are "alternate" names (e.g., "Britain" instead of "England").

All fields are required and must be non-null/non-zero-length; Names (not adjectives) should not contain whitespace, and must not be empty ("") or null.

This should generally not be used, except for when a game is first created. Note that Power uses instance equality, so two Power() objects created with the same arguments will NOT be the same.

Method Detail

getName

public java.lang.String getName()
Returns the name of the power. Never returns null.


getAdjective

public java.lang.String getAdjective()
Returns the adjective of the power (e.g., power France, adjective is French)


getNames

public java.lang.String[] getNames()
Get all names. There is always at least one. Does not include adjectives.


isActive

public boolean isActive()
Determines if this power is active. Only active powers can order units.


hashCode

public int hashCode()
Implementation of Object.hashCode()


toString

public java.lang.String toString()
Implementation of Object.toString()


compareTo

public int compareTo(java.lang.Object obj)
Implementation of Comparable interface

Specified by:
compareTo in interface java.lang.Comparable


Copyright 2002-2004 Zachary DelProposto / jDip Development Team. All Rights Reserved.