Ejemplo n.º 1
0
  /** ************************************************************************* * * Constructor */
  public ExpressionEntry(
      BTState appState,
      String region,
      String time,
      String expr,
      String source,
      String confidence,
      String strategySource,
      String startStrategy,
      String endStrategy,
      String variable)
      throws IOException {

    region_ = region;
    try {
      time_ = Integer.parseInt(time);
    } catch (NumberFormatException nfex) {
      throw new IOException();
    }

    TimeAxisDefinition tad = appState.getDB().getTimeAxisDefinition();
    if (!tad.timeIsOk(time_)) {
      throw new IOException();
    }

    if (expr == null) {
      throw new IOException();
    } else {
      expr = expr.trim();
      try {
        expr_ = mapFromExpressionTag(expr);
      } catch (IllegalArgumentException iaex) {
        throw new IOException();
      }
    }

    if (expr_ == VARIABLE) {
      if (variable == null) {
        throw new IOException();
      }
      try {
        variable_ = Double.parseDouble(variable);
      } catch (NumberFormatException nfex) {
        throw new IOException();
      }
      if ((variable_ < 0.0) || (variable_ > 1.0)) {
        throw new IOException();
      }
    }

    if (source == null) {
      source_ = NO_SOURCE_SPECIFIED;
    } else {
      source = source.trim();
      try {
        source_ = mapFromSourceTag(source);
      } catch (IllegalArgumentException iaex) {
        throw new IOException();
      }
    }

    if (strategySource == null) {
      strategySource_ = NO_SOURCE_SPECIFIED;
    } else {
      strategySource = strategySource.trim();
      try {
        strategySource_ = mapFromSourceTag(strategySource);
      } catch (IllegalArgumentException iaex) {
        throw new IOException();
      }
    }

    if (confidence == null) {
      confidence_ = TimeCourseGene.USE_BASE_CONFIDENCE;
    } else {
      confidence = confidence.trim();
      if (confidence.equalsIgnoreCase("normal")) {
        confidence_ = TimeCourseGene.NORMAL_CONFIDENCE;
      } else if (confidence.equalsIgnoreCase("interpolated")) {
        confidence_ = TimeCourseGene.INTERPOLATED;
      } else if (confidence.equalsIgnoreCase("assumption")) {
        confidence_ = TimeCourseGene.ASSUMPTION;
      } else if (confidence.equalsIgnoreCase("inferred")) {
        confidence_ = TimeCourseGene.INFERRED;
      } else if (confidence.equalsIgnoreCase("questionable")) {
        confidence_ = TimeCourseGene.QUESTIONABLE;
      } else {
        throw new IOException();
      }
    }

    try {
      startStrategy_ = calculateStrategy(startStrategy, true);
      endStrategy_ = calculateStrategy(endStrategy, false);
    } catch (IllegalArgumentException iae) {
      throw new IOException();
    }
  }