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
e2c6257f
Commit
e2c6257f
authored
7 years ago
by
Christopher Schankula
Browse files
Options
Downloads
Patches
Plain Diff
working, sorted doBioLookup!
parent
5aac4c93
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/data/TaxonNode.java
+7
-1
7 additions, 1 deletion
src/data/TaxonNode.java
src/web/Director.java
+1
-2
1 addition, 2 deletions
src/web/Director.java
tomcat/webapps/Trawl/bioresult.jsp
+14
-4
14 additions, 4 deletions
tomcat/webapps/Trawl/bioresult.jsp
with
22 additions
and
7 deletions
src/data/TaxonNode.java
+
7
−
1
View file @
e2c6257f
...
...
@@ -12,7 +12,7 @@ import java.util.ArrayList;
* https://stackoverflow.com/questions/2697182/how-to-use-an-array-list
*/
public
class
TaxonNode
implements
Serializable
{
public
class
TaxonNode
implements
Serializable
,
Comparable
<
TaxonNode
>
{
/**
*
*/
...
...
@@ -142,4 +142,10 @@ public class TaxonNode implements Serializable {
s
+=
String
.
format
(
"%-20s%d\n"
,
"Count:"
,
childrenCount
);
return
s
;
}
@Override
public
int
compareTo
(
TaxonNode
o
)
{
// TODO Auto-generated method stub
return
0
;
}
}
This diff is collapsed.
Click to expand it.
src/web/Director.java
+
1
−
2
View file @
e2c6257f
...
...
@@ -16,9 +16,8 @@ public class Director extends HttpServlet {
public
void
doPost
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
IOException
,
ServletException
{
RequestDispatcher
view
=
null
;
String
req
=
getUrlDoPortion
(
request
);
//
if (req
==
"doBioLookup.do")
if
(
req
.
equals
(
"doBioLookup.do"
)
)
view
=
request
.
getRequestDispatcher
(
"bioresult.jsp"
);
request
.
setAttribute
(
"url"
,
req
);
//RequestDispatcher view = request.getRequestDispatcher("histogram.jsp");
view
.
forward
(
request
,
response
);
...
...
This diff is collapsed.
Click to expand it.
tomcat/webapps/Trawl/bioresult.jsp
+
14
−
4
View file @
e2c6257f
<%@page
import=
"org.json.simple.JSONArray"
%>
<%@page
import=
"sort.MergeSort"
%>
<%@page
import=
"sort.GeneralCompare"
%>
<%@page
import=
"org.json.simple.parser.JSONParser"
%>
<%@ page
import=
"java.util.*, data.Record, model.TrawlExpert, search.BST, search.BasicSearchResult, org.json.simple.JSONObject, data.TaxonNode"
%>
<%
TrawlExpert
te
=
(
TrawlExpert
)
request
.
getServletContext
().
getAttribute
(
"trawl"
);
Iterable
<
TaxonNode
>
txNodes
=
te
.
getTaxonRecord
(
2
).
getChildren
();
JSONParser
parser
=
new
JSONParser
();
//
JSONObject req = (JSONObject) parser.parse(request.getReader().
toStr
in
g
());
JSONObject
req
=
(
JSONObject
)
parser
.
parse
(
request
.
getReader
().
readL
in
e
());
//Integer taxonId = (int) (long) req.get("taxonId");
Integer
taxonId
=
(
int
)
(
long
)
req
.
get
(
"taxid"
);
//System.out.println(taxonId);
ArrayList
<
TaxonNode
>
txNodes
=
((
ArrayList
<
TaxonNode
>
)
te
.
getTaxonRecord
(
taxonId
).
getChildren
());
TaxonNode
[]
txNodesAr
=
txNodes
.
toArray
(
new
TaxonNode
[
txNodes
.
size
()]);
GeneralCompare
<
TaxonNode
>
gc
=
(
tn0
,
tn1
)
-
>
((
TaxonNode
)
tn0
).
getName
().
compareTo
(((
TaxonNode
)
tn1
).
getName
());
MergeSort
.
sort
(
txNodesAr
,
0
,
txNodesAr
.
length
-
1
,
gc
);
JSONObject
js
=
new
JSONObject
();
JSONArray
taxonIds
=
new
JSONArray
();
JSONArray
names
=
new
JSONArray
();
for
(
TaxonNode
tx:
txNodes
){
taxonIds
.
add
(-
1
);
names
.
add
(
"Any"
);
for
(
TaxonNode
tx:
txNodesAr
){
taxonIds
.
add
(
tx
.
getTaxonId
());
names
.
add
(
tx
.
getName
());
}
...
...
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