id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
16,100
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/plugins/DirPluginScanner.java
DirPluginScanner.isExpired
public boolean isExpired(final ProviderIdent ident, final File file) { return !file.exists() || !scannedFiles.contains(memoize(file)); }
java
public boolean isExpired(final ProviderIdent ident, final File file) { return !file.exists() || !scannedFiles.contains(memoize(file)); }
[ "public", "boolean", "isExpired", "(", "final", "ProviderIdent", "ident", ",", "final", "File", "file", ")", "{", "return", "!", "file", ".", "exists", "(", ")", "||", "!", "scannedFiles", ".", "contains", "(", "memoize", "(", "file", ")", ")", ";", "}...
Return true if the entry has expired
[ "Return", "true", "if", "the", "entry", "has", "expired" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/DirPluginScanner.java#L131-L133
16,101
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/plugins/DirPluginScanner.java
DirPluginScanner.scanFor
private File scanFor(final ProviderIdent ident, final File[] files) throws PluginScannerException { final List<FileCache.MemoFile> candidates = new ArrayList<>(); HashSet<FileCache.MemoFile> prescanned = new HashSet<>(scannedFiles); HashSet<FileCache.MemoFile> newscanned = new HashSet<>(); ...
java
private File scanFor(final ProviderIdent ident, final File[] files) throws PluginScannerException { final List<FileCache.MemoFile> candidates = new ArrayList<>(); HashSet<FileCache.MemoFile> prescanned = new HashSet<>(scannedFiles); HashSet<FileCache.MemoFile> newscanned = new HashSet<>(); ...
[ "private", "File", "scanFor", "(", "final", "ProviderIdent", "ident", ",", "final", "File", "[", "]", "files", ")", "throws", "PluginScannerException", "{", "final", "List", "<", "FileCache", ".", "MemoFile", ">", "candidates", "=", "new", "ArrayList", "<>", ...
Return the first valid file found
[ "Return", "the", "first", "valid", "file", "found" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/plugins/DirPluginScanner.java#L147-L181
16,102
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/execution/impl/jsch/NodeSSHConnectionInfo.java
NodeSSHConnectionInfo.resolve
private String resolve(final String propName) { return ResolverUtil.resolveProperty(propName, null, node, frameworkProject, framework); }
java
private String resolve(final String propName) { return ResolverUtil.resolveProperty(propName, null, node, frameworkProject, framework); }
[ "private", "String", "resolve", "(", "final", "String", "propName", ")", "{", "return", "ResolverUtil", ".", "resolveProperty", "(", "propName", ",", "null", ",", "node", ",", "frameworkProject", ",", "framework", ")", ";", "}" ]
Resolve a property by looking for node attribute, project, then framework value @param propName @return
[ "Resolve", "a", "property", "by", "looking", "for", "node", "attribute", "project", "then", "framework", "value" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/impl/jsch/NodeSSHConnectionInfo.java#L177-L179
16,103
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/execution/impl/jsch/NodeSSHConnectionInfo.java
NodeSSHConnectionInfo.nonBlank
public static String nonBlank(final String input) { if (null == input || "".equals(input.trim())) { return null; } else { return input.trim(); } }
java
public static String nonBlank(final String input) { if (null == input || "".equals(input.trim())) { return null; } else { return input.trim(); } }
[ "public", "static", "String", "nonBlank", "(", "final", "String", "input", ")", "{", "if", "(", "null", "==", "input", "||", "\"\"", ".", "equals", "(", "input", ".", "trim", "(", ")", ")", ")", "{", "return", "null", ";", "}", "else", "{", "return...
Return null if the input is null or empty or whitespace, otherwise return the input string trimmed.
[ "Return", "null", "if", "the", "input", "is", "null", "or", "empty", "or", "whitespace", "otherwise", "return", "the", "input", "string", "trimmed", "." ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/impl/jsch/NodeSSHConnectionInfo.java#L280-L286
16,104
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/utils/JARVerifier.java
JARVerifier.verifySingleJarFile
public final void verifySingleJarFile(JarFile jf) throws IOException, CertificateException, VerifierException { Vector entriesVec = new Vector(); // Ensure there is a manifest file Manifest man = jf.getManifest(); if (man == null) { throw new VerifierException("T...
java
public final void verifySingleJarFile(JarFile jf) throws IOException, CertificateException, VerifierException { Vector entriesVec = new Vector(); // Ensure there is a manifest file Manifest man = jf.getManifest(); if (man == null) { throw new VerifierException("T...
[ "public", "final", "void", "verifySingleJarFile", "(", "JarFile", "jf", ")", "throws", "IOException", ",", "CertificateException", ",", "VerifierException", "{", "Vector", "entriesVec", "=", "new", "Vector", "(", ")", ";", "// Ensure there is a manifest file", "Manife...
Verify the JAR file signatures with the trusted CA certificates. @param jf jar file @throws IOException on io error @throws CertificateException on cert error @throws VerifierException If the jar file cannot be verified.
[ "Verify", "the", "JAR", "file", "signatures", "with", "the", "trusted", "CA", "certificates", "." ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/utils/JARVerifier.java#L141-L207
16,105
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/execution/workflow/steps/node/impl/DefaultScriptFileNodeStepUtils.java
DefaultScriptFileNodeStepUtils.executeScriptFile
@Override public NodeStepResult executeScriptFile( StepExecutionContext context, INodeEntry node, String scriptString, String serverScriptFilePath, InputStream scriptAsStream, String fileExtension, String[] args, String ...
java
@Override public NodeStepResult executeScriptFile( StepExecutionContext context, INodeEntry node, String scriptString, String serverScriptFilePath, InputStream scriptAsStream, String fileExtension, String[] args, String ...
[ "@", "Override", "public", "NodeStepResult", "executeScriptFile", "(", "StepExecutionContext", "context", ",", "INodeEntry", "node", ",", "String", "scriptString", ",", "String", "serverScriptFilePath", ",", "InputStream", "scriptAsStream", ",", "String", "fileExtension",...
Execute a script on a remote node @param context context @param node node @param scriptString string @param serverScriptFilePath file @param scriptAsStream stream @param fileExtension file extension @param args script args @param scriptInterpreter in...
[ "Execute", "a", "script", "on", "a", "remote", "node" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/workflow/steps/node/impl/DefaultScriptFileNodeStepUtils.java#L61-L141
16,106
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/execution/workflow/steps/node/impl/DefaultScriptFileNodeStepUtils.java
DefaultScriptFileNodeStepUtils.writeScriptToTempFile
@Override public File writeScriptToTempFile( StepExecutionContext context, INodeEntry node, String scriptString, String serverScriptFilePath, InputStream scriptAsStream, boolean expandTokens ) throws FileCopierException { File t...
java
@Override public File writeScriptToTempFile( StepExecutionContext context, INodeEntry node, String scriptString, String serverScriptFilePath, InputStream scriptAsStream, boolean expandTokens ) throws FileCopierException { File t...
[ "@", "Override", "public", "File", "writeScriptToTempFile", "(", "StepExecutionContext", "context", ",", "INodeEntry", "node", ",", "String", "scriptString", ",", "String", "serverScriptFilePath", ",", "InputStream", "scriptAsStream", ",", "boolean", "expandTokens", ")"...
Copy the script input to a temp file and expand embedded tokens, if it is a string or inputstream. If it is a local file, use the original without modification @param context context @param node node @param scriptString string @param serverScriptFilePath file @param scriptAsStream...
[ "Copy", "the", "script", "input", "to", "a", "temp", "file", "and", "expand", "embedded", "tokens", "if", "it", "is", "a", "string", "or", "inputstream", ".", "If", "it", "is", "a", "local", "file", "use", "the", "original", "without", "modification" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/workflow/steps/node/impl/DefaultScriptFileNodeStepUtils.java#L158-L195
16,107
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/execution/workflow/steps/node/impl/DefaultScriptFileNodeStepUtils.java
DefaultScriptFileNodeStepUtils.removeArgsForOsFamily
@Override public ExecArgList removeArgsForOsFamily(String filepath, String osFamily) { if ("windows".equalsIgnoreCase(osFamily)) { return ExecArgList.fromStrings(false, "del", filepath); } else { return ExecArgList.fromStrings(false, "rm", "-f", filepath); } }
java
@Override public ExecArgList removeArgsForOsFamily(String filepath, String osFamily) { if ("windows".equalsIgnoreCase(osFamily)) { return ExecArgList.fromStrings(false, "del", filepath); } else { return ExecArgList.fromStrings(false, "rm", "-f", filepath); } }
[ "@", "Override", "public", "ExecArgList", "removeArgsForOsFamily", "(", "String", "filepath", ",", "String", "osFamily", ")", "{", "if", "(", "\"windows\"", ".", "equalsIgnoreCase", "(", "osFamily", ")", ")", "{", "return", "ExecArgList", ".", "fromStrings", "("...
Return ExecArgList for removing a file for the given OS family @param filepath path @param osFamily family @return arg list
[ "Return", "ExecArgList", "for", "removing", "a", "file", "for", "the", "given", "OS", "family" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/workflow/steps/node/impl/DefaultScriptFileNodeStepUtils.java#L332-L339
16,108
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/utils/NodeSet.java
NodeSet.shouldExclude
public boolean shouldExclude(final INodeEntry entry) { if(null!=getSingleNodeName()) { return !getSingleNodeName().equals(entry.getNodename()); } boolean includesMatch = includes != null && includes.matches(entry); boolean excludesMatch = excludes != null && excludes.matches...
java
public boolean shouldExclude(final INodeEntry entry) { if(null!=getSingleNodeName()) { return !getSingleNodeName().equals(entry.getNodename()); } boolean includesMatch = includes != null && includes.matches(entry); boolean excludesMatch = excludes != null && excludes.matches...
[ "public", "boolean", "shouldExclude", "(", "final", "INodeEntry", "entry", ")", "{", "if", "(", "null", "!=", "getSingleNodeName", "(", ")", ")", "{", "return", "!", "getSingleNodeName", "(", ")", ".", "equals", "(", "entry", ".", "getNodename", "(", ")", ...
Return true if the node entry should be excluded based on the includes and excludes parameters. When both include and exclude patterns match the node, it will be excluded based on which filterset is dominant. @param entry node descriptor entry @return true if the node should be excluded.
[ "Return", "true", "if", "the", "node", "entry", "should", "be", "excluded", "based", "on", "the", "includes", "and", "excludes", "parameters", ".", "When", "both", "include", "and", "exclude", "patterns", "match", "the", "node", "it", "will", "be", "excluded...
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/utils/NodeSet.java#L201-L217
16,109
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/utils/NodeSet.java
NodeSet.validate
public void validate() { if (null != failedNodesfile && failedNodesfile.getName().startsWith("${") && failedNodesfile.getName() .endsWith("}")) { failedNodesfile=null; } }
java
public void validate() { if (null != failedNodesfile && failedNodesfile.getName().startsWith("${") && failedNodesfile.getName() .endsWith("}")) { failedNodesfile=null; } }
[ "public", "void", "validate", "(", ")", "{", "if", "(", "null", "!=", "failedNodesfile", "&&", "failedNodesfile", ".", "getName", "(", ")", ".", "startsWith", "(", "\"${\"", ")", "&&", "failedNodesfile", ".", "getName", "(", ")", ".", "endsWith", "(", "\...
Validate input. If failedNodesfile looks like an invalid property reference, set it to null.
[ "Validate", "input", ".", "If", "failedNodesfile", "looks", "like", "an", "invalid", "property", "reference", "set", "it", "to", "null", "." ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/utils/NodeSet.java#L238-L243
16,110
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/utils/NodeSet.java
NodeSet.fromFilter
public static NodeSet fromFilter(String filter) { Map<String, Map<String, String>> stringMapMap = parseFilter(filter); NodeSet nodeSet = new NodeSet(); nodeSet.createInclude(stringMapMap.get("include")); nodeSet.createExclude(stringMapMap.get("exclude")); return nodeSet; }
java
public static NodeSet fromFilter(String filter) { Map<String, Map<String, String>> stringMapMap = parseFilter(filter); NodeSet nodeSet = new NodeSet(); nodeSet.createInclude(stringMapMap.get("include")); nodeSet.createExclude(stringMapMap.get("exclude")); return nodeSet; }
[ "public", "static", "NodeSet", "fromFilter", "(", "String", "filter", ")", "{", "Map", "<", "String", ",", "Map", "<", "String", ",", "String", ">", ">", "stringMapMap", "=", "parseFilter", "(", "filter", ")", ";", "NodeSet", "nodeSet", "=", "new", "Node...
Create a NodeSet from a filter @param filter filter string @return node set
[ "Create", "a", "NodeSet", "from", "a", "filter" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/utils/NodeSet.java#L380-L386
16,111
rundeck/rundeck
rundeck-storage/rundeck-storage-filesys/src/main/java/org/rundeck/storage/data/file/FileTreeUtil.java
FileTreeUtil.pathForFileInRoot
public static Path pathForFileInRoot( final File rootDir, final File file ) { String filePath = file.getAbsolutePath(); String rootPath = rootDir.getAbsolutePath(); if (!filePath.startsWith(rootPath)) { throw new IllegalArgumentException("not a file in...
java
public static Path pathForFileInRoot( final File rootDir, final File file ) { String filePath = file.getAbsolutePath(); String rootPath = rootDir.getAbsolutePath(); if (!filePath.startsWith(rootPath)) { throw new IllegalArgumentException("not a file in...
[ "public", "static", "Path", "pathForFileInRoot", "(", "final", "File", "rootDir", ",", "final", "File", "file", ")", "{", "String", "filePath", "=", "file", ".", "getAbsolutePath", "(", ")", ";", "String", "rootPath", "=", "rootDir", ".", "getAbsolutePath", ...
Return a storage Path given a file within a given root dir @param rootDir root dir to use @param file file @return sub path corresponding to the file @throws IllegalArgumentException if the file is not within the root
[ "Return", "a", "storage", "Path", "given", "a", "file", "within", "a", "given", "root", "dir" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/rundeck-storage/rundeck-storage-filesys/src/main/java/org/rundeck/storage/data/file/FileTreeUtil.java#L46-L57
16,112
rundeck/rundeck
rundeck-storage/rundeck-storage-filesys/src/main/java/org/rundeck/storage/data/file/FileTreeUtil.java
FileTreeUtil.pathForRelativeFilepath
public static Path pathForRelativeFilepath( final String filepath, final String separator ) { String[] comps = filepath.split(Pattern.quote(separator)); return PathUtil.pathFromComponents(comps); }
java
public static Path pathForRelativeFilepath( final String filepath, final String separator ) { String[] comps = filepath.split(Pattern.quote(separator)); return PathUtil.pathFromComponents(comps); }
[ "public", "static", "Path", "pathForRelativeFilepath", "(", "final", "String", "filepath", ",", "final", "String", "separator", ")", "{", "String", "[", "]", "comps", "=", "filepath", ".", "split", "(", "Pattern", ".", "quote", "(", "separator", ")", ")", ...
Return a storage path given a relative file path string @param filepath file path with given separator @param separator separator string @return storage path
[ "Return", "a", "storage", "path", "given", "a", "relative", "file", "path", "string" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/rundeck-storage/rundeck-storage-filesys/src/main/java/org/rundeck/storage/data/file/FileTreeUtil.java#L82-L89
16,113
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/execution/impl/jsch/JschNodeExecutor.java
JschNodeExecutor.passwordSourceWithPrefix
private PasswordSource passwordSourceWithPrefix( final NodeSSHConnectionInfo nodeAuthentication, final String prefix ) throws IOException { if (null != nodeAuthentication.getSudoPasswordStoragePath(prefix)) { return new BasicSource(nodeAuthentication.getSudoPasswordSt...
java
private PasswordSource passwordSourceWithPrefix( final NodeSSHConnectionInfo nodeAuthentication, final String prefix ) throws IOException { if (null != nodeAuthentication.getSudoPasswordStoragePath(prefix)) { return new BasicSource(nodeAuthentication.getSudoPasswordSt...
[ "private", "PasswordSource", "passwordSourceWithPrefix", "(", "final", "NodeSSHConnectionInfo", "nodeAuthentication", ",", "final", "String", "prefix", ")", "throws", "IOException", "{", "if", "(", "null", "!=", "nodeAuthentication", ".", "getSudoPasswordStoragePath", "("...
create password source @param nodeAuthentication auth @param prefix prefix @return source @throws IOException if password loading from storage fails
[ "create", "password", "source" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/impl/jsch/JschNodeExecutor.java#L502-L512
16,114
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/execution/impl/jsch/JschNodeExecutor.java
JschNodeExecutor.shutdownAndAwaitTermination
void shutdownAndAwaitTermination(ExecutorService pool) { pool.shutdownNow(); // Disable new tasks from being submitted try { logger.debug("Waiting up to 30 seconds for ExecutorService to shut down"); // Wait a while for existing tasks to terminate if (!pool.awaitTermi...
java
void shutdownAndAwaitTermination(ExecutorService pool) { pool.shutdownNow(); // Disable new tasks from being submitted try { logger.debug("Waiting up to 30 seconds for ExecutorService to shut down"); // Wait a while for existing tasks to terminate if (!pool.awaitTermi...
[ "void", "shutdownAndAwaitTermination", "(", "ExecutorService", "pool", ")", "{", "pool", ".", "shutdownNow", "(", ")", ";", "// Disable new tasks from being submitted", "try", "{", "logger", ".", "debug", "(", "\"Waiting up to 30 seconds for ExecutorService to shut down\"", ...
Shutdown the ExecutorService
[ "Shutdown", "the", "ExecutorService" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/impl/jsch/JschNodeExecutor.java#L607-L621
16,115
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/storage/StorageTreeFactory.java
StorageTreeFactory.baseConverter
private TreeBuilder<ResourceMeta> baseConverter(TreeBuilder<ResourceMeta> builder) { if(null!=defaultConverters && defaultConverters.contains("StorageTimestamperConverter")) { logger.debug("Configuring base converter: StorageTimestamperConverter" ); builder=builder.convert( ...
java
private TreeBuilder<ResourceMeta> baseConverter(TreeBuilder<ResourceMeta> builder) { if(null!=defaultConverters && defaultConverters.contains("StorageTimestamperConverter")) { logger.debug("Configuring base converter: StorageTimestamperConverter" ); builder=builder.convert( ...
[ "private", "TreeBuilder", "<", "ResourceMeta", ">", "baseConverter", "(", "TreeBuilder", "<", "ResourceMeta", ">", "builder", ")", "{", "if", "(", "null", "!=", "defaultConverters", "&&", "defaultConverters", ".", "contains", "(", "\"StorageTimestamperConverter\"", ...
Apply base converters for metadata timestamps @param builder builder @return builder
[ "Apply", "base", "converters", "for", "metadata", "timestamps" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/storage/StorageTreeFactory.java#L122-L142
16,116
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/storage/StorageTreeFactory.java
StorageTreeFactory.addLogger
private TreeBuilder<ResourceMeta> addLogger(TreeBuilder<ResourceMeta> builder, Map<String,String> config) { String loggerName= getLoggerName(); if (null != config.get(LOGGER_NAME)) { loggerName = config.get(LOGGER_NAME); } if (null == loggerName) { loggerName = OR...
java
private TreeBuilder<ResourceMeta> addLogger(TreeBuilder<ResourceMeta> builder, Map<String,String> config) { String loggerName= getLoggerName(); if (null != config.get(LOGGER_NAME)) { loggerName = config.get(LOGGER_NAME); } if (null == loggerName) { loggerName = OR...
[ "private", "TreeBuilder", "<", "ResourceMeta", ">", "addLogger", "(", "TreeBuilder", "<", "ResourceMeta", ">", "builder", ",", "Map", "<", "String", ",", "String", ">", "config", ")", "{", "String", "loggerName", "=", "getLoggerName", "(", ")", ";", "if", ...
Append final listeners to the tree @param builder builder @return builder
[ "Append", "final", "listeners", "to", "the", "tree" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/storage/StorageTreeFactory.java#L151-L161
16,117
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/storage/StorageTreeFactory.java
StorageTreeFactory.baseStorage
private TreeBuilder<ResourceMeta> baseStorage(TreeBuilder<ResourceMeta> builder) { //set base using file storage, could be overridden Map<String, String> config1 = expandConfig(getBaseStorageConfig()); logger.debug("Default base storage provider: " + getBaseStorageType() + ", " + ...
java
private TreeBuilder<ResourceMeta> baseStorage(TreeBuilder<ResourceMeta> builder) { //set base using file storage, could be overridden Map<String, String> config1 = expandConfig(getBaseStorageConfig()); logger.debug("Default base storage provider: " + getBaseStorageType() + ", " + ...
[ "private", "TreeBuilder", "<", "ResourceMeta", ">", "baseStorage", "(", "TreeBuilder", "<", "ResourceMeta", ">", "builder", ")", "{", "//set base using file storage, could be overridden", "Map", "<", "String", ",", "String", ">", "config1", "=", "expandConfig", "(", ...
Set up the base storage layer for the tree @param builder builder @return builder
[ "Set", "up", "the", "base", "storage", "layer", "for", "the", "tree" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/storage/StorageTreeFactory.java#L170-L185
16,118
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/storage/StorageTreeFactory.java
StorageTreeFactory.configureConverterPlugin
private TreeBuilder<ResourceMeta> configureConverterPlugin(TreeBuilder<ResourceMeta> builder, int index, Map<String, String> configProps) { String pref1 = getConverterConfigPrefix() + SEP + index; String pluginType = configProps.get(pref1 + ...
java
private TreeBuilder<ResourceMeta> configureConverterPlugin(TreeBuilder<ResourceMeta> builder, int index, Map<String, String> configProps) { String pref1 = getConverterConfigPrefix() + SEP + index; String pluginType = configProps.get(pref1 + ...
[ "private", "TreeBuilder", "<", "ResourceMeta", ">", "configureConverterPlugin", "(", "TreeBuilder", "<", "ResourceMeta", ">", "builder", ",", "int", "index", ",", "Map", "<", "String", ",", "String", ">", "configProps", ")", "{", "String", "pref1", "=", "getCo...
Configure converter plugins for the builder @param builder builder @param index given index @param configProps configuration properties @return builder
[ "Configure", "converter", "plugins", "for", "the", "builder" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/storage/StorageTreeFactory.java#L204-L227
16,119
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/storage/StorageTreeFactory.java
StorageTreeFactory.buildConverterPlugin
private TreeBuilder<ResourceMeta> buildConverterPlugin(TreeBuilder<ResourceMeta> builder, String pluginType, String path, String selector, Map<String, String> config) { StorageConverterPlugin converterPlugin = loadPlugin( pluginType, ...
java
private TreeBuilder<ResourceMeta> buildConverterPlugin(TreeBuilder<ResourceMeta> builder, String pluginType, String path, String selector, Map<String, String> config) { StorageConverterPlugin converterPlugin = loadPlugin( pluginType, ...
[ "private", "TreeBuilder", "<", "ResourceMeta", ">", "buildConverterPlugin", "(", "TreeBuilder", "<", "ResourceMeta", ">", "builder", ",", "String", "pluginType", ",", "String", "path", ",", "String", "selector", ",", "Map", "<", "String", ",", "String", ">", "...
Append a converter plugin to the tree builder @param builder builder @param pluginType converter plugin type @param path path @param selector metadata selector @param config plugin config data @return builder
[ "Append", "a", "converter", "plugin", "to", "the", "tree", "builder" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/storage/StorageTreeFactory.java#L240-L253
16,120
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/storage/StorageTreeFactory.java
StorageTreeFactory.subPropertyMap
private Map<String, String> subPropertyMap(String configPrefix, Map propertiesMap) { Map<String, String> config = new HashMap<String, String>(); for (Object o : propertiesMap.keySet()) { String key = (String) o; if (key.startsWith(configPrefix)) { String conf = ke...
java
private Map<String, String> subPropertyMap(String configPrefix, Map propertiesMap) { Map<String, String> config = new HashMap<String, String>(); for (Object o : propertiesMap.keySet()) { String key = (String) o; if (key.startsWith(configPrefix)) { String conf = ke...
[ "private", "Map", "<", "String", ",", "String", ">", "subPropertyMap", "(", "String", "configPrefix", ",", "Map", "propertiesMap", ")", "{", "Map", "<", "String", ",", "String", ">", "config", "=", "new", "HashMap", "<", "String", ",", "String", ">", "("...
Extract a map of the property values starting with the given prefix @param configPrefix prefix @param propertiesMap input @return map
[ "Extract", "a", "map", "of", "the", "property", "values", "starting", "with", "the", "given", "prefix" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/storage/StorageTreeFactory.java#L264-L274
16,121
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/storage/StorageTreeFactory.java
StorageTreeFactory.configureStoragePlugin
private void configureStoragePlugin(TreeBuilder<ResourceMeta> builder, int index, Map<String, String> configProps) { String pref1 = getStorageConfigPrefix() + SEP + index; String pluginType = configProps.get(pref1 + SEP + TYPE); String path = configProps.get(pref1 + SEP + PATH); boolean ...
java
private void configureStoragePlugin(TreeBuilder<ResourceMeta> builder, int index, Map<String, String> configProps) { String pref1 = getStorageConfigPrefix() + SEP + index; String pluginType = configProps.get(pref1 + SEP + TYPE); String path = configProps.get(pref1 + SEP + PATH); boolean ...
[ "private", "void", "configureStoragePlugin", "(", "TreeBuilder", "<", "ResourceMeta", ">", "builder", ",", "int", "index", ",", "Map", "<", "String", ",", "String", ">", "configProps", ")", "{", "String", "pref1", "=", "getStorageConfigPrefix", "(", ")", "+", ...
Configures storage plugins with the builder @param builder builder @param index current prop index @param configProps configuration properties
[ "Configures", "storage", "plugins", "with", "the", "builder" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/storage/StorageTreeFactory.java#L283-L304
16,122
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/storage/StorageTreeFactory.java
StorageTreeFactory.expandConfig
private Map<String, String> expandConfig(Map<String, String> map) { return expandAllProperties(map, getPropertyLookup().getPropertiesMap()); }
java
private Map<String, String> expandConfig(Map<String, String> map) { return expandAllProperties(map, getPropertyLookup().getPropertiesMap()); }
[ "private", "Map", "<", "String", ",", "String", ">", "expandConfig", "(", "Map", "<", "String", ",", "String", ">", "map", ")", "{", "return", "expandAllProperties", "(", "map", ",", "getPropertyLookup", "(", ")", ".", "getPropertiesMap", "(", ")", ")", ...
Expand embedded framework property references in the map values @param map map @return expanded map
[ "Expand", "embedded", "framework", "property", "references", "in", "the", "map", "values" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/storage/StorageTreeFactory.java#L313-L315
16,123
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/execution/script/ScriptfileUtils.java
ScriptfileUtils.writeScriptTempfile
public static File writeScriptTempfile( final Framework framework, final Reader source, final LineEndingStyle style ) throws IOException { return writeScriptTempfile(framework, null, null, source, style); }
java
public static File writeScriptTempfile( final Framework framework, final Reader source, final LineEndingStyle style ) throws IOException { return writeScriptTempfile(framework, null, null, source, style); }
[ "public", "static", "File", "writeScriptTempfile", "(", "final", "Framework", "framework", ",", "final", "Reader", "source", ",", "final", "LineEndingStyle", "style", ")", "throws", "IOException", "{", "return", "writeScriptTempfile", "(", "framework", ",", "null", ...
Copy reader content to a tempfile for script execution @param framework framework @param source string content @param style style @return tempfile @throws IOException if an error occurs
[ "Copy", "reader", "content", "to", "a", "tempfile", "for", "script", "execution" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/script/ScriptfileUtils.java#L170-L178
16,124
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/execution/script/ScriptfileUtils.java
ScriptfileUtils.writeScriptTempfile
public static File writeScriptTempfile( final Framework framework, final InputStream stream, final String source, final Reader reader, final LineEndingStyle style ) throws IOException { /* * Prepare a file to save the content ...
java
public static File writeScriptTempfile( final Framework framework, final InputStream stream, final String source, final Reader reader, final LineEndingStyle style ) throws IOException { /* * Prepare a file to save the content ...
[ "public", "static", "File", "writeScriptTempfile", "(", "final", "Framework", "framework", ",", "final", "InputStream", "stream", ",", "final", "String", "source", ",", "final", "Reader", "reader", ",", "final", "LineEndingStyle", "style", ")", "throws", "IOExcept...
Copy a source stream or string content to a tempfile for script execution @param framework framework @param stream source stream @param source content @param style file line ending style to use @param reader reader @return tempfile @throws IOException if an error occurs
[ "Copy", "a", "source", "stream", "or", "string", "content", "to", "a", "tempfile", "for", "script", "execution" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/script/ScriptfileUtils.java#L194-L210
16,125
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/execution/script/ScriptfileUtils.java
ScriptfileUtils.writeScriptFile
public static void writeScriptFile( InputStream stream, String scriptString, Reader reader, LineEndingStyle style, File scriptfile ) throws IOException { try (FileWriter writer = new FileWriter(scriptfile)) { if (null != scriptStri...
java
public static void writeScriptFile( InputStream stream, String scriptString, Reader reader, LineEndingStyle style, File scriptfile ) throws IOException { try (FileWriter writer = new FileWriter(scriptfile)) { if (null != scriptStri...
[ "public", "static", "void", "writeScriptFile", "(", "InputStream", "stream", ",", "String", "scriptString", ",", "Reader", "reader", ",", "LineEndingStyle", "style", ",", "File", "scriptfile", ")", "throws", "IOException", "{", "try", "(", "FileWriter", "writer", ...
Write script content to a destination file from one of the sources @param stream stream source @param scriptString script content @param reader reader source @param style line ending style @param scriptfile destination file @throws IOException on io error
[ "Write", "script", "content", "to", "a", "destination", "file", "from", "one", "of", "the", "sources" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/script/ScriptfileUtils.java#L223-L243
16,126
rundeck/rundeck
core/src/main/java/com/dtolabs/rundeck/core/execution/script/ScriptfileUtils.java
ScriptfileUtils.setExecutePermissions
public static void setExecutePermissions(final File scriptfile) throws IOException { if (!scriptfile.setExecutable(true, true)) { System.err.println("Unable to set executable bit on temp script file, execution may fail: " + scriptfile .getAbsolutePath()); } }
java
public static void setExecutePermissions(final File scriptfile) throws IOException { if (!scriptfile.setExecutable(true, true)) { System.err.println("Unable to set executable bit on temp script file, execution may fail: " + scriptfile .getAbsolutePath()); } }
[ "public", "static", "void", "setExecutePermissions", "(", "final", "File", "scriptfile", ")", "throws", "IOException", "{", "if", "(", "!", "scriptfile", ".", "setExecutable", "(", "true", ",", "true", ")", ")", "{", "System", ".", "err", ".", "println", "...
Set the executable flag on a file if supported by the OS @param scriptfile target file @throws IOException if an error occurs
[ "Set", "the", "executable", "flag", "on", "a", "file", "if", "supported", "by", "the", "OS" ]
8070f774f55bffaa1118ff0c03aea319d40a9668
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/rundeck/core/execution/script/ScriptfileUtils.java#L287-L292
16,127
yasserg/crawler4j
crawler4j/src/main/java/edu/uci/ics/crawler4j/frontier/DocIDServer.java
DocIDServer.getDocId
public int getDocId(String url) { synchronized (mutex) { OperationStatus result = null; DatabaseEntry value = new DatabaseEntry(); try { DatabaseEntry key = new DatabaseEntry(url.getBytes()); result = docIDsDB.get(null, key, value, null); ...
java
public int getDocId(String url) { synchronized (mutex) { OperationStatus result = null; DatabaseEntry value = new DatabaseEntry(); try { DatabaseEntry key = new DatabaseEntry(url.getBytes()); result = docIDsDB.get(null, key, value, null); ...
[ "public", "int", "getDocId", "(", "String", "url", ")", "{", "synchronized", "(", "mutex", ")", "{", "OperationStatus", "result", "=", "null", ";", "DatabaseEntry", "value", "=", "new", "DatabaseEntry", "(", ")", ";", "try", "{", "DatabaseEntry", "key", "=...
Returns the docid of an already seen url. @param url the URL for which the docid is returned. @return the docid of the url if it is seen before. Otherwise -1 is returned.
[ "Returns", "the", "docid", "of", "an", "already", "seen", "url", "." ]
4fcddc86414d1831973aff94050af55c7aeff3bc
https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/frontier/DocIDServer.java#L71-L94
16,128
yasserg/crawler4j
crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/Page.java
Page.toByteArray
protected byte[] toByteArray(HttpEntity entity, int maxBytes) throws IOException { if (entity == null) { return new byte[0]; } try (InputStream is = entity.getContent()) { int size = (int) entity.getContentLength(); int readBufferLength = size; if...
java
protected byte[] toByteArray(HttpEntity entity, int maxBytes) throws IOException { if (entity == null) { return new byte[0]; } try (InputStream is = entity.getContent()) { int size = (int) entity.getContentLength(); int readBufferLength = size; if...
[ "protected", "byte", "[", "]", "toByteArray", "(", "HttpEntity", "entity", ",", "int", "maxBytes", ")", "throws", "IOException", "{", "if", "(", "entity", "==", "null", ")", "{", "return", "new", "byte", "[", "0", "]", ";", "}", "try", "(", "InputStrea...
Read contents from an entity, with a specified maximum. This is a replacement of EntityUtils.toByteArray because that function does not impose a maximum size. @param entity The entity from which to read @param maxBytes The maximum number of bytes to read @return A byte array containing maxBytes or fewer bytes read fro...
[ "Read", "contents", "from", "an", "entity", "with", "a", "specified", "maximum", ".", "This", "is", "a", "replacement", "of", "EntityUtils", ".", "toByteArray", "because", "that", "function", "does", "not", "impose", "a", "maximum", "size", "." ]
4fcddc86414d1831973aff94050af55c7aeff3bc
https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/Page.java#L120-L154
16,129
yasserg/crawler4j
crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/Page.java
Page.load
public void load(HttpEntity entity, int maxBytes) throws IOException { contentType = null; Header type = entity.getContentType(); if (type != null) { contentType = type.getValue(); } contentEncoding = null; Header encoding = entity.getContentEncoding(); ...
java
public void load(HttpEntity entity, int maxBytes) throws IOException { contentType = null; Header type = entity.getContentType(); if (type != null) { contentType = type.getValue(); } contentEncoding = null; Header encoding = entity.getContentEncoding(); ...
[ "public", "void", "load", "(", "HttpEntity", "entity", ",", "int", "maxBytes", ")", "throws", "IOException", "{", "contentType", "=", "null", ";", "Header", "type", "=", "entity", ".", "getContentType", "(", ")", ";", "if", "(", "type", "!=", "null", ")"...
Loads the content of this page from a fetched HttpEntity. @param entity HttpEntity @param maxBytes The maximum number of bytes to read @throws IOException when load fails
[ "Loads", "the", "content", "of", "this", "page", "from", "a", "fetched", "HttpEntity", "." ]
4fcddc86414d1831973aff94050af55c7aeff3bc
https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/Page.java#L163-L190
16,130
yasserg/crawler4j
crawler4j/src/main/java/edu/uci/ics/crawler4j/robotstxt/PathRule.java
PathRule.matchesRobotsPattern
public static boolean matchesRobotsPattern(String pattern, String path) { return robotsPatternToRegexp(pattern).matcher(path).matches(); }
java
public static boolean matchesRobotsPattern(String pattern, String path) { return robotsPatternToRegexp(pattern).matcher(path).matches(); }
[ "public", "static", "boolean", "matchesRobotsPattern", "(", "String", "pattern", ",", "String", "path", ")", "{", "return", "robotsPatternToRegexp", "(", "pattern", ")", ".", "matcher", "(", "path", ")", ".", "matches", "(", ")", ";", "}" ]
Check if the specified path matches a robots.txt pattern @param pattern The pattern to match @param path The path to match with the pattern @return True when the pattern matches, false if it does not
[ "Check", "if", "the", "specified", "path", "matches", "a", "robots", ".", "txt", "pattern" ]
4fcddc86414d1831973aff94050af55c7aeff3bc
https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/robotstxt/PathRule.java#L107-L109
16,131
yasserg/crawler4j
crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/CrawlConfig.java
CrawlConfig.validate
public void validate() throws Exception { if (crawlStorageFolder == null) { throw new Exception("Crawl storage folder is not set in the CrawlConfig."); } if (politenessDelay < 0) { throw new Exception("Invalid value for politeness delay: " + politenessDelay); } ...
java
public void validate() throws Exception { if (crawlStorageFolder == null) { throw new Exception("Crawl storage folder is not set in the CrawlConfig."); } if (politenessDelay < 0) { throw new Exception("Invalid value for politeness delay: " + politenessDelay); } ...
[ "public", "void", "validate", "(", ")", "throws", "Exception", "{", "if", "(", "crawlStorageFolder", "==", "null", ")", "{", "throw", "new", "Exception", "(", "\"Crawl storage folder is not set in the CrawlConfig.\"", ")", ";", "}", "if", "(", "politenessDelay", "...
Validates the configs specified by this instance. @throws Exception on Validation fail
[ "Validates", "the", "configs", "specified", "by", "this", "instance", "." ]
4fcddc86414d1831973aff94050af55c7aeff3bc
https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/CrawlConfig.java#L243-L258
16,132
yasserg/crawler4j
crawler4j/src/main/java/edu/uci/ics/crawler4j/robotstxt/RobotstxtServer.java
RobotstxtServer.allows
public boolean allows(WebURL webURL) throws IOException, InterruptedException { if (!config.isEnabled()) { return true; } try { URL url = new URL(webURL.getURL()); String host = getHost(url); String path = url.getPath(); HostDirectives...
java
public boolean allows(WebURL webURL) throws IOException, InterruptedException { if (!config.isEnabled()) { return true; } try { URL url = new URL(webURL.getURL()); String host = getHost(url); String path = url.getPath(); HostDirectives...
[ "public", "boolean", "allows", "(", "WebURL", "webURL", ")", "throws", "IOException", ",", "InterruptedException", "{", "if", "(", "!", "config", ".", "isEnabled", "(", ")", ")", "{", "return", "true", ";", "}", "try", "{", "URL", "url", "=", "new", "U...
Please note that in the case of a bad URL, TRUE will be returned @throws InterruptedException @throws IOException
[ "Please", "note", "that", "in", "the", "case", "of", "a", "bad", "URL", "TRUE", "will", "be", "returned" ]
4fcddc86414d1831973aff94050af55c7aeff3bc
https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/robotstxt/RobotstxtServer.java#L77-L104
16,133
yasserg/crawler4j
crawler4j/src/main/java/edu/uci/ics/crawler4j/robotstxt/HostDirectives.java
HostDirectives.checkAccess
public int checkAccess(String path) { timeLastAccessed = System.currentTimeMillis(); int result = UNDEFINED; String myUA = config.getUserAgentName(); boolean ignoreUADisc = config.getIgnoreUADiscrimination(); // When checking rules, the list of rules is already ordered based on ...
java
public int checkAccess(String path) { timeLastAccessed = System.currentTimeMillis(); int result = UNDEFINED; String myUA = config.getUserAgentName(); boolean ignoreUADisc = config.getIgnoreUADiscrimination(); // When checking rules, the list of rules is already ordered based on ...
[ "public", "int", "checkAccess", "(", "String", "path", ")", "{", "timeLastAccessed", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "int", "result", "=", "UNDEFINED", ";", "String", "myUA", "=", "config", ".", "getUserAgentName", "(", ")", ";", "b...
Check if any of the rules say anything about the specified path @param path The path to check @return One of ALLOWED, DISALLOWED or UNDEFINED
[ "Check", "if", "any", "of", "the", "rules", "say", "anything", "about", "the", "specified", "path" ]
4fcddc86414d1831973aff94050af55c7aeff3bc
https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/robotstxt/HostDirectives.java#L98-L137
16,134
yasserg/crawler4j
crawler4j/src/main/java/edu/uci/ics/crawler4j/url/URLCanonicalizer.java
URLCanonicalizer.createParameterMap
private static Map<String, String> createParameterMap(String queryString) { if ((queryString == null) || queryString.isEmpty()) { return null; } final String[] pairs = queryString.split("&"); final Map<String, String> params = new LinkedHashMap<>(pairs.length); for ...
java
private static Map<String, String> createParameterMap(String queryString) { if ((queryString == null) || queryString.isEmpty()) { return null; } final String[] pairs = queryString.split("&"); final Map<String, String> params = new LinkedHashMap<>(pairs.length); for ...
[ "private", "static", "Map", "<", "String", ",", "String", ">", "createParameterMap", "(", "String", "queryString", ")", "{", "if", "(", "(", "queryString", "==", "null", ")", "||", "queryString", ".", "isEmpty", "(", ")", ")", "{", "return", "null", ";",...
Takes a query string, separates the constituent name-value pairs, and stores them in a LinkedHashMap ordered by their original order. @return Null if there is no query string.
[ "Takes", "a", "query", "string", "separates", "the", "constituent", "name", "-", "value", "pairs", "and", "stores", "them", "in", "a", "LinkedHashMap", "ordered", "by", "their", "original", "order", "." ]
4fcddc86414d1831973aff94050af55c7aeff3bc
https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/url/URLCanonicalizer.java#L127-L155
16,135
yasserg/crawler4j
crawler4j/src/main/java/edu/uci/ics/crawler4j/robotstxt/UserAgentDirectives.java
UserAgentDirectives.match
public int match(String userAgent) { userAgent = userAgent.toLowerCase(); int maxLength = 0; for (String ua : userAgents) { if (ua.equals("*") || userAgent.contains(ua)) { maxLength = Math.max(maxLength, ua.length()); } } return maxLength; ...
java
public int match(String userAgent) { userAgent = userAgent.toLowerCase(); int maxLength = 0; for (String ua : userAgents) { if (ua.equals("*") || userAgent.contains(ua)) { maxLength = Math.max(maxLength, ua.length()); } } return maxLength; ...
[ "public", "int", "match", "(", "String", "userAgent", ")", "{", "userAgent", "=", "userAgent", ".", "toLowerCase", "(", ")", ";", "int", "maxLength", "=", "0", ";", "for", "(", "String", "ua", ":", "userAgents", ")", "{", "if", "(", "ua", ".", "equal...
Match the current user agent directive set with the given user agent. The returned value will be the maximum match length of any user agent. @param userAgent The user agent used by the crawler @return The maximum length of a matching user agent in this set of directives
[ "Match", "the", "current", "user", "agent", "directive", "set", "with", "the", "given", "user", "agent", ".", "The", "returned", "value", "will", "be", "the", "maximum", "match", "length", "of", "any", "user", "agent", "." ]
4fcddc86414d1831973aff94050af55c7aeff3bc
https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/robotstxt/UserAgentDirectives.java#L91-L100
16,136
yasserg/crawler4j
crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/WebCrawler.java
WebCrawler.init
public void init(int id, CrawlController crawlController) throws InstantiationException, IllegalAccessException { this.myId = id; this.pageFetcher = crawlController.getPageFetcher(); this.robotstxtServer = crawlController.getRobotstxtServer(); this.docIdServer = crawlController.g...
java
public void init(int id, CrawlController crawlController) throws InstantiationException, IllegalAccessException { this.myId = id; this.pageFetcher = crawlController.getPageFetcher(); this.robotstxtServer = crawlController.getRobotstxtServer(); this.docIdServer = crawlController.g...
[ "public", "void", "init", "(", "int", "id", ",", "CrawlController", "crawlController", ")", "throws", "InstantiationException", ",", "IllegalAccessException", "{", "this", ".", "myId", "=", "id", ";", "this", ".", "pageFetcher", "=", "crawlController", ".", "get...
Initializes the current instance of the crawler @param id the id of this crawler instance @param crawlController the controller that manages this crawling session @throws IllegalAccessException @throws InstantiationException
[ "Initializes", "the", "current", "instance", "of", "the", "crawler" ]
4fcddc86414d1831973aff94050af55c7aeff3bc
https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/WebCrawler.java#L119-L130
16,137
yasserg/crawler4j
crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/WebCrawler.java
WebCrawler.onUnhandledException
protected void onUnhandledException(WebURL webUrl, Throwable e) { if (myController.getConfig().isHaltOnError() && !(e instanceof IOException)) { throw new RuntimeException("unhandled exception", e); } else { String urlStr = (webUrl == null ? "NULL" : webUrl.getURL()); ...
java
protected void onUnhandledException(WebURL webUrl, Throwable e) { if (myController.getConfig().isHaltOnError() && !(e instanceof IOException)) { throw new RuntimeException("unhandled exception", e); } else { String urlStr = (webUrl == null ? "NULL" : webUrl.getURL()); ...
[ "protected", "void", "onUnhandledException", "(", "WebURL", "webUrl", ",", "Throwable", "e", ")", "{", "if", "(", "myController", ".", "getConfig", "(", ")", ".", "isHaltOnError", "(", ")", "&&", "!", "(", "e", "instanceof", "IOException", ")", ")", "{", ...
This function is called when a unhandled exception was encountered during fetching @param webUrl URL where a unhandled exception occured
[ "This", "function", "is", "called", "when", "a", "unhandled", "exception", "was", "encountered", "during", "fetching" ]
4fcddc86414d1831973aff94050af55c7aeff3bc
https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/WebCrawler.java#L266-L276
16,138
yasserg/crawler4j
crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/WebCrawler.java
WebCrawler.shouldVisit
public boolean shouldVisit(Page referringPage, WebURL url) { if (myController.getConfig().isRespectNoFollow()) { return !((referringPage != null && referringPage.getContentType() != null && referringPage.getContentType().contains("html") && ...
java
public boolean shouldVisit(Page referringPage, WebURL url) { if (myController.getConfig().isRespectNoFollow()) { return !((referringPage != null && referringPage.getContentType() != null && referringPage.getContentType().contains("html") && ...
[ "public", "boolean", "shouldVisit", "(", "Page", "referringPage", ",", "WebURL", "url", ")", "{", "if", "(", "myController", ".", "getConfig", "(", ")", ".", "isRespectNoFollow", "(", ")", ")", "{", "return", "!", "(", "(", "referringPage", "!=", "null", ...
Classes that extends WebCrawler should overwrite this function to tell the crawler whether the given url should be crawled or not. The following default implementation indicates that all urls should be included in the crawl except those with a nofollow flag. @param url the url which we are interested to know whether i...
[ "Classes", "that", "extends", "WebCrawler", "should", "overwrite", "this", "function", "to", "tell", "the", "crawler", "whether", "the", "given", "url", "should", "be", "crawled", "or", "not", ".", "The", "following", "default", "implementation", "indicates", "t...
4fcddc86414d1831973aff94050af55c7aeff3bc
https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/WebCrawler.java#L369-L381
16,139
yasserg/crawler4j
crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/CrawlController.java
CrawlController.start
public <T extends WebCrawler> void start(Class<T> clazz, int numberOfCrawlers) { this.start(new DefaultWebCrawlerFactory<>(clazz), numberOfCrawlers, true); }
java
public <T extends WebCrawler> void start(Class<T> clazz, int numberOfCrawlers) { this.start(new DefaultWebCrawlerFactory<>(clazz), numberOfCrawlers, true); }
[ "public", "<", "T", "extends", "WebCrawler", ">", "void", "start", "(", "Class", "<", "T", ">", "clazz", ",", "int", "numberOfCrawlers", ")", "{", "this", ".", "start", "(", "new", "DefaultWebCrawlerFactory", "<>", "(", "clazz", ")", ",", "numberOfCrawlers...
Start the crawling session and wait for it to finish. This method utilizes default crawler factory that creates new crawler using Java reflection @param clazz the class that implements the logic for crawler threads @param numberOfCrawlers the number of concurrent threads that will be contributing in this crawling sess...
[ "Start", "the", "crawling", "session", "and", "wait", "for", "it", "to", "finish", ".", "This", "method", "utilizes", "default", "crawler", "factory", "that", "creates", "new", "crawler", "using", "Java", "reflection" ]
4fcddc86414d1831973aff94050af55c7aeff3bc
https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/CrawlController.java#L208-L210
16,140
yasserg/crawler4j
crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/CrawlController.java
CrawlController.start
public <T extends WebCrawler> void start(WebCrawlerFactory<T> crawlerFactory, int numberOfCrawlers) { this.start(crawlerFactory, numberOfCrawlers, true); }
java
public <T extends WebCrawler> void start(WebCrawlerFactory<T> crawlerFactory, int numberOfCrawlers) { this.start(crawlerFactory, numberOfCrawlers, true); }
[ "public", "<", "T", "extends", "WebCrawler", ">", "void", "start", "(", "WebCrawlerFactory", "<", "T", ">", "crawlerFactory", ",", "int", "numberOfCrawlers", ")", "{", "this", ".", "start", "(", "crawlerFactory", ",", "numberOfCrawlers", ",", "true", ")", ";...
Start the crawling session and wait for it to finish. @param crawlerFactory factory to create crawlers on demand for each thread @param numberOfCrawlers the number of concurrent threads that will be contributing in this crawling session. @param <T> Your class extending WebCrawler
[ "Start", "the", "crawling", "session", "and", "wait", "for", "it", "to", "finish", "." ]
4fcddc86414d1831973aff94050af55c7aeff3bc
https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/CrawlController.java#L234-L237
16,141
yasserg/crawler4j
crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/CrawlController.java
CrawlController.startNonBlocking
public <T extends WebCrawler> void startNonBlocking(WebCrawlerFactory<T> crawlerFactory, final int numberOfCrawlers) { this.start(crawlerFactory, numberOfCrawlers, false); }
java
public <T extends WebCrawler> void startNonBlocking(WebCrawlerFactory<T> crawlerFactory, final int numberOfCrawlers) { this.start(crawlerFactory, numberOfCrawlers, false); }
[ "public", "<", "T", "extends", "WebCrawler", ">", "void", "startNonBlocking", "(", "WebCrawlerFactory", "<", "T", ">", "crawlerFactory", ",", "final", "int", "numberOfCrawlers", ")", "{", "this", ".", "start", "(", "crawlerFactory", ",", "numberOfCrawlers", ",",...
Start the crawling session and return immediately. @param crawlerFactory factory to create crawlers on demand for each thread @param numberOfCrawlers the number of concurrent threads that will be contributing in this crawling session. @param <T> Your class extending WebCrawler
[ "Start", "the", "crawling", "session", "and", "return", "immediately", "." ]
4fcddc86414d1831973aff94050af55c7aeff3bc
https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/CrawlController.java#L249-L252
16,142
yasserg/crawler4j
crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/CrawlController.java
CrawlController.startNonBlocking
public <T extends WebCrawler> void startNonBlocking(Class<T> clazz, int numberOfCrawlers) { start(new DefaultWebCrawlerFactory<>(clazz), numberOfCrawlers, false); }
java
public <T extends WebCrawler> void startNonBlocking(Class<T> clazz, int numberOfCrawlers) { start(new DefaultWebCrawlerFactory<>(clazz), numberOfCrawlers, false); }
[ "public", "<", "T", "extends", "WebCrawler", ">", "void", "startNonBlocking", "(", "Class", "<", "T", ">", "clazz", ",", "int", "numberOfCrawlers", ")", "{", "start", "(", "new", "DefaultWebCrawlerFactory", "<>", "(", "clazz", ")", ",", "numberOfCrawlers", "...
Start the crawling session and return immediately. This method utilizes default crawler factory that creates new crawler using Java reflection @param clazz the class that implements the logic for crawler threads @param numberOfCrawlers the number of concurrent threads that will be contributing in this crawling session...
[ "Start", "the", "crawling", "session", "and", "return", "immediately", ".", "This", "method", "utilizes", "default", "crawler", "factory", "that", "creates", "new", "crawler", "using", "Java", "reflection" ]
4fcddc86414d1831973aff94050af55c7aeff3bc
https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/CrawlController.java#L265-L267
16,143
yasserg/crawler4j
crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/CrawlController.java
CrawlController.waitUntilFinish
public void waitUntilFinish() { while (!finished) { synchronized (waitingLock) { if (config.isHaltOnError()) { Throwable t = getError(); if (t != null && config.isHaltOnError()) { if (t instanceof RuntimeException) { ...
java
public void waitUntilFinish() { while (!finished) { synchronized (waitingLock) { if (config.isHaltOnError()) { Throwable t = getError(); if (t != null && config.isHaltOnError()) { if (t instanceof RuntimeException) { ...
[ "public", "void", "waitUntilFinish", "(", ")", "{", "while", "(", "!", "finished", ")", "{", "synchronized", "(", "waitingLock", ")", "{", "if", "(", "config", ".", "isHaltOnError", "(", ")", ")", "{", "Throwable", "t", "=", "getError", "(", ")", ";", ...
Wait until this crawling session finishes.
[ "Wait", "until", "this", "crawling", "session", "finishes", "." ]
4fcddc86414d1831973aff94050af55c7aeff3bc
https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/CrawlController.java#L431-L456
16,144
yasserg/crawler4j
crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/CrawlController.java
CrawlController.addSeed
public void addSeed(String pageUrl, int docId) throws IOException, InterruptedException { String canonicalUrl = URLCanonicalizer.getCanonicalURL(pageUrl); if (canonicalUrl == null) { logger.error("Invalid seed URL: {}", pageUrl); } else { if (docId < 0) { ...
java
public void addSeed(String pageUrl, int docId) throws IOException, InterruptedException { String canonicalUrl = URLCanonicalizer.getCanonicalURL(pageUrl); if (canonicalUrl == null) { logger.error("Invalid seed URL: {}", pageUrl); } else { if (docId < 0) { ...
[ "public", "void", "addSeed", "(", "String", "pageUrl", ",", "int", "docId", ")", "throws", "IOException", ",", "InterruptedException", "{", "String", "canonicalUrl", "=", "URLCanonicalizer", ".", "getCanonicalURL", "(", "pageUrl", ")", ";", "if", "(", "canonical...
Adds a new seed URL. A seed URL is a URL that is fetched by the crawler to extract new URLs in it and follow them for crawling. You can also specify a specific document id to be assigned to this seed URL. This document id needs to be unique. Also, note that if you add three seeds with document ids 1,2, and 7. Then the ...
[ "Adds", "a", "new", "seed", "URL", ".", "A", "seed", "URL", "is", "a", "URL", "that", "is", "fetched", "by", "the", "crawler", "to", "extract", "new", "URLs", "in", "it", "and", "follow", "them", "for", "crawling", ".", "You", "can", "also", "specify...
4fcddc86414d1831973aff94050af55c7aeff3bc
https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/CrawlController.java#L513-L549
16,145
yasserg/crawler4j
crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/CrawlController.java
CrawlController.addSeenUrl
public void addSeenUrl(String url, int docId) throws UnsupportedEncodingException { String canonicalUrl = URLCanonicalizer.getCanonicalURL(url); if (canonicalUrl == null) { logger.error("Invalid Url: {} (can't cannonicalize it!)", url); } else { try { docI...
java
public void addSeenUrl(String url, int docId) throws UnsupportedEncodingException { String canonicalUrl = URLCanonicalizer.getCanonicalURL(url); if (canonicalUrl == null) { logger.error("Invalid Url: {} (can't cannonicalize it!)", url); } else { try { docI...
[ "public", "void", "addSeenUrl", "(", "String", "url", ",", "int", "docId", ")", "throws", "UnsupportedEncodingException", "{", "String", "canonicalUrl", "=", "URLCanonicalizer", ".", "getCanonicalURL", "(", "url", ")", ";", "if", "(", "canonicalUrl", "==", "null...
This function can called to assign a specific document id to a url. This feature is useful when you have had a previous crawl and have stored the Urls and their associated document ids and want to have a new crawl which is aware of the previously seen Urls and won't re-crawl them. Note that if you add three seen Urls ...
[ "This", "function", "can", "called", "to", "assign", "a", "specific", "document", "id", "to", "a", "url", ".", "This", "feature", "is", "useful", "when", "you", "have", "had", "a", "previous", "crawl", "and", "have", "stored", "the", "Urls", "and", "thei...
4fcddc86414d1831973aff94050af55c7aeff3bc
https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/crawler/CrawlController.java#L568-L583
16,146
yasserg/crawler4j
crawler4j/src/main/java/edu/uci/ics/crawler4j/fetcher/PageFetcher.java
PageFetcher.addNtCredentials
private void addNtCredentials(NtAuthInfo authInfo, Map<AuthScope, Credentials> credentialsMap) { logger.info("NT authentication for: {}", authInfo.getLoginTarget()); try { Credentials credentials = new NTCredentials(authInfo.getUsername(), authInfo.getPassword(), InetAddr...
java
private void addNtCredentials(NtAuthInfo authInfo, Map<AuthScope, Credentials> credentialsMap) { logger.info("NT authentication for: {}", authInfo.getLoginTarget()); try { Credentials credentials = new NTCredentials(authInfo.getUsername(), authInfo.getPassword(), InetAddr...
[ "private", "void", "addNtCredentials", "(", "NtAuthInfo", "authInfo", ",", "Map", "<", "AuthScope", ",", "Credentials", ">", "credentialsMap", ")", "{", "logger", ".", "info", "(", "\"NT authentication for: {}\"", ",", "authInfo", ".", "getLoginTarget", "(", ")", ...
Do NT auth for Microsoft AD sites.
[ "Do", "NT", "auth", "for", "Microsoft", "AD", "sites", "." ]
4fcddc86414d1831973aff94050af55c7aeff3bc
https://github.com/yasserg/crawler4j/blob/4fcddc86414d1831973aff94050af55c7aeff3bc/crawler4j/src/main/java/edu/uci/ics/crawler4j/fetcher/PageFetcher.java#L210-L220
16,147
umano/AndroidSlidingUpPanel
library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java
ViewDragHelper.create
public static ViewDragHelper create(ViewGroup forParent, Interpolator interpolator, Callback cb) { return new ViewDragHelper(forParent.getContext(), forParent, interpolator, cb); }
java
public static ViewDragHelper create(ViewGroup forParent, Interpolator interpolator, Callback cb) { return new ViewDragHelper(forParent.getContext(), forParent, interpolator, cb); }
[ "public", "static", "ViewDragHelper", "create", "(", "ViewGroup", "forParent", ",", "Interpolator", "interpolator", ",", "Callback", "cb", ")", "{", "return", "new", "ViewDragHelper", "(", "forParent", ".", "getContext", "(", ")", ",", "forParent", ",", "interpo...
Factory method to create a new ViewDragHelper with the specified interpolator. @param forParent Parent view to monitor @param interpolator interpolator for scroller @param cb Callback to provide information and receive events @return a new ViewDragHelper instance
[ "Factory", "method", "to", "create", "a", "new", "ViewDragHelper", "with", "the", "specified", "interpolator", "." ]
45a460435b07e764138a700328836cafc1ed5c42
https://github.com/umano/AndroidSlidingUpPanel/blob/45a460435b07e764138a700328836cafc1ed5c42/library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java#L359-L361
16,148
umano/AndroidSlidingUpPanel
library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java
ViewDragHelper.clampMag
private float clampMag(float value, float absMin, float absMax) { final float absValue = Math.abs(value); if (absValue < absMin) return 0; if (absValue > absMax) return value > 0 ? absMax : -absMax; return value; }
java
private float clampMag(float value, float absMin, float absMax) { final float absValue = Math.abs(value); if (absValue < absMin) return 0; if (absValue > absMax) return value > 0 ? absMax : -absMax; return value; }
[ "private", "float", "clampMag", "(", "float", "value", ",", "float", "absMin", ",", "float", "absMax", ")", "{", "final", "float", "absValue", "=", "Math", ".", "abs", "(", "value", ")", ";", "if", "(", "absValue", "<", "absMin", ")", "return", "0", ...
Clamp the magnitude of value for absMin and absMax. If the value is below the minimum, it will be clamped to zero. If the value is above the maximum, it will be clamped to the maximum. @param value Value to clamp @param absMin Absolute value of the minimum significant value to return @param absMax Absolute value of th...
[ "Clamp", "the", "magnitude", "of", "value", "for", "absMin", "and", "absMax", ".", "If", "the", "value", "is", "below", "the", "minimum", "it", "will", "be", "clamped", "to", "zero", ".", "If", "the", "value", "is", "above", "the", "maximum", "it", "wi...
45a460435b07e764138a700328836cafc1ed5c42
https://github.com/umano/AndroidSlidingUpPanel/blob/45a460435b07e764138a700328836cafc1ed5c42/library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java#L697-L702
16,149
umano/AndroidSlidingUpPanel
library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java
ViewDragHelper.tryCaptureViewForDrag
boolean tryCaptureViewForDrag(View toCapture, int pointerId) { if (toCapture == mCapturedView && mActivePointerId == pointerId) { // Already done! return true; } if (toCapture != null && mCallback.tryCaptureView(toCapture, pointerId)) { mActivePointerId = poin...
java
boolean tryCaptureViewForDrag(View toCapture, int pointerId) { if (toCapture == mCapturedView && mActivePointerId == pointerId) { // Already done! return true; } if (toCapture != null && mCallback.tryCaptureView(toCapture, pointerId)) { mActivePointerId = poin...
[ "boolean", "tryCaptureViewForDrag", "(", "View", "toCapture", ",", "int", "pointerId", ")", "{", "if", "(", "toCapture", "==", "mCapturedView", "&&", "mActivePointerId", "==", "pointerId", ")", "{", "// Already done!", "return", "true", ";", "}", "if", "(", "t...
Attempt to capture the view with the given pointer ID. The callback will be involved. This will put us into the "dragging" state. If we've already captured this view with this pointer this method will immediately return true without consulting the callback. @param toCapture View to capture @param pointerId Pointer to ...
[ "Attempt", "to", "capture", "the", "view", "with", "the", "given", "pointer", "ID", ".", "The", "callback", "will", "be", "involved", ".", "This", "will", "put", "us", "into", "the", "dragging", "state", ".", "If", "we", "ve", "already", "captured", "thi...
45a460435b07e764138a700328836cafc1ed5c42
https://github.com/umano/AndroidSlidingUpPanel/blob/45a460435b07e764138a700328836cafc1ed5c42/library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java#L927-L938
16,150
umano/AndroidSlidingUpPanel
library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java
ViewDragHelper.checkTouchSlop
private boolean checkTouchSlop(View child, float dx, float dy) { if (child == null) { return false; } final boolean checkHorizontal = mCallback.getViewHorizontalDragRange(child) > 0; final boolean checkVertical = mCallback.getViewVerticalDragRange(child) > 0; if (che...
java
private boolean checkTouchSlop(View child, float dx, float dy) { if (child == null) { return false; } final boolean checkHorizontal = mCallback.getViewHorizontalDragRange(child) > 0; final boolean checkVertical = mCallback.getViewVerticalDragRange(child) > 0; if (che...
[ "private", "boolean", "checkTouchSlop", "(", "View", "child", ",", "float", "dx", ",", "float", "dy", ")", "{", "if", "(", "child", "==", "null", ")", "{", "return", "false", ";", "}", "final", "boolean", "checkHorizontal", "=", "mCallback", ".", "getVie...
Check if we've crossed a reasonable touch slop for the given child view. If the child cannot be dragged along the horizontal or vertical axis, motion along that axis will not count toward the slop check. @param child Child to check @param dx Motion since initial position along X axis @param dy Motion since initial pos...
[ "Check", "if", "we", "ve", "crossed", "a", "reasonable", "touch", "slop", "for", "the", "given", "child", "view", ".", "If", "the", "child", "cannot", "be", "dragged", "along", "the", "horizontal", "or", "vertical", "axis", "motion", "along", "that", "axis...
45a460435b07e764138a700328836cafc1ed5c42
https://github.com/umano/AndroidSlidingUpPanel/blob/45a460435b07e764138a700328836cafc1ed5c42/library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java#L1293-L1308
16,151
umano/AndroidSlidingUpPanel
library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java
ViewDragHelper.checkTouchSlop
public boolean checkTouchSlop(int directions) { final int count = mInitialMotionX.length; for (int i = 0; i < count; i++) { if (checkTouchSlop(directions, i)) { return true; } } return false; }
java
public boolean checkTouchSlop(int directions) { final int count = mInitialMotionX.length; for (int i = 0; i < count; i++) { if (checkTouchSlop(directions, i)) { return true; } } return false; }
[ "public", "boolean", "checkTouchSlop", "(", "int", "directions", ")", "{", "final", "int", "count", "=", "mInitialMotionX", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "count", ";", "i", "++", ")", "{", "if", "(", "checkTouch...
Check if any pointer tracked in the current gesture has crossed the required slop threshold. <p>This depends on internal state populated by {@link #shouldInterceptTouchEvent(android.view.MotionEvent)} or {@link #processTouchEvent(android.view.MotionEvent)}. You should only rely on the results of this method after all ...
[ "Check", "if", "any", "pointer", "tracked", "in", "the", "current", "gesture", "has", "crossed", "the", "required", "slop", "threshold", "." ]
45a460435b07e764138a700328836cafc1ed5c42
https://github.com/umano/AndroidSlidingUpPanel/blob/45a460435b07e764138a700328836cafc1ed5c42/library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java#L1324-L1332
16,152
umano/AndroidSlidingUpPanel
library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java
ViewDragHelper.checkTouchSlop
public boolean checkTouchSlop(int directions, int pointerId) { if (!isPointerDown(pointerId)) { return false; } final boolean checkHorizontal = (directions & DIRECTION_HORIZONTAL) == DIRECTION_HORIZONTAL; final boolean checkVertical = (directions & DIRECTION_VERTICAL) == DIR...
java
public boolean checkTouchSlop(int directions, int pointerId) { if (!isPointerDown(pointerId)) { return false; } final boolean checkHorizontal = (directions & DIRECTION_HORIZONTAL) == DIRECTION_HORIZONTAL; final boolean checkVertical = (directions & DIRECTION_VERTICAL) == DIR...
[ "public", "boolean", "checkTouchSlop", "(", "int", "directions", ",", "int", "pointerId", ")", "{", "if", "(", "!", "isPointerDown", "(", "pointerId", ")", ")", "{", "return", "false", ";", "}", "final", "boolean", "checkHorizontal", "=", "(", "directions", ...
Check if the specified pointer tracked in the current gesture has crossed the required slop threshold. <p>This depends on internal state populated by {@link #shouldInterceptTouchEvent(android.view.MotionEvent)} or {@link #processTouchEvent(android.view.MotionEvent)}. You should only rely on the results of this method ...
[ "Check", "if", "the", "specified", "pointer", "tracked", "in", "the", "current", "gesture", "has", "crossed", "the", "required", "slop", "threshold", "." ]
45a460435b07e764138a700328836cafc1ed5c42
https://github.com/umano/AndroidSlidingUpPanel/blob/45a460435b07e764138a700328836cafc1ed5c42/library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java#L1349-L1368
16,153
umano/AndroidSlidingUpPanel
library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java
ViewDragHelper.isViewUnder
public boolean isViewUnder(View view, int x, int y) { if (view == null) { return false; } return x >= view.getLeft() && x < view.getRight() && y >= view.getTop() && y < view.getBottom(); }
java
public boolean isViewUnder(View view, int x, int y) { if (view == null) { return false; } return x >= view.getLeft() && x < view.getRight() && y >= view.getTop() && y < view.getBottom(); }
[ "public", "boolean", "isViewUnder", "(", "View", "view", ",", "int", "x", ",", "int", "y", ")", "{", "if", "(", "view", "==", "null", ")", "{", "return", "false", ";", "}", "return", "x", ">=", "view", ".", "getLeft", "(", ")", "&&", "x", "<", ...
Determine if the supplied view is under the given point in the parent view's coordinate system. @param view Child view of the parent to hit test @param x X position to test in the parent's coordinate system @param y Y position to test in the parent's coordinate system @return true if the supplied view is under the giv...
[ "Determine", "if", "the", "supplied", "view", "is", "under", "the", "given", "point", "in", "the", "parent", "view", "s", "coordinate", "system", "." ]
45a460435b07e764138a700328836cafc1ed5c42
https://github.com/umano/AndroidSlidingUpPanel/blob/45a460435b07e764138a700328836cafc1ed5c42/library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java#L1462-L1470
16,154
umano/AndroidSlidingUpPanel
library/src/main/java/com/sothree/slidinguppanel/ScrollableViewHelper.java
ScrollableViewHelper.getScrollableViewScrollPosition
public int getScrollableViewScrollPosition(View scrollableView, boolean isSlidingUp) { if (scrollableView == null) return 0; if (scrollableView instanceof ScrollView) { if (isSlidingUp) { return scrollableView.getScrollY(); } else { ScrollView sv =...
java
public int getScrollableViewScrollPosition(View scrollableView, boolean isSlidingUp) { if (scrollableView == null) return 0; if (scrollableView instanceof ScrollView) { if (isSlidingUp) { return scrollableView.getScrollY(); } else { ScrollView sv =...
[ "public", "int", "getScrollableViewScrollPosition", "(", "View", "scrollableView", ",", "boolean", "isSlidingUp", ")", "{", "if", "(", "scrollableView", "==", "null", ")", "return", "0", ";", "if", "(", "scrollableView", "instanceof", "ScrollView", ")", "{", "if...
Returns the current scroll position of the scrollable view. If this method returns zero or less, it means at the scrollable view is in a position such as the panel should handle scrolling. If the method returns anything above zero, then the panel will let the scrollable view handle the scrolling @param scrollableView ...
[ "Returns", "the", "current", "scroll", "position", "of", "the", "scrollable", "view", ".", "If", "this", "method", "returns", "zero", "or", "less", "it", "means", "at", "the", "scrollable", "view", "is", "in", "a", "position", "such", "as", "the", "panel",...
45a460435b07e764138a700328836cafc1ed5c42
https://github.com/umano/AndroidSlidingUpPanel/blob/45a460435b07e764138a700328836cafc1ed5c42/library/src/main/java/com/sothree/slidinguppanel/ScrollableViewHelper.java#L24-L62
16,155
umano/AndroidSlidingUpPanel
library/src/main/java/com/sothree/slidinguppanel/SlidingUpPanelLayout.java
SlidingUpPanelLayout.onFinishInflate
@Override protected void onFinishInflate() { super.onFinishInflate(); if (mDragViewResId != -1) { setDragView(findViewById(mDragViewResId)); } if (mScrollableViewResId != -1) { setScrollableView(findViewById(mScrollableViewResId)); } }
java
@Override protected void onFinishInflate() { super.onFinishInflate(); if (mDragViewResId != -1) { setDragView(findViewById(mDragViewResId)); } if (mScrollableViewResId != -1) { setScrollableView(findViewById(mScrollableViewResId)); } }
[ "@", "Override", "protected", "void", "onFinishInflate", "(", ")", "{", "super", ".", "onFinishInflate", "(", ")", ";", "if", "(", "mDragViewResId", "!=", "-", "1", ")", "{", "setDragView", "(", "findViewById", "(", "mDragViewResId", ")", ")", ";", "}", ...
Set the Drag View after the view is inflated
[ "Set", "the", "Drag", "View", "after", "the", "view", "is", "inflated" ]
45a460435b07e764138a700328836cafc1ed5c42
https://github.com/umano/AndroidSlidingUpPanel/blob/45a460435b07e764138a700328836cafc1ed5c42/library/src/main/java/com/sothree/slidinguppanel/SlidingUpPanelLayout.java#L353-L362
16,156
umano/AndroidSlidingUpPanel
library/src/main/java/com/sothree/slidinguppanel/SlidingUpPanelLayout.java
SlidingUpPanelLayout.setPanelHeight
public void setPanelHeight(int val) { if (getPanelHeight() == val) { return; } mPanelHeight = val; if (!mFirstLayout) { requestLayout(); } if (getPanelState() == PanelState.COLLAPSED) { smoothToBottom(); invalidate(); ...
java
public void setPanelHeight(int val) { if (getPanelHeight() == val) { return; } mPanelHeight = val; if (!mFirstLayout) { requestLayout(); } if (getPanelState() == PanelState.COLLAPSED) { smoothToBottom(); invalidate(); ...
[ "public", "void", "setPanelHeight", "(", "int", "val", ")", "{", "if", "(", "getPanelHeight", "(", ")", "==", "val", ")", "{", "return", ";", "}", "mPanelHeight", "=", "val", ";", "if", "(", "!", "mFirstLayout", ")", "{", "requestLayout", "(", ")", "...
Set the collapsed panel height in pixels @param val A height in pixels
[ "Set", "the", "collapsed", "panel", "height", "in", "pixels" ]
45a460435b07e764138a700328836cafc1ed5c42
https://github.com/umano/AndroidSlidingUpPanel/blob/45a460435b07e764138a700328836cafc1ed5c42/library/src/main/java/com/sothree/slidinguppanel/SlidingUpPanelLayout.java#L410-L425
16,157
umano/AndroidSlidingUpPanel
library/src/main/java/com/sothree/slidinguppanel/SlidingUpPanelLayout.java
SlidingUpPanelLayout.setPanelState
public void setPanelState(PanelState state) { // Abort any running animation, to allow state change if(mDragHelper.getViewDragState() == ViewDragHelper.STATE_SETTLING){ Log.d(TAG, "View is settling. Aborting animation."); mDragHelper.abort(); } if (state == null...
java
public void setPanelState(PanelState state) { // Abort any running animation, to allow state change if(mDragHelper.getViewDragState() == ViewDragHelper.STATE_SETTLING){ Log.d(TAG, "View is settling. Aborting animation."); mDragHelper.abort(); } if (state == null...
[ "public", "void", "setPanelState", "(", "PanelState", "state", ")", "{", "// Abort any running animation, to allow state change", "if", "(", "mDragHelper", ".", "getViewDragState", "(", ")", "==", "ViewDragHelper", ".", "STATE_SETTLING", ")", "{", "Log", ".", "d", "...
Change panel state to the given state with @param state - new panel state
[ "Change", "panel", "state", "to", "the", "given", "state", "with" ]
45a460435b07e764138a700328836cafc1ed5c42
https://github.com/umano/AndroidSlidingUpPanel/blob/45a460435b07e764138a700328836cafc1ed5c42/library/src/main/java/com/sothree/slidinguppanel/SlidingUpPanelLayout.java#L1099-L1138
16,158
dreamhead/moco
moco-core/src/main/java/com/github/dreamhead/moco/matcher/XmlRequestMatcher.java
XmlRequestMatcher.trimNode
private void trimNode(final Node node) { NodeList children = node.getChildNodes(); for (int i = children.getLength() - 1; i >= 0; i--) { trimChild(node, children.item(i)); } }
java
private void trimNode(final Node node) { NodeList children = node.getChildNodes(); for (int i = children.getLength() - 1; i >= 0; i--) { trimChild(node, children.item(i)); } }
[ "private", "void", "trimNode", "(", "final", "Node", "node", ")", "{", "NodeList", "children", "=", "node", ".", "getChildNodes", "(", ")", ";", "for", "(", "int", "i", "=", "children", ".", "getLength", "(", ")", "-", "1", ";", "i", ">=", "0", ";"...
Whitespace will be kept by DOM parser.
[ "Whitespace", "will", "be", "kept", "by", "DOM", "parser", "." ]
83b0fbb9c505e327de6720cff55e7b18078f2aa9
https://github.com/dreamhead/moco/blob/83b0fbb9c505e327de6720cff55e7b18078f2aa9/moco-core/src/main/java/com/github/dreamhead/moco/matcher/XmlRequestMatcher.java#L93-L98
16,159
liyiorg/weixin-popular
src/main/java/weixin/popular/util/StreamUtils.java
StreamUtils.copy
public static int copy(InputStream in, OutputStream out) throws IOException { int byteCount = 0; byte[] buffer = new byte[BUFFER_SIZE]; int bytesRead = -1; while ((bytesRead = in.read(buffer)) != -1) { out.write(buffer, 0, bytesRead); byteCount += bytesRead; } out.flush(); return byteCount;...
java
public static int copy(InputStream in, OutputStream out) throws IOException { int byteCount = 0; byte[] buffer = new byte[BUFFER_SIZE]; int bytesRead = -1; while ((bytesRead = in.read(buffer)) != -1) { out.write(buffer, 0, bytesRead); byteCount += bytesRead; } out.flush(); return byteCount;...
[ "public", "static", "int", "copy", "(", "InputStream", "in", ",", "OutputStream", "out", ")", "throws", "IOException", "{", "int", "byteCount", "=", "0", ";", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "BUFFER_SIZE", "]", ";", "int", "bytesRead...
Copy the contents of the given InputStream to the given OutputStream. Leaves both streams open when done. @param in the InputStream to copy from @param out the OutputStream to copy to @return the number of bytes copied @throws IOException in case of I/O errors
[ "Copy", "the", "contents", "of", "the", "given", "InputStream", "to", "the", "given", "OutputStream", ".", "Leaves", "both", "streams", "open", "when", "done", "." ]
c64255292d41463bdb671938feaabf42a335d82c
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/util/StreamUtils.java#L83-L93
16,160
liyiorg/weixin-popular
src/main/java/weixin/popular/util/XMLConverUtil.java
XMLConverUtil.convertToXML
public static String convertToXML(Object object) { try { if (!JAXB_CONTEXT_MAP.containsKey(object.getClass())) { JAXB_CONTEXT_MAP.put(object.getClass(), JAXBContext.newInstance(object.getClass())); } Marshaller marshaller = JAXB_CONTEXT_MAP.get(object.getClass()).createMarshaller(); marshaller.s...
java
public static String convertToXML(Object object) { try { if (!JAXB_CONTEXT_MAP.containsKey(object.getClass())) { JAXB_CONTEXT_MAP.put(object.getClass(), JAXBContext.newInstance(object.getClass())); } Marshaller marshaller = JAXB_CONTEXT_MAP.get(object.getClass()).createMarshaller(); marshaller.s...
[ "public", "static", "String", "convertToXML", "(", "Object", "object", ")", "{", "try", "{", "if", "(", "!", "JAXB_CONTEXT_MAP", ".", "containsKey", "(", "object", ".", "getClass", "(", ")", ")", ")", "{", "JAXB_CONTEXT_MAP", ".", "put", "(", "object", "...
Object to XML @param object object @return xml
[ "Object", "to", "XML" ]
c64255292d41463bdb671938feaabf42a335d82c
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/util/XMLConverUtil.java#L141-L161
16,161
Netflix/concurrency-limits
concurrency-limits-grpc/src/main/java/com/netflix/concurrency/limits/grpc/server/GrpcServerLimiterBuilder.java
GrpcServerLimiterBuilder.partitionByHeader
public GrpcServerLimiterBuilder partitionByHeader(Metadata.Key<String> header) { return partitionResolver(context -> context.getHeaders().get(header)); }
java
public GrpcServerLimiterBuilder partitionByHeader(Metadata.Key<String> header) { return partitionResolver(context -> context.getHeaders().get(header)); }
[ "public", "GrpcServerLimiterBuilder", "partitionByHeader", "(", "Metadata", ".", "Key", "<", "String", ">", "header", ")", "{", "return", "partitionResolver", "(", "context", "->", "context", ".", "getHeaders", "(", ")", ".", "get", "(", "header", ")", ")", ...
Partition the limit by a request header. @return Chainable builder
[ "Partition", "the", "limit", "by", "a", "request", "header", "." ]
5ae2be4fea9848af6f63c7b5632af30c494e7373
https://github.com/Netflix/concurrency-limits/blob/5ae2be4fea9848af6f63c7b5632af30c494e7373/concurrency-limits-grpc/src/main/java/com/netflix/concurrency/limits/grpc/server/GrpcServerLimiterBuilder.java#L37-L39
16,162
Netflix/concurrency-limits
concurrency-limits-grpc/src/main/java/com/netflix/concurrency/limits/grpc/server/GrpcServerLimiterBuilder.java
GrpcServerLimiterBuilder.partitionByAttribute
public GrpcServerLimiterBuilder partitionByAttribute(Attributes.Key<String> attribute) { return partitionResolver(context -> context.getCall().getAttributes().get(attribute)); }
java
public GrpcServerLimiterBuilder partitionByAttribute(Attributes.Key<String> attribute) { return partitionResolver(context -> context.getCall().getAttributes().get(attribute)); }
[ "public", "GrpcServerLimiterBuilder", "partitionByAttribute", "(", "Attributes", ".", "Key", "<", "String", ">", "attribute", ")", "{", "return", "partitionResolver", "(", "context", "->", "context", ".", "getCall", "(", ")", ".", "getAttributes", "(", ")", ".",...
Partition the limit by a request attribute. @return Chainable builder
[ "Partition", "the", "limit", "by", "a", "request", "attribute", "." ]
5ae2be4fea9848af6f63c7b5632af30c494e7373
https://github.com/Netflix/concurrency-limits/blob/5ae2be4fea9848af6f63c7b5632af30c494e7373/concurrency-limits-grpc/src/main/java/com/netflix/concurrency/limits/grpc/server/GrpcServerLimiterBuilder.java#L45-L47
16,163
Netflix/concurrency-limits
concurrency-limits-servlet/src/main/java/com/netflix/concurrency/limits/servlet/ServletLimiterBuilder.java
ServletLimiterBuilder.partitionByHeader
public ServletLimiterBuilder partitionByHeader(String name) { return partitionResolver(request -> Optional.ofNullable(request.getHeader(name)).orElse(null)); }
java
public ServletLimiterBuilder partitionByHeader(String name) { return partitionResolver(request -> Optional.ofNullable(request.getHeader(name)).orElse(null)); }
[ "public", "ServletLimiterBuilder", "partitionByHeader", "(", "String", "name", ")", "{", "return", "partitionResolver", "(", "request", "->", "Optional", ".", "ofNullable", "(", "request", ".", "getHeader", "(", "name", ")", ")", ".", "orElse", "(", "null", ")...
Partition the limit by header @return Chainable builder
[ "Partition", "the", "limit", "by", "header" ]
5ae2be4fea9848af6f63c7b5632af30c494e7373
https://github.com/Netflix/concurrency-limits/blob/5ae2be4fea9848af6f63c7b5632af30c494e7373/concurrency-limits-servlet/src/main/java/com/netflix/concurrency/limits/servlet/ServletLimiterBuilder.java#L36-L38
16,164
Netflix/concurrency-limits
concurrency-limits-servlet/src/main/java/com/netflix/concurrency/limits/servlet/ServletLimiterBuilder.java
ServletLimiterBuilder.partitionByAttribute
public ServletLimiterBuilder partitionByAttribute(String name) { return partitionResolver(request -> Optional.ofNullable(request.getAttribute(name)).map(Object::toString).orElse(null)); }
java
public ServletLimiterBuilder partitionByAttribute(String name) { return partitionResolver(request -> Optional.ofNullable(request.getAttribute(name)).map(Object::toString).orElse(null)); }
[ "public", "ServletLimiterBuilder", "partitionByAttribute", "(", "String", "name", ")", "{", "return", "partitionResolver", "(", "request", "->", "Optional", ".", "ofNullable", "(", "request", ".", "getAttribute", "(", "name", ")", ")", ".", "map", "(", "Object",...
Partition the limit by request attribute @return Chainable builder
[ "Partition", "the", "limit", "by", "request", "attribute" ]
5ae2be4fea9848af6f63c7b5632af30c494e7373
https://github.com/Netflix/concurrency-limits/blob/5ae2be4fea9848af6f63c7b5632af30c494e7373/concurrency-limits-servlet/src/main/java/com/netflix/concurrency/limits/servlet/ServletLimiterBuilder.java#L54-L56
16,165
Netflix/concurrency-limits
concurrency-limits-servlet/src/main/java/com/netflix/concurrency/limits/servlet/ServletLimiterBuilder.java
ServletLimiterBuilder.partitionByParameter
public ServletLimiterBuilder partitionByParameter(String name) { return partitionResolver(request -> Optional.ofNullable(request.getParameter(name)).orElse(null)); }
java
public ServletLimiterBuilder partitionByParameter(String name) { return partitionResolver(request -> Optional.ofNullable(request.getParameter(name)).orElse(null)); }
[ "public", "ServletLimiterBuilder", "partitionByParameter", "(", "String", "name", ")", "{", "return", "partitionResolver", "(", "request", "->", "Optional", ".", "ofNullable", "(", "request", ".", "getParameter", "(", "name", ")", ")", ".", "orElse", "(", "null"...
Partition the limit by request parameter @return Chainable builder
[ "Partition", "the", "limit", "by", "request", "parameter" ]
5ae2be4fea9848af6f63c7b5632af30c494e7373
https://github.com/Netflix/concurrency-limits/blob/5ae2be4fea9848af6f63c7b5632af30c494e7373/concurrency-limits-servlet/src/main/java/com/netflix/concurrency/limits/servlet/ServletLimiterBuilder.java#L62-L64
16,166
Netflix/concurrency-limits
concurrency-limits-core/src/main/java/com/netflix/concurrency/limits/limiter/BlockingLimiter.java
BlockingLimiter.wrap
public static <ContextT> BlockingLimiter<ContextT> wrap(Limiter<ContextT> delegate, Duration timeout) { Preconditions.checkArgument(timeout.compareTo(MAX_TIMEOUT) < 0, "Timeout cannot be greater than " + MAX_TIMEOUT); return new BlockingLimiter<>(delegate, timeout); }
java
public static <ContextT> BlockingLimiter<ContextT> wrap(Limiter<ContextT> delegate, Duration timeout) { Preconditions.checkArgument(timeout.compareTo(MAX_TIMEOUT) < 0, "Timeout cannot be greater than " + MAX_TIMEOUT); return new BlockingLimiter<>(delegate, timeout); }
[ "public", "static", "<", "ContextT", ">", "BlockingLimiter", "<", "ContextT", ">", "wrap", "(", "Limiter", "<", "ContextT", ">", "delegate", ",", "Duration", "timeout", ")", "{", "Preconditions", ".", "checkArgument", "(", "timeout", ".", "compareTo", "(", "...
Wrap a limiter such that acquire will block up to a provided timeout if the limit was reached instead of return an empty listener immediately @param delegate Non-blocking limiter to wrap @param timeout Max amount of time to wait for the wait for the limit to be released. Cannot exceed {@link BlockingLimiter#MAX_TIMEO...
[ "Wrap", "a", "limiter", "such", "that", "acquire", "will", "block", "up", "to", "a", "provided", "timeout", "if", "the", "limit", "was", "reached", "instead", "of", "return", "an", "empty", "listener", "immediately" ]
5ae2be4fea9848af6f63c7b5632af30c494e7373
https://github.com/Netflix/concurrency-limits/blob/5ae2be4fea9848af6f63c7b5632af30c494e7373/concurrency-limits-core/src/main/java/com/netflix/concurrency/limits/limiter/BlockingLimiter.java#L53-L56
16,167
SonarSource/sonarqube
server/sonar-server-common/src/main/java/org/sonar/server/qualitygate/QualityGateFinder.java
QualityGateFinder.getQualityGate
public Optional<QualityGateData> getQualityGate(DbSession dbSession, OrganizationDto organization, ComponentDto component) { Optional<QualityGateData> res = dbClient.projectQgateAssociationDao().selectQGateIdByComponentId(dbSession, component.getId()) .map(qualityGateId -> dbClient.qualityGateDao().selectById...
java
public Optional<QualityGateData> getQualityGate(DbSession dbSession, OrganizationDto organization, ComponentDto component) { Optional<QualityGateData> res = dbClient.projectQgateAssociationDao().selectQGateIdByComponentId(dbSession, component.getId()) .map(qualityGateId -> dbClient.qualityGateDao().selectById...
[ "public", "Optional", "<", "QualityGateData", ">", "getQualityGate", "(", "DbSession", "dbSession", ",", "OrganizationDto", "organization", ",", "ComponentDto", "component", ")", "{", "Optional", "<", "QualityGateData", ">", "res", "=", "dbClient", ".", "projectQgat...
Return effective quality gate of a project. It will first try to get the quality gate explicitly defined on a project, if none it will try to return default quality gate of the organization
[ "Return", "effective", "quality", "gate", "of", "a", "project", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/qualitygate/QualityGateFinder.java#L48-L57
16,168
SonarSource/sonarqube
server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java
ServerPluginRepository.unloadIncompatiblePlugins
private void unloadIncompatiblePlugins() { // loop as long as the previous loop ignored some plugins. That allows to support dependencies // on many levels, for example D extends C, which extends B, which requires A. If A is not installed, // then B, C and D must be ignored. That's not possible to achieve t...
java
private void unloadIncompatiblePlugins() { // loop as long as the previous loop ignored some plugins. That allows to support dependencies // on many levels, for example D extends C, which extends B, which requires A. If A is not installed, // then B, C and D must be ignored. That's not possible to achieve t...
[ "private", "void", "unloadIncompatiblePlugins", "(", ")", "{", "// loop as long as the previous loop ignored some plugins. That allows to support dependencies", "// on many levels, for example D extends C, which extends B, which requires A. If A is not installed,", "// then B, C and D must be ignore...
Removes the plugins that are not compatible with current environment.
[ "Removes", "the", "plugins", "that", "are", "not", "compatible", "with", "current", "environment", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java#L204-L221
16,169
SonarSource/sonarqube
server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java
ServerPluginRepository.uninstall
public void uninstall(String pluginKey, File uninstallDir) { Set<String> uninstallKeys = new HashSet<>(); uninstallKeys.add(pluginKey); appendDependentPluginKeys(pluginKey, uninstallKeys); for (String uninstallKey : uninstallKeys) { PluginInfo info = getPluginInfo(uninstallKey); try { ...
java
public void uninstall(String pluginKey, File uninstallDir) { Set<String> uninstallKeys = new HashSet<>(); uninstallKeys.add(pluginKey); appendDependentPluginKeys(pluginKey, uninstallKeys); for (String uninstallKey : uninstallKeys) { PluginInfo info = getPluginInfo(uninstallKey); try { ...
[ "public", "void", "uninstall", "(", "String", "pluginKey", ",", "File", "uninstallDir", ")", "{", "Set", "<", "String", ">", "uninstallKeys", "=", "new", "HashSet", "<>", "(", ")", ";", "uninstallKeys", ".", "add", "(", "pluginKey", ")", ";", "appendDepend...
Uninstall a plugin and its dependents
[ "Uninstall", "a", "plugin", "and", "its", "dependents" ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java#L277-L299
16,170
SonarSource/sonarqube
server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java
ServerPluginRepository.appendDependentPluginKeys
private void appendDependentPluginKeys(String pluginKey, Set<String> appendTo) { for (PluginInfo otherPlugin : getPluginInfos()) { if (!otherPlugin.getKey().equals(pluginKey)) { for (PluginInfo.RequiredPlugin requirement : otherPlugin.getRequiredPlugins()) { if (requirement.getKey().equals(p...
java
private void appendDependentPluginKeys(String pluginKey, Set<String> appendTo) { for (PluginInfo otherPlugin : getPluginInfos()) { if (!otherPlugin.getKey().equals(pluginKey)) { for (PluginInfo.RequiredPlugin requirement : otherPlugin.getRequiredPlugins()) { if (requirement.getKey().equals(p...
[ "private", "void", "appendDependentPluginKeys", "(", "String", "pluginKey", ",", "Set", "<", "String", ">", "appendTo", ")", "{", "for", "(", "PluginInfo", "otherPlugin", ":", "getPluginInfos", "(", ")", ")", "{", "if", "(", "!", "otherPlugin", ".", "getKey"...
Appends dependent plugins, only the ones that still exist in the plugins folder.
[ "Appends", "dependent", "plugins", "only", "the", "ones", "that", "still", "exist", "in", "the", "plugins", "folder", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/plugins/ServerPluginRepository.java#L314-L325
16,171
SonarSource/sonarqube
server/sonar-db-dao/src/main/java/org/sonar/db/KeyLongValue.java
KeyLongValue.toMap
public static Map<String, Long> toMap(List<KeyLongValue> values) { return values .stream() .collect(uniqueIndex(KeyLongValue::getKey, KeyLongValue::getValue, values.size())); }
java
public static Map<String, Long> toMap(List<KeyLongValue> values) { return values .stream() .collect(uniqueIndex(KeyLongValue::getKey, KeyLongValue::getValue, values.size())); }
[ "public", "static", "Map", "<", "String", ",", "Long", ">", "toMap", "(", "List", "<", "KeyLongValue", ">", "values", ")", "{", "return", "values", ".", "stream", "(", ")", ".", "collect", "(", "uniqueIndex", "(", "KeyLongValue", "::", "getKey", ",", "...
This method does not keep order of list.
[ "This", "method", "does", "not", "keep", "order", "of", "list", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/KeyLongValue.java#L52-L56
16,172
SonarSource/sonarqube
server/sonar-server/src/main/java/org/sonar/server/component/ComponentUpdater.java
ComponentUpdater.removeDuplicatedProjects
private void removeDuplicatedProjects(DbSession session, String projectKey) { List<ComponentDto> duplicated = dbClient.componentDao().selectComponentsHavingSameKeyOrderedById(session, projectKey); for (int i = 1; i < duplicated.size(); i++) { dbClient.componentDao().delete(session, duplicated.get(i).getId...
java
private void removeDuplicatedProjects(DbSession session, String projectKey) { List<ComponentDto> duplicated = dbClient.componentDao().selectComponentsHavingSameKeyOrderedById(session, projectKey); for (int i = 1; i < duplicated.size(); i++) { dbClient.componentDao().delete(session, duplicated.get(i).getId...
[ "private", "void", "removeDuplicatedProjects", "(", "DbSession", "session", ",", "String", "projectKey", ")", "{", "List", "<", "ComponentDto", ">", "duplicated", "=", "dbClient", ".", "componentDao", "(", ")", ".", "selectComponentsHavingSameKeyOrderedById", "(", "...
On MySQL, as PROJECTS.KEE is not unique, if the same project is provisioned multiple times, then it will be duplicated in the database. So, after creating a project, we commit, and we search in the db if their are some duplications and we remove them. SONAR-6332
[ "On", "MySQL", "as", "PROJECTS", ".", "KEE", "is", "not", "unique", "if", "the", "same", "project", "is", "provisioned", "multiple", "times", "then", "it", "will", "be", "duplicated", "in", "the", "database", ".", "So", "after", "creating", "a", "project",...
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/component/ComponentUpdater.java#L150-L155
16,173
SonarSource/sonarqube
sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/DuplicationsCollector.java
DuplicationsCollector.endOfGroup
@Override public void endOfGroup() { ClonePart origin = null; CloneGroup.Builder builder = CloneGroup.builder().setLength(length); List<ClonePart> parts = new ArrayList<>(count); for (int[] b : blockNumbers) { Block firstBlock = text.getBlock(b[0]); Block lastBlock = text.getBlock(b[1]);...
java
@Override public void endOfGroup() { ClonePart origin = null; CloneGroup.Builder builder = CloneGroup.builder().setLength(length); List<ClonePart> parts = new ArrayList<>(count); for (int[] b : blockNumbers) { Block firstBlock = text.getBlock(b[0]); Block lastBlock = text.getBlock(b[1]);...
[ "@", "Override", "public", "void", "endOfGroup", "(", ")", "{", "ClonePart", "origin", "=", "null", ";", "CloneGroup", ".", "Builder", "builder", "=", "CloneGroup", ".", "builder", "(", ")", ".", "setLength", "(", "length", ")", ";", "List", "<", "CloneP...
Constructs CloneGroup and saves it.
[ "Constructs", "CloneGroup", "and", "saves", "it", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-duplications/src/main/java/org/sonar/duplications/detector/suffixtree/DuplicationsCollector.java#L79-L116
16,174
SonarSource/sonarqube
server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueTrackingDelegator.java
IssueTrackingDelegator.isFirstAnalysisSecondaryLongLivingBranch
private boolean isFirstAnalysisSecondaryLongLivingBranch() { if (analysisMetadataHolder.isFirstAnalysis()) { Branch branch = analysisMetadataHolder.getBranch(); return !branch.isMain() && branch.getType() == BranchType.LONG; } return false; }
java
private boolean isFirstAnalysisSecondaryLongLivingBranch() { if (analysisMetadataHolder.isFirstAnalysis()) { Branch branch = analysisMetadataHolder.getBranch(); return !branch.isMain() && branch.getType() == BranchType.LONG; } return false; }
[ "private", "boolean", "isFirstAnalysisSecondaryLongLivingBranch", "(", ")", "{", "if", "(", "analysisMetadataHolder", ".", "isFirstAnalysis", "(", ")", ")", "{", "Branch", "branch", "=", "analysisMetadataHolder", ".", "getBranch", "(", ")", ";", "return", "!", "br...
Special case where we want to do the issue tracking with the merge branch, and copy matched issue to the current branch.
[ "Special", "case", "where", "we", "want", "to", "do", "the", "issue", "tracking", "with", "the", "merge", "branch", "and", "copy", "matched", "issue", "to", "the", "current", "branch", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-ce-task-projectanalysis/src/main/java/org/sonar/ce/task/projectanalysis/issue/IssueTrackingDelegator.java#L64-L70
16,175
SonarSource/sonarqube
server/sonar-db-dao/src/main/java/org/sonar/db/measure/custom/CustomMeasureDao.java
CustomMeasureDao.selectByMetricKeyAndTextValue
public List<CustomMeasureDto> selectByMetricKeyAndTextValue(DbSession session, String metricKey, String textValue) { return mapper(session).selectByMetricKeyAndTextValue(metricKey, textValue); }
java
public List<CustomMeasureDto> selectByMetricKeyAndTextValue(DbSession session, String metricKey, String textValue) { return mapper(session).selectByMetricKeyAndTextValue(metricKey, textValue); }
[ "public", "List", "<", "CustomMeasureDto", ">", "selectByMetricKeyAndTextValue", "(", "DbSession", "session", ",", "String", "metricKey", ",", "String", "textValue", ")", "{", "return", "mapper", "(", "session", ")", ".", "selectByMetricKeyAndTextValue", "(", "metri...
Used by Views plugin
[ "Used", "by", "Views", "plugin" ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/measure/custom/CustomMeasureDao.java#L70-L72
16,176
SonarSource/sonarqube
server/sonar-server-common/src/main/java/org/sonar/server/platform/ServerImpl.java
ServerImpl.getId
@Override @CheckForNull public String getId() { return config.get(CoreProperties.SERVER_ID).orElse(null); }
java
@Override @CheckForNull public String getId() { return config.get(CoreProperties.SERVER_ID).orElse(null); }
[ "@", "Override", "@", "CheckForNull", "public", "String", "getId", "(", ")", "{", "return", "config", ".", "get", "(", "CoreProperties", ".", "SERVER_ID", ")", ".", "orElse", "(", "null", ")", ";", "}" ]
Can be null when server is waiting for migration
[ "Can", "be", "null", "when", "server", "is", "waiting", "for", "migration" ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/platform/ServerImpl.java#L53-L57
16,177
SonarSource/sonarqube
server/sonar-process/src/main/java/org/sonar/process/NetworkUtilsImpl.java
NetworkUtilsImpl.getNextAvailablePort
@VisibleForTesting static int getNextAvailablePort(InetAddress address, PortAllocator portAllocator) { for (int i = 0; i < PORT_MAX_TRIES; i++) { int port = portAllocator.getAvailable(address); if (isValidPort(port)) { PORTS_ALREADY_ALLOCATED.add(port); return port; } } t...
java
@VisibleForTesting static int getNextAvailablePort(InetAddress address, PortAllocator portAllocator) { for (int i = 0; i < PORT_MAX_TRIES; i++) { int port = portAllocator.getAvailable(address); if (isValidPort(port)) { PORTS_ALREADY_ALLOCATED.add(port); return port; } } t...
[ "@", "VisibleForTesting", "static", "int", "getNextAvailablePort", "(", "InetAddress", "address", ",", "PortAllocator", "portAllocator", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "PORT_MAX_TRIES", ";", "i", "++", ")", "{", "int", "port", "...
Warning - the allocated ports are kept in memory and are never clean-up. Besides the memory consumption, that means that ports already allocated are never freed. As a consequence no more than ~64512 calls to this method are allowed.
[ "Warning", "-", "the", "allocated", "ports", "are", "kept", "in", "memory", "and", "are", "never", "clean", "-", "up", ".", "Besides", "the", "memory", "consumption", "that", "means", "that", "ports", "already", "allocated", "are", "never", "freed", ".", "...
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-process/src/main/java/org/sonar/process/NetworkUtilsImpl.java#L56-L66
16,178
SonarSource/sonarqube
server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleIndexer.java
RuleIndexer.commitAndIndex
public void commitAndIndex(DbSession dbSession, int ruleId, OrganizationDto organization) { List<EsQueueDto> items = asList(createQueueDtoForRule(ruleId), createQueueDtoForRuleExtension(ruleId, organization)); dbClient.esQueueDao().insert(dbSession, items); dbSession.commit(); postCommit(dbSession, item...
java
public void commitAndIndex(DbSession dbSession, int ruleId, OrganizationDto organization) { List<EsQueueDto> items = asList(createQueueDtoForRule(ruleId), createQueueDtoForRuleExtension(ruleId, organization)); dbClient.esQueueDao().insert(dbSession, items); dbSession.commit(); postCommit(dbSession, item...
[ "public", "void", "commitAndIndex", "(", "DbSession", "dbSession", ",", "int", "ruleId", ",", "OrganizationDto", "organization", ")", "{", "List", "<", "EsQueueDto", ">", "items", "=", "asList", "(", "createQueueDtoForRule", "(", "ruleId", ")", ",", "createQueue...
Commit a change on a rule and its extension on the given organization
[ "Commit", "a", "change", "on", "a", "rule", "and", "its", "extension", "on", "the", "given", "organization" ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/rule/index/RuleIndexer.java#L105-L110
16,179
SonarSource/sonarqube
server/sonar-server-common/src/main/java/org/sonar/server/es/SearchOptions.java
SearchOptions.setLimit
public SearchOptions setLimit(int limit) { if (limit <= 0) { this.limit = MAX_LIMIT; } else { this.limit = Math.min(limit, MAX_LIMIT); } return this; }
java
public SearchOptions setLimit(int limit) { if (limit <= 0) { this.limit = MAX_LIMIT; } else { this.limit = Math.min(limit, MAX_LIMIT); } return this; }
[ "public", "SearchOptions", "setLimit", "(", "int", "limit", ")", "{", "if", "(", "limit", "<=", "0", ")", "{", "this", ".", "limit", "=", "MAX_LIMIT", ";", "}", "else", "{", "this", ".", "limit", "=", "Math", ".", "min", "(", "limit", ",", "MAX_LIM...
Sets the limit on the number of results to return.
[ "Sets", "the", "limit", "on", "the", "number", "of", "results", "to", "return", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/es/SearchOptions.java#L92-L99
16,180
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/utils/ZipUtils.java
ZipUtils.unzip
public static File unzip(File zip, File toDir) throws IOException { return unzip(zip, toDir, (Predicate<ZipEntry>) ze -> true); }
java
public static File unzip(File zip, File toDir) throws IOException { return unzip(zip, toDir, (Predicate<ZipEntry>) ze -> true); }
[ "public", "static", "File", "unzip", "(", "File", "zip", ",", "File", "toDir", ")", "throws", "IOException", "{", "return", "unzip", "(", "zip", ",", "toDir", ",", "(", "Predicate", "<", "ZipEntry", ">", ")", "ze", "->", "true", ")", ";", "}" ]
Unzip a file into a directory. The directory is created if it does not exist. @return the target directory
[ "Unzip", "a", "file", "into", "a", "directory", ".", "The", "directory", "is", "created", "if", "it", "does", "not", "exist", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/utils/ZipUtils.java#L57-L59
16,181
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/utils/WildcardPattern.java
WildcardPattern.match
public boolean match(String value) { value = StringUtils.removeStart(value, "/"); value = StringUtils.removeEnd(value, "/"); return pattern.matcher(value).matches(); }
java
public boolean match(String value) { value = StringUtils.removeStart(value, "/"); value = StringUtils.removeEnd(value, "/"); return pattern.matcher(value).matches(); }
[ "public", "boolean", "match", "(", "String", "value", ")", "{", "value", "=", "StringUtils", ".", "removeStart", "(", "value", ",", "\"/\"", ")", ";", "value", "=", "StringUtils", ".", "removeEnd", "(", "value", ",", "\"/\"", ")", ";", "return", "pattern...
Returns true if specified value matches this pattern.
[ "Returns", "true", "if", "specified", "value", "matches", "this", "pattern", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/utils/WildcardPattern.java#L142-L146
16,182
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/utils/WildcardPattern.java
WildcardPattern.match
public static boolean match(WildcardPattern[] patterns, String value) { for (WildcardPattern pattern : patterns) { if (pattern.match(value)) { return true; } } return false; }
java
public static boolean match(WildcardPattern[] patterns, String value) { for (WildcardPattern pattern : patterns) { if (pattern.match(value)) { return true; } } return false; }
[ "public", "static", "boolean", "match", "(", "WildcardPattern", "[", "]", "patterns", ",", "String", "value", ")", "{", "for", "(", "WildcardPattern", "pattern", ":", "patterns", ")", "{", "if", "(", "pattern", ".", "match", "(", "value", ")", ")", "{", ...
Returns true if specified value matches one of specified patterns. @since 2.4
[ "Returns", "true", "if", "specified", "value", "matches", "one", "of", "specified", "patterns", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/utils/WildcardPattern.java#L153-L160
16,183
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/utils/UriReader.java
UriReader.readString
public String readString(URI uri, Charset charset) { return searchForSupportedProcessor(uri).readString(uri, charset); }
java
public String readString(URI uri, Charset charset) { return searchForSupportedProcessor(uri).readString(uri, charset); }
[ "public", "String", "readString", "(", "URI", "uri", ",", "Charset", "charset", ")", "{", "return", "searchForSupportedProcessor", "(", "uri", ")", ".", "readString", "(", "uri", ",", "charset", ")", ";", "}" ]
Reads all characters from uri, using the given character set. It throws an unchecked exception if an error occurs.
[ "Reads", "all", "characters", "from", "uri", "using", "the", "given", "character", "set", ".", "It", "throws", "an", "unchecked", "exception", "if", "an", "error", "occurs", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/utils/UriReader.java#L69-L71
16,184
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/utils/UriReader.java
UriReader.description
public String description(URI uri) { SchemeProcessor reader = searchForSupportedProcessor(uri); return reader.description(uri); }
java
public String description(URI uri) { SchemeProcessor reader = searchForSupportedProcessor(uri); return reader.description(uri); }
[ "public", "String", "description", "(", "URI", "uri", ")", "{", "SchemeProcessor", "reader", "=", "searchForSupportedProcessor", "(", "uri", ")", ";", "return", "reader", ".", "description", "(", "uri", ")", ";", "}" ]
Returns a detailed description of the given uri. For example HTTP URIs are completed with the configured HTTP proxy.
[ "Returns", "a", "detailed", "description", "of", "the", "given", "uri", ".", "For", "example", "HTTP", "URIs", "are", "completed", "with", "the", "configured", "HTTP", "proxy", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/utils/UriReader.java#L77-L81
16,185
SonarSource/sonarqube
server/sonar-server-common/src/main/java/org/sonar/server/qualitygate/ConditionEvaluator.java
ConditionEvaluator.evaluateCondition
private static Optional<EvaluatedCondition> evaluateCondition(Condition condition, ValueType type, Comparable value) { Comparable threshold = getThreshold(condition, type); if (reachThreshold(value, threshold, condition)) { return of(new EvaluatedCondition(condition, EvaluationStatus.ERROR, value.toStrin...
java
private static Optional<EvaluatedCondition> evaluateCondition(Condition condition, ValueType type, Comparable value) { Comparable threshold = getThreshold(condition, type); if (reachThreshold(value, threshold, condition)) { return of(new EvaluatedCondition(condition, EvaluationStatus.ERROR, value.toStrin...
[ "private", "static", "Optional", "<", "EvaluatedCondition", ">", "evaluateCondition", "(", "Condition", "condition", ",", "ValueType", "type", ",", "Comparable", "value", ")", "{", "Comparable", "threshold", "=", "getThreshold", "(", "condition", ",", "type", ")",...
Evaluates the error condition. Returns empty if threshold or measure value is not defined.
[ "Evaluates", "the", "error", "condition", ".", "Returns", "empty", "if", "threshold", "or", "measure", "value", "is", "not", "defined", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server-common/src/main/java/org/sonar/server/qualitygate/ConditionEvaluator.java#L69-L76
16,186
SonarSource/sonarqube
server/sonar-db-dao/src/main/java/org/sonar/db/DbSessionImpl.java
DbSessionImpl.selectCursor
@Override public <T> Cursor<T> selectCursor(String statement) { return session.selectCursor(statement); }
java
@Override public <T> Cursor<T> selectCursor(String statement) { return session.selectCursor(statement); }
[ "@", "Override", "public", "<", "T", ">", "Cursor", "<", "T", ">", "selectCursor", "(", "String", "statement", ")", "{", "return", "session", ".", "selectCursor", "(", "statement", ")", ";", "}" ]
We only care about the the commit section. The rest is simply passed to its parent.
[ "We", "only", "care", "about", "the", "the", "commit", "section", ".", "The", "rest", "is", "simply", "passed", "to", "its", "parent", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/DbSessionImpl.java#L55-L58
16,187
SonarSource/sonarqube
server/sonar-main/src/main/java/org/sonar/application/config/CommandLineParser.java
CommandLineParser.parseArguments
public static Properties parseArguments(String[] args) { Properties props = argumentsToProperties(args); // complete with only the system properties that start with "sonar." for (Map.Entry<Object, Object> entry : System.getProperties().entrySet()) { String key = entry.getKey().toString(); if (k...
java
public static Properties parseArguments(String[] args) { Properties props = argumentsToProperties(args); // complete with only the system properties that start with "sonar." for (Map.Entry<Object, Object> entry : System.getProperties().entrySet()) { String key = entry.getKey().toString(); if (k...
[ "public", "static", "Properties", "parseArguments", "(", "String", "[", "]", "args", ")", "{", "Properties", "props", "=", "argumentsToProperties", "(", "args", ")", ";", "// complete with only the system properties that start with \"sonar.\"", "for", "(", "Map", ".", ...
Build properties from command-line arguments and system properties
[ "Build", "properties", "from", "command", "-", "line", "arguments", "and", "system", "properties" ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-main/src/main/java/org/sonar/application/config/CommandLineParser.java#L36-L47
16,188
SonarSource/sonarqube
server/sonar-main/src/main/java/org/sonar/application/config/CommandLineParser.java
CommandLineParser.argumentsToProperties
static Properties argumentsToProperties(String[] args) { Properties props = new Properties(); for (String arg : args) { if (!arg.startsWith("-D") || !arg.contains("=")) { throw new IllegalArgumentException(String.format( "Command-line argument must start with -D, for example -Dsonar.jdbc...
java
static Properties argumentsToProperties(String[] args) { Properties props = new Properties(); for (String arg : args) { if (!arg.startsWith("-D") || !arg.contains("=")) { throw new IllegalArgumentException(String.format( "Command-line argument must start with -D, for example -Dsonar.jdbc...
[ "static", "Properties", "argumentsToProperties", "(", "String", "[", "]", "args", ")", "{", "Properties", "props", "=", "new", "Properties", "(", ")", ";", "for", "(", "String", "arg", ":", "args", ")", "{", "if", "(", "!", "arg", ".", "startsWith", "(...
Convert strings "-Dkey=value" to properties
[ "Convert", "strings", "-", "Dkey", "=", "value", "to", "properties" ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-main/src/main/java/org/sonar/application/config/CommandLineParser.java#L52-L64
16,189
SonarSource/sonarqube
sonar-duplications/src/main/java/org/sonar/duplications/index/PackedMemoryCloneIndex.java
PackedMemoryCloneIndex.ensureCapacity
private void ensureCapacity() { if (size < resourceIds.length) { return; } int newCapacity = (resourceIds.length * 3) / 2 + 1; // Increase size of resourceIds String[] oldResourceIds = resourceIds; resourceIds = new String[newCapacity]; System.arraycopy(oldResourceIds, 0, resourceIds, ...
java
private void ensureCapacity() { if (size < resourceIds.length) { return; } int newCapacity = (resourceIds.length * 3) / 2 + 1; // Increase size of resourceIds String[] oldResourceIds = resourceIds; resourceIds = new String[newCapacity]; System.arraycopy(oldResourceIds, 0, resourceIds, ...
[ "private", "void", "ensureCapacity", "(", ")", "{", "if", "(", "size", "<", "resourceIds", ".", "length", ")", "{", "return", ";", "}", "int", "newCapacity", "=", "(", "resourceIds", ".", "length", "*", "3", ")", "/", "2", "+", "1", ";", "// Increase...
Increases the capacity, if necessary.
[ "Increases", "the", "capacity", "if", "necessary", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-duplications/src/main/java/org/sonar/duplications/index/PackedMemoryCloneIndex.java#L275-L291
16,190
SonarSource/sonarqube
sonar-duplications/src/main/java/org/sonar/duplications/index/PackedMemoryCloneIndex.java
PackedMemoryCloneIndex.ensureSorted
private void ensureSorted() { if (sorted) { return; } ensureCapacity(); DataUtils.sort(byBlockHash); for (int i = 0; i < size; i++) { resourceIdsIndex[i] = i; } DataUtils.sort(byResourceId); sorted = true; }
java
private void ensureSorted() { if (sorted) { return; } ensureCapacity(); DataUtils.sort(byBlockHash); for (int i = 0; i < size; i++) { resourceIdsIndex[i] = i; } DataUtils.sort(byResourceId); sorted = true; }
[ "private", "void", "ensureSorted", "(", ")", "{", "if", "(", "sorted", ")", "{", "return", ";", "}", "ensureCapacity", "(", ")", ";", "DataUtils", ".", "sort", "(", "byBlockHash", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ...
Performs sorting, if necessary.
[ "Performs", "sorting", "if", "necessary", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-duplications/src/main/java/org/sonar/duplications/index/PackedMemoryCloneIndex.java#L296-L310
16,191
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceType.java
ResourceType.getBooleanProperty
public boolean getBooleanProperty(String key) { requireNonNull(key); String value = properties.get(key); return value != null && Boolean.parseBoolean(value); }
java
public boolean getBooleanProperty(String key) { requireNonNull(key); String value = properties.get(key); return value != null && Boolean.parseBoolean(value); }
[ "public", "boolean", "getBooleanProperty", "(", "String", "key", ")", "{", "requireNonNull", "(", "key", ")", ";", "String", "value", "=", "properties", ".", "get", "(", "key", ")", ";", "return", "value", "!=", "null", "&&", "Boolean", ".", "parseBoolean"...
Returns the value of the property for this resource type. @return the Boolean value of the property. If the property hasn't been set, False is returned. @since 3.0
[ "Returns", "the", "value", "of", "the", "property", "for", "this", "resource", "type", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceType.java#L117-L121
16,192
SonarSource/sonarqube
sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/AbstractSensorOptimizer.java
AbstractSensorOptimizer.shouldExecute
public boolean shouldExecute(DefaultSensorDescriptor descriptor) { if (!fsCondition(descriptor)) { LOG.debug("'{}' skipped because there is no related file in current project", descriptor.name()); return false; } if (!activeRulesCondition(descriptor)) { LOG.debug("'{}' skipped because ther...
java
public boolean shouldExecute(DefaultSensorDescriptor descriptor) { if (!fsCondition(descriptor)) { LOG.debug("'{}' skipped because there is no related file in current project", descriptor.name()); return false; } if (!activeRulesCondition(descriptor)) { LOG.debug("'{}' skipped because ther...
[ "public", "boolean", "shouldExecute", "(", "DefaultSensorDescriptor", "descriptor", ")", "{", "if", "(", "!", "fsCondition", "(", "descriptor", ")", ")", "{", "LOG", ".", "debug", "(", "\"'{}' skipped because there is no related file in current project\"", ",", "descrip...
Decide if the given Sensor should be executed.
[ "Decide", "if", "the", "given", "Sensor", "should", "be", "executed", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-scanner-engine/src/main/java/org/sonar/scanner/sensor/AbstractSensorOptimizer.java#L47-L61
16,193
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java
Metric.merge
public Metric<G> merge(final Metric with) { this.description = with.description; this.domain = with.domain; this.enabled = with.enabled; this.qualitative = with.qualitative; this.worstValue = with.worstValue; this.bestValue = with.bestValue; this.optimizedBestValue = with.optimizedBestValue;...
java
public Metric<G> merge(final Metric with) { this.description = with.description; this.domain = with.domain; this.enabled = with.enabled; this.qualitative = with.qualitative; this.worstValue = with.worstValue; this.bestValue = with.bestValue; this.optimizedBestValue = with.optimizedBestValue;...
[ "public", "Metric", "<", "G", ">", "merge", "(", "final", "Metric", "with", ")", "{", "this", ".", "description", "=", "with", ".", "description", ";", "this", ".", "domain", "=", "with", ".", "domain", ";", "this", ".", "enabled", "=", "with", ".", ...
Merge with fields from other metric. All fields are copied, except the id. @return this
[ "Merge", "with", "fields", "from", "other", "metric", ".", "All", "fields", "are", "copied", "except", "the", "id", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/measures/Metric.java#L533-L549
16,194
SonarSource/sonarqube
server/sonar-db-dao/src/main/java/org/sonar/db/component/SnapshotDao.java
SnapshotDao.selectFinishedByComponentUuidsAndFromDates
public List<SnapshotDto> selectFinishedByComponentUuidsAndFromDates(DbSession dbSession, List<String> componentUuids, List<Long> fromDates) { checkArgument(componentUuids.size() == fromDates.size(), "The number of components (%s) and from dates (%s) must be the same.", String.valueOf(componentUuids.size()), ...
java
public List<SnapshotDto> selectFinishedByComponentUuidsAndFromDates(DbSession dbSession, List<String> componentUuids, List<Long> fromDates) { checkArgument(componentUuids.size() == fromDates.size(), "The number of components (%s) and from dates (%s) must be the same.", String.valueOf(componentUuids.size()), ...
[ "public", "List", "<", "SnapshotDto", ">", "selectFinishedByComponentUuidsAndFromDates", "(", "DbSession", "dbSession", ",", "List", "<", "String", ">", "componentUuids", ",", "List", "<", "Long", ">", "fromDates", ")", "{", "checkArgument", "(", "componentUuids", ...
Returned finished analysis from a list of projects and dates. "Finished" analysis means that the status in the CE_ACTIVITY table is SUCCESS => the goal is to be sure that the CE task is completely finished. Note that branches analysis of projects are also returned.
[ "Returned", "finished", "analysis", "from", "a", "list", "of", "projects", "and", "dates", ".", "Finished", "analysis", "means", "that", "the", "status", "in", "the", "CE_ACTIVITY", "table", "is", "SUCCESS", "=", ">", "the", "goal", "is", "to", "be", "sure...
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-dao/src/main/java/org/sonar/db/component/SnapshotDao.java#L98-L107
16,195
SonarSource/sonarqube
sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java
DefaultI18n.formatDateTime
@Override public String formatDateTime(Locale locale, Date date) { return DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.SHORT, locale).format(date); }
java
@Override public String formatDateTime(Locale locale, Date date) { return DateFormat.getDateTimeInstance(DateFormat.DEFAULT, DateFormat.SHORT, locale).format(date); }
[ "@", "Override", "public", "String", "formatDateTime", "(", "Locale", "locale", ",", "Date", "date", ")", "{", "return", "DateFormat", ".", "getDateTimeInstance", "(", "DateFormat", ".", "DEFAULT", ",", "DateFormat", ".", "SHORT", ",", "locale", ")", ".", "f...
Format date for the given locale. JVM timezone is used.
[ "Format", "date", "for", "the", "given", "locale", ".", "JVM", "timezone", "is", "used", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java#L166-L169
16,196
SonarSource/sonarqube
sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java
DefaultI18n.messageFromFile
String messageFromFile(Locale locale, String filename, String relatedProperty) { String result = null; String bundleBase = propertyToBundles.get(relatedProperty); if (bundleBase == null) { // this property has no translation return null; } String filePath = bundleBase.replace('.', '/');...
java
String messageFromFile(Locale locale, String filename, String relatedProperty) { String result = null; String bundleBase = propertyToBundles.get(relatedProperty); if (bundleBase == null) { // this property has no translation return null; } String filePath = bundleBase.replace('.', '/');...
[ "String", "messageFromFile", "(", "Locale", "locale", ",", "String", "filename", ",", "String", "relatedProperty", ")", "{", "String", "result", "=", "null", ";", "String", "bundleBase", "=", "propertyToBundles", ".", "get", "(", "relatedProperty", ")", ";", "...
Only the given locale is searched. Contrary to java.util.ResourceBundle, no strategy for locating the bundle is implemented in this method.
[ "Only", "the", "given", "locale", "is", "searched", ".", "Contrary", "to", "java", ".", "util", ".", "ResourceBundle", "no", "strategy", "for", "locating", "the", "bundle", "is", "implemented", "in", "this", "method", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java#L193-L211
16,197
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/RangeDistributionBuilder.java
RangeDistributionBuilder.add
public RangeDistributionBuilder add(Number value, int count) { if (greaterOrEqualsThan(value, bottomLimits[0])) { addValue(value, count); isEmpty = false; } return this; }
java
public RangeDistributionBuilder add(Number value, int count) { if (greaterOrEqualsThan(value, bottomLimits[0])) { addValue(value, count); isEmpty = false; } return this; }
[ "public", "RangeDistributionBuilder", "add", "(", "Number", "value", ",", "int", "count", ")", "{", "if", "(", "greaterOrEqualsThan", "(", "value", ",", "bottomLimits", "[", "0", "]", ")", ")", "{", "addValue", "(", "value", ",", "count", ")", ";", "isEm...
Increments an entry @param value the value to use to pick the entry to increment @param count the number by which to increment
[ "Increments", "an", "entry" ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/ce/measure/RangeDistributionBuilder.java#L77-L83
16,198
SonarSource/sonarqube
server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/GroupWsRef.java
GroupWsRef.fromId
static GroupWsRef fromId(int id) { checkArgument(id > -1, "Group id must be positive: %s", id); return new GroupWsRef(id, null, null); }
java
static GroupWsRef fromId(int id) { checkArgument(id > -1, "Group id must be positive: %s", id); return new GroupWsRef(id, null, null); }
[ "static", "GroupWsRef", "fromId", "(", "int", "id", ")", "{", "checkArgument", "(", "id", ">", "-", "1", ",", "\"Group id must be positive: %s\"", ",", "id", ")", ";", "return", "new", "GroupWsRef", "(", "id", ",", "null", ",", "null", ")", ";", "}" ]
Creates a reference to a group by its id. Virtual groups "Anyone" can't be returned as they can't be referenced by an id.
[ "Creates", "a", "reference", "to", "a", "group", "by", "its", "id", ".", "Virtual", "groups", "Anyone", "can", "t", "be", "returned", "as", "they", "can", "t", "be", "referenced", "by", "an", "id", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/usergroups/ws/GroupWsRef.java#L98-L101
16,199
SonarSource/sonarqube
sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerWsClient.java
ScannerWsClient.createErrorMessage
public static String createErrorMessage(HttpException exception) { String json = tryParseAsJsonError(exception.content()); if (json != null) { return json; } String msg = "HTTP code " + exception.code(); if (isHtml(exception.content())) { return msg; } return msg + ": " + Strin...
java
public static String createErrorMessage(HttpException exception) { String json = tryParseAsJsonError(exception.content()); if (json != null) { return json; } String msg = "HTTP code " + exception.code(); if (isHtml(exception.content())) { return msg; } return msg + ": " + Strin...
[ "public", "static", "String", "createErrorMessage", "(", "HttpException", "exception", ")", "{", "String", "json", "=", "tryParseAsJsonError", "(", "exception", ".", "content", "(", ")", ")", ";", "if", "(", "json", "!=", "null", ")", "{", "return", "json", ...
Tries to form a short and relevant error message from the exception, to be displayed in the console.
[ "Tries", "to", "form", "a", "short", "and", "relevant", "error", "message", "from", "the", "exception", "to", "be", "displayed", "in", "the", "console", "." ]
2fffa4c2f79ae3714844d7742796e82822b6a98a
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/ScannerWsClient.java#L121-L133