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
f7c788d2
Commit
f7c788d2
authored
10 years ago
by
User expired
Browse files
Options
Downloads
Patches
Plain Diff
added precaching for placeholder preparation
parent
c93241ab
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/it/unibz/inf/isochrone/db/Database.java
+15
-1
15 additions, 1 deletion
src/main/java/it/unibz/inf/isochrone/db/Database.java
with
15 additions
and
1 deletion
src/main/java/it/unibz/inf/isochrone/db/Database.java
+
15
−
1
View file @
f7c788d2
...
@@ -42,6 +42,7 @@ import java.util.Set;
...
@@ -42,6 +42,7 @@ import java.util.Set;
* @version 2.2
* @version 2.2
*/
*/
public
class
Database
{
public
class
Database
{
private
static
final
String
[]
PRECACHED_PLACEHOLDERS
;
protected
static
final
byte
NW_MODE_CONTINUOUS
=
0
;
protected
static
final
byte
NW_MODE_CONTINUOUS
=
0
;
protected
static
final
byte
NW_MODE_DISCRETE
=
1
;
protected
static
final
byte
NW_MODE_DISCRETE
=
1
;
private
final
String
queryEarliestArrivalTimeHomo
;
private
final
String
queryEarliestArrivalTimeHomo
;
...
@@ -67,6 +68,16 @@ public class Database {
...
@@ -67,6 +68,16 @@ public class Database {
protected
Mode
mode
;
protected
Mode
mode
;
protected
boolean
isIncoming
;
protected
boolean
isIncoming
;
// Static block
static
{
final
int
preachingLength
=
10
;
PRECACHED_PLACEHOLDERS
=
new
String
[
preachingLength
];
for
(
int
i
=
0
;
i
<
preachingLength
;
++
i
)
{
PRECACHED_PLACEHOLDERS
[
i
]
=
preparePlaceHolders
(
i
);
}
}
// Constructor
// Constructor
public
Database
(
final
ConfigDataset
config
,
final
Mode
mode
,
final
Direction
direction
)
{
public
Database
(
final
ConfigDataset
config
,
final
Mode
mode
,
final
Direction
direction
)
{
...
@@ -84,7 +95,7 @@ public class Database {
...
@@ -84,7 +95,7 @@ public class Database {
+
" WHERE SOURCE = ? AND TARGET = ? AND ROUTE_ID IN (%S) AND (TIME_D BETWEEN ? AND ?) AND SERVICE_ID IN (%S) AND TIME_A <= ?"
;
+
" WHERE SOURCE = ? AND TARGET = ? AND ROUTE_ID IN (%S) AND (TIME_D BETWEEN ? AND ?) AND SERVICE_ID IN (%S) AND TIME_A <= ?"
;
queryLatestDepartureTimeHomo
=
"SELECT TIME_D, TIME_A, ROUTE_ID FROM "
+
configSchedule
queryLatestDepartureTimeHomo
=
"SELECT TIME_D, TIME_A, ROUTE_ID FROM "
+
configSchedule
+
" WHERE SOURCE = ? AND
TARGET = ? AND ROUTE_ID IN (%S) AND (TIME_A BETWEEN ? AND ?) AND SERVICE_ID IN (%S) AND TIME_D >= ?"
;
+
" WHERE SOURCE = ? AND TARGET = ? AND ROUTE_ID IN (%S) AND (TIME_A BETWEEN ? AND ?) AND SERVICE_ID IN (%S) AND TIME_D >= ?"
;
queryGetAllEdges
=
"SELECT ID, SOURCE, TARGET, LENGTH, EDGE_MODE, ROUTE_ID FROM "
+
configEdges
;
queryGetAllEdges
=
"SELECT ID, SOURCE, TARGET, LENGTH, EDGE_MODE, ROUTE_ID FROM "
+
configEdges
;
...
@@ -742,6 +753,9 @@ public class Database {
...
@@ -742,6 +753,9 @@ public class Database {
if
(
length
<=
0
)
{
if
(
length
<=
0
)
{
return
""
;
return
""
;
}
}
if
(
length
<
PRECACHED_PLACEHOLDERS
.
length
)
{
return
PRECACHED_PLACEHOLDERS
[
length
];
}
final
StringBuilder
builder
=
new
StringBuilder
((
2
*
length
)
-
1
);
final
StringBuilder
builder
=
new
StringBuilder
((
2
*
length
)
-
1
);
builder
.
append
(
"?"
);
builder
.
append
(
"?"
);
...
...
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