Exemplo n.º 1
0
 @Override
 protected void replace(String fileName) {
   List<Map.Entry<String, Integer>> list =
       new ArrayList<Map.Entry<String, Integer>>(map_counter.accessCounterTable.entrySet());
   Collections.sort(
       list,
       new Comparator<Map.Entry<String, Integer>>() {
         public int compare(Map.Entry<String, Integer> o1, Map.Entry<String, Integer> o2) {
           return o1.getValue() - o2.getValue();
         }
       });
   map_content.remove(list.get(0));
   map_tstamp.remove(list.get(0));
   map_counter.accessCounterTable.remove(list.get(0));
 }
Exemplo n.º 2
0
  /**
   * @param fld Folder with files to match.
   * @param ptrn Pattern to match against file name.
   * @return Collection of matched files.
   */
  public static List<VisorLogFile> matchedFiles(File fld, final String ptrn) {
    List<VisorLogFile> files =
        fileTree(
            fld,
            MAX_FOLDER_DEPTH,
            new FileFilter() {
              @Override
              public boolean accept(File f) {
                return !f.isHidden()
                    && (f.isDirectory() || f.isFile() && f.getName().matches(ptrn));
              }
            });

    Collections.sort(files, LAST_MODIFIED);

    return files;
  }