Ejemplo n.º 1
0
  public static ArrayList<Entry<String, Integer>> countByTitle()
      throws ClientHandlerException, UniformInterfaceException, JSONException {
    Set<String> titleArray = Statics.getAllTitle();
    Iterator<String> itTitle = titleArray.iterator();
    String title = new String();

    Map<String, Integer> orderTitle = new HashMap<String, Integer>();
    while (itTitle.hasNext()) {
      title = itTitle.next();
      Map<String, String> userStatistics = Statics.getUserList(title);
      String userNumber = userStatistics.get("userNumber");
      Integer userNum = Integer.parseInt(userNumber);
      orderTitle.put(title, userNum);
    }
    ArrayList<Entry<String, Integer>> l = order(orderTitle);

    return l;
  }
Ejemplo n.º 2
0
  public static ArrayList<Entry<String, Integer>> countByVandalism()
      throws ClientHandlerException, UniformInterfaceException, JSONException, URISyntaxException {
    Set<String> titleArray = Statics.getAllTitle();
    Iterator<String> itTitle = titleArray.iterator();
    String title = new String();

    Map<String, Integer> orderVandalism = new HashMap<String, Integer>();
    while (itTitle.hasNext()) {
      title = itTitle.next();
      Map<String, String> vandalismAndCount = GenerateTxt.showVandalismTxt("title", title);
      String vandalismNumber = vandalismAndCount.get("count");
      Integer vandalismCountNumber = Integer.parseInt(vandalismNumber);
      if (vandalismCountNumber != 0) {
        orderVandalism.put(title, vandalismCountNumber);
      }
    }
    ArrayList<Entry<String, Integer>> l = order(orderVandalism);
    return l;
  }