mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-15 08:18:55 +00:00
add hashCode() and equals() to ReplaceRegion
Signed-off-by: mmews <marcus.mews@numberfour.eu>
This commit is contained in:
parent
0b7156d54f
commit
198a74e270
1 changed files with 21 additions and 0 deletions
|
@ -7,6 +7,8 @@
|
|||
*******************************************************************************/
|
||||
package org.eclipse.xtext.util;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author Jan Koehnlein - Initial contribution and API
|
||||
* @author Sebastian Zarnekow
|
||||
|
@ -56,6 +58,25 @@ public class ReplaceRegion {
|
|||
builder.replace(offset, getEndOffset(), text);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object object) {
|
||||
if (object instanceof ReplaceRegion) {
|
||||
ReplaceRegion rr = (ReplaceRegion) object;
|
||||
|
||||
boolean equals = true;
|
||||
equals = equals && Objects.equals(getOffset(), rr.getOffset());
|
||||
equals = equals && Objects.equals(getLength(), rr.getLength());
|
||||
equals = equals && Objects.equals(getText(), rr.getText());
|
||||
return equals;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(getOffset(), getLength(), getText());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "replace region [" + offset + " / length: " + length + "] '" + text + "'";
|
||||
|
|
Loading…
Reference in a new issue