use of org.opensolaris.opengrok.search.FileExtra in project OpenGrok by OpenGrok.
the class DirectoryListing method printNumlines.
private void printNumlines(Writer out, DirectoryEntry entry) throws IOException {
Integer numlines = null;
String readableNumlines = "";
FileExtra extra = entry.getExtra();
if (extra != null)
numlines = extra.getNumlines();
if (numlines != null) {
readableNumlines = Util.readableCount(numlines);
}
out.write("<td class=\"numlines\">");
out.write(readableNumlines);
out.write("</td>");
}
use of org.opensolaris.opengrok.search.FileExtra in project OpenGrok by OpenGrok.
the class FileExtraZipper method indexExtraByName.
private Map<String, FileExtra> indexExtraByName(List<FileExtra> extras) {
Map<String, FileExtra> byPath = new HashMap<>();
for (FileExtra extra : extras) {
File f = new File(extra.getFilepath());
String filename = f.getName();
byPath.put(filename, extra);
}
return byPath;
}
use of org.opensolaris.opengrok.search.FileExtra in project OpenGrok by OpenGrok.
the class FileExtraZipper method zip.
/**
* Merge the specified lists by looking up a possible entry in
* {@code extras} for every element in {@code files}.
* @param dir the files' directory
* @param files the file names
* @param extras some OpenGrok-analyzed extra metadata
* @return a list of the same size as {@code files}
*/
public List<DirectoryEntry> zip(File dir, List<String> files, List<FileExtra> extras) {
if (extras == null) {
return files.stream().map(f -> new DirectoryEntry(new File(dir, f))).collect(Collectors.toList());
}
Map<String, FileExtra> byName = indexExtraByName(extras);
List<DirectoryEntry> result = new ArrayList<>(files.size());
for (String file : files) {
File fileobj = new File(dir, file);
FileExtra extra = findExtra(byName, fileobj);
DirectoryEntry entry = new DirectoryEntry(fileobj, extra);
result.add(entry);
}
return result;
}
use of org.opensolaris.opengrok.search.FileExtra in project OpenGrok by OpenGrok.
the class DirectoryListing method printLoc.
private void printLoc(Writer out, DirectoryEntry entry) throws IOException {
Integer loc = null;
String readableLoc = "";
FileExtra extra = entry.getExtra();
if (extra != null)
loc = extra.getLoc();
if (loc != null) {
readableLoc = Util.readableCount(loc);
}
out.write("<td class=\"loc\">");
out.write(readableLoc);
out.write("</td>");
}
Aggregations