public enum ShipFactoryImpl extends java.lang.Enum<ShipFactoryImpl> implements ShipFactory
ShipFactory
. There is a single instance.Enum Constant and Description |
---|
INSTANCE
Singleton of ShipFactoryImpl
|
Modifier and Type | Method and Description |
---|---|
Ship |
createShip(int size)
Creates a ship.
|
static ShipFactoryImpl |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static ShipFactoryImpl[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ShipFactoryImpl INSTANCE
public static ShipFactoryImpl[] values()
for (ShipFactoryImpl c : ShipFactoryImpl.values()) System.out.println(c);
public static ShipFactoryImpl valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic Ship createShip(int size)
createShip
in interface ShipFactory
size
- size of the ship. The value must be between 0 and GlobalProperties.MAX_SIZE
java.lang.IllegalArgumentException
- if the size is invalid