falyptus

AncestraR - Area Class

May 19th, 2012
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static class Area
  2. {
  3.     private int _id;
  4.     private SuperArea _superArea;
  5.     private String _name;
  6.     private ArrayList<SubArea> _subAreas = new ArrayList<SubArea>();
  7.     private final int[] cemetery;
  8.  
  9.     public Area(int id, int superArea,String name, String cemetery)
  10.     {
  11.         _id = id;
  12.         _name = name;
  13.         _superArea = World.getSuperArea(superArea);
  14.         //Si le continent n'est pas encore créer, on le créer et on l'ajoute au monde
  15.         if(_superArea == null)
  16.         {
  17.             _superArea = new SuperArea(superArea);
  18.             World.addSuperArea(_superArea);
  19.         }
  20.         this.cemetery = {Integer.parseInt(cemetery.split(";")[0]), Integer.parseInt(cemetery.split(";")[1])};
  21.     }
  22.  
  23.     public int[] getCemetery()
  24.     {
  25.         return cemetery;
  26.     }
  27.  
  28.     public String get_name()
  29.     {
  30.         return _name;
  31.     }
  32.    
  33.     public int get_id()
  34.     {
  35.         return _id;
  36.     }
  37.  
  38.     public SuperArea get_superArea()
  39.     {
  40.         return _superArea;
  41.     }
  42.  
  43.     public void addSubArea(SubArea sa)
  44.     {
  45.         _subAreas.add(sa);
  46.     }
  47.  
  48.     public ArrayList<Carte> getMaps()
  49.     {
  50.         ArrayList<Carte> maps = new ArrayList<Carte>();
  51.         for(SubArea SA : _subAreas)maps.addAll(SA.getMaps());
  52.                 return maps;
  53.     }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment