コード例 #1
0
    private PertSource buildFromXML(String elemName, Attributes attrs) throws IOException {
      String id = AttributeExtractor.extractAttribute(elemName, attrs, "pertSrc", "id", true);

      String src = AttributeExtractor.extractAttribute(elemName, attrs, "pertSrc", "src", true);

      String type = AttributeExtractor.extractAttribute(elemName, attrs, "pertSrc", "type", true);
      type = CharacterEntityMapper.unmapEntities(type, false);

      String proxyKey =
          AttributeExtractor.extractAttribute(elemName, attrs, "pertSrc", "proxy", false);

      String proxySign =
          AttributeExtractor.extractAttribute(elemName, attrs, "pertSrc", "proxySign", false);
      if ((proxySign == null) && (proxyKey != null)) {
        throw new IOException();
      }

      String notes =
          AttributeExtractor.extractAttribute(elemName, attrs, "pertSrc", "notes", false);

      PertSource nps = new PertSource(id, src, type, proxyKey, proxySign);
      if (notes != null) {
        nps.setNotes(Splitter.stringBreak(notes, ",", 0, false));
      }

      return (nps);
    }
コード例 #2
0
  /**
   * ************************************************************************* * * Write the
   * expression to XML *
   */
  public void writeXML(PrintWriter out, Indenter ind) {
    ind.indent();
    out.print("<data region=\"");
    out.print(CharacterEntityMapper.mapEntities(region_, false));
    out.print("\" time=\"");
    out.print(time_);
    out.print("\" expr=\"");
    out.print(mapExpression(expr_));

    if (source_ != NO_SOURCE_SPECIFIED) {
      out.print("\" source=\"");
      out.print(mapToSourceTag(source_));
    }

    if (confidence_ != TimeCourseGene.USE_BASE_CONFIDENCE) {
      out.print("\" confidence=\"");
      out.print(TimeCourseGene.mapConfidence(confidence_));
    }
    String invert = mapStrategy(startStrategy_);
    if (invert != null) {
      out.print("\" starttype=\"");
      out.print(invert);
    }
    invert = mapStrategy(endStrategy_);
    if (invert != null) {
      out.print("\" endtype=\"");
      out.print(invert);
    }

    if (strategySource_ != NO_SOURCE_SPECIFIED) {
      out.print("\" stratSource=\"");
      out.print(mapToSourceTag(strategySource_));
    }

    if (expr_ == VARIABLE) {
      out.print("\" value=\"");
      out.print(variable_);
    }

    out.println("\" />");
    return;
  }
コード例 #3
0
  /**
   * ************************************************************************* * * Handle the
   * attributes for the keyword *
   */
  public static ExpressionEntry buildFromXML(BTState appState, String elemName, Attributes attrs)
      throws IOException {
    if (!elemName.equals("data")) {
      return (null);
    }

    String region = null;
    String time = null;
    String expr = null;
    String confidence = null;
    String startStrategy = null;
    String endStrategy = null;
    String variable = null;
    String srcStr = null;
    String stratSrcStr = null;

    if (attrs != null) {
      int count = attrs.getLength();
      for (int i = 0; i < count; i++) {
        String key = attrs.getQName(i);
        if (key == null) {
          continue;
        }
        String val = attrs.getValue(i);
        if (key.equals("region")) {
          region = CharacterEntityMapper.unmapEntities(val, false);
        } else if (key.equals("time")) {
          time = val;
        } else if (key.equals("expr")) {
          expr = val;
        } else if (key.equals("confidence")) {
          confidence = val;
        } else if (key.equals("starttype")) {
          startStrategy = val;
        } else if (key.equals("endtype")) {
          endStrategy = val;
        } else if (key.equals("value")) {
          variable = val;
        } else if (key.equals("source")) {
          srcStr = val;
        } else if (key.equals("stratSource")) {
          stratSrcStr = val;
        }
      }
    }

    if ((region == null) || (time == null) || (expr == null)) {
      throw new IOException();
    }

    return (new ExpressionEntry(
        appState,
        region,
        time,
        expr,
        srcStr,
        confidence,
        stratSrcStr,
        startStrategy,
        endStrategy,
        variable));
  }