code: protected SAXPointsNumber[] countPointNumber(GrammarRules grammarRules, double[] ts) {
  
      // init the data structure and copy the original values
      SAXPointsNumber pointsNumber[] = new SAXPointsNumber[ts.length];
      for (int i = 0; i < ts.length; i++) {
        pointsNumber[i] = new SAXPointsNumber();
        pointsNumber[i].setPointIndex(i);
        pointsNumber[i].setPointValue(ts[i]);
      }
  
      // get all the rules and populate the occurrence density
      int rulesNum = grammarRules.size();
      for (int i = 0; i < rulesNum; i++) {
        ArrayList<RuleInterval> arrPos = grammarRules.getRuleRecord(i).getRuleIntervals();
        for (RuleInterval saxPos : arrPos) {
          int start = saxPos.getStart();
          int end = saxPos.getEnd() - 1;
          for (int position = start; position <= end; position++) {
            pointsNumber[position]
                .setPointOccurenceNumber(pointsNumber[position].getPointOccurenceNumber() + 1);
          }
        }
      }
  
      // make an output
      // String path = "Result" +
      // System.getProperties().getProperty("file.separator");
      // String fileName = "PointsNumber.txt";
      // SAXFileIOHelper.deleteFile(path, fileName);
      // SAXFileIOHelper.writeFile(path, fileName,
      // Arrays.toString(pointsNumber));
  
      return pointsNumber;
    }
docs: This method counts how many times each data point is used in ANY sequitur rule (i.e. data point
  1 appears only in R1 and R2, the number for data point 1 is two). The function will get the
  occurrence time for all points, and write the result into a text file named as
  "PointsNumber.txt".
  
  @param grammarRules the grammar.
  @param ts the time series.
  
  @return the points count.