Source for gnu.gcj.jvmti.Location

   1: // Location.java - a wrapper class for breakpoint locations in JVMTI
   2: 
   3: /* Copyright (C) 2006  Free Software Foundation
   4: 
   5:    This file is part of libgcj.
   6: 
   7: This software is copyrighted work licensed under the terms of the
   8: Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
   9: details.  */
  10: 
  11: package gnu.gcj.jvmti;
  12: 
  13: import java.lang.Long;
  14: 
  15: /**
  16:  * This class represents a breakpoint location (pair<jmethodID,jlocation>).
  17:  * BreakpointManager uses this class as a key in the Map of installed
  18:  * breakpoints.
  19:  *
  20:  * @author Keith Seitz (keiths@redhat.com)
  21:  */
  22: public class Location
  23: {
  24:   // method (a jmethodID in JVMTI)
  25:   private long method;
  26: 
  27:   // index (a jlocation in JVMTI)
  28:   private long location;
  29: 
  30:   /**
  31:    * Constructor
  32:    *
  33:    * @param method   the method defined by this location (a jmethodID)
  34:    * @param location the integer index of the insn in the method (a jlocation)
  35:    */
  36:   public Location (long method, long location)
  37:   {
  38:     this.method = method;
  39:     this.location = location;
  40:   }
  41: 
  42:   public int hashCode ()
  43:   {
  44:     return toString ().hashCode ();
  45:   }
  46: 
  47:   public boolean equals (Object obj)
  48:   {
  49:     Location loc = (Location) obj;
  50:     return (loc.method == method && loc.location == location);
  51:   }
  52: 
  53:   /**
  54:    * Converts the Location to a String
  55:    */
  56:   public String toString ()
  57:   {
  58:     return Long.toHexString (method) + "." + Long.toString (location);
  59:   }
  60: }