home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / pc / java / unuy2wen / cybcerone / orient / leafmap.java < prev    next >
Encoding:
Java Source  |  1996-08-14  |  1.5 KB  |  75 lines

  1. // LeafMap.java
  2. // 23.02.96
  3. //
  4. // a map with no children, displayed by highlighting a box on its parent
  5.  
  6. package cybcerone.orient;
  7.  
  8. import java.awt.Image;
  9. import java.util.Vector;
  10.  
  11. /**
  12.  * A map with no children, but has its own photos and description.
  13.  */
  14. public class LeafMap implements Maplike {
  15.  
  16.   private String name;
  17.   private String parent;
  18.   private String description;
  19.  
  20.   private Image[] photos;
  21.  
  22.   private Maplikes theMaps;
  23.  
  24.   public LeafMap (String name, String parent, String description,
  25.           Vector photos) {
  26.     if (photos != null) {
  27.       this.photos = new Image[photos.size ()];
  28.       photos.copyInto (this.photos);
  29.     } else
  30.       this.photos = null;
  31.  
  32.     this.name = name;
  33.     this.parent = parent;
  34.     this.description = description;
  35.   }
  36.  
  37.   public String getName () { return name; }
  38.  
  39.   public Image getMap () {
  40.     return (getParent().getMap());
  41.   }
  42.  
  43.   public Image getLegend () {
  44.     return (getParent().getLegend());
  45.   }
  46.  
  47.   public String getDesc () { return description; }
  48.  
  49.   public Image[] getPhotos () { return photos; }
  50.  
  51.   public Maplike getParent () {
  52.     if (theMaps != null)
  53.       return (theMaps.findMap (parent));
  54.     else
  55.       return null;
  56.   }
  57.   
  58.   public Zone find (String name) {
  59.     return (getParent().find (name));
  60.   }
  61.  
  62.   public Zone find (int x, int y) {
  63.     return (getParent().find (x, y));
  64.   }
  65.   
  66.   public void setMaplikes (Maplikes theMaps) {
  67.     this.theMaps = theMaps;
  68.   }
  69.   
  70.   public String toString () {
  71.     return ("LeafMap[" + getName () + "]");
  72.   }
  73.   
  74. }
  75.