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
36cf6dd5
Commit
36cf6dd5
authored
7 years ago
by
Christopher Schankula
Browse files
Options
Downloads
Patches
Plain Diff
cast to int instead of long for memory
parent
1c02360a
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/TaxonNode.java
+20
-5
20 additions, 5 deletions
src/biotree/TaxonNode.java
src/biotree/WormsAPI.java
+1
-1
1 addition, 1 deletion
src/biotree/WormsAPI.java
with
21 additions
and
6 deletions
src/biotree/TaxonNode.java
+
20
−
5
View file @
36cf6dd5
...
...
@@ -6,7 +6,7 @@ import java.util.ArrayList;
public
class
TaxonNode
{
//JSON returns long
private
final
long
taxonId
;
private
final
int
taxonId
;
private
final
TaxonType
taxonType
;
private
final
String
name
;
...
...
@@ -14,16 +14,16 @@ public class TaxonNode {
private
ArrayList
<
TaxonNode
>
children
=
new
ArrayList
<
TaxonNode
>();
private
int
count
;
public
TaxonNode
(
long
taxonId
,
TaxonType
taxonType
,
String
name
)
{
public
TaxonNode
(
int
taxonId
,
TaxonType
taxonType
,
String
name
)
{
this
.
taxonId
=
taxonId
;
this
.
taxonType
=
taxonType
;
this
.
name
=
name
;
this
.
parent
=
null
;
this
.
children
=
n
ull
;
this
.
children
=
n
ew
ArrayList
<
TaxonNode
>()
;
this
.
count
=
0
;
}
//JSON returns long
public
long
getTaxonId
()
{
public
int
getTaxonId
()
{
return
this
.
taxonId
;
}
...
...
@@ -59,4 +59,19 @@ public class TaxonNode {
public
void
incCount
()
{
this
.
count
++;
}
public
String
toString
()
{
String
s
=
""
;
s
+=
String
.
format
(
"%-20s%s\n"
,
"Scientific Name:"
,
name
);
s
+=
String
.
format
(
"%-20s%s\n"
,
"Taxon Type:"
,
taxonType
);
s
+=
String
.
format
(
"%-20s%d\n"
,
"Taxon ID:"
,
taxonId
);
if
(
parent
!=
null
)
s
+=
String
.
format
(
"%-20s%d\n"
,
"Parent:"
,
parent
.
getTaxonId
());
s
+=
String
.
format
(
"%-20s"
,
"Children:"
);
for
(
TaxonNode
tx:
children
)
{
s
+=
String
.
format
(
"%d "
,
tx
.
getTaxonId
());
}
s
+=
"\n"
;
s
+=
String
.
format
(
"%-20s%d\n"
,
"Count:"
,
count
);
return
s
;
}
}
This diff is collapsed.
Click to expand it.
src/biotree/WormsAPI.java
+
1
−
1
View file @
36cf6dd5
...
...
@@ -163,7 +163,7 @@ public class WormsAPI {
JSONObject
child
=
(
JSONObject
)
current
.
get
(
"child"
);
if
(
checktype
==
true
)
{
curNode
=
new
TaxonNode
((
long
)
current
.
get
(
"AphiaID"
),
TaxonType
.
valueOf
((
String
)
current
.
get
(
"rank"
)),
curNode
=
new
TaxonNode
(
(
int
)
(
long
)
current
.
get
(
"AphiaID"
),
TaxonType
.
valueOf
((
String
)
current
.
get
(
"rank"
)),
(
String
)
current
.
get
(
"scientificname"
));
nodes
[
n
]
=
curNode
;
n
++;
...
...
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