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
31491423
Commit
31491423
authored
6 years ago
by
Christopher Schankula
Browse files
Options
Downloads
Patches
Plain Diff
new TrawlExpert object api for getting a certain taxon node from a
scientific name
parent
d56106a4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/data/BioTree.java
+18
-2
18 additions, 2 deletions
src/data/BioTree.java
src/model/TrawlExpert.java
+17
-0
17 additions, 0 deletions
src/model/TrawlExpert.java
with
35 additions
and
2 deletions
src/data/BioTree.java
+
18
−
2
View file @
31491423
...
...
@@ -170,7 +170,7 @@ public class BioTree implements Serializable {
*/
public
static
Integer
processRecord
(
String
scientificName
)
throws
IOException
,
ParseException
{
//reverse lookup based on name, try adding the found taxonId.
Integer
taxonId
=
getTaxonRecor
d
(
scientificName
);
Integer
taxonId
=
nameToTaxonI
d
(
scientificName
);
System
.
out
.
println
(
scientificName
+
": "
+
taxonId
);
if
(
taxonId
==
null
)
return
null
;
if
(
taxonId
==
-
1
)
return
null
;
...
...
@@ -237,6 +237,22 @@ public class BioTree implements Serializable {
return
idNodes
.
get
(
taxonId
);
}
/**
* Get the species at a given index (taxonId). This assumes that the
* node already exists or else it will return null. As such, it is best
* to use this function once all the data has been parsed and the BioTree
* has been built.
*
* @param i
* The speciesid (index) of the species.
* @return The Species object.
* @throws ParseException
* @throws IOException
*/
public
static
TaxonNode
getTaxonRecord
(
String
scientificName
)
throws
IOException
,
ParseException
{
return
idNodes
.
get
(
nameToTaxonId
(
scientificName
));
}
/**
* Get the TaxonNode containing information about the given scientific name.
* This assumes that thenode already exists locally or else it will return null.
...
...
@@ -249,7 +265,7 @@ public class BioTree implements Serializable {
* @throws ParseException
* @throws IOException
*/
public
static
Integer
getTaxonRecor
d
(
String
scientificName
)
throws
IOException
,
ParseException
{
public
static
Integer
nameToTaxonI
d
(
String
scientificName
)
throws
IOException
,
ParseException
{
Integer
taxonId
;
//look up based on string literal, return if found
TaxonNode
tx
=
strNodes
.
get
(
scientificName
);
...
...
This diff is collapsed.
Click to expand it.
src/model/TrawlExpert.java
+
17
−
0
View file @
31491423
package
model
;
import
java.io.IOException
;
import
org.json.simple.parser.ParseException
;
import
data.BioTree
;
import
data.DataStore
;
import
data.FileProcessor
;
import
data.Record
;
import
data.TaxonNode
;
import
search.BasicSearch
;
import
search.BasicSearchResult
;
import
sort.KDT
;
...
...
@@ -37,4 +40,18 @@ public class TrawlExpert {
public
BasicSearchResult
rangeSearch
(
Integer
taxonId
,
Integer
yearLo
,
Integer
yearHi
)
{
return
BasicSearch
.
range
(
taxonId
,
yearLo
,
yearHi
);
}
public
TaxonNode
getTaxonRecord
(
Integer
taxonId
)
{
return
BioTree
.
getTaxonRecord
(
taxonId
);
}
public
TaxonNode
getTaxonRecord
(
String
scientificName
)
{
try
{
return
BioTree
.
getTaxonRecord
(
scientificName
);
}
catch
(
IOException
|
ParseException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
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