Esempio n. 1
0
 public void refresh() {
   int dividend = 0;
   int divider = 0;
   for (KeyWord word : this.keyWords) {
     dividend += word.getCount() * word.getRank();
     divider = word.getCount();
   }
   this.average = (double) ((int) ((double) dividend / (double) divider * 10000)) / 100.0d;
 }
Esempio n. 2
0
 // Constructors
 public Category(KeyWord word) {
   this.id = 0;
   this.name = word.getName();
   this.rank = 0;
   this.average = 0.0d;
   this.count = word.getCount();
   this.frequency = 0.0d;
   // intervals should be generated on update
   this.keyWords = new ArrayList<>();
   this.keyWords.add(word);
 }
Esempio n. 3
0
  public void refresh(int wordsCount) {
    int rangScore = 0;
    int totalCount = 0;

    this.intervals = new ArrayList<>();
    this.count = 0;

    for (KeyWord word : this.keyWords) {
      rangScore += word.getCount() * word.getRank();
      totalCount = word.getCount();

      for (int i = 0; i < word.getIntervals().size(); i++) {
        if (i >= this.intervals.size()) {
          this.intervals.add(word.getIntervals().get(i));
        } else {
          this.intervals.set(i, this.intervals.get(i) + word.getIntervals().get(i));
        }
      }
      this.count += word.getCount();
    }
    this.average = (double) ((int) ((double) rangScore / (double) totalCount * 100)) / 100.0d;
    this.frequency = (double) ((int) ((double) totalCount / (double) wordsCount * 10000)) / 100.0d;
  }