1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 18:26:01 +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; 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 { public class Location implements ICDILocation {
@ -29,8 +23,10 @@ public class Location implements ICDILocation {
} }
public Location(String f, String fnct, int l, long a) { public Location(String f, String fnct, int l, long a) {
file = f; if (f != null)
function = fnct; file = f;
if (fnct != null)
function = fnct;
line = l; line = l;
addr = a; addr = a;
} }
@ -80,12 +76,21 @@ public class Location implements ICDILocation {
* @see org.eclipse.cdt.debug.core.cdi.ICDILocation#equals(ICDILocation) * @see org.eclipse.cdt.debug.core.cdi.ICDILocation#equals(ICDILocation)
*/ */
public boolean equals(ICDILocation location) { public boolean equals(ICDILocation location) {
if (location instanceof Location) { String ofile = location.getFile();
Location loc = (Location)location; if (ofile == null) {
return addr == loc.getAddress() && ofile = "";
file.equals(loc.getFile()) && }
function.equals(loc.getFunction()) && String ofunction = location.getFunction();
line == loc.getLineNumber(); 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); return super.equals(location);
} }