proj_name stringclasses 131
values | relative_path stringlengths 30 228 | class_name stringlengths 1 68 | func_name stringlengths 1 48 | masked_class stringlengths 78 9.82k | func_body stringlengths 46 9.61k | len_input int64 29 2.01k | len_output int64 14 1.94k | total int64 55 2.05k | relevant_context stringlengths 0 38.4k |
|---|---|---|---|---|---|---|---|---|---|
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/analysis/verilog/VerilogLexer.java | VerilogLexer | chkLOC | class VerilogLexer extends JFlexSymbolMatcher
implements JFlexJointLexer, Resettable {
/**
* Calls {@link #phLOC()} if the yystate is not COMMENT or SCOMMENT.
*/
public void chkLOC() {<FILL_FUNCTION_BODY>}
/**
* Subclasses must override to get the constant value created by JFlex to
... |
if (yystate() != COMMENT() && yystate() != SCOMMENT()) {
phLOC();
}
| 199 | 36 | 235 | <methods>public non-sealed void <init>() ,public void clearNonSymbolMatchedListener() ,public void clearSymbolMatchedListener() ,public void setNonSymbolMatchedListener(org.opengrok.indexer.analysis.NonSymbolMatchedListener) ,public void setSymbolMatchedListener(org.opengrok.indexer.analysis.SymbolMatchedListener) <var... |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/CanonicalRootValidator.java | CanonicalRootValidator | validate | class CanonicalRootValidator {
/**
* Validates the specified setting, returning an error message if validation
* fails.
* @return a defined instance if not valid or {@code null} otherwise
*/
public static String validate(String setting, String elementDescription) {<FILL_FUNCTION_BODY>}
... |
// Test that the value ends with the system separator.
if (!setting.endsWith(File.separator)) {
return elementDescription + " must end with a separator";
}
// Test that the value is not like a Windows root (e.g. C:\ or Z:/).
if (setting.matches("\\w:(?:[/\\\\]*)")) {... | 103 | 263 | 366 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/ConfigMerge.java | ConfigMerge | main | class ConfigMerge {
private static final String NAME = "ConfigMerge";
private ConfigMerge() {
}
/**
* Merge base and new configuration.
* @param cfgBase base configuration
* @param cfgNew new configuration, will receive properties from the base configuration
* @throws Exception ex... |
Getopt getopt = new Getopt(argv, "h?");
try {
getopt.parse();
} catch (ParseException ex) {
System.err.println(NAME + ": " + ex.getMessage());
bUsage(System.err);
System.exit(1);
}
int cmd;
getopt.reset();
while ... | 750 | 545 | 1,295 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/ConfigurationClassLoader.java | ConfigurationClassLoader | loadClass | class ConfigurationClassLoader extends ClassLoader {
private static final Set<String> allowedClasses = Set.of(
ArrayList.class,
AuthControlFlag.class,
AuthorizationEntity.class,
AuthorizationPlugin.class,
AuthorizationStack.class,
Collections.... |
if (!allowedClasses.contains(name)) {
throw new IllegalAccessError(name + " is not allowed to be used in configuration");
}
return getClass().getClassLoader().loadClass(name);
| 277 | 54 | 331 | <methods>public void clearAssertionStatus() ,public final java.lang.Package getDefinedPackage(java.lang.String) ,public final java.lang.Package[] getDefinedPackages() ,public java.lang.String getName() ,public final java.lang.ClassLoader getParent() ,public static java.lang.ClassLoader getPlatformClassLoader() ,public ... |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/Filter.java | PatternList | add | class PatternList extends ArrayList<String> {
private static final long serialVersionUID = -6883390970972775838L;
private final Filter owner;
public PatternList(Filter owner) {
this.owner = owner;
}
@Override
public boolean add(String pattern) {<FILL_FUNCT... |
boolean ret = super.add(pattern);
if (ret) {
owner.addPattern(pattern);
}
return ret;
| 105 | 38 | 143 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/Group.java | Group | getAllProjects | class Group implements Comparable<Group>, Nameable {
static {
ClassUtil.remarkTransientFields(Group.class);
}
private String name;
/**
* Group regexp pattern.
*
* No project matches the empty pattern of "" however this group can still
* be used as a superior group for other... |
Set<Project> projectsTmp = new TreeSet<>();
projectsTmp.addAll(getRepositories());
projectsTmp.addAll(getProjects());
for (Group grp : getDescendants()) {
projectsTmp.addAll(grp.getAllProjects());
}
return projectsTmp;
| 1,825 | 87 | 1,912 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/IgnoredNames.java | IgnoredNames | ignore | class IgnoredNames implements Serializable {
private static final long serialVersionUID = 1L;
private static final String FILE_PREFIX = "f:";
private static final String DIR_PREFIX = "d:";
private IgnoredFiles ignoredFiles;
private IgnoredDirs ignoredDirs;
public IgnoredNames() {
ignor... |
if (file.isFile()) {
return ignoredFiles.match(file);
} else {
return ignoredDirs.match(file);
}
| 679 | 42 | 721 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/IncludeFiles.java | IncludeFiles | getFooterIncludeFileContent | class IncludeFiles {
/**
* Reload the content of all include files.
*/
public void reloadIncludeFiles() {
getBodyIncludeFileContent(true);
getHeaderIncludeFileContent(true);
getFooterIncludeFileContent(true);
getForbiddenIncludeFileContent(true);
getHttpHeaderIn... |
if (footer == null || force) {
footer = getFileContent(new File(RuntimeEnvironment.getInstance().getIncludeRootPath(),
Configuration.FOOTER_INCLUDE_FILE));
}
return footer;
| 930 | 61 | 991 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/IndexSearcherFactory.java | IndexSearcherFactory | newSearcher | class IndexSearcherFactory extends SearcherFactory {
public IndexSearcher newSearcher(IndexReader reader) {
return newSearcher(reader, null);
}
@Override
public IndexSearcher newSearcher(IndexReader reader, IndexReader prev) {<FILL_FUNCTION_BODY>}
} |
// The previous IndexReader is not used here.
return new IndexSearcher(reader, RuntimeEnvironment.getInstance().getSearchExecutor());
| 85 | 35 | 120 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/IndexTimestamp.java | IndexTimestamp | stamp | class IndexTimestamp {
private Date lastModified;
private static final Logger LOGGER = LoggerFactory.getLogger(IndexTimestamp.class);
/**
* Get the date of the last index update.
*
* @return the time of the last index update.
*/
public Date getDateForLastIndexRun() {
Runtim... |
RuntimeEnvironment env = RuntimeEnvironment.getInstance();
File timestamp = new File(env.getDataRootFile(), "timestamp");
String purpose = "used for timestamping the index database.";
if (timestamp.exists()) {
if (!timestamp.setLastModified(System.currentTimeMillis())) {
... | 211 | 181 | 392 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/OpenGrokThreadFactory.java | OpenGrokThreadFactory | newThread | class OpenGrokThreadFactory implements ThreadFactory {
private final String threadPrefix;
public static final String PREFIX = "OpenGrok-";
public OpenGrokThreadFactory(String name) {
if (!name.endsWith("-")) {
threadPrefix = name + "-";
} else {
threadPrefix = name;... |
Thread thread = Executors.defaultThreadFactory().newThread(Objects.requireNonNull(runnable, "runnable"));
thread.setName(PREFIX + threadPrefix + thread.getId());
return thread;
| 127 | 55 | 182 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/PathAccepter.java | PathAccepter | accept | class PathAccepter {
private static final Logger LOGGER = LoggerFactory.getLogger(PathAccepter.class);
private final IgnoredNames ignoredNames;
private final Filter includedNames;
/**
* Package-private to be initialized from the runtime environment.
*/
PathAccepter(IgnoredNames ignoredN... |
if (!includedNames.isEmpty()
&& // the filter should not affect directory names
(!(file.isDirectory() || includedNames.match(file)))) {
LOGGER.finer(() -> String.format("not including '%s'", launderLog(file.getAbsolutePath())));
return false;
}
... | 207 | 144 | 351 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/PatternUtil.java | PatternUtil | compilePattern | class PatternUtil {
private PatternUtil() {
// private to enforce static
}
/**
* A check if a pattern contains at least one pair of parentheses meaning
* that there is at least one capture group. This group must not be empty.
*/
private static final String PATTERN_SINGLE_GROUP = ... |
if (!pattern.matches(PATTERN_SINGLE_GROUP)) {
throw new PatternSyntaxException(PATTERN_MUST_CONTAIN_GROUP, pattern, 0);
}
return Pattern.compile(pattern).toString();
| 310 | 65 | 375 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/StatsdConfig.java | StatsdConfig | getForHelp | class StatsdConfig {
private int port;
private String host;
private boolean enabled;
private StatsdFlavor flavor;
public String getHost() {
return host;
}
public void setHost(String host) {
this.host = host;
}
public int getPort() {
return port;
}
... |
StatsdConfig res = new StatsdConfig();
res.setHost("foo.bar");
res.setPort(8125);
res.setFlavor(StatsdFlavor.ETSY);
return res;
| 255 | 61 | 316 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/SuperIndexSearcherFactory.java | SuperIndexSearcherFactory | newSearcher | class SuperIndexSearcherFactory extends SearcherFactory {
@Override
public SuperIndexSearcher newSearcher(IndexReader r, IndexReader prev) {<FILL_FUNCTION_BODY>}
} |
// The previous IndexReader is not used here.
return new SuperIndexSearcher(r, RuntimeEnvironment.getInstance().getSearchExecutor());
| 55 | 36 | 91 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/configuration/WatchDogService.java | WatchDogService | start | class WatchDogService {
private static final Logger LOGGER = LoggerFactory.getLogger(WatchDogService.class);
private Thread watchDogThread;
private WatchService watchDogWatcher;
public static final int THREAD_SLEEP_TIME = 2000;
WatchDogService() {
}
/**
* Starts a watch dog service ... |
stop();
if (directory == null || !directory.isDirectory() || !directory.canRead()) {
LOGGER.log(Level.INFO, "Watch dog cannot be started - invalid directory: {0}", directory);
return;
}
LOGGER.log(Level.INFO, "Starting watchdog in: {0}", directory);
watc... | 398 | 581 | 979 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/AbstractCache.java | AbstractCache | clearFile | class AbstractCache implements Cache {
public boolean hasCacheForFile(File file) throws CacheException {
try {
return getCachedFile(file).exists();
} catch (CacheException ex) {
throw new CacheException(ex);
}
}
/**
* Get a <code>File</code> object de... |
File historyFile;
try {
historyFile = getCachedFile(new File(RuntimeEnvironment.getInstance().getSourceRootPath() + path));
} catch (CacheException ex) {
LOGGER.log(Level.WARNING, String.format("cannot get cached file for file '%s'"
+ " - the cache en... | 769 | 107 | 876 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/AccuRevAnnotationParser.java | AccuRevAnnotationParser | processStream | class AccuRevAnnotationParser implements Executor.StreamHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(AccuRevAnnotationParser.class);
private static final Pattern ANNOTATION_PATTERN
= Pattern.compile("^\\s+(\\d+.\\d+)\\s+(\\w+)"); // version, user
/**
* Store a... |
try (BufferedReader reader
= new BufferedReader(new InputStreamReader(input))) {
String line;
int lineno = 0;
try {
while ((line = reader.readLine()) != null) {
++lineno;
Matcher matcher = ANNOTATION_PAT... | 262 | 303 | 565 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/AccuRevHistoryParser.java | AccuRevHistoryParser | parse | class AccuRevHistoryParser implements Executor.StreamHandler {
private AccuRevRepository repository;
private History history;
/**
* Parse the history for the specified file.
*
* @param file the file to parse history for
* @param repos Pointer to the {@code AccuRevRepository}
* @re... |
repository = (AccuRevRepository) repos;
history = null;
String relPath = repository.getDepotRelativePath(file);
/*
* When the path given is really just the root to the source
* workarea, no history is available, create fake.
*/
String rootRelative... | 862 | 239 | 1,101 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/Annotation.java | Annotation | generateColors | class Annotation {
private static final Logger LOGGER = LoggerFactory.getLogger(Annotation.class);
AnnotationData annotationData;
private final Map<String, String> desc = new HashMap<>(); // maps revision to description
private final Map<String, Integer> fileVersions = new HashMap<>(); // maps revisi... |
List<Color> orderedColors = RainbowColorGenerator.getOrderedColors();
Map<String, String> colorMap = new HashMap<>();
final List<String> revisions =
getRevisions()
.stream()
/*
* Greater file version means... | 1,672 | 367 | 2,039 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/AnnotationData.java | AnnotationData | equals | class AnnotationData implements Serializable {
private static final long serialVersionUID = -1;
// for serialization
public AnnotationData() {
}
public AnnotationData(String filename) {
this.filename = filename;
}
private List<AnnotationLine> annotationLines = new ArrayList<>();
... |
return Optional.ofNullable(obj)
.filter(other -> getClass() == other.getClass())
.map(AnnotationData.class::cast)
.filter(other -> Objects.deepEquals(getLines(), other.getLines()))
.filter(other -> Objects.equals(getFilename(), other.getFilename()... | 1,585 | 174 | 1,759 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/AnnotationDataClassLoader.java | AnnotationDataClassLoader | loadClass | class AnnotationDataClassLoader extends ClassLoader {
private static final Set<String> allowedClasses = Set.of(
ArrayList.class,
Collections.class,
AnnotationData.class,
AnnotationLine.class,
String.class,
XMLDecoder.class
).stream().map(ja... |
if (!allowedClasses.contains(name)) {
throw new IllegalAccessError(name + " is not allowed to be used in AnnotationData object");
}
return getClass().getClassLoader().loadClass(name);
| 131 | 57 | 188 | <methods>public void clearAssertionStatus() ,public final java.lang.Package getDefinedPackage(java.lang.String) ,public final java.lang.Package[] getDefinedPackages() ,public java.lang.String getName() ,public final java.lang.ClassLoader getParent() ,public static java.lang.ClassLoader getPlatformClassLoader() ,public ... |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/AnnotationLine.java | AnnotationLine | equals | class AnnotationLine implements Serializable {
private static final long serialVersionUID = 3402729223485872826L;
private String revision;
private String author;
private boolean enabled;
private String displayRevision;
public AnnotationLine() {
// for serialization
}
/**
... |
return Optional.ofNullable(obj)
.filter(other -> getClass() == other.getClass())
.map(AnnotationLine.class::cast)
.filter(other -> Objects.equals(isEnabled(), other.isEnabled()))
.filter(other -> Objects.equals(getAuthor(), other.getAuthor()))
... | 527 | 138 | 665 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/BazaarAnnotationParser.java | BazaarAnnotationParser | processStream | class BazaarAnnotationParser implements Executor.StreamHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(BazaarAnnotationParser.class);
/**
* Store annotation created by processStream.
*/
private final Annotation annotation;
/**
* Pattern used to extract author/rev... |
try (BufferedReader in = new BufferedReader(new InputStreamReader(input))) {
String line = "";
int lineno = 0;
Matcher matcher = BLAME_PATTERN.matcher(line);
while ((line = in.readLine()) != null) {
++lineno;
matcher.reset(line);
... | 271 | 208 | 479 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/BazaarHistoryParser.java | BazaarHistoryParser | populateCommitFilesInHistoryEntry | class BazaarHistoryParser implements Executor.StreamHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(BazaarHistoryParser.class);
private String myDir;
private final List<HistoryEntry> entries = new ArrayList<>();
private final BazaarRepository repository;
BazaarHistoryParser... |
if (!(currentLine.startsWith("modified:") || currentLine.startsWith("added:")
|| currentLine.startsWith("removed:"))) {
// The list of files is prefixed with blanks.
currentLine = currentLine.trim();
int idx = currentLine.indexOf(" => ");
if (id... | 1,813 | 230 | 2,043 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/BazaarTagEntry.java | BazaarTagEntry | compareTo | class BazaarTagEntry extends TagEntry {
public BazaarTagEntry(int revision, String tag) {
super(revision, tag);
}
@Override
public int compareTo(HistoryEntry that) {<FILL_FUNCTION_BODY>}
} |
assert this.revision != NOREV : "BazaarTagEntry created without tag specified.specified";
return Integer.compare(this.revision, Integer.parseInt(that.getRevision()));
| 71 | 53 | 124 | <methods>public int compareTo(org.opengrok.indexer.history.TagEntry) ,public abstract int compareTo(org.opengrok.indexer.history.HistoryEntry) ,public boolean equals(java.lang.Object) ,public java.util.Date getDate() ,public java.lang.String getTags() ,public int hashCode() ,public void setTags(java.lang.String) <varia... |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/BazaarTagParser.java | BazaarTagParser | processStream | class BazaarTagParser implements Executor.StreamHandler {
/**
* Store tag entries created by processStream.
*/
private final NavigableSet<TagEntry> entries = new TreeSet<>();
/**
* Returns the set of entries that has been created.
*
* @return entries a set of tag entries
*/
... |
try (BufferedReader in = new BufferedReader(new InputStreamReader(input))) {
String line;
while ((line = in.readLine()) != null) {
String[] parts = line.split(" *");
if (parts.length < 2) {
throw new IOException("Tag line contains mor... | 141 | 277 | 418 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/BitKeeperAnnotationParser.java | BitKeeperAnnotationParser | processStream | class BitKeeperAnnotationParser implements Executor.StreamHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(BitKeeperAnnotationParser.class);
/**
* Store annotation created by processStream.
*/
private final Annotation annotation;
/**
* @param fileName the name of ... |
final BufferedReader in = new BufferedReader(new InputStreamReader(input));
for (String line = in.readLine(); line != null; line = in.readLine()) {
final String[] fields = line.split("\t");
if (fields.length >= 2) {
final String author = fields[0];
... | 278 | 147 | 425 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/BitKeeperHistoryParser.java | BitKeeperHistoryParser | processStream | class BitKeeperHistoryParser implements Executor.StreamHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(BitKeeperHistoryParser.class);
/**
* Parses dates.
*/
private final SimpleDateFormat dateFormat;
/**
* Store entries processed from executor output.
*/
... |
HistoryEntry entry = null;
final BufferedReader in = new BufferedReader(new InputStreamReader(input));
for (String line = in.readLine(); line != null; line = in.readLine()) {
if (line.startsWith("D ")) {
entry = null;
try {
final ... | 439 | 336 | 775 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/BitKeeperTagEntry.java | BitKeeperTagEntry | compareTo | class BitKeeperTagEntry extends TagEntry {
protected String changeset;
public BitKeeperTagEntry(String changeset, Date date, String tag) {
super(date, tag);
this.changeset = changeset;
}
@Override
public int compareTo(HistoryEntry that) {<FILL_FUNCTION_BODY>}
} |
assert this.date != null : "BitKeeper TagEntry created without date specified";
return this.date.compareTo(that.getDate());
| 94 | 40 | 134 | <methods>public int compareTo(org.opengrok.indexer.history.TagEntry) ,public abstract int compareTo(org.opengrok.indexer.history.HistoryEntry) ,public boolean equals(java.lang.Object) ,public java.util.Date getDate() ,public java.lang.String getTags() ,public int hashCode() ,public void setTags(java.lang.String) <varia... |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/BitKeeperTagParser.java | BitKeeperTagParser | processStream | class BitKeeperTagParser implements Executor.StreamHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(BitKeeperTagParser.class);
/**
* Parses dates.
*/
private final SimpleDateFormat dateFormat;
/**
* Store tag entries created by {@link #processStream(InputStream)}.... |
String revision = null;
Date date = null;
String tag;
final BufferedReader in = new BufferedReader(new InputStreamReader(input));
for (String line = in.readLine(); line != null; line = in.readLine()) {
if (line.startsWith("D ")) {
final String[] fiel... | 363 | 228 | 591 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/BoundaryChangesets.java | IdWithProgress | getBoundaryChangesetIDs | class IdWithProgress {
private final Progress progress;
private final String id;
IdWithProgress(String id, Progress progress) {
this.id = id;
this.progress = progress;
}
public String getId() {
return id;
}
public Progress ge... |
reset();
Level logLevel = Level.FINE;
LOGGER.log(logLevel, "getting boundary changesets for {0}", repository);
Statistics stat = new Statistics();
try (Progress progress = new Progress(LOGGER, String.format("changesets visited of %s", this.repository),
logLeve... | 182 | 184 | 366 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/CVSAnnotationParser.java | CVSAnnotationParser | processStream | class CVSAnnotationParser implements Executor.StreamHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(CVSAnnotationParser.class);
/**
* Pattern used to extract author/revision from {@code cvs annotate}.
*/
private static final Pattern ANNOTATE_PATTERN = Pattern.compile("([\\.... |
BufferedReader in = new BufferedReader(new InputStreamReader(input));
String line = "";
int lineno = 0;
boolean hasStarted = false;
Matcher matcher = ANNOTATE_PATTERN.matcher(line);
while ((line = in.readLine()) != null) {
// Skip header
if (!hasS... | 274 | 273 | 547 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/CVSHistoryParser.java | CVSHistoryParser | parseTag | class CVSHistoryParser implements Executor.StreamHandler {
private enum ParseState {
NAMES, TAG, REVISION, METADATA, COMMENT
}
private History history;
private CVSRepository cvsRepository = new CVSRepository();
/**
* Process the output from the log command and insert the {@link Histor... |
String[] pair = s.trim().split(": ");
if (pair.length != 2) {
//
// Overriding processStream() thus need to comply with the
// set of exceptions it can throw.
//
throw new IOException("Failed to parse tag: '" + s + "'");
} else {
... | 1,530 | 174 | 1,704 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/CacheUtil.java | CacheUtil | clearCacheDir | class CacheUtil {
private static final Logger LOGGER = LoggerFactory.getLogger(CacheUtil.class);
private CacheUtil() {
// private to enforce static
}
/**
*
* @param repository {@link RepositoryInfo} instance
* @param cache {@link Cache} instance
* @return absolute director... |
String histDir = CacheUtil.getRepositoryCacheDataDirname(repository, cache);
if (histDir != null) {
// Remove all files which constitute the history cache.
try {
IOUtils.removeRecursive(Paths.get(histDir));
} catch (NoSuchFileException ex) {
... | 347 | 145 | 492 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/ClearCaseAnnotationParser.java | ClearCaseAnnotationParser | processStream | class ClearCaseAnnotationParser implements Executor.StreamHandler {
/**
* Store annotation created by processStream.
*/
private final Annotation annotation;
/**
* @param fileName the name of the file being annotated
*/
public ClearCaseAnnotationParser(String fileName) {
ann... |
String line;
try (BufferedReader in = new BufferedReader(
new InputStreamReader(input))) {
while ((line = in.readLine()) != null) {
String[] parts = line.split("\\|");
String aAuthor = parts[0];
String aRevision = parts[1];
... | 166 | 121 | 287 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/ClearCaseHistoryParser.java | ClearCaseHistoryParser | processStream | class ClearCaseHistoryParser implements Executor.StreamHandler {
private History history;
private ClearCaseRepository repository = new ClearCaseRepository();
History parse(File file, Repository repos) throws HistoryException {
repository = (ClearCaseRepository) repos;
try {
Exe... |
BufferedReader in = new BufferedReader(new InputStreamReader(input));
List<HistoryEntry> entries = new ArrayList<>();
String s;
HistoryEntry entry = null;
while ((s = in.readLine()) != null) {
if (!"create version".equals(s) && !"create directory version".equals(s)) ... | 387 | 458 | 845 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/DirectoryHistoryReader.java | DirectoryHistoryReader | readFromHistory | class DirectoryHistoryReader {
private static final Logger LOGGER = LoggerFactory.getLogger(DirectoryHistoryReader.class);
// This is a giant hash constructed in this class.
// It maps date -> author -> (comment, revision, displayRevision) -> [ list of files ]
private final Map<Date, Map<String, Map<L... |
for (HistoryEntry entry : hist.getHistoryEntries()) {
if (entry.isActive()) {
String comment = entry.getMessage();
String cauthor = entry.getAuthor();
Date cdate = entry.getDate();
String revision = entry.getRevision();
... | 1,822 | 116 | 1,938 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/FileAnnotationCache.java | FileAnnotationCache | readAnnotation | class FileAnnotationCache extends AbstractCache implements AnnotationCache {
private static final Logger LOGGER = LoggerFactory.getLogger(FileAnnotationCache.class);
private Counter fileAnnotationCacheHits;
private Counter fileAnnotationCacheMisses;
private static final String ANNOTATION_CACHE_DIR_NA... |
File cacheFile;
try {
cacheFile = getCachedFile(file);
} catch (CacheException e) {
LOGGER.log(Level.WARNING, "failed to get annotation cache file", e);
return null;
}
try {
Statistics statistics = new Statistics();
An... | 1,876 | 165 | 2,041 | <methods>public non-sealed void <init>() ,public List<java.lang.String> clearCache(Collection<org.opengrok.indexer.history.RepositoryInfo>) ,public void clearFile(java.lang.String) ,public java.lang.String getCacheFileSuffix() ,public boolean hasCacheForFile(java.io.File) throws org.opengrok.indexer.history.CacheExcept... |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/FileCollector.java | FileCollector | accept | class FileCollector extends ChangesetVisitor {
private final Set<String> files;
public FileCollector(boolean consumeMergeChangesets) {
super(consumeMergeChangesets);
files = new HashSet<>();
}
public void accept(RepositoryWithHistoryTraversal.ChangesetInfo changesetInfo) {<FILL_FUNCTIO... |
if (changesetInfo.renamedFiles != null) {
files.addAll(changesetInfo.renamedFiles);
}
if (changesetInfo.files != null) {
files.addAll(changesetInfo.files);
}
if (changesetInfo.deletedFiles != null) {
files.addAll(changesetInfo.deletedFiles);
... | 204 | 101 | 305 | <methods><variables>boolean consumeMergeChangesets |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/GitTagEntry.java | GitTagEntry | compareTo | class GitTagEntry extends TagEntry {
private final String hash;
GitTagEntry(String hash, Date date, String tags) {
super(date, tags);
this.hash = hash;
}
/**
* Gets the immutable, initialized Git hash value.
*/
String getHash() {
return hash;
}
@Override... |
assert this.date != null : "Git TagEntry created without date specified";
return this.date.compareTo(that.getDate());
| 119 | 38 | 157 | <methods>public int compareTo(org.opengrok.indexer.history.TagEntry) ,public abstract int compareTo(org.opengrok.indexer.history.HistoryEntry) ,public boolean equals(java.lang.Object) ,public java.util.Date getDate() ,public java.lang.String getTags() ,public int hashCode() ,public void setTags(java.lang.String) <varia... |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/History.java | History | getHistoryEntries | class History implements Serializable {
private static final long serialVersionUID = -1;
static final String TAGS_SEPARATOR = ", ";
/** Entries in the log. The first entry is the most recent one. */
private List<HistoryEntry> entries;
/**
* Track renamed files, so they can be treated in spec... |
offset = Math.max(offset, 0);
limit = offset + limit > entries.size() ? entries.size() - offset : limit;
return entries.subList(offset, offset + limit);
| 1,502 | 52 | 1,554 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/HistoryClassLoader.java | HistoryClassLoader | loadClass | class HistoryClassLoader extends ClassLoader {
private static final Set<String> allowedClasses = Set.of(
ArrayList.class,
Collections.class,
Date.class,
HashMap.class,
History.class,
HistoryEntry.class,
RepositoryInfo.class,
... |
if (!allowedClasses.contains(name)) {
throw new IllegalAccessError(name + " is not allowed to be used in History object");
}
return getClass().getClassLoader().loadClass(name);
| 150 | 55 | 205 | <methods>public void clearAssertionStatus() ,public final java.lang.Package getDefinedPackage(java.lang.String) ,public final java.lang.Package[] getDefinedPackages() ,public java.lang.String getName() ,public final java.lang.ClassLoader getParent() ,public static java.lang.ClassLoader getPlatformClassLoader() ,public ... |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/HistoryCollector.java | HistoryCollector | accept | class HistoryCollector extends ChangesetVisitor {
List<HistoryEntry> entries;
Set<String> renamedFiles;
String latestRev;
HistoryCollector(boolean consumeMergeChangesets) {
super(consumeMergeChangesets);
entries = new ArrayList<>();
renamedFiles = new HashSet<>();
}
@O... |
RepositoryWithHistoryTraversal.CommitInfo commit = changesetInfo.commit;
// Make sure to record the revision even though this is a merge changeset
// and the collector does not want to consume these.
// The changesets are visited from newest to oldest, so record just the first one.
... | 129 | 325 | 454 | <methods><variables>boolean consumeMergeChangesets |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/HistoryEntry.java | HistoryEntry | dump | class HistoryEntry implements Serializable {
private static final long serialVersionUID = 1277313126047397131L;
private static final Logger LOGGER = LoggerFactory.getLogger(HistoryEntry.class);
private String revision;
private String displayRevision;
private Date date;
private String author;
... |
LOGGER.log(Level.FINE, "HistoryEntry : revision = {0}", revision);
LOGGER.log(Level.FINE, "HistoryEntry : displayRevision = {0}", displayRevision);
LOGGER.log(Level.FINE, "HistoryEntry : date = {0}", date);
LOGGER.log(Level.FINE, "HistoryEntry : author = {0}"... | 1,509 | 284 | 1,793 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/HistoryReader.java | HistoryReader | createInternalReader | class HistoryReader extends Reader {
private final List<HistoryEntry> entries;
private Reader input;
public HistoryReader(History history) {
entries = history.getHistoryEntries();
}
@Override
public int read(char @NotNull [] cbuf, int off, int len) throws IOException {
if (inp... |
StringBuilder str = new StringBuilder();
for (HistoryEntry entry : entries) {
str.append(entry.getLine());
}
return new StringReader(str.toString());
| 174 | 49 | 223 | <methods>public abstract void close() throws java.io.IOException,public void mark(int) throws java.io.IOException,public boolean markSupported() ,public static java.io.Reader nullReader() ,public int read() throws java.io.IOException,public int read(java.nio.CharBuffer) throws java.io.IOException,public int read(char[]... |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/MercurialAnnotationParser.java | MercurialAnnotationParser | processStream | class MercurialAnnotationParser implements Executor.StreamHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(MercurialAnnotationParser.class);
private Annotation annotation = null;
private final HashMap<String, HistoryEntry> revs;
private final File file;
/**
* Pattern use... |
annotation = new Annotation(file.getName());
String line;
int lineno = 0;
Matcher matcher = ANNOTATION_PATTERN.matcher("");
try (BufferedReader in = new BufferedReader(new InputStreamReader(input))) {
while ((line = in.readLine()) != null) {
++lineno... | 228 | 265 | 493 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/MercurialHistoryParserRevisionsOnly.java | MercurialHistoryParserRevisionsOnly | parse | class MercurialHistoryParserRevisionsOnly implements Executor.StreamHandler {
private final MercurialRepository repository;
private final Consumer<BoundaryChangesets.IdWithProgress> visitor;
private final Progress progress;
MercurialHistoryParserRevisionsOnly(MercurialRepository repository,
... |
try {
Executor executor = repository.getHistoryLogExecutor(file, sinceRevision, null, true);
int status = executor.exec(true, this);
if (status != 0) {
throw new HistoryException(
String.format("Failed to get revisions for: \"%s\" sin... | 245 | 152 | 397 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/MercurialTagEntry.java | MercurialTagEntry | compareTo | class MercurialTagEntry extends TagEntry {
public MercurialTagEntry(int revision, String tag) {
super(revision, tag);
}
@Override
public int compareTo(HistoryEntry that) {<FILL_FUNCTION_BODY>}
} |
assert this.revision != NOREV : "Mercurial TagEntry created without revision specified";
String[] revs = that.getRevision().split(":");
assert revs.length == 2 : "Unable to parse revision format";
return Integer.compare(this.revision, Integer.parseInt(revs[0]));
| 71 | 85 | 156 | <methods>public int compareTo(org.opengrok.indexer.history.TagEntry) ,public abstract int compareTo(org.opengrok.indexer.history.HistoryEntry) ,public boolean equals(java.lang.Object) ,public java.util.Date getDate() ,public java.lang.String getTags() ,public int hashCode() ,public void setTags(java.lang.String) <varia... |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/MercurialTagParser.java | MercurialTagParser | processStream | class MercurialTagParser implements Executor.StreamHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(MercurialTagParser.class);
/**
* Store tag entries created by processStream.
*/
private TreeSet<TagEntry> entries = new TreeSet<>();
/**
* Returns the set of entries... |
try {
try (BufferedReader in = new BufferedReader(
new InputStreamReader(input))) {
String line;
while ((line = in.readLine()) != null) {
String[] parts = line.split(" *");
if (parts.length < 2) {
... | 161 | 446 | 607 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/MonotoneAnnotationParser.java | MonotoneAnnotationParser | processStream | class MonotoneAnnotationParser implements Executor.StreamHandler {
/**
* Store annotation created by processStream.
*/
private final Annotation annotation;
/**
* Pattern used to extract author/revision from the {@code mnt annotate} command.
*/
private static final Pattern ANNOTATION... |
try (BufferedReader in = new BufferedReader(new InputStreamReader(input))) {
String line;
String author = null;
String rev = null;
while ((line = in.readLine()) != null) {
Matcher matcher = ANNOTATION_PATTERN.matcher(line);
if (mat... | 239 | 153 | 392 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/MonotoneHistoryParser.java | MonotoneHistoryParser | parse | class MonotoneHistoryParser implements Executor.StreamHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(MonotoneHistoryParser.class);
private final List<HistoryEntry> entries = new ArrayList<>(); //NOPMD
private final MonotoneRepository repository;
private final String mydir;
... |
try {
Executor executor = repository.getHistoryLogExecutor(file, changeset);
int status = executor.exec(true, this);
if (status != 0) {
throw new HistoryException("Failed to get history for: \"" +
file.getAbsolutePa... | 1,195 | 144 | 1,339 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/MonotoneRepository.java | MonotoneRepository | getHistoryGet | class MonotoneRepository extends Repository {
private static final Logger LOGGER = LoggerFactory.getLogger(MonotoneRepository.class);
private static final long serialVersionUID = 1L;
/**
* The property name used to obtain the client command for this repository.
*/
public static final String ... |
File directory = new File(getDirectoryName());
try {
String filename = (new File(parent, basename)).getCanonicalPath()
.substring(getDirectoryName().length() + 1);
ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK);
String[] argv = {RepoCommand, "cat"... | 1,647 | 202 | 1,849 | <methods>public final java.lang.String determineBranch() throws java.io.IOException,public final java.lang.String determineCurrentVersion() throws java.io.IOException,public final java.lang.String determineParent() throws java.io.IOException,public static java.lang.String format(java.util.Date) ,public boolean getHisto... |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/PerforceAnnotationParser.java | PerforceAnnotationParser | processStream | class PerforceAnnotationParser implements Executor.StreamHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(PerforceAnnotationParser.class);
/**
* Store annotation created by processStream.
*/
private final Annotation annotation;
private final PerforceRepository repo;
... |
// Pass null for revision to get all history for the file.
PerforceHistoryParser parser = new PerforceHistoryParser(repo);
List<HistoryEntry> revisions = parser.getRevisions(file, null).getHistoryEntries();
HashMap<String, String> revAuthor = new HashMap<>();
for (HistoryEntry e... | 265 | 380 | 645 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/RCSAnnotationParser.java | RCSAnnotationParser | processStream | class RCSAnnotationParser implements Executor.StreamHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(RCSAnnotationParser.class);
private Annotation annotation = null;
private final File file;
/**
* Pattern used to extract author/revision from {@code blame}.
*/
priva... |
annotation = new Annotation(file.getName());
String line;
int lineno = 0;
Matcher matcher = ANNOTATION_PATTERN.matcher("");
try (BufferedReader in = new BufferedReader(new InputStreamReader(input))) {
while ((line = in.readLine()) != null) {
++lineno... | 200 | 213 | 413 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/RCSHistoryParser.java | RCSHistoryParser | parseFile | class RCSHistoryParser {
private static final Logger LOGGER = LoggerFactory.getLogger(RCSHistoryParser.class);
private static File readCVSRoot(File root, File cvsDir, String name) throws IOException {
String cvsroot = readFirstLine(root);
if (cvsroot == null) {
return null;
... |
File rcsfile = getRCSFile(file);
if (rcsfile == null) {
return null;
}
try {
Archive archive = new Archive(rcsfile.getPath());
Version ver = archive.getRevisionVersion();
Node n = archive.findNode(ver);
n = n.root();
... | 967 | 179 | 1,146 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/RCSRepository.java | RCSRepository | getHistoryGet | class RCSRepository extends Repository {
private static final Logger LOGGER = LoggerFactory.getLogger(RCSRepository.class);
private static final long serialVersionUID = 1L;
/**
* This property name is used to obtain the command to get annotation for this repository.
*/
private static final ... |
try {
File file = new File(parent, basename);
File rcsFile = getRCSFile(file);
try (InputStream in = new RCSget(rcsFile.getPath(), rev)) {
copyBytes(out::write, in);
}
return true;
} catch (IOException ioe) {
LOGGER... | 1,244 | 130 | 1,374 | <methods>public final java.lang.String determineBranch() throws java.io.IOException,public final java.lang.String determineCurrentVersion() throws java.io.IOException,public final java.lang.String determineParent() throws java.io.IOException,public static java.lang.String format(java.util.Date) ,public boolean getHisto... |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/RCSget.java | RCSget | read | class RCSget extends InputStream {
private final InputStream stream;
/**
* Pass null in version to get current revision.
* @param file file contents to get
* @param version specified revision or @{code null}
* @throws java.io.IOException if I/O exception occurred
* @throws java.io.File... |
throw new IOException("use a BufferedInputStream. just read() is not supported!");
| 516 | 23 | 539 | <methods>public void <init>() ,public int available() throws java.io.IOException,public void close() throws java.io.IOException,public synchronized void mark(int) ,public boolean markSupported() ,public static java.io.InputStream nullInputStream() ,public abstract int read() throws java.io.IOException,public int read(b... |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/RazorHistoryParser.java | RazorHistoryParser | parseContents | class RazorHistoryParser {
private static final Logger LOGGER = LoggerFactory.getLogger(RazorHistoryParser.class);
private RazorRepository repository = new RazorRepository();
private static final Pattern ACTION_TYPE_PATTERN =
Pattern.compile("^(INTRODUCE|CHECK-OUT|CHECK-IN|UN-CHECK-OUT|RENAME... |
String line;
ArrayList<HistoryEntry> entries = new ArrayList<>();
HistoryEntry entry = null;
boolean ignoreEntry = false;
boolean seenActionType = false;
boolean lastWasTitle = true;
Matcher actionMatcher = ACTION_TYPE_PATTERN.matcher("");
Matcher info... | 703 | 969 | 1,672 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/RepoRepository.java | RepoRepository | isRepositoryFor | class RepoRepository extends Repository {
// TODO: cache all of the GitRepositories within the class
private static final long serialVersionUID = 1L;
/**
* The property name used to obtain the client command for this repository.
*/
public static final String CMD_PROPERTY_KEY = "org.opengrok.i... |
if (file.isDirectory()) {
File f = new File(file, ".repo");
return f.exists() && f.isDirectory();
}
return false;
| 543 | 47 | 590 | <methods>public final java.lang.String determineBranch() throws java.io.IOException,public final java.lang.String determineCurrentVersion() throws java.io.IOException,public final java.lang.String determineParent() throws java.io.IOException,public static java.lang.String format(java.util.Date) ,public boolean getHisto... |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/RepositoriesHelp.java | RepositoriesHelp | getText | class RepositoriesHelp {
public static String getText() {<FILL_FUNCTION_BODY>}
private static void appendClassesHelp(
StringBuilder builder, List<Class<? extends Repository>> clazzes) {
clazzes.sort((o1, o2) -> o1.getSimpleName().compareToIgnoreCase(o2.getSimpleName()));
for (Clas... |
StringBuilder builder = new StringBuilder();
builder.append("Enabled repositories:");
builder.append(System.lineSeparator());
builder.append(System.lineSeparator());
List<Class<? extends Repository>> clazzes = RepositoryFactory.getRepositoryClasses();
appendClassesHelp(b... | 338 | 210 | 548 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/RepositoryLookupUncached.java | RepositoryLookupUncached | getRepository | class RepositoryLookupUncached implements RepositoryLookup {
private static final Logger LOGGER = LoggerFactory.getLogger(RepositoryLookupUncached.class);
@Override
public Repository getRepository(final Path filePath, Set<String> repoParentDirs,
Map<String, Repository> repositories, PathCanonicaliz... |
Path path = filePath;
while (path != null) {
String nextPath = path.toString();
for (String rootKey : repoParentDirs) {
String rel;
try {
rel = canonicalizer.resolve(path, path.getFileSystem().getPath(rootKey));
... | 153 | 236 | 389 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/RepositoryWithHistoryTraversal.java | ChangesetInfo | doCreateCache | class ChangesetInfo {
CommitInfo commit;
public SortedSet<String> files;
public Set<String> renamedFiles;
public Set<String> deletedFiles;
public Boolean isMerge;
ChangesetInfo(CommitInfo commit) {
this.commit = commit;
this.files = new TreeSet<>(... |
RuntimeEnvironment env = RuntimeEnvironment.getInstance();
FileCollector fileCollector = null;
Project project = Project.getProject(directory);
if (project != null && isHistoryBasedReindex() && isHistoryEnabled()) {
// The fileCollector has to go through merge changesets no... | 607 | 1,027 | 1,634 | <methods>public non-sealed void <init>() ,public abstract void accept(java.lang.String, Consumer<org.opengrok.indexer.history.BoundaryChangesets.IdWithProgress>, org.opengrok.indexer.util.Progress) throws org.opengrok.indexer.history.HistoryException,public int getPerPartesCount() <variables>private static final java.u... |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/RepositoryWithPerPartesHistory.java | RepositoryWithPerPartesHistory | doCreateCache | class RepositoryWithPerPartesHistory extends Repository {
private static final long serialVersionUID = -3433255821312805064L;
public static final int MAX_CHANGESETS = 128;
private static final Logger LOGGER = LoggerFactory.getLogger(RepositoryWithPerPartesHistory.class);
/**
* Just like for {@lin... |
if (!RuntimeEnvironment.getInstance().isHistoryCachePerPartesEnabled()) {
LOGGER.log(Level.INFO, "repository {0} supports per partes history cache creation however " +
"it is disabled in the configuration. Generating history cache as whole.", this);
History history ... | 416 | 442 | 858 | <methods>public final java.lang.String determineBranch() throws java.io.IOException,public final java.lang.String determineCurrentVersion() throws java.io.IOException,public final java.lang.String determineParent() throws java.io.IOException,public static java.lang.String format(java.util.Date) ,public boolean getHisto... |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/SCCSHistoryParser.java | SCCSHistoryParser | read | class SCCSHistoryParser {
static final String SCCS_DIR_NAME = "SCCS";
boolean pass;
boolean passRecord;
boolean active;
int field;
boolean sep;
StringBuilder sccsRecord = new StringBuilder(128);
Reader in;
// Record fields
private String revision;
private Date rdate;
p... |
int c, d, dt;
while ((c = in.read()) != -1) {
switch (c) { //NOPMD
case 1:
d = in.read();
switch (d) {
case 'c':
case 't':
case 'u':
d ... | 1,200 | 392 | 1,592 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/SCCSRepository.java | SCCSRepository | annotate | class SCCSRepository extends Repository {
private static final Logger LOGGER = LoggerFactory.getLogger(SCCSRepository.class);
private static final long serialVersionUID = 1L;
/**
* The property name used to obtain the client command for this repository.
*/
public static final String CMD_PROP... |
Map<String, String> authors = getAuthors(file);
ArrayList<String> argv = new ArrayList<>();
ensureCommand(CMD_PROPERTY_KEY, CMD_FALLBACK);
argv.add(RepoCommand);
argv.add("get");
argv.add("-m");
argv.add("-p");
if (revision != null) {
argv.ad... | 1,556 | 214 | 1,770 | <methods>public final java.lang.String determineBranch() throws java.io.IOException,public final java.lang.String determineCurrentVersion() throws java.io.IOException,public final java.lang.String determineParent() throws java.io.IOException,public static java.lang.String format(java.util.Date) ,public boolean getHisto... |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/SCCSRepositoryAnnotationParser.java | SCCSRepositoryAnnotationParser | processStream | class SCCSRepositoryAnnotationParser implements Executor.StreamHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(SCCSRepositoryAnnotationParser.class);
/**
* Store annotation created by {@link #processStream(InputStream)}.
*/
private final Annotation annotation;
private ... |
try (BufferedReader in = new BufferedReader(new InputStreamReader(input))) {
String line;
int lineno = 0;
while ((line = in.readLine()) != null) {
++lineno;
Matcher matcher = ANNOTATION_PATTERN.matcher(line);
if (matcher.find()... | 285 | 212 | 497 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/SCCSRepositoryAuthorParser.java | SCCSRepositoryAuthorParser | processStream | class SCCSRepositoryAuthorParser implements Executor.StreamHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(SCCSRepositoryAuthorParser.class);
private final Map<String, String> authors = new HashMap<>();
/**
* Pattern used to extract revision from the {@code sccs get} command.
... |
try (BufferedReader in = new BufferedReader(
new InputStreamReader(input))) {
String line;
int lineno = 0;
while ((line = in.readLine()) != null) {
++lineno;
Matcher matcher = AUTHOR_PATTERN.matcher(line);
i... | 192 | 180 | 372 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/SCCSget.java | SCCSget | getRevision | class SCCSget {
public static InputStream getRevision(String command, File file, String revision) throws IOException {<FILL_FUNCTION_BODY>}
private SCCSget() {
}
} |
InputStream ret = null;
ArrayList<String> argv = new ArrayList<>();
argv.add(command);
argv.add("get");
argv.add("-p");
if (revision != null) {
argv.add("-r" + revision);
}
argv.add(file.getCanonicalPath());
Executor executor = new Ex... | 57 | 140 | 197 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/SSCMHistoryParser.java | SSCMHistoryParser | processStream | class SSCMHistoryParser implements Executor.StreamHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(SSCMHistoryParser.class);
private final SSCMRepository repository;
SSCMHistoryParser(SSCMRepository repository) {
this.repository = repository;
}
private static final ... |
history = new History();
BufferedReader in = new BufferedReader(new InputStreamReader(input));
StringBuilder total = new StringBuilder(input.available());
String line;
while ((line = in.readLine()) != null) {
total.append(line).append(NEWLINE);
}
Ar... | 775 | 719 | 1,494 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/SubversionAnnotationParser.java | SubversionAnnotationParser | processStream | class SubversionAnnotationParser implements Executor.StreamHandler {
private static final Logger LOGGER = LoggerFactory.getLogger(SubversionAnnotationParser.class);
/**
* Store annotation created by processStream.
*/
private final Annotation annotation;
private final String fileName;
/*... |
SAXParserFactory factory = SAXParserFactory.newInstance();
SAXParser saxParser;
try {
saxParser = factory.newSAXParser();
saxParser.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, ""); // Compliant
saxParser.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");... | 501 | 224 | 725 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/SubversionHistoryParser.java | Handler | initSaxParser | class Handler extends DefaultHandler2 {
private static final String COPYFROM_PATH = "copyfrom-path";
/**
* Example of the longest date format that we should accept - SimpleDateFormat cannot cope with micro/nano seconds.
*/
static final int SVN_MILLIS_DATE_LENGTH = "2020-03-26... |
SAXParserFactory factory = SAXParserFactory.newInstance();
saxParser = null;
try {
saxParser = factory.newSAXParser();
saxParser.setProperty(XMLConstants.ACCESS_EXTERNAL_DTD, ""); // Compliant
saxParser.setProperty(XMLConstants.ACCESS_EXTERNAL_SCHEMA, ""); //... | 1,248 | 127 | 1,375 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/history/TagEntry.java | TagEntry | compareTo | class TagEntry implements Comparable<TagEntry> {
private static final String DATE_NULL_ASSERT = "date == null";
/**
* If repo uses linear revision numbering.
*/
protected final int revision;
/**
* If repo does not use linear numbering.
*/
protected final Date date;
/**
... |
if (this == that) {
return 0;
}
if (this.revision != NOREV) {
return Integer.compare(this.revision, that.revision);
}
assert this.date != null : DATE_NULL_ASSERT;
return this.date.compareTo(that.date);
| 798 | 89 | 887 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/index/DefaultIndexChangedListener.java | DefaultIndexChangedListener | fileAdded | class DefaultIndexChangedListener implements IndexChangedListener {
private static final Logger LOGGER = LoggerFactory.getLogger(DefaultIndexChangedListener.class);
private final Map<String, Statistics> statMap = new ConcurrentHashMap<>();
@Override
public void fileAdd(String path, String analyzer) {... |
Statistics stat = statMap.get(path);
if (stat != null) {
boolean loggingDone = stat.report(LOGGER, Level.FINEST, String.format("Added: '%s' (%s)", path, analyzer),
"indexer.file.add.latency");
statMap.remove(path, stat);
// The report() updated t... | 269 | 201 | 470 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexAnalysisSettings.java | IndexAnalysisSettings | readObject | class IndexAnalysisSettings implements Serializable {
private static final long serialVersionUID = 1172403004716059609L;
private static final ObjectInputFilter serialFilter = new WhitelistObjectInputFilter(IndexAnalysisSettings.class);
private String projectName;
/**
* Nullable to allow easing ... |
boolean hasValue = in.readBoolean();
String vstring = in.readUTF();
projectName = hasValue ? vstring : null;
hasValue = in.readBoolean();
int vint = in.readInt();
tabSize = hasValue ? vint : null;
hasValue = in.readBoolean();
long vlong = in.readLong()... | 1,330 | 238 | 1,568 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexAnalysisSettingsAccessor.java | IndexAnalysisSettingsAccessor | read | class IndexAnalysisSettingsAccessor {
/**
* The {@link QueryBuilder}-normalized value for UUID 58859C75-F941-42E5-8D1A-FAF71DDEBBA7.
*/
static final String INDEX_ANALYSIS_SETTINGS_OBJUID = "uthuslvotkgltggqqjmurqojpjpjjkutkujktnkk";
private static final int INDEX_ANALYSIS_SETTINGS_OBJVER = 3;
... |
IndexSearcher searcher = RuntimeEnvironment.getInstance().getIndexSearcherFactory().newSearcher(reader);
Query q;
try {
q = new QueryParser(QueryBuilder.OBJUID, new CompatibleAnalyser()).
parse(INDEX_ANALYSIS_SETTINGS_OBJUID);
} catch (ParseException ex) {
... | 813 | 370 | 1,183 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexAnalysisSettingsUpgrader.java | IndexAnalysisSettingsUpgrader | convertFromV2 | class IndexAnalysisSettingsUpgrader {
/**
* De-serialize the specified {@code bytes}, and upgrade if necessary from
* an older version to the current object version which is
* {@link IndexAnalysisSettings3}.
* @param bytes a defined instance
* @param objectVersion a value greater than or e... |
IndexAnalysisSettings3 res = new IndexAnalysisSettings3();
res.setAnalyzerGuruVersion(old2.getAnalyzerGuruVersion());
res.setAnalyzersVersions(old2.getAnalyzersVersions());
res.setProjectName(old2.getProjectName());
res.setTabSize(old2.getTabSize());
// Version 2 has no ... | 295 | 113 | 408 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexDocumentException.java | IndexDocumentException | toString | class IndexDocumentException extends IndexCheckException {
private static final long serialVersionUID = -277429315137557112L;
private final Map<Path, Integer> duplicatePathMap;
private final Set<Path> missingPaths;
public IndexDocumentException(String s, Path path) {
super(s, path);
th... |
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append(getMessage());
stringBuilder.append(":");
if (!duplicatePathMap.isEmpty()) {
stringBuilder.append(" duplicate paths = ");
stringBuilder.append(duplicatePathMap);
}
if (!missin... | 215 | 116 | 331 | <methods>public void <init>(java.lang.String, java.nio.file.Path) ,public void <init>(java.lang.String, Set<java.nio.file.Path>) ,public void <init>(java.lang.Exception) ,public Set<java.nio.file.Path> getFailedPaths() <variables>private final Set<java.nio.file.Path> failedPaths,private static final long serialVersionU... |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexVersionException.java | IndexVersionException | toString | class IndexVersionException extends IndexCheckException {
private static final long serialVersionUID = 5693446916108385595L;
private final int luceneIndexVersion;
private final int indexVersion;
public IndexVersionException(String message, Path path, int luceneIndexVersion, int indexVersion) {
... |
return getMessage() + ": " + String.format("Lucene version = %d", luceneIndexVersion) + ", " +
String.format("index version = %d", indexVersion);
| 148 | 49 | 197 | <methods>public void <init>(java.lang.String, java.nio.file.Path) ,public void <init>(java.lang.String, Set<java.nio.file.Path>) ,public void <init>(java.lang.Exception) ,public Set<java.nio.file.Path> getFailedPaths() <variables>private final Set<java.nio.file.Path> failedPaths,private static final long serialVersionU... |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexWriterConfigFactory.java | IndexWriterConfigFactory | get | class IndexWriterConfigFactory {
IndexWriterConfigFactory() {
}
public IndexWriterConfig get() {<FILL_FUNCTION_BODY>}
} |
RuntimeEnvironment env = RuntimeEnvironment.getInstance();
Analyzer analyzer = AnalyzerGuru.getAnalyzer();
IndexWriterConfig iwc = new IndexWriterConfig(analyzer);
iwc.setOpenMode(IndexWriterConfig.OpenMode.CREATE_OR_APPEND);
iwc.setRAMBufferSizeMB(env.getRamBufferSize());
... | 43 | 100 | 143 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexedSymlink.java | IndexedSymlink | hashCode | class IndexedSymlink {
private final String absolute;
private final String canonical;
private final boolean isLocal;
private final String canonicalSeparated;
/**
* Initializes an instance with the required arguments.
* @param absolute a defined instance
* @param canonical a defined... |
int result = absolute.hashCode();
result = 31 * result + canonical.hashCode();
result = 31 * result + (isLocal ? 1 : 0);
return result;
| 594 | 51 | 645 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/index/IndexerUtil.java | IndexerUtil | enableProjects | class IndexerUtil {
private IndexerUtil() {
}
/**
* @return map of HTTP headers to use when making API requests to the web application
*/
public static MultivaluedMap<String, Object> getWebAppHeaders() {
MultivaluedMap<String, Object> headers = new MultivaluedHashMap<>();
Str... |
try (Client client = ClientBuilder.newBuilder().
connectTimeout(RuntimeEnvironment.getInstance().getConnectTimeout(), TimeUnit.SECONDS).build()) {
final Invocation.Builder request = client.target(host)
.path("api")
.path("v1")
... | 319 | 230 | 549 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/index/NumLinesLOCAccessor.java | NumLinesLOCAccessor | storeBulk | class NumLinesLOCAccessor {
private static final int BULK_READ_THRESHOLD = 100;
/**
* Determines whether there is stored number-of-lines and lines-of-code
* in the index associated to the specified {@code reader}.
*/
public boolean hasStored(IndexReader reader) throws IOException {
D... |
DSearchResult searchResult = newDSearch(reader, Integer.MAX_VALUE);
// Index the existing document IDs by QueryBuilder.D.
HashMap<String, Integer> byDir = new HashMap<>();
int intMaximum = Integer.MAX_VALUE < searchResult.hits.totalHits.value ?
Integer.MAX_VALUE : (int... | 1,761 | 268 | 2,029 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/index/NumLinesLOCAggregator.java | NumLinesLOCAggregator | register | class NumLinesLOCAggregator {
private final Object syncRoot = new Object();
private final HashMap<String, DeltaData> registeredDeltas = new HashMap<>();
/**
* Gets an iterator over all registered data, explicit and derived, and not
* ordered.
* @return a defined instance
*/
public ... |
File file = new File(counts.getPath());
File directory = file.getParentFile();
if (directory != null) {
synchronized (syncRoot) {
do {
String dirPath = Util.fixPathIfWindows(directory.getPath());
var extantDelta = registeredDel... | 603 | 162 | 765 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/index/NumLinesLOCUtil.java | NumLinesLOCUtil | read | class NumLinesLOCUtil {
/**
* Reads data, if they exist, from the specified document.
* @param doc {@link Document} instance
* @return a defined instance
*/
public static NullableNumLinesLOC read(Document doc) {<FILL_FUNCTION_BODY>}
/* private to enforce static */
private NumLinesL... |
String path = doc.get(QueryBuilder.D);
if (path == null) {
path = doc.get(QueryBuilder.PATH);
}
Long numLines = NumberUtil.tryParseLong(doc.get(QueryBuilder.NUML));
Long loc = NumberUtil.tryParseLong(doc.get(QueryBuilder.LOC));
return new NullableNumLinesLOC(... | 102 | 107 | 209 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/index/PendingFileDeletion.java | PendingFileDeletion | equals | class PendingFileDeletion {
private final String absolutePath;
public PendingFileDeletion(String absolutePath) {
this.absolutePath = absolutePath;
}
/**
* @return the absolute path
*/
public String getAbsolutePath() {
return absolutePath;
}
/**
* Compares {@... |
if (!(o instanceof PendingFileDeletion)) {
return false;
}
PendingFileDeletion other = (PendingFileDeletion) o;
return this.absolutePath.equals(other.absolutePath);
| 194 | 63 | 257 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/index/PendingFileRenaming.java | PendingFileRenaming | equals | class PendingFileRenaming {
private final String absolutePath;
private final String transientPath;
public PendingFileRenaming(String absolutePath, String transientPath) {
this.absolutePath = absolutePath;
this.transientPath = transientPath;
}
/**
* @return the final, absolute ... |
if (!(o instanceof PendingFileRenaming)) {
return false;
}
PendingFileRenaming other = (PendingFileRenaming) o;
return this.absolutePath.equals(other.absolutePath);
| 255 | 63 | 318 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/index/PendingSymlinkage.java | PendingSymlinkage | equals | class PendingSymlinkage {
private final String sourcePath;
private final String targetRelPath;
public PendingSymlinkage(String sourcePath, String targetRelPath) {
this.sourcePath = sourcePath;
this.targetRelPath = targetRelPath;
}
/**
* @return the source, absolute path
*... |
if (!(o instanceof PendingSymlinkage)) {
return false;
}
PendingSymlinkage other = (PendingSymlinkage) o;
return this.sourcePath.equals(other.sourcePath);
| 254 | 58 | 312 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/logger/formatter/LogFormatter.java | LogFormatter | format | class LogFormatter extends Formatter {
private static final String DEFAULT_FORMAT = "%1$tb %1$td, %1$tY %1$tl:%1$tM:%1$tS %1$Tp %2$s%n%4$s: %5$s%6$s%n";
private final String format;
private final String version;
public LogFormatter() {
this(DEFAULT_FORMAT, "unknown");
}
public LogFor... |
Date dat = new Date(logRecord.getMillis());
StringBuilder source = new StringBuilder();
if (logRecord.getSourceClassName() != null) {
source.append(logRecord.getSourceClassName());
if (logRecord.getSourceMethodName() != null) {
source.append(' ').append(l... | 225 | 383 | 608 | <methods>public abstract java.lang.String format(java.util.logging.LogRecord) ,public java.lang.String formatMessage(java.util.logging.LogRecord) ,public java.lang.String getHead(java.util.logging.Handler) ,public java.lang.String getTail(java.util.logging.Handler) <variables> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/search/CustomQueryParser.java | CustomQueryParser | isCaseSensitive | class CustomQueryParser extends QueryParser {
/**
* Create a query parser customized for OpenGrok.
*
* @param field default field for unqualified query terms
*/
public CustomQueryParser(String field) {
super(field, new CompatibleAnalyser());
setDefaultOperator(AND_OPERATOR);... |
// Only definition search and reference search are case sensitive
return QueryBuilder.DEFS.equals(field)
|| QueryBuilder.REFS.equals(field);
| 860 | 41 | 901 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/search/DirectoryExtraReader.java | DirectoryExtraReader | search | class DirectoryExtraReader {
// N.b.: update #search() comment when changing
private static final int DIR_LIMIT_NUM = 2000;
private static final Logger LOGGER = LoggerFactory.getLogger(
DirectoryExtraReader.class);
/**
* Search for supplemental file information in the specified {@code pa... |
if (searcher == null) {
throw new IllegalArgumentException("`searcher' is null");
}
if (path == null) {
throw new IllegalArgumentException("`path' is null");
}
QueryBuilder qbuild = new QueryBuilder();
qbuild.setDirPath(path);
Query query... | 319 | 271 | 590 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/search/Hit.java | Hit | equals | class Hit implements Comparable<Hit> {
/**
* Holds value of property filename.
*/
private String filename;
/**
* Holds value of property directory.
*/
private String directory;
/**
* Holds value of property line.
*/
private String line;
/**
* Holds value... |
if (o instanceof Hit) {
return compareTo((Hit) o) == 0;
}
return false;
| 1,328 | 33 | 1,361 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/search/SettingsHelper.java | SettingsHelper | getTabSize | class SettingsHelper {
private final IndexReader reader;
/**
* Key is Project name or empty string for null Project.
*/
private Map<String, IndexAnalysisSettings3> mappedAnalysisSettings;
/**
* Key is Project name or empty string for null Project. Map is ordered by
* canonical len... |
String projectName = proj != null ? proj.getName() : null;
IndexAnalysisSettings3 settings = getSettings(projectName);
int tabSize;
if (settings != null && settings.getTabSize() != null) {
tabSize = settings.getTabSize();
} else {
tabSize = proj != null ?... | 907 | 110 | 1,017 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/search/Summarizer.java | Excerpt | getSummary | class Excerpt {
List<Summary.Fragment> passages = new ArrayList<>();
Set<String> tokenSet = new TreeSet<>();
int numTerms = 0;
public void addToken(String token) {
tokenSet.add(token);
}
/**
* Return how many unique tokens we have.
*/
... |
if (text == null) {
return null;
}
// Simplistic implementation. Finds the first fragments in the document
// containing any query terms.
//
// @TODO: check that phrases in the query are matched in the fragment
SToken[] tokens = getTokens(text); ... | 357 | 1,585 | 1,942 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/search/Summary.java | Ellipsis | toString | class Ellipsis extends Fragment {
/* Constructs an ellipsis fragment for the given text. */
public Ellipsis() {
super(" ... ");
}
/* Returns true. */
@Override
public boolean isEllipsis() {
return true;
}
/* Returns an HTML repres... |
StringBuilder buffer = new StringBuilder();
for (Fragment fragment : fragments) {
buffer.append(fragment);
}
return buffer.toString();
| 295 | 41 | 336 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/search/TermEscaperBase.java | TermEscaperBase | consume | class TermEscaperBase {
private StringBuilder out;
/**
* "Runs the scanner [as documented by JFlex].
* <p>[The method] can be used to get the next token from the input."
* <p>"Consume[s] input until one of the expressions in the specification
* is matched or an error occurs."
* @retur... |
try {
while (yylex()) {
continue;
}
} catch (IOException ex) {
// cannot get here with StringBuilder operations
}
| 324 | 45 | 369 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/FormattedLines.java | FormattedLines | merge | class FormattedLines {
private final SortedMap<Integer, String> lines = new TreeMap<>();
private String footer;
private boolean limited;
/*
* Gets a count of the number of lines in the instance.
*/
public int getCount() {
return lines.size();
}
/**
* @return the foot... |
FormattedLines res = new FormattedLines();
res.lines.putAll(this.lines);
for (Map.Entry<Integer, String> kv : other.lines.entrySet()) {
res.lines.putIfAbsent(kv.getKey(), kv.getValue());
}
res.setFooter(this.footer != null ? this.footer : other.footer);
res.... | 655 | 124 | 779 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/LineHighlight.java | LineHighlight | condenseMarkups | class LineHighlight {
private final int lineno;
private List<PhraseHighlight> markups;
/** Offset of elided left part. */
private int lelide;
/** Offset of elide right part. */
private int relide;
private boolean didLelide;
private boolean didRelide;
public LineHighlight(int linen... |
if (markups == null) {
return;
}
markups.sort(PhraseHighlightComparator.INSTANCE);
// Condense instances if there is overlap.
for (int i = 0; i + 1 < markups.size(); ++i) {
PhraseHighlight phi0 = markups.get(i);
PhraseHighlight phi1 = markups... | 1,180 | 173 | 1,353 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/LineMatcher.java | LineMatcher | compareStrings | class LineMatcher {
// Line Matcher States
public static final int NOT_MATCHED = 0;
public static final int MATCHED = 1;
public static final int WAIT = 2;
/**
* Tells whether the matching should be done in a case-insensitive manner.
*/
private final boolean caseInsensitive;
/**
... |
if (s1 == null) {
return s2 == null ? 0 : -1;
} else if (caseInsensitive) {
return s1.compareToIgnoreCase(s2);
} else {
return s1.compareTo(s2);
}
| 473 | 72 | 545 | <no_super_class> |
oracle_opengrok | opengrok/opengrok-indexer/src/main/java/org/opengrok/indexer/search/context/OGPassageScorer.java | OGPassageScorer | score | class OGPassageScorer extends PassageScorer {
private static final Logger LOGGER = LoggerFactory.getLogger(OGPassageScorer.class);
public OGPassageScorer() {
// Use non-default values so that the scorer object is easier to identify when debugging.
super(1, 2, 3);
}
@Override
publi... |
LOGGER.log(Level.FINEST, "{0} -> {1}", new Object[]{passage, passage.getStartOffset()});
return -passage.getStartOffset();
| 124 | 50 | 174 | <no_super_class> |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.