KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > debug > core > model > JDIReferenceListVariable


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

11 package org.eclipse.jdt.internal.debug.core.model;
12
13 import org.eclipse.jdt.debug.core.IJavaObject;
14 import org.eclipse.jdt.internal.debug.core.logicalstructures.JDIPlaceholderVariable;
15
16 /**
17  * A variable that stores a list of references. Used to display reference information collected from the vm
18  * using the 'all references' utility in Java 6.0. This variable uses a <code>JDIReferenceListValue</code>
19  * as its value. It's children will be <code>JDIReferenceListEntryVariable</code>.
20  *
21  * @since 3.3
22  * @see JDIReferenceListValue
23  * @see JDIReferenceListEntryVariable
24  */

25 public class JDIReferenceListVariable extends JDIPlaceholderVariable{
26     
27     /**
28      * Creates a new variable that stores a list of references, all referring to the java object specified
29      * by the parameter root.
30      *
31      * @param name The name this variable should use
32      * @param root The root java object that references will be collected for
33      */

34     public JDIReferenceListVariable(String JavaDoc name, IJavaObject root) {
35         super (name,new JDIReferenceListValue(root));
36     }
37     
38     /* (non-Javadoc)
39      * @see org.eclipse.jdt.internal.debug.core.logicalstructures.JDIPlaceholderVariable#equals(java.lang.Object)
40      */

41     public boolean equals(Object JavaDoc obj) {
42         // Two JDIReferenceListVariables are equal if their values are equal
43
if (obj instanceof JDIReferenceListVariable){
44             JDIReferenceListVariable var = (JDIReferenceListVariable)obj;
45             if (getValue() instanceof JDIPlaceholderValue || var.getValue() instanceof JDIPlaceholderValue){
46                 // A placeholder value is only equal to the same instance
47
return this == obj;
48             }
49             return getValue().equals(var.getValue());
50         }
51         return false;
52     }
53     
54     /* (non-Javadoc)
55      * @see org.eclipse.jdt.internal.debug.core.logicalstructures.JDIPlaceholderVariable#hashCode()
56      */

57     public int hashCode() {
58         return getValue().hashCode();
59     }
60 }
61
Popular Tags