Exemplo n.º 1
0
  @Override
  public void visitMatrixReport(MatrixReport matrixReport) {
    Map<String, Matrix> matrixs = matrixReport.getMatrixs();
    Collection<Matrix> matrix = matrixs.values();
    int size = matrix.size();

    if (size > m_maxItems) {
      List<Matrix> matrixList = new ArrayList<Matrix>(matrix);
      Collections.sort(matrixList, new MeatricCompartor());

      matrixs.clear();
      for (int i = 0; i < m_maxItems; i++) {
        Matrix temp = matrixList.get(i);
        matrixs.put(temp.getName(), temp);
      }

      Matrix value = new Matrix(OTHERS);
      for (int i = m_maxItems; i < size; i++) {
        Matrix item = matrixList.get(i);

        value.setType(item.getType());
        value.setCount(item.getCount() + value.getCount());
      }
      matrixs.put(OTHERS, value);
    }

    super.visitMatrixReport(matrixReport);
  }
Exemplo n.º 2
0
 @Override
 public int compare(Matrix o1, Matrix o2) {
   return o2.getCount() - o1.getCount();
 }