コード例 #1
0
  public ThrowsTagImpl(String text, ClassDocImpl contextClass, MemberDocImpl contextMember) {
    super(text);

    char[] textarr = text.toCharArray();
    int i = 0;
    for (; i < textarr.length; ++i) {
      if (!Parser.isWhitespace(textarr[i])) break;
    }
    for (; i < textarr.length; ++i) {
      if (Parser.isWhitespace(textarr[i])) {
        this.exceptionName = new String(textarr, 0, i).trim();
        this.exceptionComment = new String(textarr, i, textarr.length - i).trim();
        break;
      }
    }
    if (null != exceptionName) {
      if (contextClass == null) {
        this.exception = Main.getRootDoc().classNamed(exceptionName);
      } else {
        this.exception = contextClass.findClass(exceptionName);
      }
      if (exception != null) this.exceptionName = exception.qualifiedName();
      else {
        if (text.trim().startsWith("<")) {
          Main.getRootDoc()
              .printWarning(
                  "Expected exception name but got '"
                      + text
                      + "' in class "
                      + contextClass.getClassName());
        }
      }
    } else {
      Main.getRootDoc()
          .printWarning(
              "@throws tag in comment for "
                  + contextClass.qualifiedName()
                  + "."
                  + contextMember.name()
                  + " doesn't specify an exception.");
    }
    if (this.exceptionComment != null) {
      setBody(this.exceptionComment, contextClass, contextMember);
    }
  }
コード例 #2
0
ファイル: Driver.java プロジェクト: smirarab/global
  public static void test1() {
    Sequence[] seqs = Parser.test1();
    double[][] distances = (new GappedHammingDistance()).getDistanceMatrix(seqs);
    DecimalFormat f = new DecimalFormat("0000.000");

    System.out.println("   " + seqs.length);

    for (int i = 0; i < seqs.length; i++) {
      System.out.print(seqs[i].name);
      for (int k = 0; k < 10 - seqs[i].name.length(); k++) {
        System.out.print(" ");
      }
      System.out.print("  ");
      int cols = 1;
      for (int j = 0; j < seqs.length; j++) {
        if (i != j) {
          int di = i;
          int dj = j;
          // force symmetric matrix - arg - what the???
          // testing!!!
          if (j > i) {
            di = j;
            dj = i;
          }
          double d = distances[di][dj];
          // testing
          if (d > 2000) {
            System.err.println("ARGH");
          }
          System.out.print(f.format(d));
        } else {
          System.out.print(f.format(0));
        }
        System.out.print("  ");
        cols++;
        if (cols >= 7) {
          System.out.println();
          System.out.print("  ");
          cols = 0;
        }
      }
      if (cols != 7) {
        System.out.println();
      }
    }
  }
コード例 #3
0
ファイル: Driver.java プロジェクト: smirarab/global
  public static void run(
      String infile,
      String outfile,
      String statsOutFile,
      String distanceMeasureString,
      String gapScalingFactorMultipliersString) {

    // testing
    // System.out.println ("zallstring that I heard in Driver.java: |" +
    // gapScalingFactorMultipliersString + "|");

    double[] gapScalingFactorMultipliers =
        parseGapScalingFactorMultipliersString(gapScalingFactorMultipliersString);
    Sequence[] seqs = Parser.parseMSA(infile);

    // arg - to satisfy compiler
    double[][] distances = new double[0][0];

    DistanceWithGapMethod distance = getDistanceWithGapMethod(distanceMeasureString);

    // unfortunately, for cache get/set - no easy way of outputting
    // to stats file if logdet distance error occurred??
    // so just output to STDOUT
    if (distance instanceof GappedDistance) {
      GappedDistance gappedDistance = (GappedDistance) distance;
      // do this cache set only once per all GSFM settings
      gappedDistance.cacheSetSimpleDistanceMatrices(seqs);
      // rerun for all gsfm settings as necessary
      for (int i = 0; i < gapScalingFactorMultipliers.length; i++) {
        double gsfm = gapScalingFactorMultipliers[i];

        // testing
        // System.out.println (gsfm);

        String gsfmOutfile = outfile + GSFM_FILENAME_DELIMITER + (new Double(gsfm)).toString();
        String gsfmStatsOutfile =
            statsOutFile + GSFM_FILENAME_DELIMITER + (new Double(gsfm)).toString();

        // change printwriter to new filename
        changePrintWriter(gsfmStatsOutfile);

        distances = gappedDistance.cacheGetDistanceMatrix(gsfm);
        Writer.writePhylipDistanceMatrix(seqs, distances, gsfmOutfile);

        flushAndClosePrintWriter();
      }
    }
    // LATER ADD IN PARAMETERIZING PASS IN MULTIPLE GAP OPEN/EXTEND
    // PARAMETER COSTS FOR AFFINE DISTANCES
    else if (distance instanceof AffineDistance) {
      // parse out rest of parameters from distanceMeasureString
      GapPenalties gapPenalties = parseAffineDistanceMeasureStringParameters(distanceMeasureString);

      AffineDistance affineDistance = (AffineDistance) distance;
      // do this cache set only once per all GSFM settings
      affineDistance.cacheSetSimpleDistanceMatrices(seqs);
      // rerun for all gsfm settings as necessary
      // affine distance params
      // concatenated onto affine distance name
      for (int i = 0; i < gapScalingFactorMultipliers.length; i++) {
        double gsfm = gapScalingFactorMultipliers[i];

        String gsfmOutfile = outfile + GSFM_FILENAME_DELIMITER + (new Double(gsfm)).toString();
        String gsfmStatsOutfile =
            statsOutFile + GSFM_FILENAME_DELIMITER + (new Double(gsfm)).toString();

        // WARNING - MUST MUST MUST have this set
        // appropriately for both gsfm AND affine penalties!!!
        // change printwriter to new filename
        changePrintWriter(gsfmStatsOutfile);

        distances =
            affineDistance.cacheGetDistanceMatrix(
                gsfm, gapPenalties.gapOpenPenalty, gapPenalties.gapExtendPenalty);
        Writer.writePhylipDistanceMatrix(seqs, distances, gsfmOutfile);

        flushAndClosePrintWriter();
      }
    } else { // no caching of simple distances for non-gapped distance methods
      if ((gapScalingFactorMultipliers.length != 1) || (gapScalingFactorMultipliers[0] != 0.0)) {
        printUsage();
        System.exit(1);
      }

      String gsfmFilenameSuffix = GSFM_FILENAME_DELIMITER + gapScalingFactorMultipliers[0];

      // change printwriter to filename
      changePrintWriter(statsOutFile + gsfmFilenameSuffix);

      distances = distance.getDistanceMatrix(seqs);
      Writer.writePhylipDistanceMatrix(seqs, distances, outfile + gsfmFilenameSuffix);

      flushAndClosePrintWriter();
    }
  }