Pastebin launched a little side project called HostCabi.net, check it out ;-)Don't like ads? PRO users don't see any ads ;-)
Guest

trenches1

By: ace on May 26th, 2010  |  syntax: None  |  size: 1.30 KB  |  hits: 18  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. import java.util.ArrayList;
  2. /**
  3.  * Write a description of class Trenches here.
  4.  *
  5.  * @author (your name)
  6.  * @version (a version number or a date)
  7.  */
  8. public class Trenches
  9. {
  10.    
  11.  private ArrayList<Calvary> calvary;
  12.  private ArrayList<Infantry> infantry;
  13.  private ArrayList<Tank> tank;
  14.  
  15.  
  16.     /**
  17.      * Constructor for objects of class Trenches
  18.      */
  19.     public Trenches()
  20.     {
  21.        infantry = new ArrayList<Infantry>();
  22.        calvary = new ArrayList<Calvary>();
  23.        tank = new ArrayList<Tank>();
  24.      
  25.     }
  26.  
  27.     /**
  28.      * An example of a method - replace this comment with your own
  29.      *
  30.      * @param  y   a sample parameter for a method
  31.      * @return     the sum of x and y
  32.      */
  33.     public void place(Calvary calvary, int position)
  34.     {
  35.        calvary.setPosition(position);
  36.                
  37.             }
  38.  
  39.     public void place(Infantry infantry, int position)
  40.     {
  41.        infantry.setPosition(position);
  42.                
  43.             }
  44.  
  45.             public void place(Tank tank, int position)
  46.     {
  47.        tank.setPosition(position);
  48.                
  49.             }
  50.  
  51.             public void move()
  52.             {
  53.                 calvary.move();
  54.                 infantry.move();
  55.                 tank.move();
  56.             }
  57.            
  58.            
  59. }