mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-08 16:55:38 +02:00
Added new method equals().
This commit is contained in:
parent
1a408fd237
commit
d296af351f
3 changed files with 47 additions and 0 deletions
|
@ -70,4 +70,13 @@ public interface ICDIVariableObject extends ICDIObject {
|
||||||
* @throws CDIException if this method fails. Reasons include:
|
* @throws CDIException if this method fails. Reasons include:
|
||||||
*/
|
*/
|
||||||
String getQualifiedName() throws CDIException;
|
String getQualifiedName() throws CDIException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the variable Object are the same,
|
||||||
|
* For example event if the name is the same because of
|
||||||
|
* casting this may return false;
|
||||||
|
* @return true if the same
|
||||||
|
*/
|
||||||
|
boolean equals(ICDIVariableObject varObject);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,6 +164,13 @@ public abstract class CVariable extends CDebugElement
|
||||||
{
|
{
|
||||||
return ( fVariableObject != null ) ? fVariableObject.getQualifiedName() : null;
|
return ( fVariableObject != null ) ? fVariableObject.getQualifiedName() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject#equals(org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject)
|
||||||
|
*/
|
||||||
|
public boolean equals(ICDIVariableObject varObject) {
|
||||||
|
return super.equals(varObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class InternalVariable
|
class InternalVariable
|
||||||
|
|
|
@ -288,4 +288,35 @@ public class VariableObject extends CObject implements ICDIVariableObject {
|
||||||
return qualifiedName;
|
return qualifiedName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject#equals(ICDIVariableObject)
|
||||||
|
*/
|
||||||
|
public boolean equals(ICDIVariableObject varObj) {
|
||||||
|
if (varObj instanceof VariableObject) {
|
||||||
|
VariableObject var = (VariableObject) varObj;
|
||||||
|
if (var.getName().equals(getName())
|
||||||
|
&& var.getCastingArrayStart() == getCastingArrayStart()
|
||||||
|
&& var.getCastingArrayEnd() == getCastingArrayEnd()
|
||||||
|
&& ((var.getCastingType() == null && getCastingType() == null)
|
||||||
|
|| (var.getCastingType() != null && getCastingType() != null && var.getCastingType().equals(getCastingType())))) {
|
||||||
|
ICDIStackFrame varFrame = null;
|
||||||
|
ICDIStackFrame ourFrame = null;
|
||||||
|
try {
|
||||||
|
varFrame = var.getStackFrame();
|
||||||
|
ourFrame = getStackFrame();
|
||||||
|
} catch (CDIException e) {
|
||||||
|
}
|
||||||
|
if (ourFrame == null && varFrame == null) {
|
||||||
|
return true;
|
||||||
|
} else if (varFrame != null && ourFrame != null && varFrame.equals(ourFrame)) {
|
||||||
|
if (var.getStackDepth() == getStackDepth()) {
|
||||||
|
if (var.getPosition() == getPosition()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.equals(varObj);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue