Class Treasure

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class Treasure
    extends java.lang.Object
    implements java.lang.Cloneable
    A treasure object.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.awt.geom.Point2D location
      The location.
      protected int weight
      The weight.
    • Constructor Summary

      Constructors 
      Constructor Description
      Treasure()  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected static Treasure create​(java.util.Random rnd, double width, double height)
      Create a random treasure.
      java.awt.geom.Point2D getLocation()
      Get the location of the treasure.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • location

        protected java.awt.geom.Point2D location
        The location.
      • weight

        protected int weight
        The weight.
    • Constructor Detail

      • Treasure

        public Treasure()
    • Method Detail

      • create

        protected static Treasure create​(java.util.Random rnd,
                                         double width,
                                         double height)
        Create a random treasure.
        Parameters:
        rnd - The random number generator.
        width - The environment width.
        height - The environment height.
      • getLocation

        public java.awt.geom.Point2D getLocation()
        Get the location of the treasure.
        Returns:
        The location