1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 335259 - Restored symmetry between PDOMNode.equals and CompositeIndexBinding.equals.

This commit is contained in:
Sergey Prigogin 2011-01-25 20:32:06 +00:00
parent e7395929a9
commit 855cfa3b48

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2010 QNX Software Systems and others.
* Copyright (c) 2005, 2011 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -9,12 +9,13 @@
* Doug Schaefer (QNX) - Initial API and implementation
* Markus Schorn (Wind River Systems)
* Andrew Ferguson (Symbian)
* Sergey Prigogin (Google)
*******************************************************************************/
package org.eclipse.cdt.internal.core.pdom.dom;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.dom.IPDOMVisitor;
import org.eclipse.cdt.internal.core.index.composite.CompositeIndexBinding;
import org.eclipse.cdt.internal.core.pdom.PDOM;
import org.eclipse.cdt.internal.core.pdom.db.Database;
import org.eclipse.core.runtime.CoreException;
@ -25,7 +26,6 @@ import org.eclipse.core.runtime.CoreException;
* This class managed the parent pointer.
*/
public abstract class PDOMNode implements IInternalPDOMNode {
private static final int TYPE = 0;
private static final int PARENT = 4;
@ -75,8 +75,8 @@ public abstract class PDOMNode implements IInternalPDOMNode {
}
protected abstract int getRecordSize();
public abstract int getNodeType();
public abstract int getNodeType();
public final long getRecord() {
return record;
@ -103,6 +103,10 @@ public abstract class PDOMNode implements IInternalPDOMNode {
public final boolean equals(Object obj) {
if (obj == this)
return true;
// For symmetry with CompositeIndexBinding.equals(Object)
if (obj instanceof CompositeIndexBinding) {
obj = ((CompositeIndexBinding) obj).getRawBinding();
}
if (obj instanceof PDOMNode) {
PDOMNode other = (PDOMNode) obj;
return getPDOM() == other.getPDOM() && record == other.record;
@ -148,8 +152,7 @@ public abstract class PDOMNode implements IInternalPDOMNode {
protected byte getByte(long offset) {
try {
return getDB().getByte(offset);
}
catch (CoreException e) {
} catch (CoreException e) {
CCorePlugin.log(e);
return 0;
}
@ -161,9 +164,9 @@ public abstract class PDOMNode implements IInternalPDOMNode {
* @param offset The position of the desired bit.
* @return the bit at the specified offset.
*/
protected boolean getBit(int bitVector, int offset) {
protected static boolean getBit(int bitVector, int offset) {
int mask = 1 << offset;
return (bitVector & mask) == mask;
return (bitVector & mask) != 0;
}
/**