Skip to content
Snippets Groups Projects
Commit d9d55530 authored by Robert Butora's avatar Robert Butora
Browse files

simplifies algorithm output VoTable bySurveys

parent aa7a24a3
No related branches found
No related tags found
No related merge requests found
...@@ -148,61 +148,46 @@ final class XmlSerializer ...@@ -148,61 +148,46 @@ final class XmlSerializer
out.write( "<VOTABLE version='1.1'>" ); out.write( "<VOTABLE version='1.1'>" );
out.write( "<DESCRIPTION> " + searchOutputData.versionString + out.write( "<DESCRIPTION> " + searchOutputData.versionString +
" SUBSURVCOUNT: " + searchOutputData.subsurveyArr.length + " </DESCRIPTION>" ); " subsurvey count: " + searchOutputData.subsurveyArr.length + " </DESCRIPTION>" );
if((searchOutputData.subsurveyArr != null) && (searchOutputData.subsurveyArr.length > 0)) if((searchOutputData.subsurveyArr != null) && (searchOutputData.subsurveyArr.length > 0))
{ {
Subsurvey[] subsurv = searchOutputData.subsurveyArr;
// assumes ORDERED subsurveyArray: by surveyname // assumes ORDERED subsurveyArray: by surveyname
List<StarTable> tableList = new ArrayList(); List<StarTable> tableList = new ArrayList();
String prevSurveyname = searchOutputData.subsurveyArr[0].surveyname.trim(); String prevSurveyname;// = subsurv[0].surveyname.trim();
for(Subsurvey subsurvey : searchOutputData.subsurveyArr) int ix = 0;
do
{ {
prevSurveyname = subsurv[ix].surveyname.trim();
if(prevSurveyname.equals(subsurvey.surveyname.trim())) do
{ {
StarTable table = makeSubsurveyTable( subsurvey ); StarTable table = makeSubsurveyTable( subsurv[ix] );
tableList.add(table); tableList.add(table);
ix++;
} }
else while((ix < subsurv.length) && prevSurveyname.equals(subsurv[ix].surveyname.trim()));
{
out.write( "<RESOURCE>" );
out.write( "<DESCRIPTION> " + prevSurveyname + " </DESCRIPTION>" );
/* PLACEHOLDER FOR RESOURCE PARAM
table.setParameter(new DescribedValue(
new DefaultValueInfo("subsurveyCount",Integer.class,
"Count of subsurveys with found datacube(s)" ),
subsurveyArr.length ) );
table.setParameter(new DescribedValue(
new DefaultValueInfo( "survey", String.class,
"Survey name" ),
subsurvey.surveyname ) );
*/
StarTable[] tables = tableList.toArray(new StarTable[0]); StarTable[] tables = tableList.toArray(new StarTable[0]);
for ( int i = 0; i < tables.length; i++ ) writeResourceSurvey(out, prevSurveyname, tables);
{
VOSerializer.makeSerializer( DataFormat.TABLEDATA, tables[i] ).writeInlineTableElement( out );
}
tableList.clear(); tableList.clear();
out.write( "</RESOURCE>" );
prevSurveyname = subsurvey.surveyname.trim();
StarTable table = makeSubsurveyTable( subsurvey );
tableList.add(table);
} }
while(ix < subsurv.length);
} }
out.write( "</VOTABLE>" );
out.flush();
}
if(!tableList.isEmpty()) private static void writeResourceSurvey(BufferedWriter out, String description, StarTable[] tables)
throws IOException
{ {
out.write( "<RESOURCE>" ); out.write( "<RESOURCE>" );
out.write( "<DESCRIPTION> " + prevSurveyname + " </DESCRIPTION>" ); out.write( "<DESCRIPTION> " + description + " </DESCRIPTION>" );
/* PLACEHOLDER FOR RESOURCE PARAM /* PLACEHOLDER FOR RESOURCE PARAM
...@@ -217,23 +202,14 @@ final class XmlSerializer ...@@ -217,23 +202,14 @@ final class XmlSerializer
subsurvey.surveyname ) ); subsurvey.surveyname ) );
*/ */
StarTable[] tables = tableList.toArray(new StarTable[0]);
for ( int i = 0; i < tables.length; i++ ) for ( int i = 0; i < tables.length; i++ )
{ {
VOSerializer.makeSerializer( DataFormat.TABLEDATA, tables[i] ).writeInlineTableElement( out ); VOSerializer.makeSerializer( DataFormat.TABLEDATA, tables[i] ).writeInlineTableElement( out );
} }
tableList.clear();
out.write( "</RESOURCE>" ); out.write( "</RESOURCE>" );
} }
}
out.write( "</VOTABLE>" );
out.flush();
}
private static StarTable makeSubsurveyTable(Subsurvey subsurvey) private static StarTable makeSubsurveyTable(Subsurvey subsurvey)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment