Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
isochrone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Institut für Informatik
dbis
dbis-isochrone
isochrone
Commits
2c72cdaa
Commit
2c72cdaa
authored
10 years ago
by
User expired
Browse files
Options
Downloads
Patches
Plain Diff
minor improvements in hashCode/equals method (using algorithm's name
instead of full class object)
parent
f9671885
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/test/java/it/unibz/inf/isochrone/network/AlgorithmConfiguration.java
+8
-10
8 additions, 10 deletions
...t/unibz/inf/isochrone/network/AlgorithmConfiguration.java
with
8 additions
and
10 deletions
src/test/java/it/unibz/inf/isochrone/network/AlgorithmConfiguration.java
+
8
−
10
View file @
2c72cdaa
...
...
@@ -4,11 +4,13 @@ import it.unibz.inf.isochrone.algorithm.Isochrone;
public
class
AlgorithmConfiguration
{
private
final
Class
<?
extends
Isochrone
>
algorithmClass
;
private
final
String
algorithmName
;
private
final
TestParameters
params
;
private
final
boolean
expireNodes
;
public
AlgorithmConfiguration
(
final
Class
<?
extends
Isochrone
>
algorithmClass
,
final
TestParameters
params
,
final
boolean
expireNodes
)
{
this
.
algorithmClass
=
algorithmClass
;
this
.
algorithmName
=
algorithmClass
.
getSimpleName
();
this
.
params
=
params
;
this
.
expireNodes
=
expireNodes
;
}
...
...
@@ -37,11 +39,9 @@ public class AlgorithmConfiguration {
public
int
hashCode
()
{
final
int
prime
=
31
;
int
result
=
1
;
// CHECKSTYLE:OFF MagicNumber
result
=
prime
*
result
+
((
algorithmClass
==
null
)
?
0
:
algorithmClass
.
hashCode
());
result
=
prime
*
result
+
(
expireNodes
?
1231
:
1237
);
result
=
prime
*
result
+
((
algorithmName
==
null
)
?
0
:
algorithmName
.
hashCode
());
result
=
prime
*
result
+
Boolean
.
hashCode
(
expireNodes
);
result
=
prime
*
result
+
((
params
==
null
)
?
0
:
params
.
hashCode
());
// CHECKSTYLE:ON MagicNumber
return
result
;
}
...
...
@@ -56,13 +56,12 @@ public class AlgorithmConfiguration {
if
(
getClass
()
!=
obj
.
getClass
())
{
return
false
;
}
final
AlgorithmConfiguration
other
=
(
AlgorithmConfiguration
)
obj
;
if
(
algorithm
Class
==
null
)
{
if
(
other
.
algorithm
Class
!=
null
)
{
if
(
algorithm
Name
==
null
)
{
if
(
other
.
algorithm
Name
!=
null
)
{
return
false
;
}
}
else
if
(!
algorithm
Class
.
equals
(
other
.
algorithm
Class
))
{
}
else
if
(!
algorithm
Name
.
equals
(
other
.
algorithm
Name
))
{
return
false
;
}
if
(
expireNodes
!=
other
.
expireNodes
)
{
...
...
@@ -75,13 +74,12 @@ public class AlgorithmConfiguration {
}
else
if
(!
params
.
equals
(
other
.
params
))
{
return
false
;
}
return
true
;
}
@Override
public
String
toString
()
{
return
"
CachingKey [class="
+
algorithmClass
.
getSimple
Name
()
+
", duration="
+
params
.
getDuration
()
+
", expireNodes="
+
expireNodes
+
"]"
;
return
"
AlgorithmConfiguration [algorithmName="
+
algorithm
Name
+
", duration="
+
params
.
getDuration
()
+
", expireNodes="
+
expireNodes
+
"]"
;
}
}
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