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
f4e308e0
Commit
f4e308e0
authored
7 years ago
by
Winnie
Browse files
Options
Downloads
Patches
Plain Diff
- Create TaxonNode ADT
parent
52c4b73c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/biotree/TaxonNode.java
+29
-16
29 additions, 16 deletions
src/biotree/TaxonNode.java
with
29 additions
and
16 deletions
src/biotree/TaxonNode.java
+
29
−
16
View file @
f4e308e0
package
biotree
;
import
java.util.ArrayList
;
import
java.util.List
;
// https://stackoverflow.com/questions/2697182/how-to-use-an-array-list
public
class
TaxonNode
{
private
final
int
taxonId
;
private
final
TaxonType
taxonType
;
private
final
String
name
;
private
TaxonNode
parent
;
// this can't be final unless parent is recursively returned and constructed in constructor.
private
List
<
TaxonNode
>
children
=
new
ArrayList
<
TaxonNode
>();
private
int
count
;
public
TaxonNode
(
int
taxonId
,
TaxonType
taxonType
,
String
name
)
{
this
.
taxonId
=
taxonId
;
this
.
taxonType
=
taxonType
;
this
.
name
=
name
;
this
.
parent
=
null
;
this
.
children
=
null
;
this
.
count
=
1
;
}
public
int
getTaxonId
()
{
return
0
;
return
this
.
taxonId
;
}
public
TaxonType
getTaxonType
()
{
return
null
;
return
this
.
taxonType
;
}
public
String
getName
()
{
return
""
;
return
this
.
name
;
}
public
void
setParent
(
TaxonNode
parent
)
{
this
.
parent
=
parent
;
}
public
void
addChild
(
TaxonNode
c
hild
)
{
public
void
addChild
(
TaxonNode
newC
hild
)
{
this
.
children
.
add
(
newChild
);
}
public
TaxonNode
getParent
()
{
return
null
;
return
this
.
parent
;
}
public
TaxonNode
[]
getChildren
()
{
return
null
;
//Stub Changed
public
List
<
TaxonNode
>
getChildren
()
{
return
this
.
children
;
}
public
int
getCount
()
{
return
0
;
return
this
.
count
;
}
public
void
incCount
()
{
this
.
count
++;
}
}
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