Esempio n. 1
0
  @Override
  protected void algorithm() {
    // TODO Auto-generated method stub

    if (featureTargetValue > featurePresentValue) {
      setSuggestionLowToHigh(
          "Your document only has '"
              + featurePresentValue
              + "' occurances of the number "
              + super.stringInBraces
              + ", however, it would "
              + "be ideal to have '"
              + featureTargetValue
              + "' occurances of "
              + super.stringInBraces
              + ". See if there is anywhere that you would reasonably be able to fit one or more "
              + stringInBraces
              + " into your document.");
    } else if (featurePresentValue > featureTargetValue) {
      String stringDoc = super.getDocument();
      ArrayList<int[]> theIndices =
          IndexFinder.findIndices(stringDoc, super.stringInBraces.replaceAll("\\p{C}", " "));
      highlightMap.put(getNextColor(), theIndices);
      setSuggestionHighToLow(
          "Your document has '"
              + featurePresentValue
              + "' occurances of the number "
              + super.stringInBraces
              + ". It should only have "
              + featureTargetValue
              + "' occurances of "
              + super.stringInBraces
              + ". At the very least, try to exchange some numeric formed numbers for their 'word' counterparts.");
    } else setNoChangeNeeded(true);
  }
Esempio n. 2
0
  @Test
  public void testFinder() throws Exception {

    ShuttlDirectoryTreeFactory directoryTreeFactory = new ShuttlDirectoryTreeFactory();
    List<Path> indexers = directoryTreeFactory.getIndexerPaths();

    directoryTreeFactory.addIndex(indexers.get(0), "index1");
    directoryTreeFactory.addIndex(indexers.get(1), "index2");

    IndexFinder finder = new IndexFinder(fileSystem, directoryTreeFactory.getRoot());

    List<Index> indexes = finder.find();

    assertEquals(indexes.size(), 2);
    assertEquals(indexes.get(0).getName(), "index1");
    assertEquals(indexes.get(1).getName(), "index2");
  }