
/* legacy from copy of DataCube.Survey
 * FIXME equivalent to Subsurvey.java : keep only one of them */

import java.io.UnsupportedEncodingException;


/*static*/ class Survey {
   double rf ;        // rest frequency
   String surveyname; // surveyname
   String species;
   String transition;
   String rf_unit;
   String vel_unit;
   String description;

   Survey(){
      this.rf          = 0.0;
      this.surveyname  = null;
      this.species     = null;
      this.transition  = null;
      this.rf_unit     = null;
      this.vel_unit    = null;
      this.description = null;
   }

   Survey(Survey arg_s){
      this.rf          = arg_s.rf;
      this.surveyname  = arg_s.surveyname;
      this.species     = arg_s.species;
      this.transition  = arg_s.transition;
      this.rf_unit     = arg_s.rf_unit;
      this.vel_unit    = arg_s.vel_unit;
      try{
         this.description = new String(arg_s.description.getBytes("ISO-8859-1"), "UTF-8");
         //this.description = arg_s.description;
      }
      catch (UnsupportedEncodingException ex)
      {
         ex.printStackTrace();
      }
   }

   String id() { return (this.surveyname + " " + this.species + " "  + this.transition); }
   boolean matches(String id) { return id.equals(this.id()); }
/*
   void toXML(PrintWriter writer){

      // replace with escape the XML-predefined entities:
      // <, >, &, %
      description = description.replace("&","&amp;");
      description = description.replace("<","&lt;");
      description = description.replace(">","&gt;");
      description = description.replace("%","&#37;");

      writer.println("<Description>"  + description + "</Description>");
      writer.println("<Survey>"       + surveyname  + "</Survey>");
      writer.println("<Species>"      + species     + "</Species>");
      writer.println("<Transition>"   + transition  + "</Transition>");
      writer.println("<RestFreq>");
      writer.println("<value>"        + rf          + "</value>");
      writer.println("<unit>"         + rf_unit     + "</unit>");
      writer.println("</RestFreq>");
      writer.println("<VelocityUnit>" + vel_unit    + "</VelocityUnit>");
   }
*/
}

