mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Fix for 183966, performance improvement for PDOMNode.hashCode().
This commit is contained in:
parent
73fd7f02ab
commit
4fc2c97265
2 changed files with 7 additions and 3 deletions
|
@ -297,6 +297,10 @@ public abstract class PDOMBinding extends PDOMNamedNode implements IIndexFragmen
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean equals(Object o) {
|
public boolean equals(Object o) {
|
||||||
|
if (o instanceof PDOMNode) {
|
||||||
|
PDOMNode node= (PDOMNode) o;
|
||||||
|
return pdom==node.pdom && record == node.record;
|
||||||
|
}
|
||||||
return compareTo(o)==0;
|
return compareTo(o)==0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -72,14 +72,14 @@ public abstract class PDOMNode implements IPDOMNode {
|
||||||
return true;
|
return true;
|
||||||
if (obj instanceof PDOMNode) {
|
if (obj instanceof PDOMNode) {
|
||||||
PDOMNode other = (PDOMNode)obj;
|
PDOMNode other = (PDOMNode)obj;
|
||||||
return pdom.equals(other.pdom) && record == other.record;
|
return pdom == other.pdom && record == other.record;
|
||||||
}
|
}
|
||||||
|
|
||||||
return super.equals(obj);
|
return super.equals(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return 31 * pdom.getPath().hashCode() + 41 * record;
|
return System.identityHashCode(pdom) + 41*record;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void accept(IPDOMVisitor visitor) throws CoreException {
|
public void accept(IPDOMVisitor visitor) throws CoreException {
|
||||||
|
|
Loading…
Add table
Reference in a new issue