Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
PAPADAKOS PANAGIOTIS
themis
Commits
604115ca
Commit
604115ca
authored
Mar 22, 2020
by
Panagiotis Papadakos
Browse files
[DocInfoEssential & DocInfoFull] override equals and hashcode to use only the id
parent
0731d924
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
3 deletions
+37
-3
src/main/java/gr/csd/uoc/hy463/themis/model/DocInfoEssential.java
.../java/gr/csd/uoc/hy463/themis/model/DocInfoEssential.java
+20
-3
src/main/java/gr/csd/uoc/hy463/themis/model/DocInfoFull.java
src/main/java/gr/csd/uoc/hy463/themis/model/DocInfoFull.java
+17
-0
No files found.
src/main/java/gr/csd/uoc/hy463/themis/model/DocInfoEssential.java
View file @
604115ca
...
...
@@ -54,10 +54,10 @@ public class DocInfoEssential {
LENGTH
// for OkapiBM25 (Value should be integer)
}
pr
ivate
String
id
=
""
;
// the 40 byte id
pr
ivate
long
offset
=
0
;
// offset in documents file
pr
otected
String
id
=
""
;
// the 40 byte id
pr
otected
long
offset
=
0
;
// offset in documents file
// The size of the hashmap is only 3.... since up to now we have 3 properties to hold
pr
ivate
final
Map
<
PROPERTY
,
Object
>
props
=
new
HashMap
<>(
3
);
pr
otected
final
Map
<
PROPERTY
,
Object
>
props
=
new
HashMap
<>(
3
);
public
DocInfoEssential
(
String
id
,
long
offset
)
{
this
.
id
=
id
;
...
...
@@ -93,4 +93,21 @@ public class DocInfoEssential {
return
offset
;
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
DocInfoEssential
other
=
(
DocInfoEssential
)
o
;
return
this
.
id
==
other
.
id
;
}
@Override
public
int
hashCode
()
{
return
id
.
hashCode
();
}
}
src/main/java/gr/csd/uoc/hy463/themis/model/DocInfoFull.java
View file @
604115ca
...
...
@@ -36,4 +36,21 @@ public class DocInfoFull extends DocInfoEssential {
super
(
id
,
offset
);
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
DocInfoEssential
other
=
(
DocInfoEssential
)
o
;
return
this
.
id
==
other
.
id
;
}
@Override
public
int
hashCode
()
{
return
id
.
hashCode
();
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment