Class Group

java.lang.Object
  |
  +--Group
Direct Known Subclasses:
CharacterGroup, MilitaryGroup

public class Group
extends java.lang.Object

class Group exists for groups, or so-called "stacks" of units. It is an abstract class; instances will normally be from subclasses.


Field Summary
protected  Environ environ
           
protected  Planet planet
           
protected  char side
           
protected  char type
           
protected  java.util.Vector units
           
 
Constructor Summary
Group()
           
Group(Unit u)
           
 
Method Summary
 void add(Unit u)
          add() adds a Unit to the Group
protected  boolean CheckEmpty()
          Test whether Group is empty
 Environ getEnviron()
           
 java.util.Vector getGroup()
          accessor methods
 int getNumDetectedChars()
          returns the number of detected characters in the group
 int getNumMilUnits()
          getNumMilUnits() returns the number of MilitaryUnits in a vector
 int getNumUnits()
          getNumUnits() returns the number (int) of units in the Group
 Planet getPlanet()
           
 char getSide()
           
 char getType()
           
 boolean move(Charactr[] c, Environ newEnv, Group newGrp)
          move() This move() method moves an array of Charactrs from one environ to another on the same planet (no spaceship is involved).
 boolean move(Charactr[] c, Spaceship[] ships, Environ newEnv, Group newGrp)
          move() This move() method moves an array of Charactrs from one environ to another using a spaceship(s).
 boolean move(MilitaryUnit[] units, Charactr[] c, Environ newEnv)
          move() This move() method moves arrays of Military Units and Charactrs from one environ to another.
 boolean move(MilitaryUnit[] units, Charactr[] c, Spaceship[] ships, Environ newEnv)
          move() This move() method moves an array of Military Units, an array of Charactrs, and an array of Spaceships to the military group of the destination environ.
 boolean move(MilitaryUnit[] units, Environ newEnv)
          move() This move() method moves a MilitaryGroup from one environ to another.
 boolean move(MilitaryUnit[] units, Spaceship[] ships, Environ newEnv)
          move() This variation of the move() method moves a MilitaryGroup and any unmanned spaceships being moved with it from environ to another.
 boolean moveGroupFromEnvironToOrbit(Charactr[] c, Spaceship[] ships, Orbit newEnv, Group newGrp)
          moveGroupFromEnvironToOrbit() This method moves an array of Charactrs from an orbit box to an orbit box using a spaceship(s).
 boolean moveGroupFromEnvironToOrbit(MilitaryUnit[] units, Charactr[] c, Spaceship[] ships, Orbit newEnv)
          moveGroupFromEnvironToOrbit() This method moves an array of Military Units, an array of Charactrs, and an array of Spaceships to the military group of the destination orbit box.
 boolean moveGroupFromEnvironToOrbit(MilitaryUnit[] units, Orbit newEnv)
          moveGroupFromEnvironToOrbit() This method moves a MilitaryGroup from an environ to an orbit box.
 boolean moveGroupFromOrbitToEnviron(Charactr[] c, Spaceship[] ships, Environ newEnv, Group newGrp)
          moveGroupFromOrbitToEnviron This method moves an array of Charactrs from an orbit box to an environ using a spaceship(s).
 boolean moveGroupFromOrbitToEnviron(MilitaryUnit[] units, Charactr[] c, Spaceship[] ships, Environ newEnv)
          moveGroupFromOrbitToEnviron() This method moves an array of Military Units, an array of Charactrs, and an array of Spaceships to the military group of the destination environ.
 boolean moveGroupFromOrbitToEnviron(MilitaryUnit[] units, Environ newEnv)
          moveGroupFromOrbitToEnviron() This method moves a MilitaryGroup from an orbit box to an environ.
 boolean moveGroupFromOrbitToOrbit(Charactr[] c, Spaceship[] ships, Orbit newEnv, Group newGrp)
          moveGroupFromOrbitToOrbit() This method moves an array of Charactrs from an orbit box to an orbit box using a spaceship(s).
 boolean moveGroupFromOrbitToOrbit(MilitaryUnit[] units, Charactr[] c, Spaceship[] ships, Orbit newEnv)
          moveGroupFromOrbitToOrbit() This method moves an array of Military Units, an array of Charactrs, and an array of Spaceships to the military group of the destination orbit box.
 boolean moveGroupFromOrbitToOrbit(MilitaryUnit[] units, Orbit newEnv)
          moveGroupFromOrbitToOrbit() This method moves a MilitaryGroup from an orbit box to an orbit box.
 void remove(Unit u)
          remove() remove a Unit from the Group
 void setEnviron(Environ newEnv)
          modifier methods
 void setPlanet(Planet newEnv)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

units

protected java.util.Vector units

environ

protected Environ environ

planet

protected Planet planet

type

protected char type

side

protected char side
Constructor Detail

Group

public Group()

Group

public Group(Unit u)
Method Detail

getGroup

public java.util.Vector getGroup()
accessor methods


getEnviron

public Environ getEnviron()

getPlanet

public Planet getPlanet()

getType

public char getType()

getSide

public char getSide()

getNumMilUnits

public int getNumMilUnits()
getNumMilUnits() returns the number of MilitaryUnits in a vector


setEnviron

public void setEnviron(Environ newEnv)
modifier methods


setPlanet

public void setPlanet(Planet newEnv)

getNumUnits

public int getNumUnits()
getNumUnits() returns the number (int) of units in the Group


add

public void add(Unit u)
add() adds a Unit to the Group


remove

public void remove(Unit u)
remove() remove a Unit from the Group


getNumDetectedChars

public int getNumDetectedChars()
returns the number of detected characters in the group


move

public boolean move(MilitaryUnit[] units,
                    Environ newEnv)
move() This move() method moves a MilitaryGroup from one environ to another. takes a military unit array and destination environ returns true if move successful; false otherwise


move

public boolean move(Charactr[] c,
                    Environ newEnv,
                    Group newGrp)
move() This move() method moves an array of Charactrs from one environ to another on the same planet (no spaceship is involved). takes an array of charactrs, a destination environ and a destination group. returns true if move successful; false otherwise


move

public boolean move(MilitaryUnit[] units,
                    Spaceship[] ships,
                    Environ newEnv)
move() This variation of the move() method moves a MilitaryGroup and any unmanned spaceships being moved with it from environ to another. takes a military unit array, a spaceship array, and destination environ returns true if move successful; false otherwise


move

public boolean move(MilitaryUnit[] units,
                    Charactr[] c,
                    Environ newEnv)
move() This move() method moves arrays of Military Units and Charactrs from one environ to another. takes an array of military units, an array of Charactrs, and a destination environ. returns true if move successful; false otherwise


move

public boolean move(Charactr[] c,
                    Spaceship[] ships,
                    Environ newEnv,
                    Group newGrp)
move() This move() method moves an array of Charactrs from one environ to another using a spaceship(s). Takes an array of charactrs, an array of spaceships, a destination environ and a destination group. returns true if move successful; false otherwise


move

public boolean move(MilitaryUnit[] units,
                    Charactr[] c,
                    Spaceship[] ships,
                    Environ newEnv)
move() This move() method moves an array of Military Units, an array of Charactrs, and an array of Spaceships to the military group of the destination environ. Takes an array of each of the above, plus the destination environ. Returns true if sucessful, false otherwise.


moveGroupFromOrbitToEnviron

public boolean moveGroupFromOrbitToEnviron(MilitaryUnit[] units,
                                           Environ newEnv)
moveGroupFromOrbitToEnviron() This method moves a MilitaryGroup from an orbit box to an environ. takes a military unit array and destination environ returns true if move successful; false otherwise


moveGroupFromOrbitToEnviron

public boolean moveGroupFromOrbitToEnviron(Charactr[] c,
                                           Spaceship[] ships,
                                           Environ newEnv,
                                           Group newGrp)
moveGroupFromOrbitToEnviron This method moves an array of Charactrs from an orbit box to an environ using a spaceship(s). Takes an array of charactrs, an array of spaceships, a destination environ and a destination group. returns true if move successful; false otherwise


moveGroupFromOrbitToEnviron

public boolean moveGroupFromOrbitToEnviron(MilitaryUnit[] units,
                                           Charactr[] c,
                                           Spaceship[] ships,
                                           Environ newEnv)
moveGroupFromOrbitToEnviron() This method moves an array of Military Units, an array of Charactrs, and an array of Spaceships to the military group of the destination environ. Takes an array of each of the above, plus the destination environ. Returns true if sucessful, false otherwise.


moveGroupFromOrbitToOrbit

public boolean moveGroupFromOrbitToOrbit(MilitaryUnit[] units,
                                         Orbit newEnv)
moveGroupFromOrbitToOrbit() This method moves a MilitaryGroup from an orbit box to an orbit box. takes a military unit array and destination orbit returns true if move successful; false otherwise


moveGroupFromOrbitToOrbit

public boolean moveGroupFromOrbitToOrbit(Charactr[] c,
                                         Spaceship[] ships,
                                         Orbit newEnv,
                                         Group newGrp)
moveGroupFromOrbitToOrbit() This method moves an array of Charactrs from an orbit box to an orbit box using a spaceship(s). Takes an array of charactrs, an array of spaceships, a destination orbit and a destination group. returns true if move successful; false otherwise


moveGroupFromOrbitToOrbit

public boolean moveGroupFromOrbitToOrbit(MilitaryUnit[] units,
                                         Charactr[] c,
                                         Spaceship[] ships,
                                         Orbit newEnv)
moveGroupFromOrbitToOrbit() This method moves an array of Military Units, an array of Charactrs, and an array of Spaceships to the military group of the destination orbit box. Takes an array of each of the above, plus the destination orbit. Returns true if sucessful, false otherwise.


moveGroupFromEnvironToOrbit

public boolean moveGroupFromEnvironToOrbit(MilitaryUnit[] units,
                                           Orbit newEnv)
moveGroupFromEnvironToOrbit() This method moves a MilitaryGroup from an environ to an orbit box. takes a military unit array and destination orbit returns true if move successful; false otherwise


moveGroupFromEnvironToOrbit

public boolean moveGroupFromEnvironToOrbit(Charactr[] c,
                                           Spaceship[] ships,
                                           Orbit newEnv,
                                           Group newGrp)
moveGroupFromEnvironToOrbit() This method moves an array of Charactrs from an orbit box to an orbit box using a spaceship(s). Takes an array of charactrs, an array of spaceships, a destination orbit and a destination group. returns true if move successful; false otherwise


moveGroupFromEnvironToOrbit

public boolean moveGroupFromEnvironToOrbit(MilitaryUnit[] units,
                                           Charactr[] c,
                                           Spaceship[] ships,
                                           Orbit newEnv)
moveGroupFromEnvironToOrbit() This method moves an array of Military Units, an array of Charactrs, and an array of Spaceships to the military group of the destination orbit box. Takes an array of each of the above, plus the destination orbit. Returns true if sucessful, false otherwise.


CheckEmpty

protected boolean CheckEmpty()
Test whether Group is empty