Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2XB3FinalProject
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Analyze
Contributor analytics
Repository 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
Christopher Schankula
2XB3FinalProject
Commits
12ac6314
Commit
12ac6314
authored
6 years ago
by
Christopher Schankula
Browse files
Options
Downloads
Patches
Plain Diff
range search including lat / long
parent
c784de31
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/search/BasicSearch.java
+15
-3
15 additions, 3 deletions
src/search/BasicSearch.java
src/sort/RangeHelper.java
+6
-6
6 additions, 6 deletions
src/sort/RangeHelper.java
with
21 additions
and
9 deletions
src/search/BasicSearch.java
+
15
−
3
View file @
12ac6314
...
...
@@ -17,6 +17,10 @@ import sort.RangeHelper;
*
*/
public
class
BasicSearch
{
public
static
BasicSearchResult
range
(
Integer
taxonId
,
Integer
yearLo
,
Integer
yearHi
){
return
range
(
taxonId
,
yearLo
,
yearHi
,
-
90.0
,
90.0
,
-
180.0
,
180.0
);
}
/**
* Returns all records matching any of the children of the given TaxonID and in the
* date range given
...
...
@@ -25,7 +29,7 @@ public class BasicSearch {
* @param yearHi The upper bound on the year range
* @return
*/
public
static
BasicSearchResult
range
(
Integer
taxonId
,
Integer
yearLo
,
Integer
yearHi
){
public
static
BasicSearchResult
range
(
Integer
taxonId
,
Integer
yearLo
,
Integer
yearHi
,
Double
latLo
,
Double
latHi
,
Double
longLo
,
Double
longHi
){
GeneralRange
<
Record
>
a0
=
RangeHelper
.
date
(
Bound
.
ANY
);
if
((
yearLo
!=
null
)
&&
(
yearHi
!=
null
))
{
...
...
@@ -34,8 +38,16 @@ public class BasicSearch {
a0
=
RangeHelper
.
date
(
Bound
.
LOWHIGH
,
lower
,
upper
);
}
GeneralRange
<
Record
>
a2
=
r
->
0
;
GeneralRange
<
Record
>
a3
=
r
->
0
;
GeneralRange
<
Record
>
a2
=
RangeHelper
.
latitude
(
Bound
.
ANY
);
GeneralRange
<
Record
>
a3
=
RangeHelper
.
longitude
(
Bound
.
ANY
);
if
((
latLo
!=
null
)
&&
(
latHi
!=
null
))
{
a2
=
RangeHelper
.
latitude
(
Bound
.
LOWHIGH
,
latLo
,
latHi
);
}
if
((
longLo
!=
null
)
&&
(
longHi
!=
null
))
{
a3
=
RangeHelper
.
longitude
(
Bound
.
LOWHIGH
,
longLo
,
longHi
);
}
GeneralRange
<
Record
>
a1
;
...
...
This diff is collapsed.
Click to expand it.
src/sort/RangeHelper.java
+
6
−
6
View file @
12ac6314
...
...
@@ -84,7 +84,7 @@ public class RangeHelper {
* @param bound -Value of bound
* @return -General range that matches the bound
*/
public
static
GeneralRange
<
Record
>
longitude
(
Bound
boundtype
,
float
bound
)
{
public
static
GeneralRange
<
Record
>
longitude
(
Bound
boundtype
,
double
bound
)
{
if
(
boundtype
==
Bound
.
LOWER
)
{
GeneralRange
<
Record
>
range
=
p
->
p
.
getLongitude
()
<
bound
?
0
:
1
;
return
range
;
...
...
@@ -94,7 +94,7 @@ public class RangeHelper {
return
range
;
}
else
if
(
boundtype
==
Bound
.
EQUALS
)
{
GeneralRange
<
Record
>
range
=
p
->
Float
.
compare
(
p
.
getLongitude
(),
bound
)
;
GeneralRange
<
Record
>
range
=
p
->
Double
.
compare
(
p
.
getLongitude
(),
bound
)
;
return
range
;
}
else
return
null
;
...
...
@@ -108,7 +108,7 @@ public class RangeHelper {
* @param rightbound -Value of right bound
* @return -General range that matches the bound
*/
public
static
GeneralRange
<
Record
>
longitude
(
Bound
boundtype
,
float
leftbound
,
float
rightbound
)
{
public
static
GeneralRange
<
Record
>
longitude
(
Bound
boundtype
,
double
leftbound
,
double
rightbound
)
{
if
(
boundtype
==
Bound
.
LOWHIGH
)
{
GeneralRange
<
Record
>
range
=
p
->
p
.
getLongitude
()
<
leftbound
?
-
1
:
(
p
.
getLongitude
()
>
rightbound
?
1
:
0
);
return
range
;
...
...
@@ -138,7 +138,7 @@ public class RangeHelper {
* @param bound -Value of bound
* @return -General range that matches the bound
*/
public
static
GeneralRange
<
Record
>
latitude
(
Bound
boundtype
,
float
bound
)
{
public
static
GeneralRange
<
Record
>
latitude
(
Bound
boundtype
,
double
bound
)
{
if
(
boundtype
==
Bound
.
LOWER
)
{
GeneralRange
<
Record
>
range
=
p
->
p
.
getLatitude
()
<
bound
?
0
:
1
;
return
range
;
...
...
@@ -148,7 +148,7 @@ public class RangeHelper {
return
range
;
}
else
if
(
boundtype
==
Bound
.
EQUALS
)
{
GeneralRange
<
Record
>
range
=
p
->
Float
.
compare
(
p
.
getLatitude
(),
bound
);
GeneralRange
<
Record
>
range
=
p
->
Double
.
compare
(
p
.
getLatitude
(),
bound
);
return
range
;
}
else
return
null
;
...
...
@@ -163,7 +163,7 @@ public class RangeHelper {
* @param rightbound -Value of right bound
* @return -General range that matches the bound
*/
public
static
GeneralRange
<
Record
>
latitude
(
Bound
boundtype
,
int
leftbound
,
int
rightbound
)
{
public
static
GeneralRange
<
Record
>
latitude
(
Bound
boundtype
,
double
leftbound
,
double
rightbound
)
{
if
(
boundtype
==
Bound
.
LOWHIGH
)
{
GeneralRange
<
Record
>
range
=
p
->
p
.
getLatitude
()
<
leftbound
?
-
1
:
(
p
.
getLatitude
()
>
rightbound
?
1
:
0
);
return
range
;
...
...
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