1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 22:52:11 +02:00

Provide equality for :

file:linenumber
and
file:functioname
This commit is contained in:
Alain Magloire 2002-09-20 18:17:26 +00:00
parent 4eb6c43261
commit 734438b514

View file

@ -10,12 +10,6 @@ import org.eclipse.cdt.debug.core.cdi.ICDILocation;
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
/**
* @author alain
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/
public class Location implements ICDILocation {
@ -29,8 +23,10 @@ public class Location implements ICDILocation {
}
public Location(String f, String fnct, int l, long a) {
file = f;
function = fnct;
if (f != null)
file = f;
if (fnct != null)
function = fnct;
line = l;
addr = a;
}
@ -80,12 +76,21 @@ public class Location implements ICDILocation {
* @see org.eclipse.cdt.debug.core.cdi.ICDILocation#equals(ICDILocation)
*/
public boolean equals(ICDILocation location) {
if (location instanceof Location) {
Location loc = (Location)location;
return addr == loc.getAddress() &&
file.equals(loc.getFile()) &&
function.equals(loc.getFunction()) &&
line == loc.getLineNumber();
String ofile = location.getFile();
if (ofile == null) {
ofile = "";
}
String ofunction = location.getFunction();
if (ofunction == null) {
ofunction = "";
}
if (file.equals(ofile) && line == location.getLineNumber()) {
return true;
}
if (file.equals(ofile) && function.equals(ofunction)) {
return true;
}
return super.equals(location);
}