Home | History | Annotate | Download | only in jdwp
      1 /*
      2  * Licensed to the Apache Software Foundation (ASF) under one or more
      3  * contributor license agreements.  See the NOTICE file distributed with
      4  * this work for additional information regarding copyright ownership.
      5  * The ASF licenses this file to You under the Apache License, Version 2.0
      6  * (the "License"); you may not use this file except in compliance with
      7  * the License.  You may obtain a copy of the License at
      8  *
      9  *     http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  *  Unless required by applicable law or agreed to in writing, software
     12  *  distributed under the License is distributed on an "AS IS" BASIS,
     13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  *
     15  *  See the License for the specific language governing permissions and
     16  *  limitations under the License.
     17  */
     18 
     19 /**
     20  * @author Aleksey V. Yantsen
     21  */
     22 
     23 /**
     24  * Created on 10.25.2004
     25  */
     26 package org.apache.harmony.jpda.tests.framework.jdwp;
     27 
     28 import org.apache.harmony.jpda.tests.framework.jdwp.JDWPConstants;
     29 
     30 /**
     31  * This class represents Location value in JDWP packet.
     32  */
     33 public class Location {
     34     public byte tag;
     35     public long classID;
     36     public long methodID;
     37     public long index;
     38 
     39     /**
     40      * Creates new Location value with empty data.
     41      */
     42     public Location() {
     43         tag = JDWPConstants.Tag.NO_TAG;
     44         classID = 0;
     45         methodID = 0;
     46         index = 0;
     47     }
     48 
     49     /**
     50      * Creates new Location value with specified data.
     51      */
     52     public Location(byte tag, long classID, long methodID, long index) {
     53         this.tag = tag;
     54         this.classID = classID;
     55         this.methodID = methodID;
     56         this.index = index;
     57     }
     58 
     59     /**
     60      * Converts Location to string format for printing.
     61      */
     62     @Override
     63     public String toString() {
     64         return "Location: tag="+tag+", classID="+classID+", methodID="+methodID+", index="+index;
     65     }
     66 
     67     /**
     68      * Compares this with other Location object.
     69      */
     70     @Override
     71     public boolean equals(Object obj) {
     72         if (!(obj instanceof Location))
     73             return false;
     74         Location loc = (Location )obj;
     75         return classID == loc.classID && methodID == loc.methodID
     76                     && index == loc.index;
     77 
     78     }
     79 }