Package org.aavso.tools.vstar.ui.mediator

Examples of org.aavso.tools.vstar.ui.mediator.StarInfo


  // Find star name corresponding to '000-BCT-905' (Eps Aur).
  public void testGetEpsAurFromAUIDViaVSX() {
    try {
      AAVSODatabaseConnector obsConnector = AAVSODatabaseConnector.utDBConnector;
      Connection connection = obsConnector.createConnection();
      StarInfo info = vsxStarNameAndAUIDRetriever.getStarByAUID(connection,
          "000-BCT-905");
      // Test for equality, trimming and ignoring case.
      assertTrue("Eps Aur".equalsIgnoreCase(info.getDesignation().trim()));
    } catch (Exception e) {
      fail();
    }
  }
View Full Code Here


  // Retrieve 'Nova Eridani 2009' AUID.
  public void testGetNEridaniAUIDViaVSX() {
    try {
      AAVSODatabaseConnector obsConnector = AAVSODatabaseConnector.utDBConnector;
      Connection connection = obsConnector.createConnection();
      StarInfo info = vsxStarNameAndAUIDRetriever.getStarByName(connection, "N Eri 2009");
      assertEquals("000-BJR-847", info.getAuid());
    } catch (Exception e) {
      fail();
    }
  }
View Full Code Here

  // Retrieve 'KT Eri' (same as 'N Eri 2009') AUID.
  public void testGetKTEridaniAUIDViaVSX() {
    try {
      AAVSODatabaseConnector obsConnector = AAVSODatabaseConnector.utDBConnector;
      Connection connection = obsConnector.createConnection();
      StarInfo info = vsxStarNameAndAUIDRetriever.getStarByName(connection, "KT Eri");
      assertEquals("000-BJR-847", info.getAuid());
    } catch (Exception e) {
      fail();
    }
  }
View Full Code Here

  // Find star name corresponding to '000-BJR-847' (Nova Eridani 2009).
  public void testGetNovaEridani2009FromAUIDViaVSX() {
    try {
      AAVSODatabaseConnector obsConnector = AAVSODatabaseConnector.utDBConnector;
      Connection connection = obsConnector.createConnection();
      StarInfo info = vsxStarNameAndAUIDRetriever.getStarByAUID(connection,
          "000-BJR-847");
      // Test for equality, trimming and ignoring case.
      // TODO: trim at source (in dialog)
      assertTrue("KT Eri".equalsIgnoreCase(info.getDesignation().trim()));
    } catch (Exception e) {
      fail();
    }
  }
View Full Code Here

      if (aliasResults.next()) {
        auid = aliasResults.getString("auid");
      }
    }

    return new StarInfo(name, auid);
  }
View Full Code Here

    ResultSet validationResults = starNamePreparedStatement.executeQuery();
    if (validationResults.next()) {
      starName = validationResults.getString("name");
    }

    return new StarInfo(starName, auid);
  }
View Full Code Here

          name = obsFile.getName();
        }

        mediator.createNewStarObservationArtefacts(analyser
            .getNewStarType(),
            new StarInfo(textFormatReader, name), plotTaskPortion,
            isAdditiveLoad);
      }
    } catch (Throwable t) {
      ValidObservation.restore();
View Full Code Here

      AAVSODatabaseConnector vsxConnector = AAVSODatabaseConnector.vsxDBConnector;
      Connection vsxConnection = vsxConnector.createConnection();

      // TODO: this should always be populated by VSX methods below!!
      // (e.g. to get period, epoch, variable/spectral type, discoverer).
      StarInfo starInfo = new StarInfo(starName, auid);

      // Do we need to ask for the AUID from the database before
      // proceeding?
      if (auid == null) {
        starInfo = vsxConnector.getAUID(vsxConnection, starName);
        auid = starInfo.getAuid();
        if (auid == null) {
          throw new UnknownStarError(starName);
        }
      }

      // No, do we need instead to ask for the star name because
      // we have an AUID but no star name?
      if (starName == null) {
        starInfo = vsxConnector.getStarName(vsxConnection, auid);
        starName = starInfo.getDesignation();
        if (starName == null) {
          throw new UnknownAUIDError(auid);
        }
      }

      updateProgress(2);

      // Get a prepared statement to read a set of observations
      // from the database, setting the parameters for the star
      // we are targeting. We distinguish between the case where
      // no JD min/max is supplied, and when one is.

      // TODO:
      // - Hide all this statement stuff behind a get-observations
      // method.
      // - Obs stmt creation and param setting should be a single
      // operation to avoid possible mismatched calls! Either that
      // or remove stmt parameter from parameter setting method.

      AAVSODatabaseConnector obsConnector = AAVSODatabaseConnector.observationDBConnector;
      Connection obsConnection = obsConnector.createConnection();

      PreparedStatement obsStmt = null;

      if (minJD == 0 && maxJD == Double.MAX_VALUE) {
        obsStmt = obsConnector
            .createObservationWithNoJDRangeQuery(obsConnection);
      } else {
        obsStmt = obsConnector
            .createObservationWithJDRangeQuery(obsConnection);
      }
      updateProgress(2);

      // Execute the query, passing the result set to the
      // database observation retriever to give us the valid
      // and observation lists and categorised valid observation
      // map from which all else flows.
      if (minJD == 0 && maxJD == Double.MAX_VALUE) {
        obsConnector.setObservationWithNoJDRangeQueryParams(obsStmt,
            auid);
      } else {
        obsConnector.setObservationWithJDRangeQueryParams(obsStmt,
            auid, minJD, maxJD);
      }

      Mediator.getUI().getStatusPane().setMessage(
          LocaleProps.get("STATUS_PANE_RETRIEVING_OBS"));
      results = obsStmt.executeQuery();
      updateProgress(2);

      AAVSODatabaseObservationReader databaseObsReader = new AAVSODatabaseObservationReader(
          results);

      ValidObservation.reset();

      databaseObsReader.retrieveObservations();
      starInfo.setRetriever(databaseObsReader);

      updateProgress(2);

      if (databaseObsReader.getValidObservations().isEmpty()) {
        throw new ObservationReadError(
View Full Code Here

   */
  public void update(NewStarMessage msg) {
    if (msg.getNewStarType() == NewStarType.NEW_STAR_FROM_DATABASE) {
      // We may have period and/or epoch information from
      // the database.
      StarInfo info = msg.getStarInfo();
      Double period = info.getPeriod();
      Double epoch = info.getEpoch();

      if (period == null) {
        // No period available, so just clear the field.
        this.periodField.setText("");
        this.periodField.setToolTipText("Enter period in days");
View Full Code Here

  }

  @Override
  public void invoke(ISeriesInfoProvider seriesInfo) {
    // Get default period, if there is one.
    StarInfo starInfo = Mediator.getInstance().getLatestNewStarMessage()
        .getStarInfo();
    period = starInfo.getPeriod();

    // Request the series to be used.
    ObservationAndMeanPlotModel model = Mediator.getInstance()
        .getObservationPlotModel(AnalysisType.RAW_DATA);

    SingleSeriesSelectionDialog seriesDlg = new SingleSeriesSelectionDialog(
        model);

    if (!seriesDlg.isCancelled()) {
      // Get the mean magnitude.
      SeriesType series = seriesDlg.getSeries();
      List<ValidObservation> obs = seriesInfo.getObservations(series);
      // TODO: how should this be computed? B-V or arithmetic mean as
      // below?
      magnitude = DescStats.calcMagMeanInRange(obs,
          JDTimeElementEntity.instance, 0, obs.size() - 1)[DescStats.MEAN_MAG_INDEX];

      // Get the type, modified period and magnitude.
      Set<String> types = new TreeSet<String>();
      types.add(DCEP);
      String type = starInfo.getVarType();
      String initialType = type;
      if (type == null || !types.contains(type)) {
        initialType = DCEP;
      }
View Full Code Here

TOP

Related Classes of org.aavso.tools.vstar.ui.mediator.StarInfo

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.