Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ARSnova Backend
Manage
Activity
Members
Labels
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Privacy
Imprint
Contact
Snippets
Groups
Projects
Show more breadcrumbs
Paul-Christian Volkmer
ARSnova Backend
Commits
178a4bab
Commit
178a4bab
authored
10 years ago
by
Christoph Thelen
Browse files
Options
Downloads
Patches
Plain Diff
Add auto-generated hashCode/equals methods
parent
3fe6819e
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/de/thm/arsnova/entities/Answer.java
+83
-0
83 additions, 0 deletions
src/main/java/de/thm/arsnova/entities/Answer.java
src/main/java/de/thm/arsnova/entities/Question.java
+36
-0
36 additions, 0 deletions
src/main/java/de/thm/arsnova/entities/Question.java
with
119 additions
and
0 deletions
src/main/java/de/thm/arsnova/entities/Answer.java
+
83
−
0
View file @
178a4bab
...
@@ -176,4 +176,87 @@ public class Answer {
...
@@ -176,4 +176,87 @@ public class Answer {
+
", user: "
+
user
;
+
", user: "
+
user
;
}
}
@Override
public
int
hashCode
()
{
// auto generated!
final
int
prime
=
31
;
int
result
=
1
;
result
=
prime
*
result
+
((
_id
==
null
)
?
0
:
_id
.
hashCode
());
result
=
prime
*
result
+
((
_rev
==
null
)
?
0
:
_rev
.
hashCode
());
result
=
prime
*
result
+
((
answerSubject
==
null
)
?
0
:
answerSubject
.
hashCode
());
result
=
prime
*
result
+
((
answerText
==
null
)
?
0
:
answerText
.
hashCode
());
result
=
prime
*
result
+
piRound
;
result
=
prime
*
result
+
((
questionId
==
null
)
?
0
:
questionId
.
hashCode
());
result
=
prime
*
result
+
((
sessionId
==
null
)
?
0
:
sessionId
.
hashCode
());
result
=
prime
*
result
+
(
int
)
(
timestamp
^
(
timestamp
>>>
32
));
result
=
prime
*
result
+
((
user
==
null
)
?
0
:
user
.
hashCode
());
return
result
;
}
@Override
public
boolean
equals
(
Object
obj
)
{
// auto generated!
if
(
this
==
obj
)
return
true
;
if
(
obj
==
null
)
return
false
;
if
(
getClass
()
!=
obj
.
getClass
())
{
return
false
;
}
Answer
other
=
(
Answer
)
obj
;
if
(
_id
==
null
)
{
if
(
other
.
_id
!=
null
)
{
return
false
;
}
}
else
if
(!
_id
.
equals
(
other
.
_id
))
{
return
false
;
}
if
(
_rev
==
null
)
{
if
(
other
.
_rev
!=
null
)
{
return
false
;
}
}
else
if
(!
_rev
.
equals
(
other
.
_rev
))
{
return
false
;
}
if
(
answerSubject
==
null
)
{
if
(
other
.
answerSubject
!=
null
)
{
return
false
;
}
}
else
if
(!
answerSubject
.
equals
(
other
.
answerSubject
))
{
return
false
;
}
if
(
answerText
==
null
)
{
if
(
other
.
answerText
!=
null
)
{
return
false
;
}
}
else
if
(!
answerText
.
equals
(
other
.
answerText
))
{
return
false
;
}
if
(
piRound
!=
other
.
piRound
)
{
return
false
;
}
if
(
questionId
==
null
)
{
if
(
other
.
questionId
!=
null
)
{
return
false
;
}
}
else
if
(!
questionId
.
equals
(
other
.
questionId
))
{
return
false
;
}
if
(
sessionId
==
null
)
{
if
(
other
.
sessionId
!=
null
)
{
return
false
;
}
}
else
if
(!
sessionId
.
equals
(
other
.
sessionId
))
{
return
false
;
}
if
(
timestamp
!=
other
.
timestamp
)
{
return
false
;
}
if
(
user
==
null
)
{
if
(
other
.
user
!=
null
)
{
return
false
;
}
}
else
if
(!
user
.
equals
(
other
.
user
))
{
return
false
;
}
return
true
;
}
}
}
This diff is collapsed.
Click to expand it.
src/main/java/de/thm/arsnova/entities/Question.java
+
36
−
0
View file @
178a4bab
...
@@ -416,6 +416,42 @@ public class Question {
...
@@ -416,6 +416,42 @@ public class Question {
return
"Question type '"
+
type
+
"': "
+
subject
+
";\n"
+
text
+
possibleAnswers
;
return
"Question type '"
+
type
+
"': "
+
subject
+
";\n"
+
text
+
possibleAnswers
;
}
}
@Override
public
int
hashCode
()
{
// auto generated!
final
int
prime
=
31
;
int
result
=
1
;
result
=
prime
*
result
+
((
_id
==
null
)
?
0
:
_id
.
hashCode
());
result
=
prime
*
result
+
((
_rev
==
null
)
?
0
:
_rev
.
hashCode
());
return
result
;
}
@Override
public
boolean
equals
(
Object
obj
)
{
// auto generated!
if
(
this
==
obj
)
return
true
;
if
(
obj
==
null
)
return
false
;
if
(
getClass
()
!=
obj
.
getClass
())
{
return
false
;
}
Question
other
=
(
Question
)
obj
;
if
(
_id
==
null
)
{
if
(
other
.
_id
!=
null
)
{
return
false
;
}
}
else
if
(!
_id
.
equals
(
other
.
_id
))
{
return
false
;
}
if
(
_rev
==
null
)
{
if
(
other
.
_rev
!=
null
)
{
return
false
;
}
}
else
if
(!
_rev
.
equals
(
other
.
_rev
))
{
return
false
;
}
return
true
;
}
public
int
calculateValue
(
Answer
answer
)
{
public
int
calculateValue
(
Answer
answer
)
{
if
(
answer
.
isAbstention
())
{
if
(
answer
.
isAbstention
())
{
return
0
;
return
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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