net.aerith.misao.xml
Class XmlReport

java.lang.Object
  |
  +--net.aerith.misao.xml.IONode
        |
        +--net.aerith.misao.xml.relaxer.XmlReport
              |
              +--net.aerith.misao.xml.XmlReport

public class XmlReport
extends XmlReport

The XmlReport is an application side implementation of the class that the relaxer generated automatically.

In order to reduce the memory assumption, all the star data are converted into the internal data by masticateXml method after reading the XML file, and restored into the XML data by composeXml method.

See Also:
Serialized Form

Fields inherited from class net.aerith.misao.xml.relaxer.XmlReport
data, information, parentRNode, rContext, system
 
Constructor Summary
XmlReport()
           
 
Method Summary
 void countStars()
          Counts the number of stars.
private static java.lang.String getAttribute(java.lang.String s)
          Gets the attribute string in one line of the XML document.
private static java.lang.String getContent(java.lang.String s)
          Gets the content string in one line of the XML document.
static XmlReport read(java.io.BufferedReader in, Coor coor, double radius)
          Reads the XML report document with only star data around the specified R.A.
 void read(java.io.File file)
          Reads this XML document from the specified file.
 void read(java.io.Reader in)
          Reads this XML document from the specified reader.
static XmlInformation readInformation(java.io.File file)
          Reads only the information element in the XML document from the specified file.
static XmlInformation readInformation(java.io.Reader in)
          Reads only the information element in the XML document from the specified reader.
static XmlStar readStar(java.io.BufferedReader in, java.lang.String name)
          Reads the star element in the XML report document with the specified name.
 void write(java.io.File file)
          Writes this XML document to the specified file.
 void write(java.io.Writer out)
          Writes this XML document to the specified writer.
 
Methods inherited from class net.aerith.misao.xml.relaxer.XmlReport
getData, getInformation, getParentRNode, getRContext, getRContextResolved, getRNodes, getSystem, init, isMatch, isMatch, isMatchHungry, makeElement, setData, setInformation, setParentRNode, setRContext, setSystem, setup, setup, setup
 
Methods inherited from class net.aerith.misao.xml.IONode
translateFrom, translateTo
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Constructor Detail

XmlReport

public XmlReport()
Method Detail

read

public void read(java.io.Reader in)
          throws java.io.IOException
Reads this XML document from the specified reader.

This method does not use the standard DOM parser, but runs faster and does not consume too much memory.

Overrides:
read in class IONode
Parameters:
in - the reader.
Throws:
java.io.IOException - if I/O error occurs.

read

public void read(java.io.File file)
          throws java.io.IOException
Reads this XML document from the specified file. When the filename ends with ".gz" suffix, it opens the file through GZIPInputStream.
Overrides:
read in class IONode
Parameters:
file - the file.
Throws:
java.io.IOException - if I/O error occurs.

getContent

private static java.lang.String getContent(java.lang.String s)
Gets the content string in one line of the XML document. This is for the fast reader, but not perfect.
Parameters:
s - the one line string.
Returns:
the content.

getAttribute

private static java.lang.String getAttribute(java.lang.String s)
Gets the attribute string in one line of the XML document. This is for the fast reader, but not perfect.
Parameters:
s - the one line string.
Returns:
the attiribute.

readInformation

public static XmlInformation readInformation(java.io.File file)
                                      throws java.io.IOException,
                                             java.io.FileNotFoundException
Reads only the information element in the XML document from the specified file. When the filename ends with ".gz" suffix, it opens the file through GZIPInputStream.
Parameters:
file - the XML document file.
Returns:
the information element.
Throws:
java.io.IOException - if I/O error occurs.
java.io.FileNotFoundException - if a file does not exists.

readInformation

public static XmlInformation readInformation(java.io.Reader in)
                                      throws java.io.IOException
Reads only the information element in the XML document from the specified reader.
Parameters:
in - the reader.
Returns:
the information element.
Throws:
java.io.IOException - if I/O error occurs.

read

public static XmlReport read(java.io.BufferedReader in,
                             Coor coor,
                             double radius)
                      throws java.io.IOException
Reads the XML report document with only star data around the specified R.A. and Decl.
Parameters:
in - the reader.
coor - the R.A. and Decl.
radius - the radius in degree.
Returns:
the Xml report document.
Throws:
java.io.IOException - if I/O error occurs.

readStar

public static XmlStar readStar(java.io.BufferedReader in,
                               java.lang.String name)
                        throws java.io.IOException
Reads the star element in the XML report document with the specified name.
Parameters:
in - the reader.
name - the name.
Returns:
the star element.
Throws:
java.io.IOException - if I/O error occurs.

write

public void write(java.io.Writer out)
           throws java.io.IOException
Writes this XML document to the specified writer.
Overrides:
write in class IONode
Parameters:
out - the writer.
Throws:
java.io.IOException - if I/O error occurs.

write

public void write(java.io.File file)
           throws java.io.IOException
Writes this XML document to the specified file. When the filename ends with ".gz" suffix, it opens the file through GZIPOutputStream.
Overrides:
write in class IONode
Parameters:
out - the writer.
Throws:
java.io.IOException - if I/O error occurs.

countStars

public void countStars()
Counts the number of stars.