megamek.common
Class TurnVectors

java.lang.Object
  extended by megamek.common.TurnVectors
All Implemented Interfaces:
java.util.Enumeration<TurnOrdered>

public class TurnVectors
extends java.lang.Object
implements java.util.Enumeration<TurnOrdered>

A handy utility class for collecting Vectors of TurnOrdered markers and then walking through them.


Constructor Summary
TurnVectors(int normalCount, int totalCount, int ssCount, int jsCount, int wsCount, int dsCount, int scCount, int aeroCount, int evenCount, int min)
          Construct empty Vectors with the given capacities.
 
Method Summary
 void addAero(TurnOrdered marker)
           
 void addDropship(TurnOrdered marker)
           
 void addEven(TurnOrdered marker)
          Add a TurnOrdered marker for a turn that must occur after all normal turns.
 void addJumpship(TurnOrdered marker)
           
 void addNormal(TurnOrdered marker)
          Add a TurnOrdered marker for a "normal" turn.
 void addSmallCraft(TurnOrdered marker)
           
 void addSpaceStation(TurnOrdered marker)
           
 void addWarship(TurnOrdered marker)
           
 int getAeroTurns()
           
 int getDropshipTurns()
           
 int getEvenTurns()
          Get the number of turns that must occur after all normal turns.
 int getJumpshipTurns()
           
 int getMin()
          Return the smallest number of times one of the TurnOrdered objects is present in the list of "normal" turns.
 int getNormalTurns()
           
 int getSmallCraftTurns()
           
 int getSpaceStationTurns()
           
 int getTotalTurns()
          Get the number of normal turns.
 int getWarshipTurns()
           
 boolean hasMoreAeroElements()
          Determine if we've iterated to the end of our aero turn markers.
 boolean hasMoreDropshipElements()
          Determine if we've iterated to the end of our dropship turn markers.
 boolean hasMoreElements()
          Determine if we've iterated to the end of our total turn markers.
 boolean hasMoreEvenElements()
          Determine if we've iterated to the end of our even turn markers.
 boolean hasMoreJumpshipElements()
          Determine if we've iterated to the end of our jumpship turn markers.
 boolean hasMoreNormalElements()
          Determine if we've iterated to the end of our turn markers.
 boolean hasMoreSmallCraftElements()
          Determine if we've iterated to the end of our small craft turn markers.
 boolean hasMoreSpaceStationElements()
          Determine if we've iterated to the end of our space station turn markers.
 boolean hasMoreWarshipElements()
          Determine if we've iterated to the end of our warship turn markers.
 TurnOrdered nextAeroElement()
          Get the next "aero" TurnOrdered marker.
 TurnOrdered nextDropshipElement()
          Get the next "dropship" TurnOrdered marker.
 TurnOrdered nextElement()
          Get the next "total" TurnOrdered marker.
 TurnOrdered nextEvenElement()
          Get the next "even" TurnOrdered marker.
 TurnOrdered nextJumpshipElement()
          Get the next "jumpship" TurnOrdered marker.
 TurnOrdered nextNormalElement()
          Get the next TurnOrdered marker.
 TurnOrdered nextSmallCraftElement()
          Get the next "small craft" TurnOrdered marker.
 TurnOrdered nextSpaceStationElement()
          Get the next "space station" TurnOrdered marker.
 TurnOrdered nextWarshipElement()
          Get the next "warship" TurnOrdered marker.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TurnVectors

public TurnVectors(int normalCount,
                   int totalCount,
                   int ssCount,
                   int jsCount,
                   int wsCount,
                   int dsCount,
                   int scCount,
                   int aeroCount,
                   int evenCount,
                   int min)
Construct empty Vectors with the given capacities.

Parameters:
normalCount - the int count of TurnOrdered object markers for normal turns
evenCount - the int count of markers for turns that occur after all normal turns.
min - the smallest int number of times one of the TurnOrdered objects appears in the normal list.
Method Detail

getEvenTurns

public int getEvenTurns()
Get the number of turns that must occur after all normal turns.

Returns:
the int count of even turns.

getTotalTurns

public int getTotalTurns()
Get the number of normal turns.

Returns:
the int count of normal turns.

getNormalTurns

public int getNormalTurns()

getSpaceStationTurns

public int getSpaceStationTurns()

getJumpshipTurns

public int getJumpshipTurns()

getWarshipTurns

public int getWarshipTurns()

getDropshipTurns

public int getDropshipTurns()

getSmallCraftTurns

public int getSmallCraftTurns()

getAeroTurns

public int getAeroTurns()

addEven

public void addEven(TurnOrdered marker)
Add a TurnOrdered marker for a turn that must occur after all normal turns.

Parameters:
marker - the TurnOrdered marker for a even turn.
Throws:
java.lang.IllegalStateException - if as many markers have been added for even turns as indicated at construction.

addNormal

public void addNormal(TurnOrdered marker)
Add a TurnOrdered marker for a "normal" turn.

Parameters:
marker - the TurnOrdered marker for a "normal" turn.
Throws:
java.lang.IllegalStateException - if as many markers have been added for normal turns as indicated at construction.

addSpaceStation

public void addSpaceStation(TurnOrdered marker)

addWarship

public void addWarship(TurnOrdered marker)

addJumpship

public void addJumpship(TurnOrdered marker)

addDropship

public void addDropship(TurnOrdered marker)

addSmallCraft

public void addSmallCraft(TurnOrdered marker)

addAero

public void addAero(TurnOrdered marker)

hasMoreNormalElements

public boolean hasMoreNormalElements()
Determine if we've iterated to the end of our turn markers.

Returns:
true if we've read all turn markers.

nextNormalElement

public TurnOrdered nextNormalElement()
Get the next TurnOrdered marker.

Returns:
the TurnOrdered marker; all "even" markers will be returned after all "normal" markers.

hasMoreEvenElements

public boolean hasMoreEvenElements()
Determine if we've iterated to the end of our even turn markers.

Returns:
true if we've read all turn markers.

nextElement

public TurnOrdered nextElement()
Get the next "total" TurnOrdered marker.

Specified by:
nextElement in interface java.util.Enumeration<TurnOrdered>
Returns:
the "total" TurnOrdered marker.

hasMoreElements

public boolean hasMoreElements()
Determine if we've iterated to the end of our total turn markers.

Specified by:
hasMoreElements in interface java.util.Enumeration<TurnOrdered>
Returns:
true if we've read all turn markers.

nextSpaceStationElement

public TurnOrdered nextSpaceStationElement()
Get the next "space station" TurnOrdered marker.

Returns:
the "space staion" TurnOrdered marker.

hasMoreSpaceStationElements

public boolean hasMoreSpaceStationElements()
Determine if we've iterated to the end of our space station turn markers.

Returns:
true if we've read all turn markers.

nextJumpshipElement

public TurnOrdered nextJumpshipElement()
Get the next "jumpship" TurnOrdered marker.

Returns:
the "jumpship" TurnOrdered marker.

hasMoreJumpshipElements

public boolean hasMoreJumpshipElements()
Determine if we've iterated to the end of our jumpship turn markers.

Returns:
true if we've read all turn markers.

nextWarshipElement

public TurnOrdered nextWarshipElement()
Get the next "warship" TurnOrdered marker.

Returns:
the "warship" TurnOrdered marker.

hasMoreWarshipElements

public boolean hasMoreWarshipElements()
Determine if we've iterated to the end of our warship turn markers.

Returns:
true if we've read all turn markers.

nextDropshipElement

public TurnOrdered nextDropshipElement()
Get the next "dropship" TurnOrdered marker.

Returns:
the "dropship" TurnOrdered marker.

hasMoreDropshipElements

public boolean hasMoreDropshipElements()
Determine if we've iterated to the end of our dropship turn markers.

Returns:
true if we've read all turn markers.

nextSmallCraftElement

public TurnOrdered nextSmallCraftElement()
Get the next "small craft" TurnOrdered marker.

Returns:
the "small craft" TurnOrdered marker.

nextAeroElement

public TurnOrdered nextAeroElement()
Get the next "aero" TurnOrdered marker.

Returns:
the "small craft" TurnOrdered marker.

hasMoreSmallCraftElements

public boolean hasMoreSmallCraftElements()
Determine if we've iterated to the end of our small craft turn markers.

Returns:
true if we've read all turn markers.

hasMoreAeroElements

public boolean hasMoreAeroElements()
Determine if we've iterated to the end of our aero turn markers.

Returns:
true if we've read all turn markers.

nextEvenElement

public TurnOrdered nextEvenElement()
Get the next "even" TurnOrdered marker.

Returns:
the "even" TurnOrdered marker.

getMin

public int getMin()
Return the smallest number of times one of the TurnOrdered objects is present in the list of "normal" turns.

Returns:
the int number of times.