Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SableCC STUPS
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
general
stups
SableCC STUPS
Commits
6c4b3121
Commit
6c4b3121
authored
3 years ago
by
dgelessus
Browse files
Options
Downloads
Patches
Plain Diff
Implement missing equals/hashCode for SourcePosition
parent
d2eaf66b
No related branches found
No related tags found
No related merge requests found
Pipeline
#87662
passed
3 years ago
Stage: test
Stage: deploy
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/SourcePosition.java
+19
-0
19 additions, 0 deletions
.../main/java/de/hhu/stups/sablecc/patch/SourcePosition.java
with
19 additions
and
0 deletions
sablecc-runtime/src/main/java/de/hhu/stups/sablecc/patch/SourcePosition.java
+
19
−
0
View file @
6c4b3121
...
...
@@ -6,6 +6,8 @@
package
de.hhu.stups.sablecc.patch
;
import
java.util.Objects
;
public
class
SourcePosition
implements
Comparable
<
SourcePosition
>
{
private
final
int
line
;
...
...
@@ -25,6 +27,23 @@ public class SourcePosition implements Comparable<SourcePosition> {
return
pos
;
}
@Override
public
boolean
equals
(
final
Object
obj
)
{
if
(
this
==
obj
)
{
return
true
;
}
if
(
obj
==
null
||
this
.
getClass
()
!=
obj
.
getClass
())
{
return
false
;
}
final
SourcePosition
other
=
(
SourcePosition
)
obj
;
return
this
.
getLine
()
==
other
.
getLine
()
&&
this
.
getPos
()
==
other
.
getPos
();
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
this
.
getLine
(),
this
.
getPos
());
}
@Override
public
int
compareTo
(
SourcePosition
that
)
{
if
(
this
.
line
<
that
.
line
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment