1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-06 17:26:01 +02:00

Fix for 183966, performance improvement for PDOMNode.hashCode().

This commit is contained in:
Markus Schorn 2007-04-25 12:59:19 +00:00
parent 73fd7f02ab
commit 4fc2c97265
2 changed files with 7 additions and 3 deletions

View file

@ -297,6 +297,10 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IIndexFragmen
}
public boolean equals(Object o) {
if (o instanceof PDOMNode) {
PDOMNode node= (PDOMNode) o;
return pdom==node.pdom && record == node.record;
}
return compareTo(o)==0;
}
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2005, 2006 QNX Software Systems and others.
* Copyright (c) 2005, 2007 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
@ -72,14 +72,14 @@ public abstract class PDOMNode implements IPDOMNode {
return true;
if (obj instanceof PDOMNode) {
PDOMNode other = (PDOMNode)obj;
return pdom.equals(other.pdom) && record == other.record;
return pdom == other.pdom && record == other.record;
}
return super.equals(obj);
}
public int hashCode() {
return 31 * pdom.getPath().hashCode() + 41 * record;
return System.identityHashCode(pdom) + 41*record;
}
public void accept(IPDOMVisitor visitor) throws CoreException {