Package org.cishell.testing.convertertester.core.converter.graph

Examples of org.cishell.testing.convertertester.core.converter.graph.Converter


    //assign fault scores to each converter
   
    Map convToFaultScore = new HashMap();
   
    for (int ii = 0; ii < involvedCs.length; ii++) {
      Converter involvedC = (Converter) involvedCs[ii];
     
      Float oldFaultScore = (Float) convToFaultScore.get(involvedC);
      Float newFaultScore;
      if (oldFaultScore == null) {
        //first occurrence of this converter
       
        newFaultScore = DEFAULT_FAULT_SCORE;
        if (isConvThatFailed(involvedC, failFP)) {
          newFaultScore = new Float(newFaultScore.floatValue() *
              FAILED_CONV_PENALTY);
        }
       
      } else {
        //converter has occurred before
       
        newFaultScore = new Float(oldFaultScore.floatValue() +
            DEFAULT_FAULT_SCORE.floatValue() * REPEAT_PENALTY);
      }
     
      convToFaultScore.put(involvedC, newFaultScore);
 
    }
   

   
    //reduce fault scores of trusted converters
   
    float faultScoresTotal = 0.0f;
   
    Set convs = convToFaultScore.keySet();
    Iterator convIter = convs.iterator();
    while (convIter.hasNext()) {
      Converter convInvolved = (Converter) convIter.next();
      Float convFaultScore =
        (Float) convToFaultScore.get(convInvolved);
     
      if (trustedCList.contains(convInvolved)) {
        convFaultScore = new Float(convFaultScore.floatValue() *
            TRUSTED_CONV_PENALTY_REDUCTION);
      }
     
      convToFaultScore.put(convInvolved, convFaultScore);
      faultScoresTotal += convFaultScore.floatValue();
    }
   
    List resultCAFList = new ArrayList();
   
   
    //return chance each converter is at fault, based on fault scores.
   
    for (int ii = 0; ii < involvedCs.length; ii++) {
      Converter involvedC = involvedCs[ii];
     
      Float faultScore = (Float) convToFaultScore.get(involvedC);
     
      float normalizedFaultScore;
      if (faultScoresTotal != 0.0f) {
View Full Code Here


    //eliminate converters that are trusted
   
    List uniqueUntrustedCs = new ArrayList();
    Iterator iter = uniqueInvolvedCs.iterator();
    while (iter.hasNext()) {
      Converter c  = (Converter) iter.next();
      if (! trustedCList.contains(c)) {
        //converter isn't trusted
        //add it to the list
        uniqueUntrustedCs.add(c);
      } else {
        //converter is trusted
        //do nothing
      }
    }
   
    float chanceEachAtFault = 1.0f / uniqueUntrustedCs.size();
   
    List chanceAtFaultList = new ArrayList();
    for (int ii = 0; ii < involvedCs.length; ii++) {
      Converter c = involvedCs[ii];
     
      ChanceAtFault chanceAtFault = null;
      if (uniqueUntrustedCs.contains(c)) {
        chanceAtFault =
          new ChanceAtFault(failFP, c, chanceEachAtFault);
View Full Code Here

        ConverterPath testConvs = tr.getTestConverters();
        if (fprs.length > 0) {
          //mark trusted converters.
           
          for (int kk = 0; kk < testConvs.size(); kk++) {
            Converter c = testConvs.get(kk);
            float percentFilePassesThisConvParticipatedIn =
              trusted[kk] / (float) fprs.length;
            if (trusted[kk] >= MINIMUM_SUCCESSES_TO_BE_TRUSTED &&
                percentFilePassesThisConvParticipatedIn >=
            MINIMUM_PERCENT_FILE_PASSES_REACHED_TO_BE_TRUSTED) {
View Full Code Here

          }
        }
       
        //for each converter involved...
        for (int kk = 0; kk < convsInvolved.length; kk++) {
          Converter conv = convsInvolved[kk];
         
          /*
           * associate the converter with the tests and
           * file passes that involve it.
           *
 
View Full Code Here

    List convResults = new ArrayList();

    List trustedConvList = Arrays.asList(trustedConvs);
    // for every converter we know of...
    for (int ii = 0; ii < allConvs.length; ii++) {
      Converter conv = allConvs[ii];
      // get the associated test to passes map
      Map testToPasses = (Map) convToTestsToPasses.get(conv);

      /*
       * create converter result objects which contain information about
View Full Code Here

   * @param convToTestsToPasses The map we side-effect
   * @param allConvs an array of all the converters we know of
   */
  private static void initialize(Map convToTestsToPasses, Converter[] allConvs) {
    for (int ii = 0; ii < allConvs.length; ii++) {
      Converter conv = allConvs[ii];
     
      convToTestsToPasses.put(conv, new HashMap());
    }
  }
View Full Code Here

   

 
    //dataSoFar.add(currentData);
   
    Converter currentConverter = null;
    try {
      for (int ii = 0; ii < converters.size(); ii++) {
        currentConverter = converters.get(ii);
     
        // No parameters used.
        Hashtable<String, Object> parameters = new Hashtable<String, Object>();
       
        currentData =
          currentConverter.execute(currentData, parameters, fakeCIShellContext);
       
        if (currentData != null) {
          setMetadata(currentData, currentConverter);
          dataSoFar.add(currentData);
        }

        /*
         * There are two ways that converters generally fail.
         * 1) They throw an exception that propagates out into
         * this method, where we catch it.
         * 2) They catch their own exception, send it to the logger,
         * and return null.
         */
        if (currentData == null || currentData[0].getData() == null) {
          Converter converter = converters.get(ii);
         
          String explanation = "Result of conversion was null. \r\n";
         
         
          if (fakeCIShellContext.hasLogEntries()) {
View Full Code Here

  public void generate(ConvResult cr) {

    FileOutputStream reportOutStream = null;
    try {
      ConvResult convResult = cr;
      Converter conv = convResult.getConverter();

      File reportFile = new File(ReportGenerator.TEMP_DIR + cr.getUniqueName());
      reportOutStream = new FileOutputStream(reportFile);

      PrintStream report = new PrintStream(reportOutStream);
View Full Code Here

           
            List cafs = (List) passToCafs.get(pass);
           
            Converter[] involvedConvs = pass.getConvertersInvolved();
            for (int jj = 0; jj < involvedConvs.length; jj++) {
              Converter involvedConv = involvedConvs[jj];
             
              ChanceAtFault associatedCaf =
                getCafAssociatedWithProvidedConverter(
                    cafs, involvedConv);
             
              if (associatedCaf.getChanceAtFault() > 0.0f) {
              report.println("    " +
                  involvedConv.getShortName() + " (%" +
                  FormatUtil.formatToPercent(associatedCaf.getChanceAtFault()) +
                  " Chance At Fault)");
              } else {
                report.println("    " +
                    involvedConv.getShortName());
              }
            }
          }
        }
      }
View Full Code Here

      report.println("");
     
      report.println("Test Converters...");
      ConverterPath testConvs = tr.getTestConverters();
      for (int ii = 0; ii < testConvs.size(); ii++) {
        Converter conv = testConvs.get(ii);
        String shortName = conv.getShortName();
        report.println("  " + shortName);
      }
      report.println("");
     
      report.println("Comparison Converters...");
      ConverterPath compareConvs = tr.getComparisonConverters();
      for (int ii = 0; ii < compareConvs.size(); ii++) {
        Converter conv = compareConvs.get(ii);
        String shortName = conv.getShortName();
        report.println("  " + shortName);
      }
     
      report.println("");
      report.println("---------------");
View Full Code Here

TOP

Related Classes of org.cishell.testing.convertertester.core.converter.graph.Converter

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.