Package domain

Source Code of domain.StatisticDomainController

/**
*
* @author marc.molins.piulachs
*/

package domain;

import data.StatisticController;

public class StatisticDomainController {

 
    public void saveStatistics(int id) {
        //agafa de domini i guarda a disc
    StatisticController sc = new StatisticController();
    UserStatistics us = UserStatistics.getInstance()
   
    sc.setStatistics(id, us.getTotalWords(), us.getMarkedWords(), us.getNominalizedTexts(),
        us.getLearntRules(), us.getLearntPairs(), us.getAddedVerbs(), us.getVerbsMean());
    }

    public void loadStatistics(int id) {
        //agafa les dades de disc i les carrega a les dues classes de domini
    StatisticController sc = new StatisticController();
    UserStatistics us = UserStatistics.getInstance();
   
    int[] stats = sc.getStatistics(id);
    double meanVerbs = sc.getStatisticsMeanVerbs(id);
   
    us.setTotalWords(stats[0]);
    us.setMarkedWords(stats[1]);
    us.setNominalizedTexts(stats[2]);
    us.setLearntRules(stats[3]);
    us.setLearntPairs(stats[4]);
    us.setAddedVerbs(stats[5]);
    us.setVerbsMean(meanVerbs);
   
    }

 
 
  ///USER
 
    public int getTotalWordsUser() {
    UserStatistics us = UserStatistics.getInstance();
    return us.getTotalWords();
  }
 
  public int getMarkedWordsUser() {
    UserStatistics us = UserStatistics.getInstance();
    return us.getMarkedWords();
  }
 
  public int getNominalizedTexts() {
    UserStatistics us = UserStatistics.getInstance();
    return us.getNominalizedTexts();
  }
 
    public int getLearntRulesUser() {
    UserStatistics us = UserStatistics.getInstance();
        return us.getLearntRules();
    }
 
  public int getLearntPairsUser() {
    UserStatistics us = UserStatistics.getInstance();
    return us.getLearntPairs();
  }
 
  public int getAddedVerbs() {
    UserStatistics us = UserStatistics.getInstance();
    return us.getAddedVerbs();
  }
 
    public double getVerbsMean() {
        UserStatistics us = UserStatistics.getInstance();
    return us.getVerbsMean();
    }

 
 
  ////TEXT
 
    public int getTotalWordsText() {
    TextStatistics ts = TextStatistics.getInstance();
    return ts.getTotalWords();
    }
 
    public int getMarkedWordsText() {
        TextStatistics ts = TextStatistics.getInstance();
    return ts.getMarkedWords();
    }

    public String getMostCommonVerb() {
        TextStatistics ts = TextStatistics.getInstance();
    return ts.getMostCommonVerb();
    }
 
    public int getLearntRulesText() {
        TextStatistics ts = TextStatistics.getInstance();
    return ts.getLearntRules();
    }
 
    public int getLearntPairsText() {
        TextStatistics ts = TextStatistics.getInstance();
    return ts.getLearntPairs();
    }

}
TOP

Related Classes of domain.StatisticDomainController

TOP
Copyright © 2018 www.massapi.com. 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.