Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TeeTime-Framework
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nelson Tavares de Sousa
TeeTime-Framework
Commits
efa6071d
Commit
efa6071d
authored
9 years ago
by
Nelson Tavares de Sousa
Browse files
Options
Downloads
Patches
Plain Diff
hashCode and equals added
parent
10e80cc3
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/main/java/teetime/util/Connection.java
+42
-0
42 additions, 0 deletions
src/main/java/teetime/util/Connection.java
with
42 additions
and
0 deletions
src/main/java/teetime/util/Connection.java
+
42
−
0
View file @
efa6071d
...
@@ -19,6 +19,48 @@ public class Connection<T> {
...
@@ -19,6 +19,48 @@ public class Connection<T> {
this
.
capacity
=
capacity
;
this
.
capacity
=
capacity
;
}
}
@Override
public
int
hashCode
()
{
final
int
prime
=
31
;
int
result
=
1
;
result
=
prime
*
result
+
capacity
;
result
=
prime
*
result
+
((
sourcePort
==
null
)
?
0
:
sourcePort
.
hashCode
());
result
=
prime
*
result
+
((
targetPort
==
null
)
?
0
:
targetPort
.
hashCode
());
return
result
;
}
@Override
public
boolean
equals
(
final
Object
obj
)
{
if
(
this
==
obj
)
{
return
true
;
}
if
(
obj
==
null
)
{
return
false
;
}
if
(
getClass
()
!=
obj
.
getClass
())
{
return
false
;
}
Connection
<?>
other
=
(
Connection
<?>)
obj
;
if
(
capacity
!=
other
.
capacity
)
{
return
false
;
}
if
(
sourcePort
==
null
)
{
if
(
other
.
sourcePort
!=
null
)
{
return
false
;
}
}
else
if
(!
sourcePort
.
equals
(
other
.
sourcePort
))
{
return
false
;
}
if
(
targetPort
==
null
)
{
if
(
other
.
targetPort
!=
null
)
{
return
false
;
}
}
else
if
(!
targetPort
.
equals
(
other
.
targetPort
))
{
return
false
;
}
return
true
;
}
public
int
getCapacity
()
{
public
int
getCapacity
()
{
return
capacity
;
return
capacity
;
}
}
...
...
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