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
31b205be
Commit
31b205be
authored
7 years ago
by
Ray Liu
Browse files
Options
Downloads
Patches
Plain Diff
Added Date fields and getters for record and also added rangehelper
functions for longitude and latitude
parent
101cff32
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/biotree/Record.java
+11
-0
11 additions, 0 deletions
src/biotree/Record.java
src/sort/RangeHelper.java
+64
-0
64 additions, 0 deletions
src/sort/RangeHelper.java
with
75 additions
and
0 deletions
src/biotree/Record.java
+
11
−
0
View file @
31b205be
...
...
@@ -12,6 +12,7 @@ public class Record implements Comparable<Record> {
private
final
int
year
;
private
final
int
month
;
private
final
int
day
;
private
final
Date
recDate
;
/**
...
...
@@ -29,6 +30,7 @@ public class Record implements Comparable<Record> {
this
.
year
=
year
;
this
.
month
=
month
;
this
.
day
=
day
;
this
.
recDate
=
new
Date
(
year
,
month
,
day
);
}
...
...
@@ -109,6 +111,15 @@ public class Record implements Comparable<Record> {
return
day
;
}
/**
* Gets date of the record
*
* @return The date of the record
*/
public
Date
getDate
()
{
return
recDate
;
}
@Override
public
int
compareTo
(
Record
o
)
{
// TODO Auto-generated method stub
...
...
This diff is collapsed.
Click to expand it.
src/sort/RangeHelper.java
+
64
−
0
View file @
31b205be
...
...
@@ -34,4 +34,68 @@ public class RangeHelper {
}
else
return
null
;
}
public
static
GeneralRange
<
Record
>
longitude
(
Bound
boundtype
)
{
if
(
boundtype
==
Bound
.
ANY
)
{
GeneralRange
<
Record
>
range
=
p
->
0
;
return
range
;
}
else
return
null
;
}
public
static
GeneralRange
<
Record
>
longitude
(
Bound
boundtype
,
int
bound
)
{
if
(
boundtype
==
Bound
.
LOWER
)
{
GeneralRange
<
Record
>
range
=
p
->
p
.
getLongitude
()
<
bound
?
0
:
1
;
return
range
;
}
else
if
(
boundtype
==
Bound
.
UPPER
)
{
GeneralRange
<
Record
>
range
=
p
->
p
.
getLongitude
()
>
bound
?
0
:
1
;
return
range
;
}
else
if
(
boundtype
==
Bound
.
EQUALS
)
{
GeneralRange
<
Record
>
range
=
p
->
p
.
getLongitude
()
==
bound
?
0
:
1
;
return
range
;
}
else
return
null
;
}
public
static
GeneralRange
<
Record
>
longitude
(
Bound
boundtype
,
int
leftbound
,
int
rightbound
)
{
if
(
boundtype
==
Bound
.
LOWHIGH
)
{
GeneralRange
<
Record
>
range
=
p
->
p
.
getLongitude
()
<
leftbound
?
-
1
:
(
p
.
getLongitude
()
>
rightbound
?
1
:
0
);
return
range
;
}
else
return
null
;
}
public
static
GeneralRange
<
Record
>
latitude
(
Bound
boundtype
)
{
if
(
boundtype
==
Bound
.
ANY
)
{
GeneralRange
<
Record
>
range
=
p
->
0
;
return
range
;
}
else
return
null
;
}
public
static
GeneralRange
<
Record
>
latitude
(
Bound
boundtype
,
int
bound
)
{
if
(
boundtype
==
Bound
.
LOWER
)
{
GeneralRange
<
Record
>
range
=
p
->
p
.
getLatitude
()
<
bound
?
0
:
1
;
return
range
;
}
else
if
(
boundtype
==
Bound
.
UPPER
)
{
GeneralRange
<
Record
>
range
=
p
->
p
.
getLatitude
()
>
bound
?
0
:
1
;
return
range
;
}
else
if
(
boundtype
==
Bound
.
EQUALS
)
{
GeneralRange
<
Record
>
range
=
p
->
p
.
getLatitude
()
==
bound
?
0
:
1
;
return
range
;
}
else
return
null
;
}
public
static
GeneralRange
<
Record
>
latitude
(
Bound
boundtype
,
int
leftbound
,
int
rightbound
)
{
if
(
boundtype
==
Bound
.
LOWHIGH
)
{
GeneralRange
<
Record
>
range
=
p
->
p
.
getLatitude
()
<
leftbound
?
-
1
:
(
p
.
getLatitude
()
>
rightbound
?
1
:
0
);
return
range
;
}
else
return
null
;
}
}
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