dip.world
Class Unit.Type

java.lang.Object
  extended bydip.world.Unit.Type
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
Unit

public static class Unit.Type
extends java.lang.Object
implements java.io.Serializable

A Type is the class of unit, for example, Army or Fleet.

Type constans should be used; new Type objects should not be created unless the game concepts are being extended.

See Also:
Serialized Form

Field Summary
static Unit.Type ARMY
          Constant representing an Army
static Unit.Type FLEET
          Constant representing a Fleet
static Unit.Type UNDEFINED
          Constant representing an unknown type
static Unit.Type WING
          Constant representing a Wing
 
Constructor Summary
protected Unit.Type(java.lang.String internalName)
          Create a new Type
 
Method Summary
 java.lang.String getFullName()
          Get the full name of this type (e.g., 'Army')
 java.lang.String getFullNameWithArticle()
          Get the full name, including an article
 java.lang.String getShortName()
          Get the short name of this type (e.g., 'A')
 int hashCode()
          Returns the hashcode
static Unit.Type parse(java.lang.String text)
          Returns a type constant corresponding to the input.
protected  java.lang.Object readResolve()
          Assigns serialized objects to a single constant reference
 java.lang.String toString()
          Get the short name
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ARMY

public static final Unit.Type ARMY
Constant representing an Army


FLEET

public static final Unit.Type FLEET
Constant representing a Fleet


WING

public static final Unit.Type WING
Constant representing a Wing


UNDEFINED

public static final Unit.Type UNDEFINED
Constant representing an unknown type

Constructor Detail

Unit.Type

protected Unit.Type(java.lang.String internalName)
Create a new Type

Method Detail

getFullName

public java.lang.String getFullName()
Get the full name of this type (e.g., 'Army')


getShortName

public java.lang.String getShortName()
Get the short name of this type (e.g., 'A')


toString

public java.lang.String toString()
Get the short name


getFullNameWithArticle

public java.lang.String getFullNameWithArticle()
Get the full name, including an article


hashCode

public int hashCode()
Returns the hashcode


parse

public static Unit.Type parse(java.lang.String text)
Returns a type constant corresponding to the input. Case insensitive. This will parse localized names, AS WELL AS the standard English names. So, for English names (and all other languages):
		null -> Type.UNDEFINED
		'f' or 'fleet' -> Type.FLEET
		'a' or 'army' -> Type.ARMY
		'w' or 'wing' -> Type.WING
		any other -> null
	


readResolve

protected java.lang.Object readResolve()
                                throws java.io.ObjectStreamException
Assigns serialized objects to a single constant reference

Throws:
java.io.ObjectStreamException


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