Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ø
øving 9
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Awesome group
øving 9
Commits
d796afd9
Commit
d796afd9
authored
2 years ago
by
Pedro Pablo Cardona Arroyave
Browse files
Options
Downloads
Patches
Plain Diff
Fail Alt
parent
8be5badc
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
out/production/Real Task 9/Comparators$AltComparator.class
+0
-0
0 additions, 0 deletions
out/production/Real Task 9/Comparators$AltComparator.class
src/Comparators.java
+3
-6
3 additions, 6 deletions
src/Comparators.java
with
3 additions
and
6 deletions
out/production/Real Task 9/Comparators$AltComparator.class
+
0
−
0
View file @
d796afd9
No preview for this file type
This diff is collapsed.
Click to expand it.
src/Comparators.java
+
3
−
6
View file @
d796afd9
...
...
@@ -8,17 +8,14 @@ public class Comparators {
}
static
class
AltComparator
implements
Comparator
<
Edge
>
{
int
[]
landMark
;
int
landMark
Number
;
int
landMark
Distance
;
public
AltComparator
(
int
[]
landMarkValues
,
int
landMarkNumber
){
landMark
=
landMarkValues
;
this
.
landMark
Number
=
landMarkNumber
;
this
.
landMark
Distance
=
landMark
[
landMarkNumber
]
;
}
@Override
public
int
compare
(
Edge
o1
,
Edge
o2
)
{
return
Integer
.
compare
(
o1
.
drivingTime
+
o1
.
currentWeight
+
getDelta
(
o1
.
destination
),
o2
.
drivingTime
+
o2
.
currentWeight
+
getDelta
(
o2
.
destination
));
}
private
int
getDelta
(
int
destination
){
return
landMark
[
destination
]
-
landMark
[
landMarkNumber
];
return
Integer
.
compare
(
o1
.
drivingTime
+
o1
.
currentWeight
+
landMark
[
o1
.
destination
]
-
landMarkDistance
,
o2
.
drivingTime
+
o2
.
currentWeight
+
landMark
[
o2
.
destination
]
-
landMarkDistance
);
}
}
}
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