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
c574532a
Commit
c574532a
authored
10 years ago
by
User expired
Browse files
Options
Downloads
Patches
Plain Diff
changed collection types to get some speedup
parent
569ae991
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/it/unibz/inf/isochrone/algorithm/Isochrone.java
+4
-3
4 additions, 3 deletions
...main/java/it/unibz/inf/isochrone/algorithm/Isochrone.java
src/main/java/it/unibz/inf/isochrone/network/NodeConnection.java
+8
-8
8 additions, 8 deletions
...n/java/it/unibz/inf/isochrone/network/NodeConnection.java
with
12 additions
and
11 deletions
src/main/java/it/unibz/inf/isochrone/algorithm/Isochrone.java
+
4
−
3
View file @
c574532a
...
...
@@ -12,11 +12,12 @@ import it.unibz.inf.isochrone.network.NodeConnection;
import
it.unibz.inf.isochrone.util.EnumContainer.Direction
;
import
it.unibz.inf.isochrone.util.Query
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.LinkedHashSet
;
import
java.util.LinkedList
;
import
java.util.Map
;
import
java.util.Map.Entry
;
import
java.util.PriorityQueue
;
...
...
@@ -215,7 +216,7 @@ public abstract class Isochrone {
}
private
Collection
<
Node
>
expandLinks
(
final
Node
node
,
final
Collection
<
Link
>
links
)
{
final
Collection
<
Node
>
resultNodes
=
new
Array
List
<>();
final
Collection
<
Node
>
resultNodes
=
new
Linked
List
<>();
final
NodeConnection
nConnections
=
new
NodeConnection
(
node
);
for
(
final
Link
link
:
links
)
{
...
...
@@ -297,7 +298,7 @@ public abstract class Isochrone {
}
final
Map
<
Node
,
Double
>
newDistances
=
getAdjNodeCost
(
nConnection
);
final
Set
<
Node
>
resultCollection
=
new
HashSet
<>(
newDistances
.
size
());
final
Set
<
Node
>
resultCollection
=
new
Linked
HashSet
<>(
newDistances
.
size
());
for
(
final
Entry
<
Node
,
Double
>
e
:
newDistances
.
entrySet
())
{
final
Node
adjacentNode
=
e
.
getKey
();
final
double
newDistance
=
e
.
getValue
();
...
...
This diff is collapsed.
Click to expand it.
src/main/java/it/unibz/inf/isochrone/network/NodeConnection.java
+
8
−
8
View file @
c574532a
...
...
@@ -2,8 +2,8 @@ package it.unibz.inf.isochrone.network;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.
Linked
HashMap
;
import
java.util.
Linked
HashSet
;
import
java.util.Map
;
import
java.util.Set
;
...
...
@@ -18,8 +18,8 @@ public class NodeConnection {
public
NodeConnection
(
final
Node
sourceNode
)
{
this
.
sourceNode
=
sourceNode
;
this
.
continuousTargetConnections
=
new
HashMap
<>();
this
.
discreteTargetConnections
=
new
HashMap
<>();
this
.
continuousTargetConnections
=
new
Linked
HashMap
<>();
this
.
discreteTargetConnections
=
new
Linked
HashMap
<>();
}
// Getters
...
...
@@ -73,7 +73,7 @@ public class NodeConnection {
}
public
Map
<
Node
,
Collection
<
Link
>>
getTargets
()
{
final
Map
<
Node
,
Collection
<
Link
>>
allTargets
=
new
HashMap
<>();
final
Map
<
Node
,
Collection
<
Link
>>
allTargets
=
new
Linked
HashMap
<>();
allTargets
.
putAll
(
continuousTargetConnections
);
allTargets
.
putAll
(
discreteTargetConnections
);
...
...
@@ -140,7 +140,7 @@ public class NodeConnection {
private
static
Collection
<
Integer
>
getIdsForRoutes
(
final
Map
<
Node
,
Collection
<
Link
>>
m
)
{
final
Collection
<
Collection
<
Link
>>
linkSet
=
m
.
values
();
final
Set
<
Integer
>
resultSet
=
new
HashSet
<>(
linkSet
.
size
());
final
Set
<
Integer
>
resultSet
=
new
Linked
HashSet
<>(
linkSet
.
size
());
for
(
final
Collection
<
Link
>
lCollection
:
linkSet
)
{
for
(
final
Link
l
:
lCollection
)
{
resultSet
.
add
(
l
.
getRoute
());
...
...
@@ -156,7 +156,7 @@ public class NodeConnection {
private
static
Collection
<
Integer
>
getRoutesToTargetNode
(
final
Map
<
Node
,
Collection
<
Link
>>
m
,
final
Node
node
)
{
final
Collection
<
Link
>
linkSet
=
m
.
get
(
node
);
final
Set
<
Integer
>
resultSet
=
new
HashSet
<>(
linkSet
.
size
());
final
Set
<
Integer
>
resultSet
=
new
Linked
HashSet
<>(
linkSet
.
size
());
for
(
final
Link
l
:
linkSet
)
{
resultSet
.
add
(
l
.
getRoute
());
}
...
...
@@ -165,7 +165,7 @@ public class NodeConnection {
private
static
Collection
<
Integer
>
getIdsForTargetNodes
(
final
Map
<
Node
,
Collection
<
Link
>>
m
)
{
final
Set
<
Node
>
nodeSet
=
m
.
keySet
();
final
Set
<
Integer
>
resultSet
=
new
HashSet
<>(
nodeSet
.
size
());
final
Set
<
Integer
>
resultSet
=
new
Linked
HashSet
<>(
nodeSet
.
size
());
for
(
final
Node
n
:
nodeSet
)
{
resultSet
.
add
(
n
.
getId
());
}
...
...
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