KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > jdo > tools > enhancer > utils > TableSwitchHelper


1
2 /*
3  * Copyright (c) 1998 - 2005 Versant Corporation
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  * Versant Corporation - initial API and implementation
11  */

12 package com.versant.core.jdo.tools.enhancer.utils;
13
14 import com.versant.lib.bcel.generic.InstructionHandle;
15
16 /**
17  *
18  */

19 public class TableSwitchHelper implements Comparable JavaDoc{
20     public int match;
21     public InstructionHandle target;
22     /**
23      * Implements Comparable to order all fields by name
24      *
25      */

26     public int compareTo(Object JavaDoc o){
27         TableSwitchHelper other = (TableSwitchHelper)o;
28         if (match == other.match){
29             return 0;
30         } else if (match < other.match){
31             return -1;
32         } else {
33             return 1;
34         }
35     }
36
37     public boolean equals(Object JavaDoc other){
38         if (other != null && getClass() == other.getClass()){
39             TableSwitchHelper otherTableSwitchHelper = (TableSwitchHelper)other;
40             return match == otherTableSwitchHelper.match;
41         } else {
42             return false;
43         }
44     }
45
46     public int hashCode(){
47         Integer JavaDoc i = new Integer JavaDoc(match);
48         return 13 * i.hashCode();
49     }
50 }
51
Popular Tags