コード例 #1
0
  private List<Double> captureSelectedBlock() {
    int startIndex = FileUtils.findIndexBySingleValue(lines, "Transaction\\s+History");
    int endIndex = FileUtils.findIndexBySingleValue(lines, "^\\s*Totals");

    List<Double> mainList = new ArrayList<>();
    List<String> selected = new ArrayList<>();

    List<String> list = FileUtils.getSelectedBlockByIndex(lines, startIndex, endIndex);
    for (String s : list) {
      String result = FileUtils.getResultFromPattern("^\\s*\\d{1,2}/\\d{1,2}\\s+", s);
      if (!result.startsWith("NoMatch")) {
        if (selected.size() > 0) {
          if (selected.get(selected.size() - 1).startsWith(result)) {
            selected.set(selected.size() - 1, s);
          } else {
            selected.add(s);
          }
        } else {
          selected.add(s);
        }
      }
    }
    for (int a = 0; a < selected.size(); a++) {
      String[] line = selected.get(a).split(" ");
      if (line.length > 1) {
        mainList.add(
            FileUtils.convertStringToDouble(
                FileUtils.getDollarSignRemovedValue(
                    FileUtils.getBracketRemovedValue(line[line.length - 1]))));
      }
    }

    return mainList;
  }
コード例 #2
0
 private List<String> captureSelectedRecordsBlock() {
   List<String> list = initialBlock;
   List<String> main = new ArrayList<String>();
   for (String s : list) {
     String result = FileUtils.getResultFromPattern("ONL\\s+TFR\\s+TO|INTERNET\\s+TFR\\s+TO", s);
     if (!result.startsWith("NoMatch") && s.matches("^\\s*\\d{1,2}/\\d{1,2}.+")) {
       main.add(s);
     }
   }
   return main;
 }
コード例 #3
0
 private List<String> captureFilteredBlock() {
   List<String> list = lines;
   List<String> main = new ArrayList<>();
   for (String s : list) {
     String result = FileUtils.getResultFromPattern("^\\D{3}\\s+\\d{1,2}", s);
     if (!result.startsWith("NoMatch")) {
       main.add(s);
     }
   }
   return main;
 }
コード例 #4
0
  private void captureOnlineTransferToRecords() {
    List<String> firstLine = new ArrayList<>();
    List<String> secondLine = new ArrayList<>();
    List<Integer> indexFinder = new ArrayList<>();
    List<String> mergedLine = new ArrayList<>();

    for (int a = 0; a < this.selectedBlock.size(); a++) {
      String result =
          FileUtils.getResultFromPattern(
              "ONLINE\\s+BANKING\\s+TRANSFER\\s+TO", this.selectedBlock.get(a));

      if (!result.startsWith("NoMatch")) {
        indexFinder.add(a + 1);
        firstLine.add(this.selectedBlock.get(a));
        String[] temp = this.selectedBlock.get(a).split("\\s+");
        date.add(temp[0]);
        String value =
            FileUtils.getDollarSignRemovedValue(
                FileUtils.getLastElementFromArray(this.selectedBlock.get(a)));
        double d = FileUtils.convertStringToDouble(value);
        amount.add(d);
        String desc = "";
        for (int x = 1; x < temp.length - 1; x++) {
          desc += temp[x] + " ";
        }
        description.add(desc);
      }
    }
    for (int a = 0; a < indexFinder.size(); a++) {
      String val = selectedBlock.get(indexFinder.get(a));

      String result = this.description.get(a) + " " + val;
      String ch = FileUtils.getResultFromPattern("TO\\s+XX+\\d+", result);
      if (!ch.startsWith("NoMatch")) {
        ch = FileUtils.getFourDigitAccountNumber(ch);
        checkNo.add(ch);
      } else {
        checkNo.add("N/A");
      }
    }
  }
コード例 #5
0
 private String captureDate() {
   String dd = "";
   for (int a = 0; a < lines.size(); a++) {
     String d =
         FileUtils.getResultFromPattern(
             "through\\s+\\D+\\s+\\d{1,2},\\s+\\d{4}", this.lines.get(a));
     if (!d.startsWith("NoMatch")) {
       String[] tmp = d.split("\\s+");
       dd = tmp[tmp.length - 3];
     }
   }
   return dd;
 }
コード例 #6
0
 private List<Double> captureAmountFromSelectedRecords() {
   List<Double> main = new ArrayList<>();
   for (String s : this.filteredBlock) {
     String result = FileUtils.getResultFromPattern("Refund|REFUND|Return", s);
     if (!result.startsWith("NoMatch")) {
       String[] temp = s.split("\\s+");
       main.add(
           FileUtils.convertStringToDouble(
               FileUtils.getDollarSignRemovedValue(temp[temp.length - 1])));
     }
   }
   return main;
 }
コード例 #7
0
 private List<String> captureSelectedBlock() {
   String start = "Transaction\\s+history";
   String end = "Ending\\s+balance\\s+on\\s+\\d{1,2}/";
   List<String> mainList = new ArrayList<>();
   List<String> list = FileUtils.getSelectedBlock(lines, start, end);
   for (String s : list) {
     String result = FileUtils.getResultFromPattern("^\\d{1,2}/\\d{1,2}", s);
     if (!result.startsWith("NoMatch")) {
       //  System.out.println(s);
       mainList.add(s);
     }
   }
   return mainList;
 }
コード例 #8
0
 private double captureAverageLedgerBalance() {
   double d = 0;
   for (String s : lines) {
     String result = FileUtils.getResultFromPattern("Average\\s+Ledger\\s+Balance*", s);
     if (!result.startsWith("NoMatch")) {
       String[] temp = s.split("\\s+");
       d =
           FileUtils.convertStringToDouble(
               FileUtils.getDollarSignRemovedValue(
                   FileUtils.getNegativeSignDetectedValue(temp[3])));
       break;
     }
   }
   return d;
 }
コード例 #9
0
  private void captureSelectedBlockForDebit() {
    List<String> List = new ArrayList<>();
    List<Double> list = new ArrayList<>();
    List<String> datelist = new ArrayList<>();
    List<Double> CheckDailyPaymentAmount = new ArrayList<>();

    for (int x = 0; x < debitBlock.size(); x++) {
      for (int a = 0; a < words.size(); a++) {
        String wordLine = words.get(a).toLowerCase();
        String result = FileUtils.getResultFromPattern(wordLine, debitBlock.get(x).toLowerCase());
        if (!result.startsWith("NoMatch")) {
          for (int R = x; R > 0; R--) {
            if (debitBlock.get(R).matches("^\\s*\\d{1,2}/\\d{1,2}/\\d{1,2}.+")) {
              List.add(debitBlock.get(R));
              dailykeyDescription.add(words.get(a).toLowerCase());
              break;
            }
          }
          break;
        }
      }
    }
    for (int a = 0; a < List.size(); a++) {
      String value = FileUtils.getLastElementFromArray(List.get(a));
      value = FileUtils.getDollarSignRemovedValue(value);
      double d = FileUtils.convertStringToDouble(value);
      String[] temp = List.get(a).trim().split("\\s+");
      datelist.add(temp[0]);
      list.add(d);
    }
    for (int a = 0; a < list.size(); a++) {
      double d = list.get(a);
      if (CheckDailyPaymentAmount.contains(d)) {
        //  if (!DailypaymentkeywordDescription.contains(dailykeyDescription.get(a)))
        //  {
        DailypaymentkeywordAmount.add(d);
        DailypaymentkeywordDate.add(datelist.get(a));
        DailypaymentkeywordDescription.add(dailykeyDescription.get(a));
        //  }
      } else {
        CheckDailyPaymentAmount.add(d);
      }
    }
  }
コード例 #10
0
 private void captureDateDescriptionAmount() {
   List<String> list = this.selectedBlock;
   for (String s : list) {
     String[] temp = s.split("\\s+");
     date.add(temp[0]);
     amount.add(FileUtils.convertStringToDouble(FileUtils.getDollarSignRemovedValue(temp[1])));
     String desc = "";
     for (int a = 2; a < temp.length; a++) {
       desc += temp[a] + " ";
     }
     description.add(desc);
     String res = FileUtils.getResultFromPattern("\\d{7,}", desc);
     if (!res.startsWith("NoMatch")) {
       checkNo.add(FileUtils.getFourDigitAccountNumber(res));
     } else {
       checkNo.add("N/A");
     }
   }
   this.checkNoDuplicateRemoved = FileUtils.removeDuplicateValues(checkNo);
 }
コード例 #11
0
 private List<String> captureSelectedBlockForDeposit() {
   List<String> list = new ArrayList<>();
   for (int x = 0; x < depositBlock.size(); x++) {
     for (int a = 0; a < words.size(); a++) {
       String wordLine = words.get(a).toLowerCase();
       String result = FileUtils.getResultFromPattern(wordLine, depositBlock.get(x).toLowerCase());
       if (!result.startsWith("NoMatch")) {
         for (int R = x; R > 0; R--) {
           if (depositBlock.get(R).matches("^\\s*\\d{1,2}/\\d{1,2}/\\d{1,2}.+")) {
             list.add(depositBlock.get(R));
             keyDescription.add(words.get(a).toLowerCase());
             break;
           }
         }
         break;
       }
     }
   }
   return list;
 }
コード例 #12
0
 private String captureAccountNumber() {
   String result = FileUtils.getResultFromPattern("Account:\\s+\\d+", pages[0]);
   return FileUtils.getFourDigitAccountNumber(result);
 }
コード例 #13
0
 private String captureDate() {
   String result = FileUtils.getResultFromPattern("to\\s+\\d{2}/\\d{2}/\\d{2}", pages[0]);
   return FileUtils.getLastElementFromArray(result);
 }