repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
218
func_name
stringlengths
5
140
whole_func_string
stringlengths
79
3.99k
language
stringclasses
1 value
func_code_string
stringlengths
79
3.99k
func_code_tokens
listlengths
20
624
func_documentation_string
stringlengths
61
1.96k
func_documentation_tokens
listlengths
1
478
split_name
stringclasses
1 value
func_code_url
stringlengths
107
339
looly/hutool
hutool-core/src/main/java/cn/hutool/core/text/StrSpliter.java
StrSpliter.splitTrim
public static List<String> splitTrim(String str, char separator, boolean ignoreEmpty){ return split(str, separator, 0, true, ignoreEmpty); }
java
public static List<String> splitTrim(String str, char separator, boolean ignoreEmpty){ return split(str, separator, 0, true, ignoreEmpty); }
[ "public", "static", "List", "<", "String", ">", "splitTrim", "(", "String", "str", ",", "char", "separator", ",", "boolean", "ignoreEmpty", ")", "{", "return", "split", "(", "str", ",", "separator", ",", "0", ",", "true", ",", "ignoreEmpty", ")", ";", ...
切分字符串 @param str 被切分的字符串 @param separator 分隔符字符 @param ignoreEmpty 是否忽略空串 @return 切分后的集合 @since 3.2.1
[ "切分字符串" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/text/StrSpliter.java#L76-L78
aleksandr-m/gitflow-maven-plugin
src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java
AbstractGitFlowMojo.gitSetConfig
private void gitSetConfig(final String name, String value) throws MojoFailureException, CommandLineException { if (value == null || value.isEmpty()) { value = "\"\""; } // ignore error exit codes executeGitCommandExitCode("config", name, value); }
java
private void gitSetConfig(final String name, String value) throws MojoFailureException, CommandLineException { if (value == null || value.isEmpty()) { value = "\"\""; } // ignore error exit codes executeGitCommandExitCode("config", name, value); }
[ "private", "void", "gitSetConfig", "(", "final", "String", "name", ",", "String", "value", ")", "throws", "MojoFailureException", ",", "CommandLineException", "{", "if", "(", "value", "==", "null", "||", "value", ".", "isEmpty", "(", ")", ")", "{", "value", ...
Executes git config command. @param name Option name. @param value Option value. @throws MojoFailureException @throws CommandLineException
[ "Executes", "git", "config", "command", "." ]
train
https://github.com/aleksandr-m/gitflow-maven-plugin/blob/d7be13c653d885c1cb1d8cd0337fa9db985c381e/src/main/java/com/amashchenko/maven/plugin/gitflow/AbstractGitFlowMojo.java#L416-L424
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ParameterBuilder.java
ParameterBuilder.searchConfigurationFiles
public void searchConfigurationFiles(final String wildcard, final String extension) { // Store parameters this.configurationFileWildcard = wildcard; this.configurationFileExtension = extension; // Search and analyze all properties files available readPropertiesFiles(); }
java
public void searchConfigurationFiles(final String wildcard, final String extension) { // Store parameters this.configurationFileWildcard = wildcard; this.configurationFileExtension = extension; // Search and analyze all properties files available readPropertiesFiles(); }
[ "public", "void", "searchConfigurationFiles", "(", "final", "String", "wildcard", ",", "final", "String", "extension", ")", "{", "// Store parameters\r", "this", ".", "configurationFileWildcard", "=", "wildcard", ";", "this", ".", "configurationFileExtension", "=", "e...
Search configuration files according to the parameters provided. @param wildcard the regex wildcard (must not be null) @param extension the file extension without the first dot (ie: properties) (must not be null)
[ "Search", "configuration", "files", "according", "to", "the", "parameters", "provided", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/parameter/ParameterBuilder.java#L79-L87
lordcodes/SnackbarBuilder
snackbarbuilder/src/main/java/com/github/andrewlord1990/snackbarbuilder/SnackbarWrapper.java
SnackbarWrapper.appendMessage
@NonNull @SuppressWarnings("WeakerAccess") public SnackbarWrapper appendMessage(@NonNull CharSequence message, @ColorInt int color) { Spannable spannable = new SpannableString(message); spannable.setSpan(new ForegroundColorSpan(color), 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); messageView.append(spannable); return this; }
java
@NonNull @SuppressWarnings("WeakerAccess") public SnackbarWrapper appendMessage(@NonNull CharSequence message, @ColorInt int color) { Spannable spannable = new SpannableString(message); spannable.setSpan(new ForegroundColorSpan(color), 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); messageView.append(spannable); return this; }
[ "@", "NonNull", "@", "SuppressWarnings", "(", "\"WeakerAccess\"", ")", "public", "SnackbarWrapper", "appendMessage", "(", "@", "NonNull", "CharSequence", "message", ",", "@", "ColorInt", "int", "color", ")", "{", "Spannable", "spannable", "=", "new", "SpannableStr...
Append text in the specified color to the Snackbar. @param message The text to append. @param color The color to apply to the text. @return This instance.
[ "Append", "text", "in", "the", "specified", "color", "to", "the", "Snackbar", "." ]
train
https://github.com/lordcodes/SnackbarBuilder/blob/a104a753c78ed66940c19d295e141a521cf81d73/snackbarbuilder/src/main/java/com/github/andrewlord1990/snackbarbuilder/SnackbarWrapper.java#L392-L400
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
LambdaToMethod.setVarargsIfNeeded
private void setVarargsIfNeeded(JCTree tree, Type varargsElement) { if (varargsElement != null) { switch (tree.getTag()) { case APPLY: ((JCMethodInvocation)tree).varargsElement = varargsElement; break; case NEWCLASS: ((JCNewClass)tree).varargsElement = varargsElement; break; default: throw new AssertionError(); } } }
java
private void setVarargsIfNeeded(JCTree tree, Type varargsElement) { if (varargsElement != null) { switch (tree.getTag()) { case APPLY: ((JCMethodInvocation)tree).varargsElement = varargsElement; break; case NEWCLASS: ((JCNewClass)tree).varargsElement = varargsElement; break; default: throw new AssertionError(); } } }
[ "private", "void", "setVarargsIfNeeded", "(", "JCTree", "tree", ",", "Type", "varargsElement", ")", "{", "if", "(", "varargsElement", "!=", "null", ")", "{", "switch", "(", "tree", ".", "getTag", "(", ")", ")", "{", "case", "APPLY", ":", "(", "(", "JCM...
Set varargsElement field on a given tree (must be either a new class tree or a method call tree)
[ "Set", "varargsElement", "field", "on", "a", "given", "tree", "(", "must", "be", "either", "a", "new", "class", "tree", "or", "a", "method", "call", "tree", ")" ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java#L749-L757
Jasig/uPortal
uPortal-security/uPortal-security-mvc/src/main/java/org/apereo/portal/security/filter/CorsFilter.java
CorsFilter.getInitParameter
private String getInitParameter(String name, String defaultValue) { String value = getInitParameter(name); if (value != null) { return value; } return defaultValue; }
java
private String getInitParameter(String name, String defaultValue) { String value = getInitParameter(name); if (value != null) { return value; } return defaultValue; }
[ "private", "String", "getInitParameter", "(", "String", "name", ",", "String", "defaultValue", ")", "{", "String", "value", "=", "getInitParameter", "(", "name", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "return", "value", ";", "}", "return", ...
This method returns the parameter's value if it exists, or defaultValue if not. @param name The parameter's name @param defaultValue The default value to return if the parameter does not exist @return The parameter's value or the default value if the parameter does not exist
[ "This", "method", "returns", "the", "parameter", "s", "value", "if", "it", "exists", "or", "defaultValue", "if", "not", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-security/uPortal-security-mvc/src/main/java/org/apereo/portal/security/filter/CorsFilter.java#L228-L236
carewebframework/carewebframework-core
org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/CipherUtil.java
CipherUtil.getKeyStore
public static KeyStore getKeyStore(String keystoreLocation, String keystoreType) throws NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException { KeyStore keystore = KeyStore.getInstance(keystoreType); InputStream is = CipherUtil.class.getResourceAsStream(keystoreLocation); if (is == null) { is = new FileInputStream(keystoreLocation); } keystore.load(is, null); return keystore; }
java
public static KeyStore getKeyStore(String keystoreLocation, String keystoreType) throws NoSuchAlgorithmException, CertificateException, IOException, KeyStoreException { KeyStore keystore = KeyStore.getInstance(keystoreType); InputStream is = CipherUtil.class.getResourceAsStream(keystoreLocation); if (is == null) { is = new FileInputStream(keystoreLocation); } keystore.load(is, null); return keystore; }
[ "public", "static", "KeyStore", "getKeyStore", "(", "String", "keystoreLocation", ",", "String", "keystoreType", ")", "throws", "NoSuchAlgorithmException", ",", "CertificateException", ",", "IOException", ",", "KeyStoreException", "{", "KeyStore", "keystore", "=", "KeyS...
Returns a key store instance of the specified type from the specified resource. @param keystoreLocation Path to key store location. @param keystoreType Key store type. @return A key store instance. @throws NoSuchAlgorithmException If algorithm not supported. @throws CertificateException If certificate invalid. @throws IOException If IO exception. @throws KeyStoreException If key store invalid.
[ "Returns", "a", "key", "store", "instance", "of", "the", "specified", "type", "from", "the", "specified", "resource", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.api-parent/org.carewebframework.api.core/src/main/java/org/carewebframework/api/security/CipherUtil.java#L71-L83
soi-toolkit/soi-toolkit-mule
tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/model/ModelFactory.java
ModelFactory.newModel
public static IModel newModel(String groupId, String artifactId, String version, String service, MuleVersionEnum muleVersion, TransportEnum inboundTransport, TransportEnum outboundTransport, TransformerEnum transformerType) { return doCreateNewModel(groupId, artifactId, version, service, muleVersion, null, null, inboundTransport, outboundTransport, transformerType, null, null); }
java
public static IModel newModel(String groupId, String artifactId, String version, String service, MuleVersionEnum muleVersion, TransportEnum inboundTransport, TransportEnum outboundTransport, TransformerEnum transformerType) { return doCreateNewModel(groupId, artifactId, version, service, muleVersion, null, null, inboundTransport, outboundTransport, transformerType, null, null); }
[ "public", "static", "IModel", "newModel", "(", "String", "groupId", ",", "String", "artifactId", ",", "String", "version", ",", "String", "service", ",", "MuleVersionEnum", "muleVersion", ",", "TransportEnum", "inboundTransport", ",", "TransportEnum", "outboundTranspo...
Constructor-method to use when services with inbound and outbound services @param groupId @param artifactId @param version @param service @return the new model instance
[ "Constructor", "-", "method", "to", "use", "when", "services", "with", "inbound", "and", "outbound", "services" ]
train
https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/tools/soitoolkit-generator/soitoolkit-generator/src/main/java/org/soitoolkit/tools/generator/model/ModelFactory.java#L95-L97
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/BaseTable.java
BaseTable.doSetHandle
public boolean doSetHandle(Object bookmark, int iHandleType) throws DBException { switch (iHandleType) { case DBConstants.DATA_SOURCE_HANDLE: m_dataSource = bookmark; return true; // Success case DBConstants.OBJECT_ID_HANDLE: m_objectID = bookmark; // Override this to make it work return true; // Success case DBConstants.OBJECT_SOURCE_HANDLE: case DBConstants.FULL_OBJECT_HANDLE: // Override to handle this case. return true; // Success? case DBConstants.BOOKMARK_HANDLE: default: this.getRecord().getKeyArea(DBConstants.MAIN_KEY_AREA).reverseBookmark(bookmark, DBConstants.FILE_KEY_AREA); String strCurrentOrder = this.getRecord().getKeyArea().getKeyName(); this.getRecord().setKeyArea(DBConstants.MAIN_KEY_AREA); m_bIsOpen = false; boolean bSuccess = this.doSeek("="); m_bIsOpen = true; this.getRecord().setKeyArea(strCurrentOrder); return bSuccess; } }
java
public boolean doSetHandle(Object bookmark, int iHandleType) throws DBException { switch (iHandleType) { case DBConstants.DATA_SOURCE_HANDLE: m_dataSource = bookmark; return true; // Success case DBConstants.OBJECT_ID_HANDLE: m_objectID = bookmark; // Override this to make it work return true; // Success case DBConstants.OBJECT_SOURCE_HANDLE: case DBConstants.FULL_OBJECT_HANDLE: // Override to handle this case. return true; // Success? case DBConstants.BOOKMARK_HANDLE: default: this.getRecord().getKeyArea(DBConstants.MAIN_KEY_AREA).reverseBookmark(bookmark, DBConstants.FILE_KEY_AREA); String strCurrentOrder = this.getRecord().getKeyArea().getKeyName(); this.getRecord().setKeyArea(DBConstants.MAIN_KEY_AREA); m_bIsOpen = false; boolean bSuccess = this.doSeek("="); m_bIsOpen = true; this.getRecord().setKeyArea(strCurrentOrder); return bSuccess; } }
[ "public", "boolean", "doSetHandle", "(", "Object", "bookmark", ",", "int", "iHandleType", ")", "throws", "DBException", "{", "switch", "(", "iHandleType", ")", "{", "case", "DBConstants", ".", "DATA_SOURCE_HANDLE", ":", "m_dataSource", "=", "bookmark", ";", "ret...
Reposition to this record using this bookmark. @param bookmark The handle to use to position the record. @param iHandleType The type of handle (DATA_SOURCE/OBJECT_ID,OBJECT_SOURCE,BOOKMARK). @return - true - record found/false - record not found @exception FILE_NOT_OPEN. @exception DBException File exception.
[ "Reposition", "to", "this", "record", "using", "this", "bookmark", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/BaseTable.java#L988-L1016
finmath/finmath-lib
src/main/java/net/finmath/functions/LinearAlgebra.java
LinearAlgebra.getFactorMatrixUsingCommonsMath
private static double[][] getFactorMatrixUsingCommonsMath(double[][] correlationMatrix, int numberOfFactors) { /* * Factor reduction */ // Create an eigen vector decomposition of the correlation matrix double[] eigenValues; double[][] eigenVectorMatrix; if(isEigenvalueDecompositionViaSVD) { SingularValueDecomposition svd = new SingularValueDecomposition(new Array2DRowRealMatrix(correlationMatrix)); eigenValues = svd.getSingularValues(); eigenVectorMatrix = svd.getV().getData(); } else { EigenDecomposition eigenDecomp = new EigenDecomposition(new Array2DRowRealMatrix(correlationMatrix, false)); eigenValues = eigenDecomp.getRealEigenvalues(); eigenVectorMatrix = eigenDecomp.getV().getData(); } class EigenValueIndex implements Comparable<EigenValueIndex> { private int index; private Double value; EigenValueIndex(int index, double value) { this.index = index; this.value = value; } @Override public int compareTo(EigenValueIndex o) { return o.value.compareTo(value); } } List<EigenValueIndex> eigenValueIndices = new ArrayList<>(); for(int i=0; i<eigenValues.length; i++) { eigenValueIndices.add(i,new EigenValueIndex(i,eigenValues[i])); } Collections.sort(eigenValueIndices); // Extract factors corresponding to the largest eigenvalues double[][] factorMatrix = new double[eigenValues.length][numberOfFactors]; for (int factor = 0; factor < numberOfFactors; factor++) { int eigenVectorIndex = eigenValueIndices.get(factor).index; double eigenValue = eigenValues[eigenVectorIndex]; double signChange = eigenVectorMatrix[0][eigenVectorIndex] > 0.0 ? 1.0 : -1.0; // Convention: Have first entry of eigenvector positive. This is to make results more consistent. double eigenVectorNormSquared = 0.0; for (int row = 0; row < eigenValues.length; row++) { eigenVectorNormSquared += eigenVectorMatrix[row][eigenVectorIndex] * eigenVectorMatrix[row][eigenVectorIndex]; } eigenValue = Math.max(eigenValue,0.0); for (int row = 0; row < eigenValues.length; row++) { factorMatrix[row][factor] = signChange * Math.sqrt(eigenValue/eigenVectorNormSquared) * eigenVectorMatrix[row][eigenVectorIndex]; } } return factorMatrix; }
java
private static double[][] getFactorMatrixUsingCommonsMath(double[][] correlationMatrix, int numberOfFactors) { /* * Factor reduction */ // Create an eigen vector decomposition of the correlation matrix double[] eigenValues; double[][] eigenVectorMatrix; if(isEigenvalueDecompositionViaSVD) { SingularValueDecomposition svd = new SingularValueDecomposition(new Array2DRowRealMatrix(correlationMatrix)); eigenValues = svd.getSingularValues(); eigenVectorMatrix = svd.getV().getData(); } else { EigenDecomposition eigenDecomp = new EigenDecomposition(new Array2DRowRealMatrix(correlationMatrix, false)); eigenValues = eigenDecomp.getRealEigenvalues(); eigenVectorMatrix = eigenDecomp.getV().getData(); } class EigenValueIndex implements Comparable<EigenValueIndex> { private int index; private Double value; EigenValueIndex(int index, double value) { this.index = index; this.value = value; } @Override public int compareTo(EigenValueIndex o) { return o.value.compareTo(value); } } List<EigenValueIndex> eigenValueIndices = new ArrayList<>(); for(int i=0; i<eigenValues.length; i++) { eigenValueIndices.add(i,new EigenValueIndex(i,eigenValues[i])); } Collections.sort(eigenValueIndices); // Extract factors corresponding to the largest eigenvalues double[][] factorMatrix = new double[eigenValues.length][numberOfFactors]; for (int factor = 0; factor < numberOfFactors; factor++) { int eigenVectorIndex = eigenValueIndices.get(factor).index; double eigenValue = eigenValues[eigenVectorIndex]; double signChange = eigenVectorMatrix[0][eigenVectorIndex] > 0.0 ? 1.0 : -1.0; // Convention: Have first entry of eigenvector positive. This is to make results more consistent. double eigenVectorNormSquared = 0.0; for (int row = 0; row < eigenValues.length; row++) { eigenVectorNormSquared += eigenVectorMatrix[row][eigenVectorIndex] * eigenVectorMatrix[row][eigenVectorIndex]; } eigenValue = Math.max(eigenValue,0.0); for (int row = 0; row < eigenValues.length; row++) { factorMatrix[row][factor] = signChange * Math.sqrt(eigenValue/eigenVectorNormSquared) * eigenVectorMatrix[row][eigenVectorIndex]; } } return factorMatrix; }
[ "private", "static", "double", "[", "]", "[", "]", "getFactorMatrixUsingCommonsMath", "(", "double", "[", "]", "[", "]", "correlationMatrix", ",", "int", "numberOfFactors", ")", "{", "/*\n\t\t * Factor reduction\n\t\t */", "// Create an eigen vector decomposition of the cor...
Returns the matrix of the n Eigenvectors corresponding to the first n largest Eigenvalues of a correlation matrix. These eigenvectors can also be interpreted as "principal components" (i.e., the method implements the PCA). @param correlationMatrix The given correlation matrix. @param numberOfFactors The requested number of factors (Eigenvectors). @return Matrix of n Eigenvectors (columns) (matrix is given as double[n][numberOfFactors], where n is the number of rows of the correlationMatrix.
[ "Returns", "the", "matrix", "of", "the", "n", "Eigenvectors", "corresponding", "to", "the", "first", "n", "largest", "Eigenvalues", "of", "a", "correlation", "matrix", ".", "These", "eigenvectors", "can", "also", "be", "interpreted", "as", "principal", "componen...
train
https://github.com/finmath/finmath-lib/blob/a3c067d52dd33feb97d851df6cab130e4116759f/src/main/java/net/finmath/functions/LinearAlgebra.java#L376-L429
lightoze/gwt-i18n-server
src/main/java/net/lightoze/gwt/i18n/client/LocaleFactory.java
LocaleFactory.put
public static <T extends LocalizableResource> void put(Class<T> cls, String locale, T m) { Map<String, LocalizableResource> localeCache = getLocaleCache(cls); synchronized (cache) { localeCache.put(locale, m); } }
java
public static <T extends LocalizableResource> void put(Class<T> cls, String locale, T m) { Map<String, LocalizableResource> localeCache = getLocaleCache(cls); synchronized (cache) { localeCache.put(locale, m); } }
[ "public", "static", "<", "T", "extends", "LocalizableResource", ">", "void", "put", "(", "Class", "<", "T", ">", "cls", ",", "String", "locale", ",", "T", "m", ")", "{", "Map", "<", "String", ",", "LocalizableResource", ">", "localeCache", "=", "getLocal...
Populate localization object cache for the specified locale. @param cls localization interface class @param locale locale string @param m localization object @param <T> localization interface class
[ "Populate", "localization", "object", "cache", "for", "the", "specified", "locale", "." ]
train
https://github.com/lightoze/gwt-i18n-server/blob/96de53288e9bf31721d7b0e2a1d9f7b6ce1a7e83/src/main/java/net/lightoze/gwt/i18n/client/LocaleFactory.java#L95-L100
BigBadaboom/androidsvg
androidsvg/src/main/java/com/caverock/androidsvg/SVGImageView.java
SVGImageView.setSVG
public void setSVG(SVG svg, String css) { if (svg == null) throw new IllegalArgumentException("Null value passed to setSVG()"); this.svg = svg; this.renderOptions.css(css); doRender(); }
java
public void setSVG(SVG svg, String css) { if (svg == null) throw new IllegalArgumentException("Null value passed to setSVG()"); this.svg = svg; this.renderOptions.css(css); doRender(); }
[ "public", "void", "setSVG", "(", "SVG", "svg", ",", "String", "css", ")", "{", "if", "(", "svg", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"Null value passed to setSVG()\"", ")", ";", "this", ".", "svg", "=", "svg", ";", "this",...
Directly set the SVG and the CSS. @param svg An {@code SVG} instance @param css Optional extra CSS to apply when rendering @since 1.3
[ "Directly", "set", "the", "SVG", "and", "the", "CSS", "." ]
train
https://github.com/BigBadaboom/androidsvg/blob/0d1614dd1a4da10ea4afe3b0cea1361a4ac6b45a/androidsvg/src/main/java/com/caverock/androidsvg/SVGImageView.java#L152-L161
zaproxy/zaproxy
src/org/zaproxy/zap/extension/script/ScriptAPI.java
ScriptAPI.validateVarValue
private static void validateVarValue(String varValue) throws ApiException { if (varValue == null) { throw new ApiException(ApiException.Type.DOES_NOT_EXIST, PARAM_VAR_KEY); } }
java
private static void validateVarValue(String varValue) throws ApiException { if (varValue == null) { throw new ApiException(ApiException.Type.DOES_NOT_EXIST, PARAM_VAR_KEY); } }
[ "private", "static", "void", "validateVarValue", "(", "String", "varValue", ")", "throws", "ApiException", "{", "if", "(", "varValue", "==", "null", ")", "{", "throw", "new", "ApiException", "(", "ApiException", ".", "Type", ".", "DOES_NOT_EXIST", ",", "PARAM_...
Validates that the value is non-{@code null}, that is, the variable exists. @param varValue the value of the variable to validate. @throws ApiException if the value is {@code null}.
[ "Validates", "that", "the", "value", "is", "non", "-", "{", "@code", "null", "}", "that", "is", "the", "variable", "exists", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/script/ScriptAPI.java#L177-L181
enioka/jqm
jqm-all/jqm-client/jqm-api-client-core/src/main/java/com/enioka/jqm/api/JobRequest.java
JobRequest.addParameter
public JobRequest addParameter(String key, String value) { validateParameter(key, value); parameters.put(key, value); return this; }
java
public JobRequest addParameter(String key, String value) { validateParameter(key, value); parameters.put(key, value); return this; }
[ "public", "JobRequest", "addParameter", "(", "String", "key", ",", "String", "value", ")", "{", "validateParameter", "(", "key", ",", "value", ")", ";", "parameters", ".", "put", "(", "key", ",", "value", ")", ";", "return", "this", ";", "}" ]
Parameters are <key,value> pairs that are passed at runtime to the job. The amount of required parameters depends on the requested job itself. @param key max length is 50 @param value max length is 1000
[ "Parameters", "are", "<key", "value", ">", "pairs", "that", "are", "passed", "at", "runtime", "to", "the", "job", ".", "The", "amount", "of", "required", "parameters", "depends", "on", "the", "requested", "job", "itself", "." ]
train
https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-client/jqm-api-client-core/src/main/java/com/enioka/jqm/api/JobRequest.java#L131-L136
headius/invokebinder
src/main/java/com/headius/invokebinder/Signature.java
Signature.dropArg
public Signature dropArg(int index) { assert index < argNames.length; String[] newArgNames = new String[argNames.length - 1]; if (index > 0) System.arraycopy(argNames, 0, newArgNames, 0, index); if (index < argNames.length - 1) System.arraycopy(argNames, index + 1, newArgNames, index, argNames.length - (index + 1)); MethodType newType = methodType.dropParameterTypes(index, index + 1); return new Signature(newType, newArgNames); }
java
public Signature dropArg(int index) { assert index < argNames.length; String[] newArgNames = new String[argNames.length - 1]; if (index > 0) System.arraycopy(argNames, 0, newArgNames, 0, index); if (index < argNames.length - 1) System.arraycopy(argNames, index + 1, newArgNames, index, argNames.length - (index + 1)); MethodType newType = methodType.dropParameterTypes(index, index + 1); return new Signature(newType, newArgNames); }
[ "public", "Signature", "dropArg", "(", "int", "index", ")", "{", "assert", "index", "<", "argNames", ".", "length", ";", "String", "[", "]", "newArgNames", "=", "new", "String", "[", "argNames", ".", "length", "-", "1", "]", ";", "if", "(", "index", ...
Drops the argument at the given index. @param index the index of the argument to drop @return a new signature
[ "Drops", "the", "argument", "at", "the", "given", "index", "." ]
train
https://github.com/headius/invokebinder/blob/ce6bfeb8e33265480daa7b797989dd915d51238d/src/main/java/com/headius/invokebinder/Signature.java#L334-L345
EdwardRaff/JSAT
JSAT/src/jsat/distributions/ContinuousDistribution.java
ContinuousDistribution.getDescriptiveName
public String getDescriptiveName() { StringBuilder sb = new StringBuilder(getDistributionName()); sb.append("("); String[] vars = getVariables(); double[] vals = getCurrentVariableValues(); sb.append(vars[0]).append(" = ").append(vals[0]); for(int i = 1; i < vars.length; i++) sb.append(", ").append(vars[i]).append(" = ").append(vals[i]); sb.append(")"); return sb.toString(); } /** * Return the name of the distribution. * @return the name of the distribution. */ abstract public String getDistributionName(); /** * Returns an array, where each value contains the name of a parameter in the distribution. * The order must always be the same, and match up with the values returned by {@link #getCurrentVariableValues() } * * @return a string of the variable names this distribution uses */ abstract public String[] getVariables(); /** * Returns an array, where each value contains the value of a parameter in the distribution. * The order must always be the same, and match up with the values returned by {@link #getVariables() } * @return the current values of the parameters used by this distribution, in the same order as their names are returned by {@link #getVariables() } */ abstract public double[] getCurrentVariableValues(); /** * Sets one of the variables of this distribution by the name. * @param var the variable to set * @param value the value to set */ abstract public void setVariable(String var, double value); @Override abstract public ContinuousDistribution clone(); /** * Attempts to set the variables used by this distribution based on population sample data, * assuming the sample data is from this type of distribution. * * @param data the data to use to attempt to fit against */ abstract public void setUsingData(Vec data); @Override public String toString() { return getDistributionName(); } }
java
public String getDescriptiveName() { StringBuilder sb = new StringBuilder(getDistributionName()); sb.append("("); String[] vars = getVariables(); double[] vals = getCurrentVariableValues(); sb.append(vars[0]).append(" = ").append(vals[0]); for(int i = 1; i < vars.length; i++) sb.append(", ").append(vars[i]).append(" = ").append(vals[i]); sb.append(")"); return sb.toString(); } /** * Return the name of the distribution. * @return the name of the distribution. */ abstract public String getDistributionName(); /** * Returns an array, where each value contains the name of a parameter in the distribution. * The order must always be the same, and match up with the values returned by {@link #getCurrentVariableValues() } * * @return a string of the variable names this distribution uses */ abstract public String[] getVariables(); /** * Returns an array, where each value contains the value of a parameter in the distribution. * The order must always be the same, and match up with the values returned by {@link #getVariables() } * @return the current values of the parameters used by this distribution, in the same order as their names are returned by {@link #getVariables() } */ abstract public double[] getCurrentVariableValues(); /** * Sets one of the variables of this distribution by the name. * @param var the variable to set * @param value the value to set */ abstract public void setVariable(String var, double value); @Override abstract public ContinuousDistribution clone(); /** * Attempts to set the variables used by this distribution based on population sample data, * assuming the sample data is from this type of distribution. * * @param data the data to use to attempt to fit against */ abstract public void setUsingData(Vec data); @Override public String toString() { return getDistributionName(); } }
[ "public", "String", "getDescriptiveName", "(", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "getDistributionName", "(", ")", ")", ";", "sb", ".", "append", "(", "\"(\"", ")", ";", "String", "[", "]", "vars", "=", "getVariables", "(", ...
The descriptive name of a distribution returns the name of the distribution, followed by the parameters of the distribution and their values. @return the name of the distribution that includes parameter values
[ "The", "descriptive", "name", "of", "a", "distribution", "returns", "the", "name", "of", "the", "distribution", "followed", "by", "the", "parameters", "of", "the", "distribution", "and", "their", "values", "." ]
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/distributions/ContinuousDistribution.java#L189-L251
jnidzwetzki/bitfinex-v2-wss-api-java
src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java
SimpleBitfinexApiBroker.setupDefaultAccountInfoHandler
private void setupDefaultAccountInfoHandler() { final BitfinexAccountSymbol accountSymbol = BitfinexSymbols.account(BitfinexApiKeyPermissions.NO_PERMISSIONS); final AccountInfoHandler accountInfoHandler = new AccountInfoHandler(ACCCOUNT_INFO_CHANNEL, accountSymbol); accountInfoHandler.onHeartbeatEvent(timestamp -> this.updateConnectionHeartbeat()); channelIdToHandlerMap.put(ACCCOUNT_INFO_CHANNEL, accountInfoHandler); }
java
private void setupDefaultAccountInfoHandler() { final BitfinexAccountSymbol accountSymbol = BitfinexSymbols.account(BitfinexApiKeyPermissions.NO_PERMISSIONS); final AccountInfoHandler accountInfoHandler = new AccountInfoHandler(ACCCOUNT_INFO_CHANNEL, accountSymbol); accountInfoHandler.onHeartbeatEvent(timestamp -> this.updateConnectionHeartbeat()); channelIdToHandlerMap.put(ACCCOUNT_INFO_CHANNEL, accountInfoHandler); }
[ "private", "void", "setupDefaultAccountInfoHandler", "(", ")", "{", "final", "BitfinexAccountSymbol", "accountSymbol", "=", "BitfinexSymbols", ".", "account", "(", "BitfinexApiKeyPermissions", ".", "NO_PERMISSIONS", ")", ";", "final", "AccountInfoHandler", "accountInfoHandl...
Setup the default info handler - can be replaced in onAuthenticationSuccessEvent
[ "Setup", "the", "default", "info", "handler", "-", "can", "be", "replaced", "in", "onAuthenticationSuccessEvent" ]
train
https://github.com/jnidzwetzki/bitfinex-v2-wss-api-java/blob/2e6adf1eb6f8cd4c8722f1619f78ab2cc3c600ee/src/main/java/com/github/jnidzwetzki/bitfinex/v2/SimpleBitfinexApiBroker.java#L344-L349
GoSimpleLLC/nbvcxz
src/main/java/me/gosimple/nbvcxz/Nbvcxz.java
Nbvcxz.backfillBruteForce
private void backfillBruteForce(final String password, final Map<Integer, Match> brute_force_matches, final List<Match> matches) { Set<Match> bf_matches = new HashSet<>(); int index = 0; while (index < password.length()) { boolean has_match = false; for (Match match : matches) { if (index >= match.getStartIndex() && index <= match.getEndIndex()) { has_match = true; } } if (!has_match) { bf_matches.add(brute_force_matches.get(index)); } index++; } matches.addAll(bf_matches); }
java
private void backfillBruteForce(final String password, final Map<Integer, Match> brute_force_matches, final List<Match> matches) { Set<Match> bf_matches = new HashSet<>(); int index = 0; while (index < password.length()) { boolean has_match = false; for (Match match : matches) { if (index >= match.getStartIndex() && index <= match.getEndIndex()) { has_match = true; } } if (!has_match) { bf_matches.add(brute_force_matches.get(index)); } index++; } matches.addAll(bf_matches); }
[ "private", "void", "backfillBruteForce", "(", "final", "String", "password", ",", "final", "Map", "<", "Integer", ",", "Match", ">", "brute_force_matches", ",", "final", "List", "<", "Match", ">", "matches", ")", "{", "Set", "<", "Match", ">", "bf_matches", ...
Fills in the matches array passed in with {@link BruteForceMatch} in every missing spot. Returns them unsorted. @param password the password @param brute_force_matches map of index and brute force match to fit that index @param matches the list of matches to fill in
[ "Fills", "in", "the", "matches", "array", "passed", "in", "with", "{", "@link", "BruteForceMatch", "}", "in", "every", "missing", "spot", ".", "Returns", "them", "unsorted", "." ]
train
https://github.com/GoSimpleLLC/nbvcxz/blob/a86fb24680e646efdf78d6fda9d68a5410145f56/src/main/java/me/gosimple/nbvcxz/Nbvcxz.java#L552-L573
hypercube1024/firefly
firefly/src/main/java/com/firefly/codec/websocket/utils/WSURI.java
WSURI.toWebsocket
public static URI toWebsocket(CharSequence inputUrl, String query) throws URISyntaxException { if (query == null) { return toWebsocket(new URI(inputUrl.toString())); } return toWebsocket(new URI(inputUrl.toString() + '?' + query)); }
java
public static URI toWebsocket(CharSequence inputUrl, String query) throws URISyntaxException { if (query == null) { return toWebsocket(new URI(inputUrl.toString())); } return toWebsocket(new URI(inputUrl.toString() + '?' + query)); }
[ "public", "static", "URI", "toWebsocket", "(", "CharSequence", "inputUrl", ",", "String", "query", ")", "throws", "URISyntaxException", "{", "if", "(", "query", "==", "null", ")", "{", "return", "toWebsocket", "(", "new", "URI", "(", "inputUrl", ".", "toStri...
Convert to WebSocket <code>ws</code> or <code>wss</code> scheme URIs <p> Converting <code>http</code> and <code>https</code> URIs to their WebSocket equivalent @param inputUrl the input URI @param query the optional query string @return the WebSocket scheme URI for the input URI. @throws URISyntaxException if unable to convert the input URI
[ "Convert", "to", "WebSocket", "<code", ">", "ws<", "/", "code", ">", "or", "<code", ">", "wss<", "/", "code", ">", "scheme", "URIs", "<p", ">", "Converting", "<code", ">", "http<", "/", "code", ">", "and", "<code", ">", "https<", "/", "code", ">", ...
train
https://github.com/hypercube1024/firefly/blob/ed3fc75b7c54a65b1e7d8141d01b49144bb423a3/firefly/src/main/java/com/firefly/codec/websocket/utils/WSURI.java#L64-L69
janus-project/guava.janusproject.io
guava-gwt/src-super/com/google/common/io/super/com/google/common/io/BaseEncoding.java
BaseEncoding.decodeChecked
final byte[] decodeChecked(CharSequence chars) throws DecodingException { chars = padding().trimTrailingFrom(chars); ByteInput decodedInput = decodingStream(asCharInput(chars)); byte[] tmp = new byte[maxDecodedSize(chars.length())]; int index = 0; try { for (int i = decodedInput.read(); i != -1; i = decodedInput.read()) { tmp[index++] = (byte) i; } } catch (DecodingException badInput) { throw badInput; } catch (IOException impossible) { throw new AssertionError(impossible); } return extract(tmp, index); }
java
final byte[] decodeChecked(CharSequence chars) throws DecodingException { chars = padding().trimTrailingFrom(chars); ByteInput decodedInput = decodingStream(asCharInput(chars)); byte[] tmp = new byte[maxDecodedSize(chars.length())]; int index = 0; try { for (int i = decodedInput.read(); i != -1; i = decodedInput.read()) { tmp[index++] = (byte) i; } } catch (DecodingException badInput) { throw badInput; } catch (IOException impossible) { throw new AssertionError(impossible); } return extract(tmp, index); }
[ "final", "byte", "[", "]", "decodeChecked", "(", "CharSequence", "chars", ")", "throws", "DecodingException", "{", "chars", "=", "padding", "(", ")", ".", "trimTrailingFrom", "(", "chars", ")", ";", "ByteInput", "decodedInput", "=", "decodingStream", "(", "asC...
Decodes the specified character sequence, and returns the resulting {@code byte[]}. This is the inverse operation to {@link #encode(byte[])}. @throws DecodingException if the input is not a valid encoded string according to this encoding.
[ "Decodes", "the", "specified", "character", "sequence", "and", "returns", "the", "resulting", "{", "@code", "byte", "[]", "}", ".", "This", "is", "the", "inverse", "operation", "to", "{", "@link", "#encode", "(", "byte", "[]", ")", "}", "." ]
train
https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava-gwt/src-super/com/google/common/io/super/com/google/common/io/BaseEncoding.java#L207-L222
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java
XFactory.createXMethod
private static XMethod createXMethod(@DottedClassName String className, String methodName, String methodSig, int accessFlags) { return createXMethod(className, methodName, methodSig, (accessFlags & Const.ACC_STATIC) != 0); }
java
private static XMethod createXMethod(@DottedClassName String className, String methodName, String methodSig, int accessFlags) { return createXMethod(className, methodName, methodSig, (accessFlags & Const.ACC_STATIC) != 0); }
[ "private", "static", "XMethod", "createXMethod", "(", "@", "DottedClassName", "String", "className", ",", "String", "methodName", ",", "String", "methodSig", ",", "int", "accessFlags", ")", "{", "return", "createXMethod", "(", "className", ",", "methodName", ",", ...
/* Create a new, never-before-seen, XMethod object and intern it.
[ "/", "*", "Create", "a", "new", "never", "-", "before", "-", "seen", "XMethod", "object", "and", "intern", "it", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java#L266-L268
VoltDB/voltdb
src/frontend/org/voltcore/messaging/HostMessenger.java
HostMessenger.createMailbox
public void createMailbox(Long proposedHSId, Mailbox mailbox) { long hsId = 0; if (proposedHSId != null) { if (m_siteMailboxes.containsKey(proposedHSId)) { org.voltdb.VoltDB.crashLocalVoltDB( "Attempted to create a mailbox for site " + CoreUtils.hsIdToString(proposedHSId) + " twice", true, null); } hsId = proposedHSId; } else { hsId = getHSIdForLocalSite(m_nextSiteId.getAndIncrement()); mailbox.setHSId(hsId); } addMailbox(hsId, mailbox); }
java
public void createMailbox(Long proposedHSId, Mailbox mailbox) { long hsId = 0; if (proposedHSId != null) { if (m_siteMailboxes.containsKey(proposedHSId)) { org.voltdb.VoltDB.crashLocalVoltDB( "Attempted to create a mailbox for site " + CoreUtils.hsIdToString(proposedHSId) + " twice", true, null); } hsId = proposedHSId; } else { hsId = getHSIdForLocalSite(m_nextSiteId.getAndIncrement()); mailbox.setHSId(hsId); } addMailbox(hsId, mailbox); }
[ "public", "void", "createMailbox", "(", "Long", "proposedHSId", ",", "Mailbox", "mailbox", ")", "{", "long", "hsId", "=", "0", ";", "if", "(", "proposedHSId", "!=", "null", ")", "{", "if", "(", "m_siteMailboxes", ".", "containsKey", "(", "proposedHSId", ")...
/* Register a custom mailbox, optionally specifying what the hsid should be.
[ "/", "*", "Register", "a", "custom", "mailbox", "optionally", "specifying", "what", "the", "hsid", "should", "be", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/messaging/HostMessenger.java#L1716-L1731
apache/flink
flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java
StreamExecutionEnvironment.fromCollection
public <OUT> DataStreamSource<OUT> fromCollection(Iterator<OUT> data, TypeInformation<OUT> typeInfo) { Preconditions.checkNotNull(data, "The iterator must not be null"); SourceFunction<OUT> function = new FromIteratorFunction<>(data); return addSource(function, "Collection Source", typeInfo); }
java
public <OUT> DataStreamSource<OUT> fromCollection(Iterator<OUT> data, TypeInformation<OUT> typeInfo) { Preconditions.checkNotNull(data, "The iterator must not be null"); SourceFunction<OUT> function = new FromIteratorFunction<>(data); return addSource(function, "Collection Source", typeInfo); }
[ "public", "<", "OUT", ">", "DataStreamSource", "<", "OUT", ">", "fromCollection", "(", "Iterator", "<", "OUT", ">", "data", ",", "TypeInformation", "<", "OUT", ">", "typeInfo", ")", "{", "Preconditions", ".", "checkNotNull", "(", "data", ",", "\"The iterator...
Creates a data stream from the given iterator. <p>Because the iterator will remain unmodified until the actual execution happens, the type of data returned by the iterator must be given explicitly in the form of the type information. This method is useful for cases where the type is generic. In that case, the type class (as given in {@link #fromCollection(java.util.Iterator, Class)} does not supply all type information. <p>Note that this operation will result in a non-parallel data stream source, i.e., a data stream source with parallelism one. @param data The iterator of elements to create the data stream from @param typeInfo The TypeInformation for the produced data stream @param <OUT> The type of the returned data stream @return The data stream representing the elements in the iterator
[ "Creates", "a", "data", "stream", "from", "the", "given", "iterator", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-streaming-java/src/main/java/org/apache/flink/streaming/api/environment/StreamExecutionEnvironment.java#L864-L869
samskivert/pythagoras
src/main/java/pythagoras/d/Matrix4.java
Matrix4.setToTransform
public Matrix4 setToTransform (IVector3 translation, IQuaternion rotation, IVector3 scale) { double sx = scale.x(), sy = scale.y(), sz = scale.z(); return setToRotation(rotation).set( m00 * sx, m10 * sy, m20 * sz, translation.x(), m01 * sx, m11 * sy, m21 * sz, translation.y(), m02 * sx, m12 * sy, m22 * sz, translation.z(), 0f, 0f, 0f, 1f); }
java
public Matrix4 setToTransform (IVector3 translation, IQuaternion rotation, IVector3 scale) { double sx = scale.x(), sy = scale.y(), sz = scale.z(); return setToRotation(rotation).set( m00 * sx, m10 * sy, m20 * sz, translation.x(), m01 * sx, m11 * sy, m21 * sz, translation.y(), m02 * sx, m12 * sy, m22 * sz, translation.z(), 0f, 0f, 0f, 1f); }
[ "public", "Matrix4", "setToTransform", "(", "IVector3", "translation", ",", "IQuaternion", "rotation", ",", "IVector3", "scale", ")", "{", "double", "sx", "=", "scale", ".", "x", "(", ")", ",", "sy", "=", "scale", ".", "y", "(", ")", ",", "sz", "=", ...
Sets this to a matrix that first scales, then rotates, then translates. @return a reference to this matrix, for chaining.
[ "Sets", "this", "to", "a", "matrix", "that", "first", "scales", "then", "rotates", "then", "translates", "." ]
train
https://github.com/samskivert/pythagoras/blob/b8fea743ee8a7d742ad9c06ee4f11f50571fbd32/src/main/java/pythagoras/d/Matrix4.java#L125-L132
graphql-java/graphql-java
src/main/java/graphql/schema/idl/SchemaTypeExtensionsChecker.java
SchemaTypeExtensionsChecker.checkInputObjectTypeExtensions
private void checkInputObjectTypeExtensions(List<GraphQLError> errors, TypeDefinitionRegistry typeRegistry) { typeRegistry.inputObjectTypeExtensions() .forEach((name, extensions) -> { checkTypeExtensionHasCorrespondingType(errors, typeRegistry, name, extensions, InputObjectTypeDefinition.class); checkTypeExtensionDirectiveRedefinition(errors, typeRegistry, name, extensions, InputObjectTypeDefinition.class); // field redefinitions extensions.forEach(extension -> { List<InputValueDefinition> inputValueDefinitions = extension.getInputValueDefinitions(); // field unique ness checkNamedUniqueness(errors, inputValueDefinitions, InputValueDefinition::getName, (namedField, fieldDef) -> new NonUniqueNameError(extension, fieldDef)); // directive checks inputValueDefinitions.forEach(fld -> checkNamedUniqueness(errors, fld.getDirectives(), Directive::getName, (directiveName, directive) -> new NonUniqueDirectiveError(extension, fld, directiveName))); inputValueDefinitions.forEach(fld -> fld.getDirectives().forEach(directive -> { checkDeprecatedDirective(errors, directive, () -> new InvalidDeprecationDirectiveError(extension, fld)); checkNamedUniqueness(errors, directive.getArguments(), Argument::getName, (argumentName, argument) -> new NonUniqueArgumentError(extension, fld, argumentName)); })); // // fields must be unique within a type extension forEachBut(extension, extensions, otherTypeExt -> checkForInputValueRedefinition(errors, otherTypeExt, otherTypeExt.getInputValueDefinitions(), inputValueDefinitions)); // // then check for field re-defs from the base type Optional<InputObjectTypeDefinition> baseTypeOpt = typeRegistry.getType(extension.getName(), InputObjectTypeDefinition.class); baseTypeOpt.ifPresent(baseTypeDef -> checkForInputValueRedefinition(errors, extension, inputValueDefinitions, baseTypeDef.getInputValueDefinitions())); }); }); }
java
private void checkInputObjectTypeExtensions(List<GraphQLError> errors, TypeDefinitionRegistry typeRegistry) { typeRegistry.inputObjectTypeExtensions() .forEach((name, extensions) -> { checkTypeExtensionHasCorrespondingType(errors, typeRegistry, name, extensions, InputObjectTypeDefinition.class); checkTypeExtensionDirectiveRedefinition(errors, typeRegistry, name, extensions, InputObjectTypeDefinition.class); // field redefinitions extensions.forEach(extension -> { List<InputValueDefinition> inputValueDefinitions = extension.getInputValueDefinitions(); // field unique ness checkNamedUniqueness(errors, inputValueDefinitions, InputValueDefinition::getName, (namedField, fieldDef) -> new NonUniqueNameError(extension, fieldDef)); // directive checks inputValueDefinitions.forEach(fld -> checkNamedUniqueness(errors, fld.getDirectives(), Directive::getName, (directiveName, directive) -> new NonUniqueDirectiveError(extension, fld, directiveName))); inputValueDefinitions.forEach(fld -> fld.getDirectives().forEach(directive -> { checkDeprecatedDirective(errors, directive, () -> new InvalidDeprecationDirectiveError(extension, fld)); checkNamedUniqueness(errors, directive.getArguments(), Argument::getName, (argumentName, argument) -> new NonUniqueArgumentError(extension, fld, argumentName)); })); // // fields must be unique within a type extension forEachBut(extension, extensions, otherTypeExt -> checkForInputValueRedefinition(errors, otherTypeExt, otherTypeExt.getInputValueDefinitions(), inputValueDefinitions)); // // then check for field re-defs from the base type Optional<InputObjectTypeDefinition> baseTypeOpt = typeRegistry.getType(extension.getName(), InputObjectTypeDefinition.class); baseTypeOpt.ifPresent(baseTypeDef -> checkForInputValueRedefinition(errors, extension, inputValueDefinitions, baseTypeDef.getInputValueDefinitions())); }); }); }
[ "private", "void", "checkInputObjectTypeExtensions", "(", "List", "<", "GraphQLError", ">", "errors", ",", "TypeDefinitionRegistry", "typeRegistry", ")", "{", "typeRegistry", ".", "inputObjectTypeExtensions", "(", ")", ".", "forEach", "(", "(", "name", ",", "extensi...
/* Input object type extensions have the potential to be invalid if incorrectly defined. The named type must already be defined and must be a Input Object type. All fields of an Input Object type extension must have unique names. All fields of an Input Object type extension must not already be a field of the original Input Object. Any directives provided must not already apply to the original Input Object type.
[ "/", "*", "Input", "object", "type", "extensions", "have", "the", "potential", "to", "be", "invalid", "if", "incorrectly", "defined", "." ]
train
https://github.com/graphql-java/graphql-java/blob/9214b6044317849388bd88a14b54fc1c18c9f29f/src/main/java/graphql/schema/idl/SchemaTypeExtensionsChecker.java#L259-L295
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/AbstractSetEnable.java
AbstractSetEnable.applyAction
@Override protected void applyAction(final SubordinateTarget target, final Object value) { // Should always be Boolean, but check anyway if (value instanceof Boolean) { applyEnableAction(target, ((Boolean) value)); } }
java
@Override protected void applyAction(final SubordinateTarget target, final Object value) { // Should always be Boolean, but check anyway if (value instanceof Boolean) { applyEnableAction(target, ((Boolean) value)); } }
[ "@", "Override", "protected", "void", "applyAction", "(", "final", "SubordinateTarget", "target", ",", "final", "Object", "value", ")", "{", "// Should always be Boolean, but check anyway", "if", "(", "value", "instanceof", "Boolean", ")", "{", "applyEnableAction", "(...
Apply the action against the target. @param target the target of this action @param value is the evaluated value
[ "Apply", "the", "action", "against", "the", "target", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/AbstractSetEnable.java#L33-L39
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java
CmsCheckableDatePanel.addDateWithCheckState
private void addDateWithCheckState(Date date, boolean checkState) { addCheckBox(date, checkState); if (!m_dates.contains(date)) { m_dates.add(date); fireValueChange(); } }
java
private void addDateWithCheckState(Date date, boolean checkState) { addCheckBox(date, checkState); if (!m_dates.contains(date)) { m_dates.add(date); fireValueChange(); } }
[ "private", "void", "addDateWithCheckState", "(", "Date", "date", ",", "boolean", "checkState", ")", "{", "addCheckBox", "(", "date", ",", "checkState", ")", ";", "if", "(", "!", "m_dates", ".", "contains", "(", "date", ")", ")", "{", "m_dates", ".", "add...
Add a date with a certain check state. @param date the date to add. @param checkState the check state.
[ "Add", "a", "date", "with", "a", "certain", "check", "state", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/widgets/serialdate/CmsCheckableDatePanel.java#L285-L292
mnlipp/jgrapes
org.jgrapes.io/src/org/jgrapes/io/FileStorage.java
FileStorage.onSaveOutput
@Handler @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public void onSaveOutput(SaveOutput event) throws InterruptedException { if (!Arrays.asList(event.options()) .contains(StandardOpenOption.WRITE)) { throw new IllegalArgumentException( "File must be opened for writing."); } for (IOSubchannel channel : event.channels(IOSubchannel.class)) { if (outputWriters.containsKey(channel)) { channel.respond(new IOError(event, new IllegalStateException("File is already open."))); } else { new Writer(event, channel); } } }
java
@Handler @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public void onSaveOutput(SaveOutput event) throws InterruptedException { if (!Arrays.asList(event.options()) .contains(StandardOpenOption.WRITE)) { throw new IllegalArgumentException( "File must be opened for writing."); } for (IOSubchannel channel : event.channels(IOSubchannel.class)) { if (outputWriters.containsKey(channel)) { channel.respond(new IOError(event, new IllegalStateException("File is already open."))); } else { new Writer(event, channel); } } }
[ "@", "Handler", "@", "SuppressWarnings", "(", "\"PMD.AvoidInstantiatingObjectsInLoops\"", ")", "public", "void", "onSaveOutput", "(", "SaveOutput", "event", ")", "throws", "InterruptedException", "{", "if", "(", "!", "Arrays", ".", "asList", "(", "event", ".", "op...
Opens a file for writing using the properties of the event. All data from subsequent {@link Output} events is written to the file. The end of record flag is ignored. @param event the event @throws InterruptedException if the execution was interrupted
[ "Opens", "a", "file", "for", "writing", "using", "the", "properties", "of", "the", "event", ".", "All", "data", "from", "subsequent", "{", "@link", "Output", "}", "events", "is", "written", "to", "the", "file", ".", "The", "end", "of", "record", "flag", ...
train
https://github.com/mnlipp/jgrapes/blob/8b5d874935d84c34a52d3e3d3745e869b5203fa0/org.jgrapes.io/src/org/jgrapes/io/FileStorage.java#L343-L359
recommenders/rival
rival-evaluate/src/main/java/net/recommenders/rival/evaluation/statistics/EffectSize.java
EffectSize.getEffectSize
public double getEffectSize(final String method) { if ("d".equals(method)) { return getCohenD(baselineMetricPerDimension, testMetricPerDimension, false); } else if ("dLS".equals(method)) { return getCohenD(baselineMetricPerDimension, testMetricPerDimension, true); } else if ("pairedT".equals(method)) { return getEffectSizePairedT(baselineMetricPerDimension, testMetricPerDimension); } return Double.NaN; }
java
public double getEffectSize(final String method) { if ("d".equals(method)) { return getCohenD(baselineMetricPerDimension, testMetricPerDimension, false); } else if ("dLS".equals(method)) { return getCohenD(baselineMetricPerDimension, testMetricPerDimension, true); } else if ("pairedT".equals(method)) { return getEffectSizePairedT(baselineMetricPerDimension, testMetricPerDimension); } return Double.NaN; }
[ "public", "double", "getEffectSize", "(", "final", "String", "method", ")", "{", "if", "(", "\"d\"", ".", "equals", "(", "method", ")", ")", "{", "return", "getCohenD", "(", "baselineMetricPerDimension", ",", "testMetricPerDimension", ",", "false", ")", ";", ...
Computes the effect size according to different methods: d and dLS are adequate for not paired samples, whereas pairedT is better for paired samples. @param method one of "d", "dLS", "pairedT" @return the effect size
[ "Computes", "the", "effect", "size", "according", "to", "different", "methods", ":", "d", "and", "dLS", "are", "adequate", "for", "not", "paired", "samples", "whereas", "pairedT", "is", "better", "for", "paired", "samples", "." ]
train
https://github.com/recommenders/rival/blob/6ee8223e91810ae1c6052899595af3906e0c34c6/rival-evaluate/src/main/java/net/recommenders/rival/evaluation/statistics/EffectSize.java#L64-L73
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/Hdf5Archive.java
Hdf5Archive.readAttributeAsFixedLengthString
private String readAttributeAsFixedLengthString(Attribute attribute, int bufferSize) throws UnsupportedKerasConfigurationException { synchronized (Hdf5Archive.LOCK_OBJECT) { VarLenType vl = attribute.getVarLenType(); byte[] attrBuffer = new byte[bufferSize]; BytePointer attrPointer = new BytePointer(attrBuffer); attribute.read(vl, attrPointer); attrPointer.get(attrBuffer); vl.deallocate(); return new String(attrBuffer); } }
java
private String readAttributeAsFixedLengthString(Attribute attribute, int bufferSize) throws UnsupportedKerasConfigurationException { synchronized (Hdf5Archive.LOCK_OBJECT) { VarLenType vl = attribute.getVarLenType(); byte[] attrBuffer = new byte[bufferSize]; BytePointer attrPointer = new BytePointer(attrBuffer); attribute.read(vl, attrPointer); attrPointer.get(attrBuffer); vl.deallocate(); return new String(attrBuffer); } }
[ "private", "String", "readAttributeAsFixedLengthString", "(", "Attribute", "attribute", ",", "int", "bufferSize", ")", "throws", "UnsupportedKerasConfigurationException", "{", "synchronized", "(", "Hdf5Archive", ".", "LOCK_OBJECT", ")", "{", "VarLenType", "vl", "=", "at...
Read attribute of fixed buffer size as string. @param attribute HDF5 attribute to read as string. @return Fixed-length string read from HDF5 attribute @throws UnsupportedKerasConfigurationException Unsupported Keras config
[ "Read", "attribute", "of", "fixed", "buffer", "size", "as", "string", "." ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-modelimport/src/main/java/org/deeplearning4j/nn/modelimport/keras/Hdf5Archive.java#L441-L452
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java
ForwardingClient.allowX11Forwarding
public void allowX11Forwarding(String display) throws SshException { String homeDir = ""; try { homeDir = System.getProperty("user.home"); } catch (SecurityException e) { // ignore } allowX11Forwarding(display, new File(homeDir, ".Xauthority")); }
java
public void allowX11Forwarding(String display) throws SshException { String homeDir = ""; try { homeDir = System.getProperty("user.home"); } catch (SecurityException e) { // ignore } allowX11Forwarding(display, new File(homeDir, ".Xauthority")); }
[ "public", "void", "allowX11Forwarding", "(", "String", "display", ")", "throws", "SshException", "{", "String", "homeDir", "=", "\"\"", ";", "try", "{", "homeDir", "=", "System", ".", "getProperty", "(", "\"user.home\"", ")", ";", "}", "catch", "(", "Securit...
Configure the forwarding client to manage X11 connections. This method will configure the {@link com.sshtools.ssh.SshClient} for X11 forwarding and will generate a fake cookie which will be used to spoof incoming X11 requests. When a request is received the fake cookie will be replaced in the authentication packet by a real cookie which is extracted from the users .Xauthority file. @param display String @throws IOException
[ "Configure", "the", "forwarding", "client", "to", "manage", "X11", "connections", ".", "This", "method", "will", "configure", "the", "{", "@link", "com", ".", "sshtools", ".", "ssh", ".", "SshClient", "}", "for", "X11", "forwarding", "and", "will", "generate...
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/net/ForwardingClient.java#L709-L717
stratosphere/stratosphere
stratosphere-addons/jdbc/src/main/java/eu/stratosphere/api/java/io/jdbc/JDBCInputFormat.java
JDBCInputFormat.nextRecord
@Override public OUT nextRecord(OUT tuple) throws IOException { try { resultSet.next(); if (columnTypes == null) { extractTypes(tuple); } addValue(tuple); return tuple; } catch (SQLException se) { close(); throw new IOException("Couldn't read data - " + se.getMessage(), se); } catch (NullPointerException npe) { close(); throw new IOException("Couldn't access resultSet", npe); } }
java
@Override public OUT nextRecord(OUT tuple) throws IOException { try { resultSet.next(); if (columnTypes == null) { extractTypes(tuple); } addValue(tuple); return tuple; } catch (SQLException se) { close(); throw new IOException("Couldn't read data - " + se.getMessage(), se); } catch (NullPointerException npe) { close(); throw new IOException("Couldn't access resultSet", npe); } }
[ "@", "Override", "public", "OUT", "nextRecord", "(", "OUT", "tuple", ")", "throws", "IOException", "{", "try", "{", "resultSet", ".", "next", "(", ")", ";", "if", "(", "columnTypes", "==", "null", ")", "{", "extractTypes", "(", "tuple", ")", ";", "}", ...
Stores the next resultSet row in a tuple @param tuple @return tuple containing next row @throws java.io.IOException
[ "Stores", "the", "next", "resultSet", "row", "in", "a", "tuple" ]
train
https://github.com/stratosphere/stratosphere/blob/c543a08f9676c5b2b0a7088123bd6e795a8ae0c8/stratosphere-addons/jdbc/src/main/java/eu/stratosphere/api/java/io/jdbc/JDBCInputFormat.java#L151-L167
digitalfondue/stampo
src/main/java/ch/digitalfondue/stampo/processor/IncludeAllPaginator.java
IncludeAllPaginator.handleDepth0Page
private List<IncludeAllPage> handleDepth0Page(List<IncludeAllPage> pages, FileResource resource, int maxDepth, Path defaultOutputPath) { boolean skipDepth0 = (boolean) resource.getMetadata().getRawMap().getOrDefault("ignore-depth-0-page", false); if (maxDepth == 0) { List<FileResource> files = new ArrayList<FileResource>(); files.add(new FileResourcePlaceHolder(defaultOutputPath, configuration)); if(!pages.isEmpty()) { files.addAll(pages.get(0).files);// we know that it has size 1 } return Collections.singletonList(new IncludeAllPage(0, files)); } else if (!skipDepth0) { pages.add(0, new IncludeAllPage(0, Collections.singletonList(new FileResourcePlaceHolder(defaultOutputPath, configuration)))); } return pages; }
java
private List<IncludeAllPage> handleDepth0Page(List<IncludeAllPage> pages, FileResource resource, int maxDepth, Path defaultOutputPath) { boolean skipDepth0 = (boolean) resource.getMetadata().getRawMap().getOrDefault("ignore-depth-0-page", false); if (maxDepth == 0) { List<FileResource> files = new ArrayList<FileResource>(); files.add(new FileResourcePlaceHolder(defaultOutputPath, configuration)); if(!pages.isEmpty()) { files.addAll(pages.get(0).files);// we know that it has size 1 } return Collections.singletonList(new IncludeAllPage(0, files)); } else if (!skipDepth0) { pages.add(0, new IncludeAllPage(0, Collections.singletonList(new FileResourcePlaceHolder(defaultOutputPath, configuration)))); } return pages; }
[ "private", "List", "<", "IncludeAllPage", ">", "handleDepth0Page", "(", "List", "<", "IncludeAllPage", ">", "pages", ",", "FileResource", "resource", ",", "int", "maxDepth", ",", "Path", "defaultOutputPath", ")", "{", "boolean", "skipDepth0", "=", "(", "boolean"...
/* It's a special case: depth 0 represent the page with the include-all directive. We let the user decide if he want to render it (default: yes). Additionally we handle the case where maxDepth is 0, we should transfer the IncludeAllPage object under the page that have the include-all directive.
[ "/", "*", "It", "s", "a", "special", "case", ":", "depth", "0", "represent", "the", "page", "with", "the", "include", "-", "all", "directive", ".", "We", "let", "the", "user", "decide", "if", "he", "want", "to", "render", "it", "(", "default", ":", ...
train
https://github.com/digitalfondue/stampo/blob/5a41f20acd9211cf3951c30d0e0825994ae95573/src/main/java/ch/digitalfondue/stampo/processor/IncludeAllPaginator.java#L193-L210
googleapis/google-cloud-java
google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p3beta1/ProductSearchClient.java
ProductSearchClient.removeProductFromProductSet
public final void removeProductFromProductSet(ProductSetName name, String product) { RemoveProductFromProductSetRequest request = RemoveProductFromProductSetRequest.newBuilder() .setName(name == null ? null : name.toString()) .setProduct(product) .build(); removeProductFromProductSet(request); }
java
public final void removeProductFromProductSet(ProductSetName name, String product) { RemoveProductFromProductSetRequest request = RemoveProductFromProductSetRequest.newBuilder() .setName(name == null ? null : name.toString()) .setProduct(product) .build(); removeProductFromProductSet(request); }
[ "public", "final", "void", "removeProductFromProductSet", "(", "ProductSetName", "name", ",", "String", "product", ")", "{", "RemoveProductFromProductSetRequest", "request", "=", "RemoveProductFromProductSetRequest", ".", "newBuilder", "(", ")", ".", "setName", "(", "na...
Removes a Product from the specified ProductSet. <p>Possible errors: <p>&#42; Returns NOT_FOUND If the Product is not found under the ProductSet. <p>Sample code: <pre><code> try (ProductSearchClient productSearchClient = ProductSearchClient.create()) { ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); String product = ""; productSearchClient.removeProductFromProductSet(name, product); } </code></pre> @param name The resource name for the ProductSet to modify. <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` @param product The resource name for the Product to be removed from this ProductSet. <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Removes", "a", "Product", "from", "the", "specified", "ProductSet", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1p3beta1/ProductSearchClient.java#L2214-L2222
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/config/dns/dnspolicy_binding.java
dnspolicy_binding.get
public static dnspolicy_binding get(nitro_service service, String name) throws Exception{ dnspolicy_binding obj = new dnspolicy_binding(); obj.set_name(name); dnspolicy_binding response = (dnspolicy_binding) obj.get_resource(service); return response; }
java
public static dnspolicy_binding get(nitro_service service, String name) throws Exception{ dnspolicy_binding obj = new dnspolicy_binding(); obj.set_name(name); dnspolicy_binding response = (dnspolicy_binding) obj.get_resource(service); return response; }
[ "public", "static", "dnspolicy_binding", "get", "(", "nitro_service", "service", ",", "String", "name", ")", "throws", "Exception", "{", "dnspolicy_binding", "obj", "=", "new", "dnspolicy_binding", "(", ")", ";", "obj", ".", "set_name", "(", "name", ")", ";", ...
Use this API to fetch dnspolicy_binding resource of given name .
[ "Use", "this", "API", "to", "fetch", "dnspolicy_binding", "resource", "of", "given", "name", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/config/dns/dnspolicy_binding.java#L114-L119
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributeListImpl.java
AttributeListImpl.addAttribute
public void addAttribute(String name, String type, String value) { names.add(name); types.add(type); values.add(value); }
java
public void addAttribute(String name, String type, String value) { names.add(name); types.add(type); values.add(value); }
[ "public", "void", "addAttribute", "(", "String", "name", ",", "String", "type", ",", "String", "value", ")", "{", "names", ".", "add", "(", "name", ")", ";", "types", ".", "add", "(", "type", ")", ";", "values", ".", "add", "(", "value", ")", ";", ...
Add an attribute to an attribute list. <p>This method is provided for SAX parser writers, to allow them to build up an attribute list incrementally before delivering it to the application.</p> @param name The attribute name. @param type The attribute type ("NMTOKEN" for an enumeration). @param value The attribute value (must not be null). @see #removeAttribute @see org.xml.sax.DocumentHandler#startElement
[ "Add", "an", "attribute", "to", "an", "attribute", "list", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributeListImpl.java#L139-L143
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/crdt/CRDTReplicationMigrationService.java
CRDTReplicationMigrationService.tryProcessOnOtherMembers
private boolean tryProcessOnOtherMembers(Operation operation, String serviceName, long timeoutNanos) { final OperationService operationService = nodeEngine.getOperationService(); final Collection<Member> targets = nodeEngine.getClusterService().getMembers(DATA_MEMBER_SELECTOR); final Member localMember = nodeEngine.getLocalMember(); for (Member target : targets) { if (target.equals(localMember)) { continue; } long start = System.nanoTime(); try { logger.fine("Replicating " + serviceName + " to " + target); InternalCompletableFuture<Object> future = operationService.createInvocationBuilder(null, operation, target.getAddress()) .setTryCount(1) .invoke(); future.get(timeoutNanos, TimeUnit.NANOSECONDS); return true; } catch (Exception e) { logger.fine("Failed replication of " + serviceName + " for target " + target, e); } timeoutNanos -= (System.nanoTime() - start); if (timeoutNanos < 0) { break; } } return false; }
java
private boolean tryProcessOnOtherMembers(Operation operation, String serviceName, long timeoutNanos) { final OperationService operationService = nodeEngine.getOperationService(); final Collection<Member> targets = nodeEngine.getClusterService().getMembers(DATA_MEMBER_SELECTOR); final Member localMember = nodeEngine.getLocalMember(); for (Member target : targets) { if (target.equals(localMember)) { continue; } long start = System.nanoTime(); try { logger.fine("Replicating " + serviceName + " to " + target); InternalCompletableFuture<Object> future = operationService.createInvocationBuilder(null, operation, target.getAddress()) .setTryCount(1) .invoke(); future.get(timeoutNanos, TimeUnit.NANOSECONDS); return true; } catch (Exception e) { logger.fine("Failed replication of " + serviceName + " for target " + target, e); } timeoutNanos -= (System.nanoTime() - start); if (timeoutNanos < 0) { break; } } return false; }
[ "private", "boolean", "tryProcessOnOtherMembers", "(", "Operation", "operation", ",", "String", "serviceName", ",", "long", "timeoutNanos", ")", "{", "final", "OperationService", "operationService", "=", "nodeEngine", ".", "getOperationService", "(", ")", ";", "final"...
Attempts to process the {@code operation} on at least one non-local member. The method will iterate through the member list and try once on each member. The method returns as soon as the first member successfully processes the operation or once there are no more members to try. @param serviceName the service name @return {@code true} if at least one member successfully processed the operation, {@code false} otherwise.
[ "Attempts", "to", "process", "the", "{", "@code", "operation", "}", "on", "at", "least", "one", "non", "-", "local", "member", ".", "The", "method", "will", "iterate", "through", "the", "member", "list", "and", "try", "once", "on", "each", "member", ".",...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/crdt/CRDTReplicationMigrationService.java#L162-L190
ltearno/hexa.tools
hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/properties/PropertyValues.java
PropertyValues.getValue
<T> T getValue( Object object, String name ) { T result = getPropertyImpl( object, name ); if( result instanceof Property ) { @SuppressWarnings( "unchecked" ) Property<T> property = ((Property<T>) result); return property.getValue(); } return result; }
java
<T> T getValue( Object object, String name ) { T result = getPropertyImpl( object, name ); if( result instanceof Property ) { @SuppressWarnings( "unchecked" ) Property<T> property = ((Property<T>) result); return property.getValue(); } return result; }
[ "<", "T", ">", "T", "getValue", "(", "Object", "object", ",", "String", "name", ")", "{", "T", "result", "=", "getPropertyImpl", "(", "object", ",", "name", ")", ";", "if", "(", "result", "instanceof", "Property", ")", "{", "@", "SuppressWarnings", "("...
Gets the property's value from an object @param object The object @param name Property name
[ "Gets", "the", "property", "s", "value", "from", "an", "object" ]
train
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.binding/src/main/java/fr/lteconsulting/hexa/databinding/properties/PropertyValues.java#L83-L94
jqm4gwt/jqm4gwt
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java
JQMList.addItem
public JQMListItem addItem(String text, String url) { JQMListItem item = new JQMListItem(text, url); addItem(items.size(), item); return item; }
java
public JQMListItem addItem(String text, String url) { JQMListItem item = new JQMListItem(text, url); addItem(items.size(), item); return item; }
[ "public", "JQMListItem", "addItem", "(", "String", "text", ",", "String", "url", ")", "{", "JQMListItem", "item", "=", "new", "JQMListItem", "(", "text", ",", "url", ")", ";", "addItem", "(", "items", ".", "size", "(", ")", ",", "item", ")", ";", "re...
Adds a new {@link JQMListItem} that contains the given @param text as the content. Note that if you want to navigate to an internal url (ie, another JQM Page) then you must prefix the url with a hash. IE, the hash is not added automatically. This allows you to navigate to external urls as well. <br> If you add an item after the page has been created then you must call .refresh() to update the layout. <br> The list item is made linkable to the @param url
[ "Adds", "a", "new", "{" ]
train
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMList.java#L290-L294
google/closure-compiler
src/com/google/javascript/jscomp/PolymerPass.java
PolymerPass.appendPolymerElementExterns
private void appendPolymerElementExterns(final PolymerClassDefinition def) { if (!nativeExternsAdded.add(def.nativeBaseElement)) { return; } Node block = IR.block(); Node baseExterns = polymerElementExterns.cloneTree(); String polymerElementType = PolymerPassStaticUtils.getPolymerElementType(def); baseExterns.getFirstChild().setString(polymerElementType); String elementType = tagNameMap.get(def.nativeBaseElement); if (elementType == null) { compiler.report(JSError.make(def.descriptor, POLYMER_INVALID_EXTENDS, def.nativeBaseElement)); return; } JSTypeExpression elementBaseType = new JSTypeExpression(new Node(Token.BANG, IR.string(elementType)), VIRTUAL_FILE); JSDocInfoBuilder baseDocs = JSDocInfoBuilder.copyFrom(baseExterns.getJSDocInfo()); baseDocs.changeBaseType(elementBaseType); baseExterns.setJSDocInfo(baseDocs.build()); block.addChildToBack(baseExterns); for (Node baseProp : polymerElementProps) { Node newProp = baseProp.cloneTree(); Node newPropRootName = NodeUtil.getRootOfQualifiedName(newProp.getFirstFirstChild()); newPropRootName.setString(polymerElementType); block.addChildToBack(newProp); } block.useSourceInfoIfMissingFromForTree(polymerElementExterns); Node parent = polymerElementExterns.getParent(); Node stmts = block.removeChildren(); parent.addChildrenAfter(stmts, polymerElementExterns); compiler.reportChangeToEnclosingScope(stmts); }
java
private void appendPolymerElementExterns(final PolymerClassDefinition def) { if (!nativeExternsAdded.add(def.nativeBaseElement)) { return; } Node block = IR.block(); Node baseExterns = polymerElementExterns.cloneTree(); String polymerElementType = PolymerPassStaticUtils.getPolymerElementType(def); baseExterns.getFirstChild().setString(polymerElementType); String elementType = tagNameMap.get(def.nativeBaseElement); if (elementType == null) { compiler.report(JSError.make(def.descriptor, POLYMER_INVALID_EXTENDS, def.nativeBaseElement)); return; } JSTypeExpression elementBaseType = new JSTypeExpression(new Node(Token.BANG, IR.string(elementType)), VIRTUAL_FILE); JSDocInfoBuilder baseDocs = JSDocInfoBuilder.copyFrom(baseExterns.getJSDocInfo()); baseDocs.changeBaseType(elementBaseType); baseExterns.setJSDocInfo(baseDocs.build()); block.addChildToBack(baseExterns); for (Node baseProp : polymerElementProps) { Node newProp = baseProp.cloneTree(); Node newPropRootName = NodeUtil.getRootOfQualifiedName(newProp.getFirstFirstChild()); newPropRootName.setString(polymerElementType); block.addChildToBack(newProp); } block.useSourceInfoIfMissingFromForTree(polymerElementExterns); Node parent = polymerElementExterns.getParent(); Node stmts = block.removeChildren(); parent.addChildrenAfter(stmts, polymerElementExterns); compiler.reportChangeToEnclosingScope(stmts); }
[ "private", "void", "appendPolymerElementExterns", "(", "final", "PolymerClassDefinition", "def", ")", "{", "if", "(", "!", "nativeExternsAdded", ".", "add", "(", "def", ".", "nativeBaseElement", ")", ")", "{", "return", ";", "}", "Node", "block", "=", "IR", ...
Duplicates the PolymerElement externs with a different element base class if needed. For example, if the base class is HTMLInputElement, then a class PolymerInputElement will be added. If the element does not extend a native HTML element, this method is a no-op.
[ "Duplicates", "the", "PolymerElement", "externs", "with", "a", "different", "element", "base", "class", "if", "needed", ".", "For", "example", "if", "the", "base", "class", "is", "HTMLInputElement", "then", "a", "class", "PolymerInputElement", "will", "be", "add...
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/PolymerPass.java#L192-L230
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.updateStreamRecording
public void updateStreamRecording(String domain, String app, String stream, String recording) { UpdateStreamRecordingRequest request = new UpdateStreamRecordingRequest() .withDomain(domain) .withApp(app) .withStream(stream) .withRecording(recording); updateStreamRecording(request); }
java
public void updateStreamRecording(String domain, String app, String stream, String recording) { UpdateStreamRecordingRequest request = new UpdateStreamRecordingRequest() .withDomain(domain) .withApp(app) .withStream(stream) .withRecording(recording); updateStreamRecording(request); }
[ "public", "void", "updateStreamRecording", "(", "String", "domain", ",", "String", "app", ",", "String", "stream", ",", "String", "recording", ")", "{", "UpdateStreamRecordingRequest", "request", "=", "new", "UpdateStreamRecordingRequest", "(", ")", ".", "withDomain...
Update stream recording in live stream service @param domain The requested domain which the specific stream belongs to @param app The requested app which the specific stream belongs to @param stream The requested stream which need to update the recording @param recording The new recording's name
[ "Update", "stream", "recording", "in", "live", "stream", "service" ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1664-L1671
webmetrics/browsermob-proxy
src/main/java/org/browsermob/proxy/jetty/util/MultiMap.java
MultiMap.getValue
public Object getValue(Object name,int i) { Object l=super.get(name); if (i==0 && LazyList.size(l)==0) return null; return LazyList.get(l,i); }
java
public Object getValue(Object name,int i) { Object l=super.get(name); if (i==0 && LazyList.size(l)==0) return null; return LazyList.get(l,i); }
[ "public", "Object", "getValue", "(", "Object", "name", ",", "int", "i", ")", "{", "Object", "l", "=", "super", ".", "get", "(", "name", ")", ";", "if", "(", "i", "==", "0", "&&", "LazyList", ".", "size", "(", "l", ")", "==", "0", ")", "return",...
Get a value from a multiple value. If the value is not a multivalue, then index 0 retrieves the value or null. @param name The entry key. @param i Index of element to get. @return Unmodifieable List of values.
[ "Get", "a", "value", "from", "a", "multiple", "value", ".", "If", "the", "value", "is", "not", "a", "multivalue", "then", "index", "0", "retrieves", "the", "value", "or", "null", "." ]
train
https://github.com/webmetrics/browsermob-proxy/blob/a9252e62246ac33d55d51b993ba1159404e7d389/src/main/java/org/browsermob/proxy/jetty/util/MultiMap.java#L77-L83
h2oai/h2o-3
h2o-core/src/main/java/water/nbhm/NonBlockingIdentityHashMap.java
NonBlockingIdentityHashMap.replace
public boolean replace ( TypeK key, TypeV oldValue, TypeV newValue ) { return putIfMatch( key, newValue, oldValue ) == oldValue; }
java
public boolean replace ( TypeK key, TypeV oldValue, TypeV newValue ) { return putIfMatch( key, newValue, oldValue ) == oldValue; }
[ "public", "boolean", "replace", "(", "TypeK", "key", ",", "TypeV", "oldValue", ",", "TypeV", "newValue", ")", "{", "return", "putIfMatch", "(", "key", ",", "newValue", ",", "oldValue", ")", "==", "oldValue", ";", "}" ]
Atomically do a <code>put(key,newValue)</code> if-and-only-if the key is mapped a value which is <code>equals</code> to <code>oldValue</code>. @throws NullPointerException if the specified key or value is null
[ "Atomically", "do", "a", "<code", ">", "put", "(", "key", "newValue", ")", "<", "/", "code", ">", "if", "-", "and", "-", "only", "-", "if", "the", "key", "is", "mapped", "a", "value", "which", "is", "<code", ">", "equals<", "/", "code", ">", "to"...
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/nbhm/NonBlockingIdentityHashMap.java#L354-L356
JOML-CI/JOML
src/org/joml/Matrix4d.java
Matrix4d.rotateAround
public Matrix4d rotateAround(Quaterniondc quat, double ox, double oy, double oz, Matrix4d dest) { if ((properties & PROPERTY_IDENTITY) != 0) return rotationAround(quat, ox, oy, oz); else if ((properties & PROPERTY_AFFINE) != 0) return rotateAroundAffine(quat, ox, oy, oz, this); return rotateAroundGeneric(quat, ox, oy, oz, this); }
java
public Matrix4d rotateAround(Quaterniondc quat, double ox, double oy, double oz, Matrix4d dest) { if ((properties & PROPERTY_IDENTITY) != 0) return rotationAround(quat, ox, oy, oz); else if ((properties & PROPERTY_AFFINE) != 0) return rotateAroundAffine(quat, ox, oy, oz, this); return rotateAroundGeneric(quat, ox, oy, oz, this); }
[ "public", "Matrix4d", "rotateAround", "(", "Quaterniondc", "quat", ",", "double", "ox", ",", "double", "oy", ",", "double", "oz", ",", "Matrix4d", "dest", ")", "{", "if", "(", "(", "properties", "&", "PROPERTY_IDENTITY", ")", "!=", "0", ")", "return", "r...
/* (non-Javadoc) @see org.joml.Matrix4dc#rotateAround(org.joml.Quaterniondc, double, double, double, org.joml.Matrix4d)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4d.java#L5059-L5065
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/internal/LettuceAssert.java
LettuceAssert.noNullElements
public static void noNullElements(Collection<?> c, String message) { if (c != null) { for (Object element : c) { if (element == null) { throw new IllegalArgumentException(message); } } } }
java
public static void noNullElements(Collection<?> c, String message) { if (c != null) { for (Object element : c) { if (element == null) { throw new IllegalArgumentException(message); } } } }
[ "public", "static", "void", "noNullElements", "(", "Collection", "<", "?", ">", "c", ",", "String", "message", ")", "{", "if", "(", "c", "!=", "null", ")", "{", "for", "(", "Object", "element", ":", "c", ")", "{", "if", "(", "element", "==", "null"...
Assert that a {@link java.util.Collection} has no null elements. @param c the collection to check @param message the exception message to use if the assertion fails @throws IllegalArgumentException if the {@link Collection} contains a {@code null} element
[ "Assert", "that", "a", "{", "@link", "java", ".", "util", ".", "Collection", "}", "has", "no", "null", "elements", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/internal/LettuceAssert.java#L112-L120
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java
WorkflowsInner.moveAsync
public Observable<Void> moveAsync(String resourceGroupName, String workflowName, WorkflowInner move) { return moveWithServiceResponseAsync(resourceGroupName, workflowName, move).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> moveAsync(String resourceGroupName, String workflowName, WorkflowInner move) { return moveWithServiceResponseAsync(resourceGroupName, workflowName, move).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "moveAsync", "(", "String", "resourceGroupName", ",", "String", "workflowName", ",", "WorkflowInner", "move", ")", "{", "return", "moveWithServiceResponseAsync", "(", "resourceGroupName", ",", "workflowName", ",", "move", ")...
Moves an existing workflow. @param resourceGroupName The resource group name. @param workflowName The workflow name. @param move The workflow to move. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Moves", "an", "existing", "workflow", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java#L1519-L1526
alipay/sofa-rpc
core/common/src/main/java/com/alipay/sofa/rpc/common/utils/ReflectUtils.java
ReflectUtils.getPropertySetterMethod
public static Method getPropertySetterMethod(Class clazz, String property, Class propertyClazz) { String methodName = "set" + property.substring(0, 1).toUpperCase() + property.substring(1); try { return clazz.getMethod(methodName, propertyClazz); } catch (NoSuchMethodException e) { throw new SofaRpcRuntimeException("No setter method for " + clazz.getName() + "#" + property, e); } }
java
public static Method getPropertySetterMethod(Class clazz, String property, Class propertyClazz) { String methodName = "set" + property.substring(0, 1).toUpperCase() + property.substring(1); try { return clazz.getMethod(methodName, propertyClazz); } catch (NoSuchMethodException e) { throw new SofaRpcRuntimeException("No setter method for " + clazz.getName() + "#" + property, e); } }
[ "public", "static", "Method", "getPropertySetterMethod", "(", "Class", "clazz", ",", "String", "property", ",", "Class", "propertyClazz", ")", "{", "String", "methodName", "=", "\"set\"", "+", "property", ".", "substring", "(", "0", ",", "1", ")", ".", "toUp...
得到set方法 @param clazz 类 @param property 属性 @param propertyClazz 属性 @return Method 方法对象
[ "得到set方法" ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/core/common/src/main/java/com/alipay/sofa/rpc/common/utils/ReflectUtils.java#L126-L133
triceo/splitlog
splitlog-api/src/main/java/com/github/triceo/splitlog/api/LogWatchBuilder.java
LogWatchBuilder.withDelayBetweenReads
public LogWatchBuilder withDelayBetweenReads(final int length, final TimeUnit unit) { this.delayBetweenReads = LogWatchBuilder.getDelay(length, unit); return this; }
java
public LogWatchBuilder withDelayBetweenReads(final int length, final TimeUnit unit) { this.delayBetweenReads = LogWatchBuilder.getDelay(length, unit); return this; }
[ "public", "LogWatchBuilder", "withDelayBetweenReads", "(", "final", "int", "length", ",", "final", "TimeUnit", "unit", ")", "{", "this", ".", "delayBetweenReads", "=", "LogWatchBuilder", ".", "getDelay", "(", "length", ",", "unit", ")", ";", "return", "this", ...
Specify the delay between attempts to read the file. @param length Length of time. @param unit Unit of that length. @return This.
[ "Specify", "the", "delay", "between", "attempts", "to", "read", "the", "file", "." ]
train
https://github.com/triceo/splitlog/blob/4e1b188e8c814119f5cf7343bbc53917843d68a2/splitlog-api/src/main/java/com/github/triceo/splitlog/api/LogWatchBuilder.java#L314-L317
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableResourceManager.java
TransactionableResourceManager.canEnrollChangeToGlobalTx
public boolean canEnrollChangeToGlobalTx(final SessionImpl session, final PlainChangesLog changes) { try { int status; if (tm != null && (status = tm.getStatus()) != Status.STATUS_NO_TRANSACTION) { if (status != Status.STATUS_ACTIVE && status != Status.STATUS_PREPARING) { throw new IllegalStateException("The session cannot be enrolled in the current global transaction due " + "to an invalidate state, the current status is " + status + " and only ACTIVE and PREPARING are allowed"); } SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<Void>() { public Void run() throws Exception { add(session, changes); return null; } }); return true; } } catch (PrivilegedActionException e) { log.warn("Could not check if a global Tx has been started or register the session into the resource manager", e); } catch (SystemException e) { log.warn("Could not check if a global Tx has been started or register the session into the resource manager", e); } return false; }
java
public boolean canEnrollChangeToGlobalTx(final SessionImpl session, final PlainChangesLog changes) { try { int status; if (tm != null && (status = tm.getStatus()) != Status.STATUS_NO_TRANSACTION) { if (status != Status.STATUS_ACTIVE && status != Status.STATUS_PREPARING) { throw new IllegalStateException("The session cannot be enrolled in the current global transaction due " + "to an invalidate state, the current status is " + status + " and only ACTIVE and PREPARING are allowed"); } SecurityHelper.doPrivilegedExceptionAction(new PrivilegedExceptionAction<Void>() { public Void run() throws Exception { add(session, changes); return null; } }); return true; } } catch (PrivilegedActionException e) { log.warn("Could not check if a global Tx has been started or register the session into the resource manager", e); } catch (SystemException e) { log.warn("Could not check if a global Tx has been started or register the session into the resource manager", e); } return false; }
[ "public", "boolean", "canEnrollChangeToGlobalTx", "(", "final", "SessionImpl", "session", ",", "final", "PlainChangesLog", "changes", ")", "{", "try", "{", "int", "status", ";", "if", "(", "tm", "!=", "null", "&&", "(", "status", "=", "tm", ".", "getStatus",...
Checks if a global Tx has been started if so the session and its change will be dynamically enrolled @param session the session to enlist in case a Global Tx has been started @param changes the changes to enlist in case a Global Tx has been started @return <code>true</code> if a global Tx has been started and the session and its change could be enrolled successfully, <code>false</code> otherwise @throws IllegalStateException if the current status of the global transaction is not appropriate
[ "Checks", "if", "a", "global", "Tx", "has", "been", "started", "if", "so", "the", "session", "and", "its", "change", "will", "be", "dynamically", "enrolled" ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableResourceManager.java#L209-L244
dkpro/dkpro-jwpl
de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java
WikipediaTemplateInfo.getPagesNotContainingTemplateNames
public Iterable<Page> getPagesNotContainingTemplateNames(List<String> templateNames) throws WikiApiException{ return getFilteredPages(templateNames, false); }
java
public Iterable<Page> getPagesNotContainingTemplateNames(List<String> templateNames) throws WikiApiException{ return getFilteredPages(templateNames, false); }
[ "public", "Iterable", "<", "Page", ">", "getPagesNotContainingTemplateNames", "(", "List", "<", "String", ">", "templateNames", ")", "throws", "WikiApiException", "{", "return", "getFilteredPages", "(", "templateNames", ",", "false", ")", ";", "}" ]
Return an iterable containing all pages that do NOT contain a template the name of which equals of the given Strings. @param templateNames the names of the template that we want to match @return An iterable with the page objects that do NOT contain any of the the specified templates @throws WikiApiException If there was any error retrieving the page object (most likely if the templates are corrupted)
[ "Return", "an", "iterable", "containing", "all", "pages", "that", "do", "NOT", "contain", "a", "template", "the", "name", "of", "which", "equals", "of", "the", "given", "Strings", "." ]
train
https://github.com/dkpro/dkpro-jwpl/blob/0a0304b6a0aa13acc18838957994e06dd4613a58/de.tudarmstadt.ukp.wikipedia.util/src/main/java/de/tudarmstadt/ukp/wikipedia/util/templates/WikipediaTemplateInfo.java#L527-L529
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/data/WaveformFinder.java
WaveformFinder.getWaveformPreview
WaveformPreview getWaveformPreview(int rekordboxId, SlotReference slot, Client client) throws IOException { final NumberField idField = new NumberField(rekordboxId); // First try to get the NXS2-style color waveform if we are supposed to. if (preferColor.get()) { try { Message response = client.simpleRequest(Message.KnownType.ANLZ_TAG_REQ, Message.KnownType.ANLZ_TAG, client.buildRMST(Message.MenuIdentifier.MAIN_MENU, slot.slot), idField, new NumberField(Message.ANLZ_FILE_TAG_COLOR_WAVEFORM_PREVIEW), new NumberField(Message.ALNZ_FILE_TYPE_EXT)); return new WaveformPreview(new DataReference(slot, rekordboxId), response); } catch (Exception e) { logger.info("No color waveform preview available for slot " + slot + ", id " + rekordboxId + "; requesting blue version.", e); } } Message response = client.simpleRequest(Message.KnownType.WAVE_PREVIEW_REQ, Message.KnownType.WAVE_PREVIEW, client.buildRMST(Message.MenuIdentifier.DATA, slot.slot), NumberField.WORD_1, idField, NumberField.WORD_0); return new WaveformPreview(new DataReference(slot, rekordboxId), response); }
java
WaveformPreview getWaveformPreview(int rekordboxId, SlotReference slot, Client client) throws IOException { final NumberField idField = new NumberField(rekordboxId); // First try to get the NXS2-style color waveform if we are supposed to. if (preferColor.get()) { try { Message response = client.simpleRequest(Message.KnownType.ANLZ_TAG_REQ, Message.KnownType.ANLZ_TAG, client.buildRMST(Message.MenuIdentifier.MAIN_MENU, slot.slot), idField, new NumberField(Message.ANLZ_FILE_TAG_COLOR_WAVEFORM_PREVIEW), new NumberField(Message.ALNZ_FILE_TYPE_EXT)); return new WaveformPreview(new DataReference(slot, rekordboxId), response); } catch (Exception e) { logger.info("No color waveform preview available for slot " + slot + ", id " + rekordboxId + "; requesting blue version.", e); } } Message response = client.simpleRequest(Message.KnownType.WAVE_PREVIEW_REQ, Message.KnownType.WAVE_PREVIEW, client.buildRMST(Message.MenuIdentifier.DATA, slot.slot), NumberField.WORD_1, idField, NumberField.WORD_0); return new WaveformPreview(new DataReference(slot, rekordboxId), response); }
[ "WaveformPreview", "getWaveformPreview", "(", "int", "rekordboxId", ",", "SlotReference", "slot", ",", "Client", "client", ")", "throws", "IOException", "{", "final", "NumberField", "idField", "=", "new", "NumberField", "(", "rekordboxId", ")", ";", "// First try to...
Requests the waveform preview for a specific track ID, given a connection to a player that has already been set up. @param rekordboxId the track whose waveform preview is desired @param slot identifies the media slot we are querying @param client the dbserver client that is communicating with the appropriate player @return the retrieved waveform preview, or {@code null} if none was available @throws IOException if there is a communication problem
[ "Requests", "the", "waveform", "preview", "for", "a", "specific", "track", "ID", "given", "a", "connection", "to", "a", "player", "that", "has", "already", "been", "set", "up", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/data/WaveformFinder.java#L480-L502
dashorst/wicket-stuff-markup-validator
isorelax/src/main/java/org/iso_relax/verifier/VerifierFactory.java
VerifierFactory.newVerifier
public Verifier newVerifier(InputStream stream, String systemId ) throws VerifierConfigurationException, SAXException, IOException { return compileSchema(stream,systemId).newVerifier(); }
java
public Verifier newVerifier(InputStream stream, String systemId ) throws VerifierConfigurationException, SAXException, IOException { return compileSchema(stream,systemId).newVerifier(); }
[ "public", "Verifier", "newVerifier", "(", "InputStream", "stream", ",", "String", "systemId", ")", "throws", "VerifierConfigurationException", ",", "SAXException", ",", "IOException", "{", "return", "compileSchema", "(", "stream", ",", "systemId", ")", ".", "newVeri...
parses a schema from the specified InputStream and returns a Verifier object that validates documents by using that schema. @param systemId System ID of this stream.
[ "parses", "a", "schema", "from", "the", "specified", "InputStream", "and", "returns", "a", "Verifier", "object", "that", "validates", "documents", "by", "using", "that", "schema", "." ]
train
https://github.com/dashorst/wicket-stuff-markup-validator/blob/9e529a4dc8bfdbbe4c794f3132ef400a006560a1/isorelax/src/main/java/org/iso_relax/verifier/VerifierFactory.java#L77-L81
jparsec/jparsec
jparsec/src/main/java/org/jparsec/Scanners.java
Scanners.notChar2
private static Pattern notChar2(final char c1, final char c2) { return new Pattern() { @Override public int match(CharSequence src, int begin, int end) { if (begin == end - 1) return 1; if (begin >= end) return MISMATCH; if (src.charAt(begin) == c1 && src.charAt(begin + 1) == c2) return Pattern.MISMATCH; return 1; } }; }
java
private static Pattern notChar2(final char c1, final char c2) { return new Pattern() { @Override public int match(CharSequence src, int begin, int end) { if (begin == end - 1) return 1; if (begin >= end) return MISMATCH; if (src.charAt(begin) == c1 && src.charAt(begin + 1) == c2) return Pattern.MISMATCH; return 1; } }; }
[ "private", "static", "Pattern", "notChar2", "(", "final", "char", "c1", ",", "final", "char", "c2", ")", "{", "return", "new", "Pattern", "(", ")", "{", "@", "Override", "public", "int", "match", "(", "CharSequence", "src", ",", "int", "begin", ",", "i...
Matches a character if the input has at least 1 character, or if the input has at least 2 characters with the first 2 characters not being {@code c1} and {@code c2}. @return the Pattern object.
[ "Matches", "a", "character", "if", "the", "input", "has", "at", "least", "1", "character", "or", "if", "the", "input", "has", "at", "least", "2", "characters", "with", "the", "first", "2", "characters", "not", "being", "{", "@code", "c1", "}", "and", "...
train
https://github.com/jparsec/jparsec/blob/df1280259f5da9eb5ffc537437569dddba66cb94/jparsec/src/main/java/org/jparsec/Scanners.java#L558-L567
dbracewell/hermes
hermes-core/src/main/java/com/davidbracewell/hermes/extraction/regex/TokenRegex.java
TokenRegex.matchFirst
public Optional<HString> matchFirst(HString text) { TokenMatcher matcher = new TokenMatcher(nfa, text); if (matcher.find()) { return Optional.of(matcher.group()); } return Optional.empty(); }
java
public Optional<HString> matchFirst(HString text) { TokenMatcher matcher = new TokenMatcher(nfa, text); if (matcher.find()) { return Optional.of(matcher.group()); } return Optional.empty(); }
[ "public", "Optional", "<", "HString", ">", "matchFirst", "(", "HString", "text", ")", "{", "TokenMatcher", "matcher", "=", "new", "TokenMatcher", "(", "nfa", ",", "text", ")", ";", "if", "(", "matcher", ".", "find", "(", ")", ")", "{", "return", "Optio...
Match first optional. @param text the text @return the optional
[ "Match", "first", "optional", "." ]
train
https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-core/src/main/java/com/davidbracewell/hermes/extraction/regex/TokenRegex.java#L257-L263
RestComm/sipunit
src/main/java/org/cafesip/sipunit/SipSession.java
SipSession.waitResponse
public EventObject waitResponse(SipTransaction trans, long timeout) { // TODO later: waitResponse() for nontransactional-request case initErrorInfo(); synchronized (trans.getBlock()) { LinkedList<EventObject> events = trans.getEvents(); if (events.isEmpty()) { try { trans.getBlock().waitForEvent(timeout); } catch (Exception ex) { setException(ex); setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage()); setReturnCode(EXCEPTION_ENCOUNTERED); return null; } } if (events.isEmpty()) { setReturnCode(TIMEOUT_OCCURRED); setErrorMessage("The maximum amount of time to wait for a response message has elapsed."); return null; } return (EventObject) events.removeFirst(); } }
java
public EventObject waitResponse(SipTransaction trans, long timeout) { // TODO later: waitResponse() for nontransactional-request case initErrorInfo(); synchronized (trans.getBlock()) { LinkedList<EventObject> events = trans.getEvents(); if (events.isEmpty()) { try { trans.getBlock().waitForEvent(timeout); } catch (Exception ex) { setException(ex); setErrorMessage("Exception: " + ex.getClass().getName() + ": " + ex.getMessage()); setReturnCode(EXCEPTION_ENCOUNTERED); return null; } } if (events.isEmpty()) { setReturnCode(TIMEOUT_OCCURRED); setErrorMessage("The maximum amount of time to wait for a response message has elapsed."); return null; } return (EventObject) events.removeFirst(); } }
[ "public", "EventObject", "waitResponse", "(", "SipTransaction", "trans", ",", "long", "timeout", ")", "{", "// TODO later: waitResponse() for nontransactional-request case", "initErrorInfo", "(", ")", ";", "synchronized", "(", "trans", ".", "getBlock", "(", ")", ")", ...
The waitResponse() method waits for a response to a previously sent transactional request message. Call this method after using one of the sendRequestWithTransaction() methods. This method blocks until one of the following occurs: 1) A javax.sip.ResponseEvent is received. This is the object returned by this method. 2) A javax.sip.TimeoutEvent is received. This is the object returned by this method. 3) The wait timeout period specified by the parameter to this method expires. Null is returned in this case. 4) An error occurs. Null is returned in this case. Note that this method can be called repeatedly upon receipt of provisional response message(s). @param trans The SipTransaction object associated with the sent request. @param timeout The maximum amount of time to wait, in milliseconds. Use a value of 0 to wait indefinitely. @return A javax.sip.ResponseEvent, javax.sip.TimeoutEvent, or null in the case of wait timeout or error. If null, call getReturnCode() and/or getErrorMessage() and, if applicable, getException() for further diagnostics.
[ "The", "waitResponse", "()", "method", "waits", "for", "a", "response", "to", "a", "previously", "sent", "transactional", "request", "message", ".", "Call", "this", "method", "after", "using", "one", "of", "the", "sendRequestWithTransaction", "()", "methods", "....
train
https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/SipSession.java#L1125-L1151
Alluxio/alluxio
core/common/src/main/java/alluxio/extensions/ExtensionFactoryRegistry.java
ExtensionFactoryRegistry.scanLibs
private void scanLibs(List<T> factories, String libDir) { LOG.info("Loading core jars from {}", libDir); List<File> files = new ArrayList<>(); try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get(libDir), mExtensionPattern)) { for (Path entry : stream) { if (entry.toFile().isFile()) { files.add(entry.toFile()); } } } catch (IOException e) { LOG.warn("Failed to load libs: {}", e.toString()); } scan(files, factories); }
java
private void scanLibs(List<T> factories, String libDir) { LOG.info("Loading core jars from {}", libDir); List<File> files = new ArrayList<>(); try (DirectoryStream<Path> stream = Files.newDirectoryStream(Paths.get(libDir), mExtensionPattern)) { for (Path entry : stream) { if (entry.toFile().isFile()) { files.add(entry.toFile()); } } } catch (IOException e) { LOG.warn("Failed to load libs: {}", e.toString()); } scan(files, factories); }
[ "private", "void", "scanLibs", "(", "List", "<", "T", ">", "factories", ",", "String", "libDir", ")", "{", "LOG", ".", "info", "(", "\"Loading core jars from {}\"", ",", "libDir", ")", ";", "List", "<", "File", ">", "files", "=", "new", "ArrayList", "<>"...
Finds all factory from the lib directory. @param factories list of factories to add to
[ "Finds", "all", "factory", "from", "the", "lib", "directory", "." ]
train
https://github.com/Alluxio/alluxio/blob/af38cf3ab44613355b18217a3a4d961f8fec3a10/core/common/src/main/java/alluxio/extensions/ExtensionFactoryRegistry.java#L169-L183
facebook/fresco
imagepipeline-base/src/main/java/com/facebook/imageutils/StreamProcessor.java
StreamProcessor.readPackedInt
public static int readPackedInt(InputStream is, int numBytes, boolean isLittleEndian) throws IOException { int value = 0; for (int i = 0; i < numBytes; i++) { int b = is.read(); if (b == -1) { throw new IOException("no more bytes"); } if (isLittleEndian) { value |= (b & 0xFF) << (i * 8); } else { value = (value << 8) | (b & 0xFF); } } return value; }
java
public static int readPackedInt(InputStream is, int numBytes, boolean isLittleEndian) throws IOException { int value = 0; for (int i = 0; i < numBytes; i++) { int b = is.read(); if (b == -1) { throw new IOException("no more bytes"); } if (isLittleEndian) { value |= (b & 0xFF) << (i * 8); } else { value = (value << 8) | (b & 0xFF); } } return value; }
[ "public", "static", "int", "readPackedInt", "(", "InputStream", "is", ",", "int", "numBytes", ",", "boolean", "isLittleEndian", ")", "throws", "IOException", "{", "int", "value", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "numBytes",...
Consumes up to 4 bytes and returns them as int (taking into account endianess). Throws exception if specified number of bytes cannot be consumed. @param is the input stream to read bytes from @param numBytes the number of bytes to read @param isLittleEndian whether the bytes should be interpreted in little or big endian format @return packed int read from input stream and constructed according to endianness
[ "Consumes", "up", "to", "4", "bytes", "and", "returns", "them", "as", "int", "(", "taking", "into", "account", "endianess", ")", ".", "Throws", "exception", "if", "specified", "number", "of", "bytes", "cannot", "be", "consumed", "." ]
train
https://github.com/facebook/fresco/blob/0b85879d51c5036d5e46e627a6651afefc0b971a/imagepipeline-base/src/main/java/com/facebook/imageutils/StreamProcessor.java#L26-L41
Graylog2/graylog2-server
graylog2-server/src/main/java/org/graylog2/plugin/inject/Graylog2Module.java
Graylog2Module.registerJacksonSubtype
protected void registerJacksonSubtype(Class<?> klass, String name) { jacksonSubTypesBinder().addBinding().toInstance(new NamedType(klass, name)); }
java
protected void registerJacksonSubtype(Class<?> klass, String name) { jacksonSubTypesBinder().addBinding().toInstance(new NamedType(klass, name)); }
[ "protected", "void", "registerJacksonSubtype", "(", "Class", "<", "?", ">", "klass", ",", "String", "name", ")", "{", "jacksonSubTypesBinder", "(", ")", ".", "addBinding", "(", ")", ".", "toInstance", "(", "new", "NamedType", "(", "klass", ",", "name", ")"...
Use this if the class does not have a {@link com.fasterxml.jackson.annotation.JsonTypeName} annotation. @param klass @param name
[ "Use", "this", "if", "the", "class", "does", "not", "have", "a", "{" ]
train
https://github.com/Graylog2/graylog2-server/blob/50b565dcead6e0a372236d5c2f8530dc5726fa9b/graylog2-server/src/main/java/org/graylog2/plugin/inject/Graylog2Module.java#L455-L457
geomajas/geomajas-project-client-gwt2
plugin/tms/tms/src/main/java/org/geomajas/gwt2/plugin/tms/client/TmsClient.java
TmsClient.createTmsMap
protected MapConfiguration createTmsMap(Profile profile, int nrOfZoomLevels) { MapConfiguration mapConfiguration = null; switch (profile) { case GLOBAL_GEODETIC: mapConfiguration = createTmsMap("EPSG:4326", CrsType.DEGREES, new Bbox(-180, -90, 360, 180), 256, nrOfZoomLevels); break; case GLOBAL_MERCATOR: mapConfiguration = createTmsMap("EPSG:3857", CrsType.METRIC, new Bbox(-MERCATOR, -MERCATOR, 2 * MERCATOR, 2 * MERCATOR), 256, nrOfZoomLevels); break; default: throw new IllegalArgumentException("Local profiles not supported"); } mapConfiguration.setHintValue(PROFILE, profile); return mapConfiguration; }
java
protected MapConfiguration createTmsMap(Profile profile, int nrOfZoomLevels) { MapConfiguration mapConfiguration = null; switch (profile) { case GLOBAL_GEODETIC: mapConfiguration = createTmsMap("EPSG:4326", CrsType.DEGREES, new Bbox(-180, -90, 360, 180), 256, nrOfZoomLevels); break; case GLOBAL_MERCATOR: mapConfiguration = createTmsMap("EPSG:3857", CrsType.METRIC, new Bbox(-MERCATOR, -MERCATOR, 2 * MERCATOR, 2 * MERCATOR), 256, nrOfZoomLevels); break; default: throw new IllegalArgumentException("Local profiles not supported"); } mapConfiguration.setHintValue(PROFILE, profile); return mapConfiguration; }
[ "protected", "MapConfiguration", "createTmsMap", "(", "Profile", "profile", ",", "int", "nrOfZoomLevels", ")", "{", "MapConfiguration", "mapConfiguration", "=", "null", ";", "switch", "(", "profile", ")", "{", "case", "GLOBAL_GEODETIC", ":", "mapConfiguration", "=",...
Create a map with one of the default profiles and a specific number of zoom levels (default = 21). @param profile @param nrOfZoomLevels @return
[ "Create", "a", "map", "with", "one", "of", "the", "default", "profiles", "and", "a", "specific", "number", "of", "zoom", "levels", "(", "default", "=", "21", ")", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/tms/tms/src/main/java/org/geomajas/gwt2/plugin/tms/client/TmsClient.java#L285-L301
TNG/JGiven
jgiven-core/src/main/java/com/tngtech/jgiven/attachment/Attachment.java
Attachment.fromText
public static Attachment fromText( String content, MediaType mediaType ) { if( mediaType.isBinary() ) { throw new IllegalArgumentException( "MediaType must not be binary" ); } return new Attachment( content, mediaType ); }
java
public static Attachment fromText( String content, MediaType mediaType ) { if( mediaType.isBinary() ) { throw new IllegalArgumentException( "MediaType must not be binary" ); } return new Attachment( content, mediaType ); }
[ "public", "static", "Attachment", "fromText", "(", "String", "content", ",", "MediaType", "mediaType", ")", "{", "if", "(", "mediaType", ".", "isBinary", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"MediaType must not be binary\"", ")", ...
Equivalent to {@link com.tngtech.jgiven.attachment.Attachment#Attachment(String, MediaType)} @throws java.lang.IllegalArgumentException if mediaType is binary
[ "Equivalent", "to", "{" ]
train
https://github.com/TNG/JGiven/blob/1a69248fc6d7eb380cdc4542e3be273842889748/jgiven-core/src/main/java/com/tngtech/jgiven/attachment/Attachment.java#L239-L244
CenturyLinkCloud/clc-java-sdk
sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/InvoiceService.java
InvoiceService.getInvoice
public InvoiceData getInvoice(Date date, String pricingAccountAlias) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return getInvoice(calendar, pricingAccountAlias); }
java
public InvoiceData getInvoice(Date date, String pricingAccountAlias) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return getInvoice(calendar, pricingAccountAlias); }
[ "public", "InvoiceData", "getInvoice", "(", "Date", "date", ",", "String", "pricingAccountAlias", ")", "{", "Calendar", "calendar", "=", "Calendar", ".", "getInstance", "(", ")", ";", "calendar", ".", "setTime", "(", "date", ")", ";", "return", "getInvoice", ...
Gets a list of invoicing data for a given account alias for a given month. @param date Date of usage @param pricingAccountAlias Short code of the account that sends the invoice for the accountAlias @return the invoice data
[ "Gets", "a", "list", "of", "invoicing", "data", "for", "a", "given", "account", "alias", "for", "a", "given", "month", "." ]
train
https://github.com/CenturyLinkCloud/clc-java-sdk/blob/c026322f077dea71b1acf9f2d665253d79d9bf85/sdk/src/main/java/com/centurylink/cloud/sdk/server/services/dsl/InvoiceService.java#L53-L58
networknt/light-4j
utility/src/main/java/com/networknt/utility/NioUtils.java
NioUtils.createZipFileSystem
private static FileSystem createZipFileSystem(String zipFilename, boolean create) throws IOException { // convert the filename to a URI final Path path = Paths.get(zipFilename); if(Files.notExists(path.getParent())) { Files.createDirectories(path.getParent()); } final URI uri = URI.create("jar:file:" + path.toUri().getPath()); final Map<String, String> env = new HashMap<>(); if (create) { env.put("create", "true"); } return FileSystems.newFileSystem(uri, env); }
java
private static FileSystem createZipFileSystem(String zipFilename, boolean create) throws IOException { // convert the filename to a URI final Path path = Paths.get(zipFilename); if(Files.notExists(path.getParent())) { Files.createDirectories(path.getParent()); } final URI uri = URI.create("jar:file:" + path.toUri().getPath()); final Map<String, String> env = new HashMap<>(); if (create) { env.put("create", "true"); } return FileSystems.newFileSystem(uri, env); }
[ "private", "static", "FileSystem", "createZipFileSystem", "(", "String", "zipFilename", ",", "boolean", "create", ")", "throws", "IOException", "{", "// convert the filename to a URI", "final", "Path", "path", "=", "Paths", ".", "get", "(", "zipFilename", ")", ";", ...
Returns a zip file system @param zipFilename to construct the file system from @param create true if the zip file should be created @return a zip file system @throws IOException
[ "Returns", "a", "zip", "file", "system" ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/NioUtils.java#L54-L68
feedzai/pdb
src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java
AbstractDatabaseEngine.executeUpdate
@Override public synchronized int executeUpdate(final String query) throws DatabaseEngineException { Statement s = null; try { getConnection(); s = conn.createStatement(); return s.executeUpdate(query); } catch (final Exception ex) { throw new DatabaseEngineException("Error handling native query", ex); } finally { if (s != null) { try { s.close(); } catch (final Exception e) { logger.trace("Error closing statement.", e); } } } }
java
@Override public synchronized int executeUpdate(final String query) throws DatabaseEngineException { Statement s = null; try { getConnection(); s = conn.createStatement(); return s.executeUpdate(query); } catch (final Exception ex) { throw new DatabaseEngineException("Error handling native query", ex); } finally { if (s != null) { try { s.close(); } catch (final Exception e) { logger.trace("Error closing statement.", e); } } } }
[ "@", "Override", "public", "synchronized", "int", "executeUpdate", "(", "final", "String", "query", ")", "throws", "DatabaseEngineException", "{", "Statement", "s", "=", "null", ";", "try", "{", "getConnection", "(", ")", ";", "s", "=", "conn", ".", "createS...
Executes a native query. @param query The query to execute. @return The number of rows updated. @throws DatabaseEngineException If something goes wrong executing the native query.
[ "Executes", "a", "native", "query", "." ]
train
https://github.com/feedzai/pdb/blob/fe07ca08417e0ddcd620a36aa1fdbca7f338be98/src/main/java/com/feedzai/commons/sql/abstraction/engine/AbstractDatabaseEngine.java#L816-L834
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.createKeyAsync
public ServiceFuture<KeyBundle> createKeyAsync(String vaultBaseUrl, String keyName, JsonWebKeyType kty, final ServiceCallback<KeyBundle> serviceCallback) { return ServiceFuture.fromResponse(createKeyWithServiceResponseAsync(vaultBaseUrl, keyName, kty), serviceCallback); }
java
public ServiceFuture<KeyBundle> createKeyAsync(String vaultBaseUrl, String keyName, JsonWebKeyType kty, final ServiceCallback<KeyBundle> serviceCallback) { return ServiceFuture.fromResponse(createKeyWithServiceResponseAsync(vaultBaseUrl, keyName, kty), serviceCallback); }
[ "public", "ServiceFuture", "<", "KeyBundle", ">", "createKeyAsync", "(", "String", "vaultBaseUrl", ",", "String", "keyName", ",", "JsonWebKeyType", "kty", ",", "final", "ServiceCallback", "<", "KeyBundle", ">", "serviceCallback", ")", "{", "return", "ServiceFuture",...
Creates a new key, stores it, then returns key parameters and attributes to the client. The create key operation can be used to create any key type in Azure Key Vault. If the named key already exists, Azure Key Vault creates a new version of the key. It requires the keys/create permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName The name for the new key. The system will generate the version name for the new key. @param kty The type of key to create. For valid values, see JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA', 'RSA-HSM', 'oct' @param serviceCallback the async ServiceCallback to handle successful and failed responses. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceFuture} object
[ "Creates", "a", "new", "key", "stores", "it", "then", "returns", "key", "parameters", "and", "attributes", "to", "the", "client", ".", "The", "create", "key", "operation", "can", "be", "used", "to", "create", "any", "key", "type", "in", "Azure", "Key", "...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L666-L668
voldemort/voldemort
src/java/voldemort/client/rebalance/RebalanceScheduler.java
RebalanceScheduler.doneTask
public synchronized void doneTask(int stealerId, int donorId) { removeNodesFromWorkerList(Arrays.asList(stealerId, donorId)); numTasksExecuting--; doneSignal.countDown(); // Try and schedule more tasks now that resources may be available to do // so. scheduleMoreTasks(); }
java
public synchronized void doneTask(int stealerId, int donorId) { removeNodesFromWorkerList(Arrays.asList(stealerId, donorId)); numTasksExecuting--; doneSignal.countDown(); // Try and schedule more tasks now that resources may be available to do // so. scheduleMoreTasks(); }
[ "public", "synchronized", "void", "doneTask", "(", "int", "stealerId", ",", "int", "donorId", ")", "{", "removeNodesFromWorkerList", "(", "Arrays", ".", "asList", "(", "stealerId", ",", "donorId", ")", ")", ";", "numTasksExecuting", "--", ";", "doneSignal", "....
Method must be invoked upon completion of a rebalancing task. It is the task's responsibility to do so. @param stealerId @param donorId
[ "Method", "must", "be", "invoked", "upon", "completion", "of", "a", "rebalancing", "task", ".", "It", "is", "the", "task", "s", "responsibility", "to", "do", "so", "." ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/src/java/voldemort/client/rebalance/RebalanceScheduler.java#L274-L281
igniterealtime/Smack
smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/IoTDataManager.java
IoTDataManager.requestMomentaryValuesReadOut
public List<IoTFieldsExtension> requestMomentaryValuesReadOut(EntityFullJid jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { final XMPPConnection connection = connection(); final int seqNr = nextSeqNr.incrementAndGet(); IoTDataRequest iotDataRequest = new IoTDataRequest(seqNr, true); iotDataRequest.setTo(jid); StanzaFilter doneFilter = new IoTFieldsExtensionFilter(seqNr, true); StanzaFilter dataFilter = new IoTFieldsExtensionFilter(seqNr, false); // Setup the IoTFieldsExtension message collectors before sending the IQ to avoid a data race. StanzaCollector doneCollector = connection.createStanzaCollector(doneFilter); StanzaCollector.Configuration dataCollectorConfiguration = StanzaCollector.newConfiguration().setStanzaFilter( dataFilter).setCollectorToReset(doneCollector); StanzaCollector dataCollector = connection.createStanzaCollector(dataCollectorConfiguration); try { connection.createStanzaCollectorAndSend(iotDataRequest).nextResultOrThrow(); // Wait until a message with an IoTFieldsExtension and the done flag comes in. doneCollector.nextResult(); } finally { // Canceling dataCollector will also cancel the doneCollector since it is configured as dataCollector's // collector to reset. dataCollector.cancel(); } int collectedCount = dataCollector.getCollectedCount(); List<IoTFieldsExtension> res = new ArrayList<>(collectedCount); for (int i = 0; i < collectedCount; i++) { Message message = dataCollector.pollResult(); IoTFieldsExtension iotFieldsExtension = IoTFieldsExtension.from(message); res.add(iotFieldsExtension); } return res; }
java
public List<IoTFieldsExtension> requestMomentaryValuesReadOut(EntityFullJid jid) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException { final XMPPConnection connection = connection(); final int seqNr = nextSeqNr.incrementAndGet(); IoTDataRequest iotDataRequest = new IoTDataRequest(seqNr, true); iotDataRequest.setTo(jid); StanzaFilter doneFilter = new IoTFieldsExtensionFilter(seqNr, true); StanzaFilter dataFilter = new IoTFieldsExtensionFilter(seqNr, false); // Setup the IoTFieldsExtension message collectors before sending the IQ to avoid a data race. StanzaCollector doneCollector = connection.createStanzaCollector(doneFilter); StanzaCollector.Configuration dataCollectorConfiguration = StanzaCollector.newConfiguration().setStanzaFilter( dataFilter).setCollectorToReset(doneCollector); StanzaCollector dataCollector = connection.createStanzaCollector(dataCollectorConfiguration); try { connection.createStanzaCollectorAndSend(iotDataRequest).nextResultOrThrow(); // Wait until a message with an IoTFieldsExtension and the done flag comes in. doneCollector.nextResult(); } finally { // Canceling dataCollector will also cancel the doneCollector since it is configured as dataCollector's // collector to reset. dataCollector.cancel(); } int collectedCount = dataCollector.getCollectedCount(); List<IoTFieldsExtension> res = new ArrayList<>(collectedCount); for (int i = 0; i < collectedCount; i++) { Message message = dataCollector.pollResult(); IoTFieldsExtension iotFieldsExtension = IoTFieldsExtension.from(message); res.add(iotFieldsExtension); } return res; }
[ "public", "List", "<", "IoTFieldsExtension", ">", "requestMomentaryValuesReadOut", "(", "EntityFullJid", "jid", ")", "throws", "NoResponseException", ",", "XMPPErrorException", ",", "NotConnectedException", ",", "InterruptedException", "{", "final", "XMPPConnection", "conne...
Try to read out a things momentary values. @param jid the full JID of the thing to read data from. @return a list with the read out data. @throws NoResponseException @throws XMPPErrorException @throws NotConnectedException @throws InterruptedException
[ "Try", "to", "read", "out", "a", "things", "momentary", "values", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-experimental/src/main/java/org/jivesoftware/smackx/iot/data/IoTDataManager.java#L172-L209
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/vod/VodClient.java
VodClient.reTranscode
public ReTranscodeResponse reTranscode(ReTranscodeRequest request) { checkStringNotEmpty(request.getMediaId(), "Media ID should not be null or empty!"); InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, PATH_MEDIA, request.getMediaId()); internalRequest.addParameter(PARA_RERUN, null); return invokeHttpClient(internalRequest, ReTranscodeResponse.class); }
java
public ReTranscodeResponse reTranscode(ReTranscodeRequest request) { checkStringNotEmpty(request.getMediaId(), "Media ID should not be null or empty!"); InternalRequest internalRequest = createRequest(HttpMethodName.PUT, request, PATH_MEDIA, request.getMediaId()); internalRequest.addParameter(PARA_RERUN, null); return invokeHttpClient(internalRequest, ReTranscodeResponse.class); }
[ "public", "ReTranscodeResponse", "reTranscode", "(", "ReTranscodeRequest", "request", ")", "{", "checkStringNotEmpty", "(", "request", ".", "getMediaId", "(", ")", ",", "\"Media ID should not be null or empty!\"", ")", ";", "InternalRequest", "internalRequest", "=", "crea...
Transcode the media again. Only status is FAILED or PUBLISHED media can use. @param request The request object containing mediaid @return
[ "Transcode", "the", "media", "again", ".", "Only", "status", "is", "FAILED", "or", "PUBLISHED", "media", "can", "use", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/vod/VodClient.java#L887-L896
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/AnnotationUtility.java
AnnotationUtility.forEachAnnotations
public static void forEachAnnotations(Element currentElement, AnnotationFilter filter, AnnotationFoundListener listener) { final Elements elementUtils=BaseProcessor.elementUtils; List<? extends AnnotationMirror> annotationList = elementUtils.getAllAnnotationMirrors(currentElement); String annotationClassName; // boolean valid=true; for (AnnotationMirror annotation : annotationList) { Map<String, String> values = new HashMap<String, String>(); annotationClassName = annotation.getAnnotationType().asElement().toString(); if (filter != null && !filter.isAccepted(annotationClassName)) { continue; } values.clear(); for (Entry<? extends ExecutableElement, ? extends AnnotationValue> annotationItem : elementUtils.getElementValuesWithDefaults(annotation).entrySet()) { String value = annotationItem.getValue().toString(); if (value.startsWith("\"") && value.endsWith("\"")) { value = value.substring(1); value = value.substring(0, value.length() - 1); } values.put(annotationItem.getKey().getSimpleName().toString(), value); } if (listener != null) { listener.onAcceptAnnotation(currentElement, annotationClassName, values); } } }
java
public static void forEachAnnotations(Element currentElement, AnnotationFilter filter, AnnotationFoundListener listener) { final Elements elementUtils=BaseProcessor.elementUtils; List<? extends AnnotationMirror> annotationList = elementUtils.getAllAnnotationMirrors(currentElement); String annotationClassName; // boolean valid=true; for (AnnotationMirror annotation : annotationList) { Map<String, String> values = new HashMap<String, String>(); annotationClassName = annotation.getAnnotationType().asElement().toString(); if (filter != null && !filter.isAccepted(annotationClassName)) { continue; } values.clear(); for (Entry<? extends ExecutableElement, ? extends AnnotationValue> annotationItem : elementUtils.getElementValuesWithDefaults(annotation).entrySet()) { String value = annotationItem.getValue().toString(); if (value.startsWith("\"") && value.endsWith("\"")) { value = value.substring(1); value = value.substring(0, value.length() - 1); } values.put(annotationItem.getKey().getSimpleName().toString(), value); } if (listener != null) { listener.onAcceptAnnotation(currentElement, annotationClassName, values); } } }
[ "public", "static", "void", "forEachAnnotations", "(", "Element", "currentElement", ",", "AnnotationFilter", "filter", ",", "AnnotationFoundListener", "listener", ")", "{", "final", "Elements", "elementUtils", "=", "BaseProcessor", ".", "elementUtils", ";", "List", "<...
Iterate over annotations of currentElement. Accept only annotation in accepted set. @param currentElement the current element @param filter the filter @param listener the listener
[ "Iterate", "over", "annotations", "of", "currentElement", ".", "Accept", "only", "annotation", "in", "accepted", "set", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/core/reflect/AnnotationUtility.java#L145-L173
alipay/sofa-rpc
extension-impl/extension-common/src/main/java/com/alipay/sofa/rpc/registry/utils/RegistryUtils.java
RegistryUtils.initOrAddList
public static <K, V> void initOrAddList(Map<K, List<V>> orginMap, K key, V needAdd) { List<V> listeners = orginMap.get(key); if (listeners == null) { listeners = new CopyOnWriteArrayList<V>(); listeners.add(needAdd); orginMap.put(key, listeners); } else { listeners.add(needAdd); } }
java
public static <K, V> void initOrAddList(Map<K, List<V>> orginMap, K key, V needAdd) { List<V> listeners = orginMap.get(key); if (listeners == null) { listeners = new CopyOnWriteArrayList<V>(); listeners.add(needAdd); orginMap.put(key, listeners); } else { listeners.add(needAdd); } }
[ "public", "static", "<", "K", ",", "V", ">", "void", "initOrAddList", "(", "Map", "<", "K", ",", "List", "<", "V", ">", ">", "orginMap", ",", "K", "key", ",", "V", "needAdd", ")", "{", "List", "<", "V", ">", "listeners", "=", "orginMap", ".", "...
Init or add list. @param <K> the key parameter @param <V> the value parameter @param orginMap the orgin map @param key the key @param needAdd the need add
[ "Init", "or", "add", "list", "." ]
train
https://github.com/alipay/sofa-rpc/blob/a31406410291e56696185a29c3ba4bd1f54488fd/extension-impl/extension-common/src/main/java/com/alipay/sofa/rpc/registry/utils/RegistryUtils.java#L252-L261
fcrepo3/fcrepo
fcrepo-security/fcrepo-security-pep/src/main/java/org/fcrepo/server/security/xacml/pep/ResponseCacheImpl.java
ResponseCacheImpl.hashAttribute
private static void hashAttribute(Attribute a, MessageDigest dig) { dig.update(a.getId().toString().getBytes()); dig.update(a.getType().toString().getBytes()); dig.update(a.getValue().encode().getBytes()); if (a.getIssuer() != null) { dig.update(a.getIssuer().getBytes()); } if (a.getIssueInstant() != null) { dig.update(a.getIssueInstant().encode().getBytes()); } }
java
private static void hashAttribute(Attribute a, MessageDigest dig) { dig.update(a.getId().toString().getBytes()); dig.update(a.getType().toString().getBytes()); dig.update(a.getValue().encode().getBytes()); if (a.getIssuer() != null) { dig.update(a.getIssuer().getBytes()); } if (a.getIssueInstant() != null) { dig.update(a.getIssueInstant().encode().getBytes()); } }
[ "private", "static", "void", "hashAttribute", "(", "Attribute", "a", ",", "MessageDigest", "dig", ")", "{", "dig", ".", "update", "(", "a", ".", "getId", "(", ")", ".", "toString", "(", ")", ".", "getBytes", "(", ")", ")", ";", "dig", ".", "update", ...
Utility function to add an attribute to the hash digest. @param a the attribute to hash
[ "Utility", "function", "to", "add", "an", "attribute", "to", "the", "hash", "digest", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-security/fcrepo-security-pep/src/main/java/org/fcrepo/server/security/xacml/pep/ResponseCacheImpl.java#L303-L313
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/QuerySnapshot.java
QuerySnapshot.withChanges
public static QuerySnapshot withChanges( final Query query, Timestamp readTime, final DocumentSet documentSet, final List<DocumentChange> documentChanges) { return new QuerySnapshot(query, readTime) { volatile List<QueryDocumentSnapshot> documents; @Nonnull @Override public List<QueryDocumentSnapshot> getDocuments() { if (documents == null) { synchronized (documentSet) { if (documents == null) { documents = documentSet.toList(); } } } return Collections.unmodifiableList(documents); } @Nonnull @Override public List<DocumentChange> getDocumentChanges() { return Collections.unmodifiableList(documentChanges); } @Override public int size() { return documentSet.size(); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } QuerySnapshot that = (QuerySnapshot) o; return Objects.equals(query, that.query) && Objects.equals(this.size(), that.size()) && Objects.equals(this.getDocumentChanges(), that.getDocumentChanges()) && Objects.equals(this.getDocuments(), that.getDocuments()); } @Override public int hashCode() { return Objects.hash(query, this.getDocumentChanges(), this.getDocuments()); } }; }
java
public static QuerySnapshot withChanges( final Query query, Timestamp readTime, final DocumentSet documentSet, final List<DocumentChange> documentChanges) { return new QuerySnapshot(query, readTime) { volatile List<QueryDocumentSnapshot> documents; @Nonnull @Override public List<QueryDocumentSnapshot> getDocuments() { if (documents == null) { synchronized (documentSet) { if (documents == null) { documents = documentSet.toList(); } } } return Collections.unmodifiableList(documents); } @Nonnull @Override public List<DocumentChange> getDocumentChanges() { return Collections.unmodifiableList(documentChanges); } @Override public int size() { return documentSet.size(); } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } QuerySnapshot that = (QuerySnapshot) o; return Objects.equals(query, that.query) && Objects.equals(this.size(), that.size()) && Objects.equals(this.getDocumentChanges(), that.getDocumentChanges()) && Objects.equals(this.getDocuments(), that.getDocuments()); } @Override public int hashCode() { return Objects.hash(query, this.getDocumentChanges(), this.getDocuments()); } }; }
[ "public", "static", "QuerySnapshot", "withChanges", "(", "final", "Query", "query", ",", "Timestamp", "readTime", ",", "final", "DocumentSet", "documentSet", ",", "final", "List", "<", "DocumentChange", ">", "documentChanges", ")", "{", "return", "new", "QuerySnap...
Creates a new QuerySnapshot representing a snapshot of a Query with changed documents.
[ "Creates", "a", "new", "QuerySnapshot", "representing", "a", "snapshot", "of", "a", "Query", "with", "changed", "documents", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/QuerySnapshot.java#L97-L149
rwl/CSparseJ
src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_permute.java
DZcs_permute.cs_permute
public static DZcs cs_permute(DZcs A, int[] pinv, int[] q, boolean values) { int t, j, k, nz = 0, m, n, Ap[], Ai[], Cp[], Ci[] ; DZcsa Cx = new DZcsa(), Ax = new DZcsa() ; DZcs C ; if (!CS_CSC(A)) return (null); /* check inputs */ m = A.m ; n = A.n ; Ap = A.p ; Ai = A.i ; Ax.x = A.x ; C = cs_spalloc (m, n, Ap [n], values && Ax.x != null, false); /* alloc result */ Cp = C.p ; Ci = C.i ; Cx.x = C.x ; for (k = 0 ; k < n ; k++) { Cp [k] = nz ; /* column k of C is column q[k] of A */ j = q != null ? (q [k]) : k ; for (t = Ap [j] ; t < Ap [j+1] ; t++) { if (Cx.x != null) Cx.set(nz, Ax.get(t)) ; /* row i of A is row pinv[i] of C */ Ci [nz++] = pinv != null ? (pinv [Ai [t]]) : Ai [t] ; } } Cp [n] = nz ; /* finalize the last column of C */ return C ; }
java
public static DZcs cs_permute(DZcs A, int[] pinv, int[] q, boolean values) { int t, j, k, nz = 0, m, n, Ap[], Ai[], Cp[], Ci[] ; DZcsa Cx = new DZcsa(), Ax = new DZcsa() ; DZcs C ; if (!CS_CSC(A)) return (null); /* check inputs */ m = A.m ; n = A.n ; Ap = A.p ; Ai = A.i ; Ax.x = A.x ; C = cs_spalloc (m, n, Ap [n], values && Ax.x != null, false); /* alloc result */ Cp = C.p ; Ci = C.i ; Cx.x = C.x ; for (k = 0 ; k < n ; k++) { Cp [k] = nz ; /* column k of C is column q[k] of A */ j = q != null ? (q [k]) : k ; for (t = Ap [j] ; t < Ap [j+1] ; t++) { if (Cx.x != null) Cx.set(nz, Ax.get(t)) ; /* row i of A is row pinv[i] of C */ Ci [nz++] = pinv != null ? (pinv [Ai [t]]) : Ai [t] ; } } Cp [n] = nz ; /* finalize the last column of C */ return C ; }
[ "public", "static", "DZcs", "cs_permute", "(", "DZcs", "A", ",", "int", "[", "]", "pinv", ",", "int", "[", "]", "q", ",", "boolean", "values", ")", "{", "int", "t", ",", "j", ",", "k", ",", "nz", "=", "0", ",", "m", ",", "n", ",", "Ap", "["...
Permutes a sparse matrix, C = PAQ. @param A m-by-n, column-compressed matrix @param pinv a permutation vector of length m @param q a permutation vector of length n @param values allocate pattern only if false, values and pattern otherwise @return C = PAQ, null on error
[ "Permutes", "a", "sparse", "matrix", "C", "=", "PAQ", "." ]
train
https://github.com/rwl/CSparseJ/blob/6a6f66bccce1558156a961494358952603b0ac84/src/main/java/edu/emory/mathcs/csparsej/tdcomplex/DZcs_permute.java#L55-L77
wcm-io/wcm-io-handler
url/src/main/java/io/wcm/handler/url/suffix/SuffixParser.java
SuffixParser.get
@SuppressWarnings("unchecked") public <T> @Nullable T get(@NotNull String key, @NotNull Class<T> clazz) { if (clazz == String.class) { return (T)getString(key, (String)null); } if (clazz == Boolean.class) { return (T)(Boolean)getBoolean(key, false); } if (clazz == Integer.class) { return (T)(Integer)getInt(key, 0); } if (clazz == Long.class) { return (T)(Long)getLong(key, 0L); } throw new IllegalArgumentException("Unsupported type: " + clazz.getName()); }
java
@SuppressWarnings("unchecked") public <T> @Nullable T get(@NotNull String key, @NotNull Class<T> clazz) { if (clazz == String.class) { return (T)getString(key, (String)null); } if (clazz == Boolean.class) { return (T)(Boolean)getBoolean(key, false); } if (clazz == Integer.class) { return (T)(Integer)getInt(key, 0); } if (clazz == Long.class) { return (T)(Long)getLong(key, 0L); } throw new IllegalArgumentException("Unsupported type: " + clazz.getName()); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", ">", "@", "Nullable", "T", "get", "(", "@", "NotNull", "String", "key", ",", "@", "NotNull", "Class", "<", "T", ">", "clazz", ")", "{", "if", "(", "clazz", "==", "String", ".", ...
Extract the value of a named suffix part from this request's suffix @param key key of the suffix part @param clazz Type expected for return value. Only String, Boolean, Integer, Long are supported. @param <T> Parameter type. @return the value of that named parameter (or the default value if not used)
[ "Extract", "the", "value", "of", "a", "named", "suffix", "part", "from", "this", "request", "s", "suffix" ]
train
https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/url/src/main/java/io/wcm/handler/url/suffix/SuffixParser.java#L82-L97
infinispan/infinispan
lucene/lucene-directory/src/main/java/org/infinispan/lucene/cacheloader/DirectoryLoaderAdaptor.java
DirectoryLoaderAdaptor.loadAllEntries
protected <K, V> void loadAllEntries(final Set<MarshallableEntry<K, V>> entriesCollector, final int maxEntries, MarshallableEntryFactory<K,V> entryFactory) { int existingElements = entriesCollector.size(); int toLoadElements = maxEntries - existingElements; if (toLoadElements <= 0) { return; } HashSet<IndexScopedKey> keysCollector = new HashSet<>(); loadSomeKeys(keysCollector, Collections.EMPTY_SET, toLoadElements); for (IndexScopedKey key : keysCollector) { Object value = load(key); if (value != null) { MarshallableEntry<K,V> cacheEntry = entryFactory.create(key, value); entriesCollector.add(cacheEntry); } } }
java
protected <K, V> void loadAllEntries(final Set<MarshallableEntry<K, V>> entriesCollector, final int maxEntries, MarshallableEntryFactory<K,V> entryFactory) { int existingElements = entriesCollector.size(); int toLoadElements = maxEntries - existingElements; if (toLoadElements <= 0) { return; } HashSet<IndexScopedKey> keysCollector = new HashSet<>(); loadSomeKeys(keysCollector, Collections.EMPTY_SET, toLoadElements); for (IndexScopedKey key : keysCollector) { Object value = load(key); if (value != null) { MarshallableEntry<K,V> cacheEntry = entryFactory.create(key, value); entriesCollector.add(cacheEntry); } } }
[ "protected", "<", "K", ",", "V", ">", "void", "loadAllEntries", "(", "final", "Set", "<", "MarshallableEntry", "<", "K", ",", "V", ">", ">", "entriesCollector", ",", "final", "int", "maxEntries", ",", "MarshallableEntryFactory", "<", "K", ",", "V", ">", ...
Loads all "entries" from the CacheLoader; considering this is actually a Lucene index, that's going to transform segments in entries in a specific order, simplest entries first. @param entriesCollector loaded entries are collected in this set @param maxEntries to limit amount of entries loaded
[ "Loads", "all", "entries", "from", "the", "CacheLoader", ";", "considering", "this", "is", "actually", "a", "Lucene", "index", "that", "s", "going", "to", "transform", "segments", "in", "entries", "in", "a", "specific", "order", "simplest", "entries", "first",...
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/lucene/lucene-directory/src/main/java/org/infinispan/lucene/cacheloader/DirectoryLoaderAdaptor.java#L65-L80
knightliao/disconf
disconf-web/src/main/java/com/baidu/unbiz/common/genericdao/mapper/GenericMapper.java
GenericMapper.load2Entity
private void load2Entity(Object entity, Method setMethod, Object value) throws Exception { try { if (value != null) { setMethod.invoke(entity, value); } } catch (Exception e) { String sValue = value.toString(); String sValueClass = value.getClass().toString(); System.out.println("Error in " + setMethod.getName() + " invoke with param :" + sValue + " type is " + sValueClass); throw e; } }
java
private void load2Entity(Object entity, Method setMethod, Object value) throws Exception { try { if (value != null) { setMethod.invoke(entity, value); } } catch (Exception e) { String sValue = value.toString(); String sValueClass = value.getClass().toString(); System.out.println("Error in " + setMethod.getName() + " invoke with param :" + sValue + " type is " + sValueClass); throw e; } }
[ "private", "void", "load2Entity", "(", "Object", "entity", ",", "Method", "setMethod", ",", "Object", "value", ")", "throws", "Exception", "{", "try", "{", "if", "(", "value", "!=", "null", ")", "{", "setMethod", ".", "invoke", "(", "entity", ",", "value...
@param entity @param setMethod @param value @throws Exception 下午4:06:04 created by Darwin(Tianxin)
[ "@param", "entity", "@param", "setMethod", "@param", "value" ]
train
https://github.com/knightliao/disconf/blob/d413cbce9334fe38a5a24982ce4db3a6ed8e98ea/disconf-web/src/main/java/com/baidu/unbiz/common/genericdao/mapper/GenericMapper.java#L80-L92
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/string/Levenshtein.java
Levenshtein.sorensenDice
@SuppressWarnings("unchecked") public static <T extends Levenshtein> T sorensenDice(String baseTarget, String compareTarget, Integer k) { return (T) new SorensenDice(baseTarget, k).update(compareTarget); }
java
@SuppressWarnings("unchecked") public static <T extends Levenshtein> T sorensenDice(String baseTarget, String compareTarget, Integer k) { return (T) new SorensenDice(baseTarget, k).update(compareTarget); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "<", "T", "extends", "Levenshtein", ">", "T", "sorensenDice", "(", "String", "baseTarget", ",", "String", "compareTarget", ",", "Integer", "k", ")", "{", "return", "(", "T", ")", "new", ...
Returns a new Sorensen-Dice coefficient instance with compare target string and k-shingling @see SorensenDice @param baseTarget @param compareTarget @param k @return
[ "Returns", "a", "new", "Sorensen", "-", "Dice", "coefficient", "instance", "with", "compare", "target", "string", "and", "k", "-", "shingling" ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Levenshtein.java#L308-L311
eclipse/hawkbit
hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java
AmqpMessageHandlerService.onMessage
public Message onMessage(final Message message, final String type, final String tenant, final String virtualHost) { if (StringUtils.isEmpty(type) || StringUtils.isEmpty(tenant)) { throw new AmqpRejectAndDontRequeueException("Invalid message! tenant and type header are mandatory!"); } final SecurityContext oldContext = SecurityContextHolder.getContext(); try { final MessageType messageType = MessageType.valueOf(type); switch (messageType) { case THING_CREATED: setTenantSecurityContext(tenant); registerTarget(message, virtualHost); break; case EVENT: checkContentTypeJson(message); setTenantSecurityContext(tenant); handleIncomingEvent(message); break; case PING: if (isCorrelationIdNotEmpty(message)) { amqpMessageDispatcherService.sendPingReponseToDmfReceiver(message, tenant, virtualHost); } break; default: logAndThrowMessageError(message, "No handle method was found for the given message type."); } } catch (final IllegalArgumentException ex) { throw new AmqpRejectAndDontRequeueException("Invalid message!", ex); } finally { SecurityContextHolder.setContext(oldContext); } return null; }
java
public Message onMessage(final Message message, final String type, final String tenant, final String virtualHost) { if (StringUtils.isEmpty(type) || StringUtils.isEmpty(tenant)) { throw new AmqpRejectAndDontRequeueException("Invalid message! tenant and type header are mandatory!"); } final SecurityContext oldContext = SecurityContextHolder.getContext(); try { final MessageType messageType = MessageType.valueOf(type); switch (messageType) { case THING_CREATED: setTenantSecurityContext(tenant); registerTarget(message, virtualHost); break; case EVENT: checkContentTypeJson(message); setTenantSecurityContext(tenant); handleIncomingEvent(message); break; case PING: if (isCorrelationIdNotEmpty(message)) { amqpMessageDispatcherService.sendPingReponseToDmfReceiver(message, tenant, virtualHost); } break; default: logAndThrowMessageError(message, "No handle method was found for the given message type."); } } catch (final IllegalArgumentException ex) { throw new AmqpRejectAndDontRequeueException("Invalid message!", ex); } finally { SecurityContextHolder.setContext(oldContext); } return null; }
[ "public", "Message", "onMessage", "(", "final", "Message", "message", ",", "final", "String", "type", ",", "final", "String", "tenant", ",", "final", "String", "virtualHost", ")", "{", "if", "(", "StringUtils", ".", "isEmpty", "(", "type", ")", "||", "Stri...
* Executed if a amqp message arrives. @param message the message @param type the type @param tenant the tenant @param virtualHost the virtual host @return the rpc message back to supplier.
[ "*", "Executed", "if", "a", "amqp", "message", "arrives", "." ]
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-dmf/hawkbit-dmf-amqp/src/main/java/org/eclipse/hawkbit/amqp/AmqpMessageHandlerService.java#L126-L158
google/closure-compiler
src/com/google/javascript/jscomp/CheckAccessControls.java
CheckAccessControls.checkTypeDeprecation
private void checkTypeDeprecation(NodeTraversal t, Node n) { if (!shouldEmitDeprecationWarning(t, n)) { return; } ObjectType instanceType = n.getJSType().toMaybeFunctionType().getInstanceType(); String deprecationInfo = getTypeDeprecationInfo(instanceType); if (deprecationInfo == null) { return; } DiagnosticType message = deprecationInfo.isEmpty() ? DEPRECATED_CLASS : DEPRECATED_CLASS_REASON; compiler.report(JSError.make(n, message, instanceType.toString(), deprecationInfo)); }
java
private void checkTypeDeprecation(NodeTraversal t, Node n) { if (!shouldEmitDeprecationWarning(t, n)) { return; } ObjectType instanceType = n.getJSType().toMaybeFunctionType().getInstanceType(); String deprecationInfo = getTypeDeprecationInfo(instanceType); if (deprecationInfo == null) { return; } DiagnosticType message = deprecationInfo.isEmpty() ? DEPRECATED_CLASS : DEPRECATED_CLASS_REASON; compiler.report(JSError.make(n, message, instanceType.toString(), deprecationInfo)); }
[ "private", "void", "checkTypeDeprecation", "(", "NodeTraversal", "t", ",", "Node", "n", ")", "{", "if", "(", "!", "shouldEmitDeprecationWarning", "(", "t", ",", "n", ")", ")", "{", "return", ";", "}", "ObjectType", "instanceType", "=", "n", ".", "getJSType...
Reports deprecation issue with regard to a type usage. <p>Precondition: {@code n} has a constructor {@link JSType}.
[ "Reports", "deprecation", "issue", "with", "regard", "to", "a", "type", "usage", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/CheckAccessControls.java#L431-L445
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/evaluation/clustering/EvaluateClustering.java
EvaluateClustering.evaluteResult
protected void evaluteResult(Database db, Clustering<?> c, Clustering<?> refc) { ClusterContingencyTable contmat = new ClusterContingencyTable(selfPairing, noiseSpecialHandling); contmat.process(refc, c); ScoreResult sr = new ScoreResult(contmat); sr.addHeader(c.getLongName()); db.getHierarchy().add(c, sr); }
java
protected void evaluteResult(Database db, Clustering<?> c, Clustering<?> refc) { ClusterContingencyTable contmat = new ClusterContingencyTable(selfPairing, noiseSpecialHandling); contmat.process(refc, c); ScoreResult sr = new ScoreResult(contmat); sr.addHeader(c.getLongName()); db.getHierarchy().add(c, sr); }
[ "protected", "void", "evaluteResult", "(", "Database", "db", ",", "Clustering", "<", "?", ">", "c", ",", "Clustering", "<", "?", ">", "refc", ")", "{", "ClusterContingencyTable", "contmat", "=", "new", "ClusterContingencyTable", "(", "selfPairing", ",", "noise...
Evaluate a clustering result. @param db Database @param c Clustering @param refc Reference clustering
[ "Evaluate", "a", "clustering", "result", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/evaluation/clustering/EvaluateClustering.java#L174-L181
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/AvailabilitySetsInner.java
AvailabilitySetsInner.getByResourceGroupAsync
public Observable<AvailabilitySetInner> getByResourceGroupAsync(String resourceGroupName, String availabilitySetName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, availabilitySetName).map(new Func1<ServiceResponse<AvailabilitySetInner>, AvailabilitySetInner>() { @Override public AvailabilitySetInner call(ServiceResponse<AvailabilitySetInner> response) { return response.body(); } }); }
java
public Observable<AvailabilitySetInner> getByResourceGroupAsync(String resourceGroupName, String availabilitySetName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, availabilitySetName).map(new Func1<ServiceResponse<AvailabilitySetInner>, AvailabilitySetInner>() { @Override public AvailabilitySetInner call(ServiceResponse<AvailabilitySetInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AvailabilitySetInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "availabilitySetName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "availabilitySetName",...
Retrieves information about an availability set. @param resourceGroupName The name of the resource group. @param availabilitySetName The name of the availability set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AvailabilitySetInner object
[ "Retrieves", "information", "about", "an", "availability", "set", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/AvailabilitySetsInner.java#L301-L308
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/type/ExceptionObjectType.java
ExceptionObjectType.fromExceptionSet
public static Type fromExceptionSet(ExceptionSet exceptionSet) throws ClassNotFoundException { Type commonSupertype = exceptionSet.getCommonSupertype(); if (commonSupertype.getType() != Const.T_OBJECT) { return commonSupertype; } ObjectType exceptionSupertype = (ObjectType) commonSupertype; String className = exceptionSupertype.getClassName(); if ("java.lang.Throwable".equals(className)) { return exceptionSupertype; } return new ExceptionObjectType(className, exceptionSet); }
java
public static Type fromExceptionSet(ExceptionSet exceptionSet) throws ClassNotFoundException { Type commonSupertype = exceptionSet.getCommonSupertype(); if (commonSupertype.getType() != Const.T_OBJECT) { return commonSupertype; } ObjectType exceptionSupertype = (ObjectType) commonSupertype; String className = exceptionSupertype.getClassName(); if ("java.lang.Throwable".equals(className)) { return exceptionSupertype; } return new ExceptionObjectType(className, exceptionSet); }
[ "public", "static", "Type", "fromExceptionSet", "(", "ExceptionSet", "exceptionSet", ")", "throws", "ClassNotFoundException", "{", "Type", "commonSupertype", "=", "exceptionSet", ".", "getCommonSupertype", "(", ")", ";", "if", "(", "commonSupertype", ".", "getType", ...
Initialize object from an exception set. @param exceptionSet the exception set @return a Type that is a supertype of all of the exceptions in the exception set
[ "Initialize", "object", "from", "an", "exception", "set", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/type/ExceptionObjectType.java#L60-L73
cesarferreira/AndroidQuickUtils
library/src/main/java/quickutils/core/categories/voice.java
voice.getSpeechRecognitionResultFromDicionary
public static String getSpeechRecognitionResultFromDicionary(int requestCode, int resultCode, Intent data, ArrayList<String> array) { ArrayList<String> matches = null; if (requestCode == 0 && resultCode == -1) { matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); StringBuilder sb = new StringBuilder(); for (String match : matches) { for (String arrayString : array) { if (arrayString.equals(match)) { return match; } } } } return null; }
java
public static String getSpeechRecognitionResultFromDicionary(int requestCode, int resultCode, Intent data, ArrayList<String> array) { ArrayList<String> matches = null; if (requestCode == 0 && resultCode == -1) { matches = data.getStringArrayListExtra(RecognizerIntent.EXTRA_RESULTS); StringBuilder sb = new StringBuilder(); for (String match : matches) { for (String arrayString : array) { if (arrayString.equals(match)) { return match; } } } } return null; }
[ "public", "static", "String", "getSpeechRecognitionResultFromDicionary", "(", "int", "requestCode", ",", "int", "resultCode", ",", "Intent", "data", ",", "ArrayList", "<", "String", ">", "array", ")", "{", "ArrayList", "<", "String", ">", "matches", "=", "null",...
Get the first result that matches the Result List from Google Speech Recognition activity (DO NOT FORGET call this function on onActivityResult()) and the Dictionary given @param requestCode - onActivityResult request code @param resultCode - onActivityResult result code @param data - onActivityResult Intent data @param array - Dictionary with all keywords @return String with the first result matched or null if was not possible to get any result
[ "Get", "the", "first", "result", "that", "matches", "the", "Result", "List", "from", "Google", "Speech", "Recognition", "activity", "(", "DO", "NOT", "FORGET", "call", "this", "function", "on", "onActivityResult", "()", ")", "and", "the", "Dictionary", "given"...
train
https://github.com/cesarferreira/AndroidQuickUtils/blob/73a91daedbb9f7be7986ea786fbc441c9e5a881c/library/src/main/java/quickutils/core/categories/voice.java#L77-L92
Azure/azure-sdk-for-java
sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysInner.java
ServerKeysInner.beginCreateOrUpdate
public ServerKeyInner beginCreateOrUpdate(String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters).toBlocking().single().body(); }
java
public ServerKeyInner beginCreateOrUpdate(String resourceGroupName, String serverName, String keyName, ServerKeyInner parameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, keyName, parameters).toBlocking().single().body(); }
[ "public", "ServerKeyInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "keyName", ",", "ServerKeyInner", "parameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",...
Creates or updates a server key. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param keyName The name of the server key to be operated on (updated or created). The key name is required to be in the format of 'vault_key_version'. For example, if the keyId is https://YourVaultName.vault.azure.net/keys/YourKeyName/01234567890123456789012345678901, then the server key name should be formatted as: YourVaultName_YourKeyName_01234567890123456789012345678901 @param parameters The requested server key resource state. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ServerKeyInner object if successful.
[ "Creates", "or", "updates", "a", "server", "key", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2015_05_01_preview/src/main/java/com/microsoft/azure/management/sql/v2015_05_01_preview/implementation/ServerKeysInner.java#L406-L408
camunda/camunda-bpm-platform
engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParseUtil.java
BpmnParseUtil.parseOutputParameterElement
public static void parseOutputParameterElement(Element outputParameterElement, IoMapping ioMapping) { String nameAttribute = outputParameterElement.attribute("name"); if(nameAttribute == null || nameAttribute.isEmpty()) { throw new BpmnParseException("Missing attribute 'name' for outputParameter", outputParameterElement); } ParameterValueProvider valueProvider = parseNestedParamValueProvider(outputParameterElement); // add parameter ioMapping.addOutputParameter(new OutputParameter(nameAttribute, valueProvider)); }
java
public static void parseOutputParameterElement(Element outputParameterElement, IoMapping ioMapping) { String nameAttribute = outputParameterElement.attribute("name"); if(nameAttribute == null || nameAttribute.isEmpty()) { throw new BpmnParseException("Missing attribute 'name' for outputParameter", outputParameterElement); } ParameterValueProvider valueProvider = parseNestedParamValueProvider(outputParameterElement); // add parameter ioMapping.addOutputParameter(new OutputParameter(nameAttribute, valueProvider)); }
[ "public", "static", "void", "parseOutputParameterElement", "(", "Element", "outputParameterElement", ",", "IoMapping", "ioMapping", ")", "{", "String", "nameAttribute", "=", "outputParameterElement", ".", "attribute", "(", "\"name\"", ")", ";", "if", "(", "nameAttribu...
Parses a output parameter and adds it to the {@link IoMapping}. @param outputParameterElement the output parameter element @param ioMapping the mapping to add the element @throws BpmnParseException if the output parameter element is malformed
[ "Parses", "a", "output", "parameter", "and", "adds", "it", "to", "the", "{", "@link", "IoMapping", "}", "." ]
train
https://github.com/camunda/camunda-bpm-platform/blob/1a464fc887ef3760e53d6f91b9e5b871a0d77cc0/engine/src/main/java/org/camunda/bpm/engine/impl/bpmn/parser/BpmnParseUtil.java#L136-L146
aws/aws-sdk-java
aws-java-sdk-codepipeline/src/main/java/com/amazonaws/services/codepipeline/model/ActionExecutionInput.java
ActionExecutionInput.withConfiguration
public ActionExecutionInput withConfiguration(java.util.Map<String, String> configuration) { setConfiguration(configuration); return this; }
java
public ActionExecutionInput withConfiguration(java.util.Map<String, String> configuration) { setConfiguration(configuration); return this; }
[ "public", "ActionExecutionInput", "withConfiguration", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "configuration", ")", "{", "setConfiguration", "(", "configuration", ")", ";", "return", "this", ";", "}" ]
<p> Configuration data for an action execution. </p> @param configuration Configuration data for an action execution. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "Configuration", "data", "for", "an", "action", "execution", ".", "<", "/", "p", ">" ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-codepipeline/src/main/java/com/amazonaws/services/codepipeline/model/ActionExecutionInput.java#L119-L122
lionsoul2014/jcseg
jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/ASegment.java
ASegment.findCHName
@Deprecated public boolean findCHName( IWord w, IChunk chunk ) { String s1 = new String(w.getValue().charAt(0)+""); String s2 = new String(w.getValue().charAt(1)+""); if ( dic.match(ILexicon.CN_LNAME, s1) && dic.match(ILexicon.CN_DNAME_1, s2)) { IWord sec = chunk.getWords()[1]; switch ( sec.getLength() ) { case 1: if ( dic.match(ILexicon.CN_DNAME_2, sec.getValue()) ) return true; case 2: String d1 = new String(sec.getValue().charAt(0)+""); IWord _w = dic.get(ILexicon.CJK_WORD, sec.getValue().charAt(1)+""); //System.out.println(_w); if ( dic.match(ILexicon.CN_DNAME_2, d1) && (_w == null || _w.getFrequency() >= config.NAME_SINGLE_THRESHOLD ) ) { return true; } } } return false; }
java
@Deprecated public boolean findCHName( IWord w, IChunk chunk ) { String s1 = new String(w.getValue().charAt(0)+""); String s2 = new String(w.getValue().charAt(1)+""); if ( dic.match(ILexicon.CN_LNAME, s1) && dic.match(ILexicon.CN_DNAME_1, s2)) { IWord sec = chunk.getWords()[1]; switch ( sec.getLength() ) { case 1: if ( dic.match(ILexicon.CN_DNAME_2, sec.getValue()) ) return true; case 2: String d1 = new String(sec.getValue().charAt(0)+""); IWord _w = dic.get(ILexicon.CJK_WORD, sec.getValue().charAt(1)+""); //System.out.println(_w); if ( dic.match(ILexicon.CN_DNAME_2, d1) && (_w == null || _w.getFrequency() >= config.NAME_SINGLE_THRESHOLD ) ) { return true; } } } return false; }
[ "@", "Deprecated", "public", "boolean", "findCHName", "(", "IWord", "w", ",", "IChunk", "chunk", ")", "{", "String", "s1", "=", "new", "String", "(", "w", ".", "getValue", "(", ")", ".", "charAt", "(", "0", ")", "+", "\"\"", ")", ";", "String", "s2...
find the Chinese double name: when the last name and the first char of the name make up a word @param chunk the best chunk. @return boolean
[ "find", "the", "Chinese", "double", "name", ":", "when", "the", "last", "name", "and", "the", "first", "char", "of", "the", "name", "make", "up", "a", "word" ]
train
https://github.com/lionsoul2014/jcseg/blob/7c8a912e3bbcaf4f8de701180b9c24e2e444a94b/jcseg-core/src/main/java/org/lionsoul/jcseg/tokenizer/ASegment.java#L1093-L1119
fcrepo3/fcrepo
fcrepo-server/src/main/java/org/fcrepo/server/validation/ValidationUtility.java
ValidationUtility.validateURL
public static void validateURL(String url, String controlGroup) throws ValidationException { if (!(controlGroup.equalsIgnoreCase("M") || controlGroup.equalsIgnoreCase("E")) && url.startsWith("file:")) { throw new ValidationException( "Malformed URL (file: not allowed for control group " + controlGroup + ") " + url); } try { new URL(url); } catch (MalformedURLException e) { if (url.startsWith(DatastreamManagedContent.UPLOADED_SCHEME)) { return; } throw new ValidationException("Malformed URL: " + url, e); } }
java
public static void validateURL(String url, String controlGroup) throws ValidationException { if (!(controlGroup.equalsIgnoreCase("M") || controlGroup.equalsIgnoreCase("E")) && url.startsWith("file:")) { throw new ValidationException( "Malformed URL (file: not allowed for control group " + controlGroup + ") " + url); } try { new URL(url); } catch (MalformedURLException e) { if (url.startsWith(DatastreamManagedContent.UPLOADED_SCHEME)) { return; } throw new ValidationException("Malformed URL: " + url, e); } }
[ "public", "static", "void", "validateURL", "(", "String", "url", ",", "String", "controlGroup", ")", "throws", "ValidationException", "{", "if", "(", "!", "(", "controlGroup", ".", "equalsIgnoreCase", "(", "\"M\"", ")", "||", "controlGroup", ".", "equalsIgnoreCa...
Validates the candidate URL. The result of the validation also depends on the control group of the datastream in question. Managed datastreams may be ingested using the file URI scheme, other datastreams may not. @param url The URL to validate. @param controlGroup The control group of the datastream the URL belongs to. @throws ValidationException if the URL is malformed.
[ "Validates", "the", "candidate", "URL", ".", "The", "result", "of", "the", "validation", "also", "depends", "on", "the", "control", "group", "of", "the", "datastream", "in", "question", ".", "Managed", "datastreams", "may", "be", "ingested", "using", "the", ...
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-server/src/main/java/org/fcrepo/server/validation/ValidationUtility.java#L59-L74
googleapis/google-cloud-java
google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/ImageInfo.java
ImageInfo.of
public static ImageInfo of(ImageId imageId, ImageConfiguration configuration) { return newBuilder(imageId, configuration).build(); }
java
public static ImageInfo of(ImageId imageId, ImageConfiguration configuration) { return newBuilder(imageId, configuration).build(); }
[ "public", "static", "ImageInfo", "of", "(", "ImageId", "imageId", ",", "ImageConfiguration", "configuration", ")", "{", "return", "newBuilder", "(", "imageId", ",", "configuration", ")", ".", "build", "(", ")", ";", "}" ]
Returns an {@code ImageInfo} object given the image identity and an image configuration. Use {@link DiskImageConfiguration} to create an image from an existing disk. Use {@link StorageImageConfiguration} to create an image from a file stored in Google Cloud Storage.
[ "Returns", "an", "{" ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/deprecated/ImageInfo.java#L390-L392
js-lib-com/commons
src/main/java/js/util/Files.java
Files.inotify
public static boolean inotify(File file, FileNotify notify, int timeout) throws IllegalArgumentException { Params.notNull(file, "File"); Predicate predicate = INOTIFY_PREDICATES.get(notify); if(predicate == null) { throw new BugError("Unsupported file notification |%s|. Missing predicate.", notify); } long timestamp = System.currentTimeMillis() + timeout; while(!predicate.test(file)) { if(timestamp <= System.currentTimeMillis()) { return false; } try { Thread.sleep(500); } catch(InterruptedException unused) { Thread.currentThread().interrupt(); } } return true; }
java
public static boolean inotify(File file, FileNotify notify, int timeout) throws IllegalArgumentException { Params.notNull(file, "File"); Predicate predicate = INOTIFY_PREDICATES.get(notify); if(predicate == null) { throw new BugError("Unsupported file notification |%s|. Missing predicate.", notify); } long timestamp = System.currentTimeMillis() + timeout; while(!predicate.test(file)) { if(timestamp <= System.currentTimeMillis()) { return false; } try { Thread.sleep(500); } catch(InterruptedException unused) { Thread.currentThread().interrupt(); } } return true; }
[ "public", "static", "boolean", "inotify", "(", "File", "file", ",", "FileNotify", "notify", ",", "int", "timeout", ")", "throws", "IllegalArgumentException", "{", "Params", ".", "notNull", "(", "file", ",", "\"File\"", ")", ";", "Predicate", "predicate", "=", ...
Wait for requested action to happen on given file. If <code>timeout</code> is zero or negative this method returns false immediately. <p> This implementation is a fallback solution for JVM without <code>java.nio.file.WatchService</code>. Please consider using watch service when available. @param file file to wait for its state change, @param notify notify type, @param timeout timeout value. @return true if file state change occurred before timeout or false otherwise. @throws IllegalArgumentException if <code>file</code> is null.
[ "Wait", "for", "requested", "action", "to", "happen", "on", "given", "file", ".", "If", "<code", ">", "timeout<", "/", "code", ">", "is", "zero", "or", "negative", "this", "method", "returns", "false", "immediately", ".", "<p", ">", "This", "implementation...
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Files.java#L1113-L1135
josueeduardo/snappy
snappy/src/main/java/io/joshworks/snappy/SnappyServer.java
SnappyServer.patch
public static void patch(String url, HttpConsumer<HttpExchange> endpoint, MediaTypes... mediaTypes) { addResource(Methods.PATCH, url, endpoint, mediaTypes); }
java
public static void patch(String url, HttpConsumer<HttpExchange> endpoint, MediaTypes... mediaTypes) { addResource(Methods.PATCH, url, endpoint, mediaTypes); }
[ "public", "static", "void", "patch", "(", "String", "url", ",", "HttpConsumer", "<", "HttpExchange", ">", "endpoint", ",", "MediaTypes", "...", "mediaTypes", ")", "{", "addResource", "(", "Methods", ".", "PATCH", ",", "url", ",", "endpoint", ",", "mediaTypes...
Define a REST endpoint mapped to HTTP HEAD @param url The relative URL to be map this endpoint. @param endpoint The endpoint handler @param mediaTypes (Optional) The accepted and returned types for this endpoint
[ "Define", "a", "REST", "endpoint", "mapped", "to", "HTTP", "HEAD" ]
train
https://github.com/josueeduardo/snappy/blob/d95a9e811eda3c24a5e53086369208819884fa49/snappy/src/main/java/io/joshworks/snappy/SnappyServer.java#L474-L476
alkacon/opencms-core
src/org/opencms/ui/CmsUserIconHelper.java
CmsUserIconHelper.toPath
private String toPath(String name, IconSize size) { return CmsStringUtil.joinPaths(CmsWorkplace.getSkinUri(), ICON_FOLDER, "" + name.hashCode()) + size.getSuffix(); }
java
private String toPath(String name, IconSize size) { return CmsStringUtil.joinPaths(CmsWorkplace.getSkinUri(), ICON_FOLDER, "" + name.hashCode()) + size.getSuffix(); }
[ "private", "String", "toPath", "(", "String", "name", ",", "IconSize", "size", ")", "{", "return", "CmsStringUtil", ".", "joinPaths", "(", "CmsWorkplace", ".", "getSkinUri", "(", ")", ",", "ICON_FOLDER", ",", "\"\"", "+", "name", ".", "hashCode", "(", ")",...
Transforms user name and icon size into the image path. @param name the user name @param size IconSize to get icon for @return the path
[ "Transforms", "user", "name", "and", "icon", "size", "into", "the", "image", "path", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/CmsUserIconHelper.java#L444-L447
sagiegurari/fax4j
src/main/java/org/fax4j/spi/hylafax/HylaFaxClientSpi.java
HylaFaxClientSpi.cancelFaxJobImpl
@Override protected void cancelFaxJobImpl(FaxJob faxJob) { //get fax job HylaFaxJob hylaFaxJob=(HylaFaxJob)faxJob; //get client HylaFAXClient client=this.getHylaFAXClient(); try { this.cancelFaxJob(hylaFaxJob,client); } catch(FaxException exception) { throw exception; } catch(Exception exception) { throw new FaxException("General error.",exception); } }
java
@Override protected void cancelFaxJobImpl(FaxJob faxJob) { //get fax job HylaFaxJob hylaFaxJob=(HylaFaxJob)faxJob; //get client HylaFAXClient client=this.getHylaFAXClient(); try { this.cancelFaxJob(hylaFaxJob,client); } catch(FaxException exception) { throw exception; } catch(Exception exception) { throw new FaxException("General error.",exception); } }
[ "@", "Override", "protected", "void", "cancelFaxJobImpl", "(", "FaxJob", "faxJob", ")", "{", "//get fax job", "HylaFaxJob", "hylaFaxJob", "=", "(", "HylaFaxJob", ")", "faxJob", ";", "//get client", "HylaFAXClient", "client", "=", "this", ".", "getHylaFAXClient", "...
This function will cancel an existing fax job. @param faxJob The fax job object containing the needed information
[ "This", "function", "will", "cancel", "an", "existing", "fax", "job", "." ]
train
https://github.com/sagiegurari/fax4j/blob/42fa51acabe7bf279e27ab3dd1cf76146b27955f/src/main/java/org/fax4j/spi/hylafax/HylaFaxClientSpi.java#L392-L413
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/FoldersApi.java
FoldersApi.listItems
public FolderItemsResponse listItems(String accountId, String folderId, FoldersApi.ListItemsOptions options) throws ApiException { Object localVarPostBody = "{}"; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling listItems"); } // verify the required parameter 'folderId' is set if (folderId == null) { throw new ApiException(400, "Missing the required parameter 'folderId' when calling listItems"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/folders/{folderId}".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())) .replaceAll("\\{" + "folderId" + "\\}", apiClient.escapeString(folderId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "from_date", options.fromDate)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "owner_email", options.ownerEmail)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "owner_name", options.ownerName)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "search_text", options.searchText)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_position", options.startPosition)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "status", options.status)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "to_date", options.toDate)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; GenericType<FolderItemsResponse> localVarReturnType = new GenericType<FolderItemsResponse>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
java
public FolderItemsResponse listItems(String accountId, String folderId, FoldersApi.ListItemsOptions options) throws ApiException { Object localVarPostBody = "{}"; // verify the required parameter 'accountId' is set if (accountId == null) { throw new ApiException(400, "Missing the required parameter 'accountId' when calling listItems"); } // verify the required parameter 'folderId' is set if (folderId == null) { throw new ApiException(400, "Missing the required parameter 'folderId' when calling listItems"); } // create path and map variables String localVarPath = "/v2/accounts/{accountId}/folders/{folderId}".replaceAll("\\{format\\}","json") .replaceAll("\\{" + "accountId" + "\\}", apiClient.escapeString(accountId.toString())) .replaceAll("\\{" + "folderId" + "\\}", apiClient.escapeString(folderId.toString())); // query params java.util.List<Pair> localVarQueryParams = new java.util.ArrayList<Pair>(); java.util.Map<String, String> localVarHeaderParams = new java.util.HashMap<String, String>(); java.util.Map<String, Object> localVarFormParams = new java.util.HashMap<String, Object>(); if (options != null) { localVarQueryParams.addAll(apiClient.parameterToPairs("", "from_date", options.fromDate)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "owner_email", options.ownerEmail)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "owner_name", options.ownerName)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "search_text", options.searchText)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "start_position", options.startPosition)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "status", options.status)); localVarQueryParams.addAll(apiClient.parameterToPairs("", "to_date", options.toDate)); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); final String[] localVarContentTypes = { }; final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); String[] localVarAuthNames = new String[] { "docusignAccessCode" }; //{ }; GenericType<FolderItemsResponse> localVarReturnType = new GenericType<FolderItemsResponse>() {}; return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); }
[ "public", "FolderItemsResponse", "listItems", "(", "String", "accountId", ",", "String", "folderId", ",", "FoldersApi", ".", "ListItemsOptions", "options", ")", "throws", "ApiException", "{", "Object", "localVarPostBody", "=", "\"{}\"", ";", "// verify the required para...
Gets a list of the envelopes in the specified folder. Retrieves a list of the envelopes in the specified folder. You can narrow the query by specifying search criteria in the query string parameters. @param accountId The external account number (int) or account ID Guid. (required) @param folderId The ID of the folder being accessed. (required) @param options for modifying the method behavior. @return FolderItemsResponse @throws ApiException if fails to make API call
[ "Gets", "a", "list", "of", "the", "envelopes", "in", "the", "specified", "folder", ".", "Retrieves", "a", "list", "of", "the", "envelopes", "in", "the", "specified", "folder", ".", "You", "can", "narrow", "the", "query", "by", "specifying", "search", "crit...
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/FoldersApi.java#L251-L299
redkale/redkale-plugins
src/org/redkalex/weixin/WeiXinQYService.java
WeiXinQYService.encryptQYMessage
protected String encryptQYMessage(String replyMsg, String timeStamp, String nonce) { // 加密 String encrypt = encryptQY(random16String(), replyMsg); // 生成安全签名 if (timeStamp == null || timeStamp.isEmpty()) timeStamp = Long.toString(System.currentTimeMillis()); String signature = sha1(qytoken, timeStamp, nonce, encrypt); // System.out.println("发送给平台的签名是: " + signature[1].toString()); // 生成发送的xml return "<xml>\n<Encrypt><![CDATA[" + encrypt + "]]></Encrypt>\n" + "<MsgSignature><![CDATA[" + signature + "]]></MsgSignature>\n" + "<TimeStamp>" + timeStamp + "</TimeStamp>\n" + "<Nonce><![CDATA[" + nonce + "]]></Nonce>\n</xml>"; }
java
protected String encryptQYMessage(String replyMsg, String timeStamp, String nonce) { // 加密 String encrypt = encryptQY(random16String(), replyMsg); // 生成安全签名 if (timeStamp == null || timeStamp.isEmpty()) timeStamp = Long.toString(System.currentTimeMillis()); String signature = sha1(qytoken, timeStamp, nonce, encrypt); // System.out.println("发送给平台的签名是: " + signature[1].toString()); // 生成发送的xml return "<xml>\n<Encrypt><![CDATA[" + encrypt + "]]></Encrypt>\n" + "<MsgSignature><![CDATA[" + signature + "]]></MsgSignature>\n" + "<TimeStamp>" + timeStamp + "</TimeStamp>\n" + "<Nonce><![CDATA[" + nonce + "]]></Nonce>\n</xml>"; }
[ "protected", "String", "encryptQYMessage", "(", "String", "replyMsg", ",", "String", "timeStamp", ",", "String", "nonce", ")", "{", "// 加密\r", "String", "encrypt", "=", "encryptQY", "(", "random16String", "(", ")", ",", "replyMsg", ")", ";", "// 生成安全签名\r", "if...
将公众平台回复用户的消息加密打包. <ol> <li>对要发送的消息进行AES-CBC加密</li> <li>生成安全签名</li> <li>将消息密文和安全签名打包成xml格式</li> </ol> <p> @param replyMsg 公众平台待回复用户的消息,xml格式的字符串 @param timeStamp 时间戳,可以自己生成,也可以用URL参数的timestamp @param nonce 随机串,可以自己生成,也可以用URL参数的nonce <p> @return 加密后的可以直接回复用户的密文,包括msg_signature, timestamp, nonce, encrypt的xml格式的字符串
[ "将公众平台回复用户的消息加密打包", ".", "<ol", ">", "<li", ">", "对要发送的消息进行AES", "-", "CBC加密<", "/", "li", ">", "<li", ">", "生成安全签名<", "/", "li", ">", "<li", ">", "将消息密文和安全签名打包成xml格式<", "/", "li", ">", "<", "/", "ol", ">", "<p", ">" ]
train
https://github.com/redkale/redkale-plugins/blob/a1edfc906a444ae19fe6aababce2957c9b5ea9d2/src/org/redkalex/weixin/WeiXinQYService.java#L163-L177
line/armeria
core/src/main/java/com/linecorp/armeria/server/file/HttpFileServiceBuilder.java
HttpFileServiceBuilder.cacheControl
public HttpFileServiceBuilder cacheControl(CacheControl cacheControl) { requireNonNull(cacheControl, "cacheControl"); return setHeader(HttpHeaderNames.CACHE_CONTROL, cacheControl); }
java
public HttpFileServiceBuilder cacheControl(CacheControl cacheControl) { requireNonNull(cacheControl, "cacheControl"); return setHeader(HttpHeaderNames.CACHE_CONTROL, cacheControl); }
[ "public", "HttpFileServiceBuilder", "cacheControl", "(", "CacheControl", "cacheControl", ")", "{", "requireNonNull", "(", "cacheControl", ",", "\"cacheControl\"", ")", ";", "return", "setHeader", "(", "HttpHeaderNames", ".", "CACHE_CONTROL", ",", "cacheControl", ")", ...
Sets the {@code "cache-control"} header. This method is a shortcut of: <pre>{@code builder.setHeader(HttpHeaderNames.CACHE_CONTROL, cacheControl); }</pre>
[ "Sets", "the", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/file/HttpFileServiceBuilder.java#L206-L209
raphw/byte-buddy
byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java
ElementMatchers.nameStartsWith
public static <T extends NamedElement> ElementMatcher.Junction<T> nameStartsWith(String prefix) { return new NameMatcher<T>(new StringMatcher(prefix, StringMatcher.Mode.STARTS_WITH)); }
java
public static <T extends NamedElement> ElementMatcher.Junction<T> nameStartsWith(String prefix) { return new NameMatcher<T>(new StringMatcher(prefix, StringMatcher.Mode.STARTS_WITH)); }
[ "public", "static", "<", "T", "extends", "NamedElement", ">", "ElementMatcher", ".", "Junction", "<", "T", ">", "nameStartsWith", "(", "String", "prefix", ")", "{", "return", "new", "NameMatcher", "<", "T", ">", "(", "new", "StringMatcher", "(", "prefix", ...
Matches a {@link NamedElement} for its name's prefix. @param prefix The expected name's prefix. @param <T> The type of the matched object. @return An element matcher for a named element's name's prefix.
[ "Matches", "a", "{", "@link", "NamedElement", "}", "for", "its", "name", "s", "prefix", "." ]
train
https://github.com/raphw/byte-buddy/blob/4d2dac80efb6bed89367567260f6811c2f712d12/byte-buddy-dep/src/main/java/net/bytebuddy/matcher/ElementMatchers.java#L677-L679
jcuda/jcusparse
JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java
JCusparse.cusparseScsr2csru
public static int cusparseScsr2csru( cusparseHandle handle, int m, int n, int nnz, cusparseMatDescr descrA, Pointer csrVal, Pointer csrRowPtr, Pointer csrColInd, csru2csrInfo info, Pointer pBuffer) { return checkResult(cusparseScsr2csruNative(handle, m, n, nnz, descrA, csrVal, csrRowPtr, csrColInd, info, pBuffer)); }
java
public static int cusparseScsr2csru( cusparseHandle handle, int m, int n, int nnz, cusparseMatDescr descrA, Pointer csrVal, Pointer csrRowPtr, Pointer csrColInd, csru2csrInfo info, Pointer pBuffer) { return checkResult(cusparseScsr2csruNative(handle, m, n, nnz, descrA, csrVal, csrRowPtr, csrColInd, info, pBuffer)); }
[ "public", "static", "int", "cusparseScsr2csru", "(", "cusparseHandle", "handle", ",", "int", "m", ",", "int", "n", ",", "int", "nnz", ",", "cusparseMatDescr", "descrA", ",", "Pointer", "csrVal", ",", "Pointer", "csrRowPtr", ",", "Pointer", "csrColInd", ",", ...
Description: Wrapper that un-sorts sparse matrix stored in CSR format (without exposing the permutation).
[ "Description", ":", "Wrapper", "that", "un", "-", "sorts", "sparse", "matrix", "stored", "in", "CSR", "format", "(", "without", "exposing", "the", "permutation", ")", "." ]
train
https://github.com/jcuda/jcusparse/blob/7687a62a4ef6b76cb91cf7da93d4cf5ade96a791/JCusparseJava/src/main/java/jcuda/jcusparse/JCusparse.java#L14494-L14507
alkacon/opencms-core
src-gwt/org/opencms/gwt/client/ui/CmsAreaSelectPanel.java
CmsAreaSelectPanel.moveTo
private void moveTo(int posX, int posY) { posX = (posX < 0) ? 0 : (((posX + m_currentSelection.getWidth()) >= m_elementWidth) ? m_elementWidth - m_currentSelection.getWidth() : posX); posY = (posY < 0) ? 0 : (((posY + m_currentSelection.getHeight()) >= m_elementHeight) ? m_elementHeight - m_currentSelection.getHeight() : posY); m_markerStyle.setTop(posY, Unit.PX); m_markerStyle.setLeft(posX, Unit.PX); m_overlayLeftStyle.setWidth(posX, Unit.PX); m_overlayTopStyle.setLeft(posX, Unit.PX); m_overlayTopStyle.setHeight(posY, Unit.PX); m_overlayBottomStyle.setLeft(posX, Unit.PX); m_overlayBottomStyle.setHeight(m_elementHeight - posY - m_currentSelection.getHeight(), Unit.PX); m_overlayRightStyle.setWidth(m_elementWidth - posX - m_currentSelection.getWidth(), Unit.PX); m_currentSelection.setTop(posY); m_currentSelection.setLeft(posX); }
java
private void moveTo(int posX, int posY) { posX = (posX < 0) ? 0 : (((posX + m_currentSelection.getWidth()) >= m_elementWidth) ? m_elementWidth - m_currentSelection.getWidth() : posX); posY = (posY < 0) ? 0 : (((posY + m_currentSelection.getHeight()) >= m_elementHeight) ? m_elementHeight - m_currentSelection.getHeight() : posY); m_markerStyle.setTop(posY, Unit.PX); m_markerStyle.setLeft(posX, Unit.PX); m_overlayLeftStyle.setWidth(posX, Unit.PX); m_overlayTopStyle.setLeft(posX, Unit.PX); m_overlayTopStyle.setHeight(posY, Unit.PX); m_overlayBottomStyle.setLeft(posX, Unit.PX); m_overlayBottomStyle.setHeight(m_elementHeight - posY - m_currentSelection.getHeight(), Unit.PX); m_overlayRightStyle.setWidth(m_elementWidth - posX - m_currentSelection.getWidth(), Unit.PX); m_currentSelection.setTop(posY); m_currentSelection.setLeft(posX); }
[ "private", "void", "moveTo", "(", "int", "posX", ",", "int", "posY", ")", "{", "posX", "=", "(", "posX", "<", "0", ")", "?", "0", ":", "(", "(", "(", "posX", "+", "m_currentSelection", ".", "getWidth", "(", ")", ")", ">=", "m_elementWidth", ")", ...
Moves the select area to the specified position, while keeping the size.<p> @param posX the new X position @param posY the new Y position
[ "Moves", "the", "select", "area", "to", "the", "specified", "position", "while", "keeping", "the", "size", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/gwt/client/ui/CmsAreaSelectPanel.java#L689-L717
bazaarvoice/emodb
web/src/main/java/com/bazaarvoice/emodb/web/auth/EmoPermission.java
EmoPermission.toPart
@Override protected MatchingPart toPart(List<MatchingPart> leadingParts, String part) { switch (leadingParts.size()) { case 0: // The first part must either be a constant or a pure wildcard; expressions such as // <code>if(or("sor","blob"))</code> are not permitted. MatchingPart resolvedPart = createEmoPermissionPart(part, PartType.CONTEXT); checkArgument(resolvedPart instanceof ConstantPart || resolvedPart.impliesAny(), "First part must be a constant or pure wildcard"); return resolvedPart; case 1: // If the first part was a pure wildcard then there cannot be a second part; expressions such as // "*|create_table" are not permitted. checkArgument(!MatchingPart.getContext(leadingParts).impliesAny(), "Cannot narrow permission without initial scope"); return createEmoPermissionPart(part, PartType.ACTION); case 2: // For sor and blob permissions the third part narrows to a table. Otherwise it narrows to a // named resource such as a queue name or databus subscription. PartType partType; if (MatchingPart.contextImpliedBy(SOR_PART, leadingParts)) { partType = PartType.SOR_TABLE; } else if (MatchingPart.contextImpliedBy(BLOB_PART, leadingParts)) { partType = PartType.BLOB_TABLE; } else { partType = PartType.NAMED_RESOURCE; } return createEmoPermissionPart(part, partType); case 3: // Only roles support four parts, where the group is the third part and the role ID is the fourth part. if (MatchingPart.contextImpliedBy(ROLE_PART, leadingParts)) { return createEmoPermissionPart(part, PartType.NAMED_RESOURCE); } break; } throw new IllegalArgumentException(format("Too many parts for EmoPermission in \"%s\" context", MatchingPart.getContext(leadingParts))); }
java
@Override protected MatchingPart toPart(List<MatchingPart> leadingParts, String part) { switch (leadingParts.size()) { case 0: // The first part must either be a constant or a pure wildcard; expressions such as // <code>if(or("sor","blob"))</code> are not permitted. MatchingPart resolvedPart = createEmoPermissionPart(part, PartType.CONTEXT); checkArgument(resolvedPart instanceof ConstantPart || resolvedPart.impliesAny(), "First part must be a constant or pure wildcard"); return resolvedPart; case 1: // If the first part was a pure wildcard then there cannot be a second part; expressions such as // "*|create_table" are not permitted. checkArgument(!MatchingPart.getContext(leadingParts).impliesAny(), "Cannot narrow permission without initial scope"); return createEmoPermissionPart(part, PartType.ACTION); case 2: // For sor and blob permissions the third part narrows to a table. Otherwise it narrows to a // named resource such as a queue name or databus subscription. PartType partType; if (MatchingPart.contextImpliedBy(SOR_PART, leadingParts)) { partType = PartType.SOR_TABLE; } else if (MatchingPart.contextImpliedBy(BLOB_PART, leadingParts)) { partType = PartType.BLOB_TABLE; } else { partType = PartType.NAMED_RESOURCE; } return createEmoPermissionPart(part, partType); case 3: // Only roles support four parts, where the group is the third part and the role ID is the fourth part. if (MatchingPart.contextImpliedBy(ROLE_PART, leadingParts)) { return createEmoPermissionPart(part, PartType.NAMED_RESOURCE); } break; } throw new IllegalArgumentException(format("Too many parts for EmoPermission in \"%s\" context", MatchingPart.getContext(leadingParts))); }
[ "@", "Override", "protected", "MatchingPart", "toPart", "(", "List", "<", "MatchingPart", ">", "leadingParts", ",", "String", "part", ")", "{", "switch", "(", "leadingParts", ".", "size", "(", ")", ")", "{", "case", "0", ":", "// The first part must either be ...
Override the logic in the parent to meet the requirements for EmoPermission.
[ "Override", "the", "logic", "in", "the", "parent", "to", "meet", "the", "requirements", "for", "EmoPermission", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/web/src/main/java/com/bazaarvoice/emodb/web/auth/EmoPermission.java#L86-L126
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java
RuleBasedNumberFormat.getRuleSetDisplayName
public String getRuleSetDisplayName(String ruleSetName) { return getRuleSetDisplayName(ruleSetName, ULocale.getDefault(Category.DISPLAY)); }
java
public String getRuleSetDisplayName(String ruleSetName) { return getRuleSetDisplayName(ruleSetName, ULocale.getDefault(Category.DISPLAY)); }
[ "public", "String", "getRuleSetDisplayName", "(", "String", "ruleSetName", ")", "{", "return", "getRuleSetDisplayName", "(", "ruleSetName", ",", "ULocale", ".", "getDefault", "(", "Category", ".", "DISPLAY", ")", ")", ";", "}" ]
Return the rule set display name for the provided rule set in the current default <code>DISPLAY</code> locale. @return the display name for the rule set @see #getRuleSetDisplayName(String,ULocale) @see Category#DISPLAY
[ "Return", "the", "rule", "set", "display", "name", "for", "the", "provided", "rule", "set", "in", "the", "current", "default", "<code", ">", "DISPLAY<", "/", "code", ">", "locale", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedNumberFormat.java#L1118-L1120