net.aerith.misao.xml
Class XmlStar

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

public class XmlStar
extends XmlStar

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

It keeps a list of Star objects, instead of a list of XmlRecord objects. After reading the XML file, all the XmlRecord objects are converted into the Star objects and deleted, by the masticateXml method. Before saving in the XML file, the Star objects are converted into the XmlRecord objects by the composeXml method. This will reduce the memory assumption.

Note that the list of star objects must not contain MergedStar.

See Also:
Serialized Form

Field Summary
protected  java.util.Vector stars
          The list of star objects.
 
Fields inherited from class net.aerith.misao.xml.relaxer.XmlStar
name, parentRNode, rContext, record
 
Constructor Summary
XmlStar()
          Constructs an XmlStar.
 
Method Summary
 void addStar(Star star)
          Adds a star object.
private  void addXmlData(Star star)
          Creates a Record of the specified star and adds to the array.
 void composeXml()
          Composes the internal star data into the XML data.
 boolean contains(Star star)
          Returns true if this contains the specified star object.
 void deleteRecord(Star star)
          Deletes the specified star object.
 void deleteXml()
          Deletes the XML data.
 java.util.Vector getAllRecords()
          Gets all the record contained in this star.
 java.lang.String[] getAllVsnetNames()
          Gets all the names of this star in a format for the VSNET (Variable Star Network).
 int getNumber()
          Gets the number in the type.
 Star[] getRecords(java.lang.String class_name)
          Gets the array of records of the specified catalog star class.
 StarImage getStarImage()
          Gets the record of the detected star image.
 java.lang.String getType()
          Gets the type.
 Position getTypicalPosition()
          Gets the typical (x,y) position of this star.
 java.lang.String getTypicalVsnetName(java.util.Vector catalog_list)
          Gets the typical name of this star in a format for the VSNET (Variable Star Network).
 void masticateXml()
          masticates the XML data into the internal star data.
 void setName(java.lang.String type, int number)
          Sets the name.
 void write(java.io.Writer out)
          Writes this XML document to the specified writer.
private  void writeStar(java.io.Writer out, Star star)
          Writes the XML document of the specified star to the specified writer.
 
Methods inherited from class net.aerith.misao.xml.relaxer.XmlStar
addRecord, getName, getParentRNode, getRContext, getRContextResolved, getRecord, getRNodes, init, isMatch, isMatch, isMatchHungry, makeElement, setName, setParentRNode, setRContext, setRecord, setup, setup, setup
 
Methods inherited from class net.aerith.misao.xml.IONode
read, read, translateFrom, translateTo, write
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

stars

protected java.util.Vector stars
The list of star objects.
Constructor Detail

XmlStar

public XmlStar()
Constructs an XmlStar.
Method Detail

getType

public java.lang.String getType()
Gets the type.
Returns:
the type.

getNumber

public int getNumber()
Gets the number in the type.
Returns:
the number in the type.

setName

public void setName(java.lang.String type,
                    int number)
Sets the name.
Parameters:
type - the type of the star.
number - the number of the star.

addStar

public void addStar(Star star)
Adds a star object.
Parameters:
star - the star to add.

getTypicalVsnetName

public java.lang.String getTypicalVsnetName(java.util.Vector catalog_list)
Gets the typical name of this star in a format for the VSNET (Variable Star Network). It selects the GCVS name, NSV name, the other variable star name, the star catalog name or the name based on the R.A. and Decl. in this order of priority. Note that only the catalogs in the specified list are considerd.
Parameters:
catalog_list - the list of valid catalog names.
Returns:
the typical name of this star.

getAllVsnetNames

public java.lang.String[] getAllVsnetNames()
Gets all the names of this star in a format for the VSNET (Variable Star Network). If the star has a catalog record, the name based on the R.A. and Decl. is excluded from the result.
Returns:
all the names of this star.

getStarImage

public StarImage getStarImage()
Gets the record of the detected star image.
Returns:
the record of the detected star image.

getRecords

public Star[] getRecords(java.lang.String class_name)
Gets the array of records of the specified catalog star class.
Parameters:
class_name - the name of the catalog star class.
Returns:
the array of records of the specified catalog star class.

deleteRecord

public void deleteRecord(Star star)
Deletes the specified star object.
Parameters:
star - the star object to be deleted.

getAllRecords

public java.util.Vector getAllRecords()
Gets all the record contained in this star.
Returns:
the list of all the record contained in this star.

contains

public boolean contains(Star star)
Returns true if this contains the specified star object.
Parameters:
star - the star object.
Returns:
true if this contains the specified star object.

getTypicalPosition

public Position getTypicalPosition()
Gets the typical (x,y) position of this star.

The position is decided in the following order of priority.

  1. position of the catalog for astrometry.
  2. position of the detected star.
  3. position of the other data.

masticateXml

public void masticateXml()
masticates the XML data into the internal star data.

composeXml

public void composeXml()
Composes the internal star data into the XML data.

addXmlData

private void addXmlData(Star star)
Creates a Record of the specified star and adds to the array.
Parameters:
star - the star.

deleteXml

public void deleteXml()
Deletes the XML data.

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.

writeStar

private void writeStar(java.io.Writer out,
                       Star star)
                throws java.io.IOException
Writes the XML document of the specified star to the specified writer.
Parameters:
out - the writer.
star - the star.
Throws:
java.io.IOException - if I/O error occurs.