repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/ServiceRemoveStepHandler.java
ServiceRemoveStepHandler.recoverServices
@Override protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { if (context.isResourceServiceRestartAllowed()) { addOperation.performRuntime(context, operation, model); } else { context.revertReloadRequired(); } }
java
@Override protected void recoverServices(OperationContext context, ModelNode operation, ModelNode model) throws OperationFailedException { if (context.isResourceServiceRestartAllowed()) { addOperation.performRuntime(context, operation, model); } else { context.revertReloadRequired(); } }
[ "@", "Override", "protected", "void", "recoverServices", "(", "OperationContext", "context", ",", "ModelNode", "operation", ",", "ModelNode", "model", ")", "throws", "OperationFailedException", "{", "if", "(", "context", ".", "isResourceServiceRestartAllowed", "(", ")...
If the {@link OperationContext#isResourceServiceRestartAllowed() context allows resource removal}, attempts to restore services by invoking the {@code performRuntime} method on the @{code addOperation} handler passed to the constructor; otherwise puts the process in reload-required state. {@inheritDoc}
[ "If", "the", "{", "@link", "OperationContext#isResourceServiceRestartAllowed", "()", "context", "allows", "resource", "removal", "}", "attempts", "to", "restore", "services", "by", "invoking", "the", "{", "@code", "performRuntime", "}", "method", "on", "the", "@", ...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/ServiceRemoveStepHandler.java#L163-L170
OpenLiberty/open-liberty
dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/core/util/ReflectionUtils.java
ReflectionUtils.getRepeatableAnnotations
public static <A extends Annotation> List<A> getRepeatableAnnotations(Method method, Class<A> annotationClass) { A[] annotations = method.getAnnotationsByType(annotationClass); if (annotations == null || annotations.length == 0) { for (Annotation metaAnnotation : method.getAnnotations()) { annotations = metaAnnotation.annotationType().getAnnotationsByType(annotationClass); if (annotations != null && annotations.length > 0) { return Arrays.asList(annotations); } } Method superclassMethod = getOverriddenMethod(method); if (superclassMethod != null) { return getRepeatableAnnotations(superclassMethod, annotationClass); } } if (annotations == null) { return null; } return Arrays.asList(annotations); }
java
public static <A extends Annotation> List<A> getRepeatableAnnotations(Method method, Class<A> annotationClass) { A[] annotations = method.getAnnotationsByType(annotationClass); if (annotations == null || annotations.length == 0) { for (Annotation metaAnnotation : method.getAnnotations()) { annotations = metaAnnotation.annotationType().getAnnotationsByType(annotationClass); if (annotations != null && annotations.length > 0) { return Arrays.asList(annotations); } } Method superclassMethod = getOverriddenMethod(method); if (superclassMethod != null) { return getRepeatableAnnotations(superclassMethod, annotationClass); } } if (annotations == null) { return null; } return Arrays.asList(annotations); }
[ "public", "static", "<", "A", "extends", "Annotation", ">", "List", "<", "A", ">", "getRepeatableAnnotations", "(", "Method", "method", ",", "Class", "<", "A", ">", "annotationClass", ")", "{", "A", "[", "]", "annotations", "=", "method", ".", "getAnnotati...
Returns a List of repeatable annotations by type from a method. @param method is the method to find @param annotationClass is the type of annotation @param <A> is the type of annotation @return List of repeatable annotations if it is found
[ "Returns", "a", "List", "of", "repeatable", "annotations", "by", "type", "from", "a", "method", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.microprofile.openapi/src/com/ibm/ws/microprofile/openapi/impl/core/util/ReflectionUtils.java#L271-L289
lucastheisen/jsch-extension
src/main/java/com/pastdev/jsch/DefaultSessionFactory.java
DefaultSessionFactory.setIdentityFromPrivateKey
public void setIdentityFromPrivateKey( String privateKey, String passPhrase ) throws JSchException { clearIdentityRepository(); jsch.addIdentity( privateKey, passPhrase ); }
java
public void setIdentityFromPrivateKey( String privateKey, String passPhrase ) throws JSchException { clearIdentityRepository(); jsch.addIdentity( privateKey, passPhrase ); }
[ "public", "void", "setIdentityFromPrivateKey", "(", "String", "privateKey", ",", "String", "passPhrase", ")", "throws", "JSchException", "{", "clearIdentityRepository", "(", ")", ";", "jsch", ".", "addIdentity", "(", "privateKey", ",", "passPhrase", ")", ";", "}" ...
Configures this factory to use a single identity authenticated by the supplied private key and pass phrase. The private key should be the path to a private key file in OpenSSH format. Clears out the current {@link IdentityRepository} before adding this key. @param privateKey Path to a private key file @param passPhrase Pass phrase for private key @throws JSchException If the key is invalid
[ "Configures", "this", "factory", "to", "use", "a", "single", "identity", "authenticated", "by", "the", "supplied", "private", "key", "and", "pass", "phrase", ".", "The", "private", "key", "should", "be", "the", "path", "to", "a", "private", "key", "file", ...
train
https://github.com/lucastheisen/jsch-extension/blob/3c5bfae84d63e8632828a10721f2e605b68d749a/src/main/java/com/pastdev/jsch/DefaultSessionFactory.java#L347-L350
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/ResourceUtils.java
ResourceUtils.getReader
public static Reader getReader(final File file, String encoding) throws IOException { InputStream stream; try { stream = AccessController.doPrivileged( new PrivilegedExceptionAction<InputStream>() { @Override public InputStream run() throws IOException { return new FileInputStream(file); } } ); } catch (PrivilegedActionException e) { throw (IOException)e.getException(); } Reader reader; if (encoding != null) { reader = new InputStreamReader(stream, encoding); } else { reader = new InputStreamReader(stream); } return reader; }
java
public static Reader getReader(final File file, String encoding) throws IOException { InputStream stream; try { stream = AccessController.doPrivileged( new PrivilegedExceptionAction<InputStream>() { @Override public InputStream run() throws IOException { return new FileInputStream(file); } } ); } catch (PrivilegedActionException e) { throw (IOException)e.getException(); } Reader reader; if (encoding != null) { reader = new InputStreamReader(stream, encoding); } else { reader = new InputStreamReader(stream); } return reader; }
[ "public", "static", "Reader", "getReader", "(", "final", "File", "file", ",", "String", "encoding", ")", "throws", "IOException", "{", "InputStream", "stream", ";", "try", "{", "stream", "=", "AccessController", ".", "doPrivileged", "(", "new", "PrivilegedExcept...
Returns a Reader for reading the specified file. @param file the file @param encoding the encoding @return the reader instance @throws IOException if an error occurred when reading resources using any I/O operations
[ "Returns", "a", "Reader", "for", "reading", "the", "specified", "file", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/ResourceUtils.java#L294-L316
javagl/CommonUI
src/main/java/de/javagl/common/ui/JTables.java
JTables.scrollToRow
public static void scrollToRow(JTable table, int row) { Rectangle visibleRect = table.getVisibleRect(); Rectangle cellRect = table.getCellRect(row, 0, true); Rectangle r = new Rectangle( visibleRect.x, cellRect.y, visibleRect.width, cellRect.height); table.scrollRectToVisible(r); }
java
public static void scrollToRow(JTable table, int row) { Rectangle visibleRect = table.getVisibleRect(); Rectangle cellRect = table.getCellRect(row, 0, true); Rectangle r = new Rectangle( visibleRect.x, cellRect.y, visibleRect.width, cellRect.height); table.scrollRectToVisible(r); }
[ "public", "static", "void", "scrollToRow", "(", "JTable", "table", ",", "int", "row", ")", "{", "Rectangle", "visibleRect", "=", "table", ".", "getVisibleRect", "(", ")", ";", "Rectangle", "cellRect", "=", "table", ".", "getCellRect", "(", "row", ",", "0",...
Scroll the given table so that the specified row is visible. @param table The table @param row The row
[ "Scroll", "the", "given", "table", "so", "that", "the", "specified", "row", "is", "visible", "." ]
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/JTables.java#L89-L97
kochedykov/jlibmodbus
src/com/intelligt/modbus/jlibmodbus/msg/ModbusRequestBuilder.java
ModbusRequestBuilder.buildReturnQueryData
public ModbusRequest buildReturnQueryData(int serverAddress, int queryData) throws ModbusNumberException { return buildDiagnostics(DiagnosticsSubFunctionCode.RETURN_QUERY_DATA, serverAddress, queryData); }
java
public ModbusRequest buildReturnQueryData(int serverAddress, int queryData) throws ModbusNumberException { return buildDiagnostics(DiagnosticsSubFunctionCode.RETURN_QUERY_DATA, serverAddress, queryData); }
[ "public", "ModbusRequest", "buildReturnQueryData", "(", "int", "serverAddress", ",", "int", "queryData", ")", "throws", "ModbusNumberException", "{", "return", "buildDiagnostics", "(", "DiagnosticsSubFunctionCode", ".", "RETURN_QUERY_DATA", ",", "serverAddress", ",", "que...
The data passed in the request data field is to be returned (looped back) in the response. The entire response message should be identical to the request. @param serverAddress a slave address @param queryData request data field @return DiagnosticsRequest instance @throws ModbusNumberException if server address is in-valid
[ "The", "data", "passed", "in", "the", "request", "data", "field", "is", "to", "be", "returned", "(", "looped", "back", ")", "in", "the", "response", ".", "The", "entire", "response", "message", "should", "be", "identical", "to", "the", "request", "." ]
train
https://github.com/kochedykov/jlibmodbus/blob/197cb39e2649e61a6fe3cb7dc91a701d847e14be/src/com/intelligt/modbus/jlibmodbus/msg/ModbusRequestBuilder.java#L202-L204
esigate/esigate
esigate-core/src/main/java/org/esigate/aggregator/ElementAttributesFactory.java
ElementAttributesFactory.createElementAttributes
static ElementAttributes createElementAttributes(String tag) { // Parsing strings // <!--$includetemplate$aggregated2$templatewithparams.jsp$--> // or // <!--$includeblock$aggregated2$$(block)$myblock$--> // in order to retrieve driver, page and name attributes Pattern pattern = Pattern.compile("(?<=\\$)(?:[^\\$]|\\$\\()*(?=\\$)"); Matcher matcher = pattern.matcher(tag); List<String> listparameters = new ArrayList<>(); while (matcher.find()) { listparameters.add(matcher.group()); } String[] parameters = listparameters.toArray(new String[listparameters.size()]); Driver driver; String page = ""; String name = null; if (parameters.length > 1) { driver = DriverFactory.getInstance(parameters[1]); } else { driver = DriverFactory.getInstance(); } if (parameters.length > 2) { page = parameters[2]; } if (parameters.length > 3) { name = parameters[3]; } return new ElementAttributes(driver, page, name); }
java
static ElementAttributes createElementAttributes(String tag) { // Parsing strings // <!--$includetemplate$aggregated2$templatewithparams.jsp$--> // or // <!--$includeblock$aggregated2$$(block)$myblock$--> // in order to retrieve driver, page and name attributes Pattern pattern = Pattern.compile("(?<=\\$)(?:[^\\$]|\\$\\()*(?=\\$)"); Matcher matcher = pattern.matcher(tag); List<String> listparameters = new ArrayList<>(); while (matcher.find()) { listparameters.add(matcher.group()); } String[] parameters = listparameters.toArray(new String[listparameters.size()]); Driver driver; String page = ""; String name = null; if (parameters.length > 1) { driver = DriverFactory.getInstance(parameters[1]); } else { driver = DriverFactory.getInstance(); } if (parameters.length > 2) { page = parameters[2]; } if (parameters.length > 3) { name = parameters[3]; } return new ElementAttributes(driver, page, name); }
[ "static", "ElementAttributes", "createElementAttributes", "(", "String", "tag", ")", "{", "// Parsing strings", "// <!--$includetemplate$aggregated2$templatewithparams.jsp$-->", "// or", "// <!--$includeblock$aggregated2$$(block)$myblock$-->", "// in order to retrieve driver, page and name a...
Parse the tag and return the ElementAttributes @param tag the tag to parse @return ElementAttributes
[ "Parse", "the", "tag", "and", "return", "the", "ElementAttributes" ]
train
https://github.com/esigate/esigate/blob/50421fb224f16e1ec42715425109a72b3b55527b/esigate-core/src/main/java/org/esigate/aggregator/ElementAttributesFactory.java#L28-L62
docusign/docusign-java-client
src/main/java/com/docusign/esign/api/UsersApi.java
UsersApi.updateSignature
public UserSignature updateSignature(String accountId, String userId, String signatureId, UserSignatureDefinition userSignatureDefinition) throws ApiException { return updateSignature(accountId, userId, signatureId, userSignatureDefinition, null); }
java
public UserSignature updateSignature(String accountId, String userId, String signatureId, UserSignatureDefinition userSignatureDefinition) throws ApiException { return updateSignature(accountId, userId, signatureId, userSignatureDefinition, null); }
[ "public", "UserSignature", "updateSignature", "(", "String", "accountId", ",", "String", "userId", ",", "String", "signatureId", ",", "UserSignatureDefinition", "userSignatureDefinition", ")", "throws", "ApiException", "{", "return", "updateSignature", "(", "accountId", ...
Updates the user signature for a specified user. Creates, or updates, the signature font and initials for the specified user. When creating a signature, you use this resource to create the signature name and then add the signature and initials images into the signature. ###### Note: This will also create a default signature for the user when one does not exist. The userId property specified in the endpoint must match the authenticated user&#39;s user ID and the user must be a member of the account. The &#x60;signatureId&#x60; parameter accepts a signature ID or a signature name. DocuSign recommends you use signature ID (&#x60;signatureId&#x60;), since some names contain characters that do not properly encode into a URL. If you use the user name, it is likely that the name includes spaces. In that case, URL encode the name before using it in the endpoint. For example encode \&quot;Bob Smith\&quot; as \&quot;Bob%20Smith\&quot;. @param accountId The external account number (int) or account ID Guid. (required) @param userId The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing. (required) @param signatureId The ID of the signature being accessed. (required) @param userSignatureDefinition (optional) @return UserSignature
[ "Updates", "the", "user", "signature", "for", "a", "specified", "user", ".", "Creates", "or", "updates", "the", "signature", "font", "and", "initials", "for", "the", "specified", "user", ".", "When", "creating", "a", "signature", "you", "use", "this", "resou...
train
https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/UsersApi.java#L1638-L1640
dkmfbk/knowledgestore
ks-core/src/main/java/eu/fbk/knowledgestore/data/Representation.java
Representation.getReader
public Reader getReader() { if (this.data instanceof Reader) { return (Reader) this.data; } else { final InputStream stream = (InputStream) this.data; return new InputStreamReader(stream, getCharset()); } }
java
public Reader getReader() { if (this.data instanceof Reader) { return (Reader) this.data; } else { final InputStream stream = (InputStream) this.data; return new InputStreamReader(stream, getCharset()); } }
[ "public", "Reader", "getReader", "(", ")", "{", "if", "(", "this", ".", "data", "instanceof", "Reader", ")", "{", "return", "(", "Reader", ")", "this", ".", "data", ";", "}", "else", "{", "final", "InputStream", "stream", "=", "(", "InputStream", ")", ...
Returns a {@code Reader} over the character data of this representation object. Conversion from byte to character data, if required, is performed according to the charset specified by the MIME type metadata property ({@link NIE#MIME_TYPE}). @return a {@code Reader} providing access to the character data of the representation.
[ "Returns", "a", "{", "@code", "Reader", "}", "over", "the", "character", "data", "of", "this", "representation", "object", ".", "Conversion", "from", "byte", "to", "character", "data", "if", "required", "is", "performed", "according", "to", "the", "charset", ...
train
https://github.com/dkmfbk/knowledgestore/blob/a548101b1dd67fcf72a1ec6f838ea7539bdbbe7a/ks-core/src/main/java/eu/fbk/knowledgestore/data/Representation.java#L365-L372
zackpollard/JavaTelegramBot-API
core/src/main/java/pro/zackpollard/telegrambot/api/utils/Utils.java
Utils.processInputFileField
public static void processInputFileField(MultipartBody request, String fieldName, InputFile inputFile) { String fileId = inputFile.getFileID(); if (fileId != null) { request.field(fieldName, fileId, false); } else if (inputFile.getInputStream() != null) { request.field(fieldName, new InputStreamBody(inputFile.getInputStream(), inputFile.getFileName()), true); } else { // assume file is not null (this is existing behaviour as of 1.5.1) request.field(fieldName, new FileContainer(inputFile), true); } }
java
public static void processInputFileField(MultipartBody request, String fieldName, InputFile inputFile) { String fileId = inputFile.getFileID(); if (fileId != null) { request.field(fieldName, fileId, false); } else if (inputFile.getInputStream() != null) { request.field(fieldName, new InputStreamBody(inputFile.getInputStream(), inputFile.getFileName()), true); } else { // assume file is not null (this is existing behaviour as of 1.5.1) request.field(fieldName, new FileContainer(inputFile), true); } }
[ "public", "static", "void", "processInputFileField", "(", "MultipartBody", "request", ",", "String", "fieldName", ",", "InputFile", "inputFile", ")", "{", "String", "fileId", "=", "inputFile", ".", "getFileID", "(", ")", ";", "if", "(", "fileId", "!=", "null",...
Adds an input file to a request, with the given field name. @param request The request to be added to. @param fieldName The name of the field. @param inputFile The input file.
[ "Adds", "an", "input", "file", "to", "a", "request", "with", "the", "given", "field", "name", "." ]
train
https://github.com/zackpollard/JavaTelegramBot-API/blob/9d100f351824042ca5fc0ea735d1fa376a13e81d/core/src/main/java/pro/zackpollard/telegrambot/api/utils/Utils.java#L166-L175
thinkaurelius/titan
titan-core/src/main/java/com/thinkaurelius/titan/core/util/ManagementUtil.java
ManagementUtil.awaitGraphIndexUpdate
public static void awaitGraphIndexUpdate(TitanGraph g, String indexName, long time, TemporalUnit unit) { awaitIndexUpdate(g,indexName,null,time,unit); }
java
public static void awaitGraphIndexUpdate(TitanGraph g, String indexName, long time, TemporalUnit unit) { awaitIndexUpdate(g,indexName,null,time,unit); }
[ "public", "static", "void", "awaitGraphIndexUpdate", "(", "TitanGraph", "g", ",", "String", "indexName", ",", "long", "time", ",", "TemporalUnit", "unit", ")", "{", "awaitIndexUpdate", "(", "g", ",", "indexName", ",", "null", ",", "time", ",", "unit", ")", ...
This method blocks and waits until the provided index has been updated across the entire Titan cluster and reached a stable state. This method will wait for the given period of time and throw an exception if the index did not reach a final state within that time. The method simply returns when the index has reached the final state prior to the time period expiring. This is a utility method to be invoked between two {@link com.thinkaurelius.titan.core.schema.TitanManagement#updateIndex(TitanIndex, com.thinkaurelius.titan.core.schema.SchemaAction)} calls to ensure that the previous update has successfully persisted. @param g @param indexName @param time @param unit
[ "This", "method", "blocks", "and", "waits", "until", "the", "provided", "index", "has", "been", "updated", "across", "the", "entire", "Titan", "cluster", "and", "reached", "a", "stable", "state", ".", "This", "method", "will", "wait", "for", "the", "given", ...
train
https://github.com/thinkaurelius/titan/blob/ee226e52415b8bf43b700afac75fa5b9767993a5/titan-core/src/main/java/com/thinkaurelius/titan/core/util/ManagementUtil.java#L42-L44
apereo/cas
core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java
AbstractCasWebflowConfigurer.getTransitionableState
public TransitionableState getTransitionableState(final Flow flow, final String stateId) { if (containsFlowState(flow, stateId)) { return (TransitionableState) flow.getTransitionableState(stateId); } return null; }
java
public TransitionableState getTransitionableState(final Flow flow, final String stateId) { if (containsFlowState(flow, stateId)) { return (TransitionableState) flow.getTransitionableState(stateId); } return null; }
[ "public", "TransitionableState", "getTransitionableState", "(", "final", "Flow", "flow", ",", "final", "String", "stateId", ")", "{", "if", "(", "containsFlowState", "(", "flow", ",", "stateId", ")", ")", "{", "return", "(", "TransitionableState", ")", "flow", ...
Gets transitionable state. @param flow the flow @param stateId the state id @return the transitionable state
[ "Gets", "transitionable", "state", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-webflow-api/src/main/java/org/apereo/cas/web/flow/configurer/AbstractCasWebflowConfigurer.java#L769-L774
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java
TmdbMovies.getMovieChanges
public ResultList<ChangeKeyItem> getMovieChanges(int movieId, String startDate, String endDate) throws MovieDbException { return getMediaChanges(movieId, startDate, endDate); }
java
public ResultList<ChangeKeyItem> getMovieChanges(int movieId, String startDate, String endDate) throws MovieDbException { return getMediaChanges(movieId, startDate, endDate); }
[ "public", "ResultList", "<", "ChangeKeyItem", ">", "getMovieChanges", "(", "int", "movieId", ",", "String", "startDate", ",", "String", "endDate", ")", "throws", "MovieDbException", "{", "return", "getMediaChanges", "(", "movieId", ",", "startDate", ",", "endDate"...
Get the changes for a specific movie ID. Changes are grouped by key, and ordered by date in descending order. By default, only the last 24 hours of changes are returned. The maximum number of days that can be returned in a single request is 14. The language is present on fields that are translatable. @param movieId @param startDate @param endDate @return @throws MovieDbException
[ "Get", "the", "changes", "for", "a", "specific", "movie", "ID", "." ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbMovies.java#L460-L462
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Validator.java
Validator.validateIpv6
public static <T extends CharSequence> T validateIpv6(T value, String errorMsg) throws ValidateException { if (false == isIpv6(value)) { throw new ValidateException(errorMsg); } return value; }
java
public static <T extends CharSequence> T validateIpv6(T value, String errorMsg) throws ValidateException { if (false == isIpv6(value)) { throw new ValidateException(errorMsg); } return value; }
[ "public", "static", "<", "T", "extends", "CharSequence", ">", "T", "validateIpv6", "(", "T", "value", ",", "String", "errorMsg", ")", "throws", "ValidateException", "{", "if", "(", "false", "==", "isIpv6", "(", "value", ")", ")", "{", "throw", "new", "Va...
验证是否为IPV6地址 @param <T> 字符串类型 @param value 值 @param errorMsg 验证错误的信息 @return 验证后的值 @throws ValidateException 验证异常
[ "验证是否为IPV6地址" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Validator.java#L835-L840
joniles/mpxj
src/main/java/net/sf/mpxj/Task.java
Task.setBaselineFinish
public void setBaselineFinish(int baselineNumber, Date value) { set(selectField(TaskFieldLists.BASELINE_FINISHES, baselineNumber), value); }
java
public void setBaselineFinish(int baselineNumber, Date value) { set(selectField(TaskFieldLists.BASELINE_FINISHES, baselineNumber), value); }
[ "public", "void", "setBaselineFinish", "(", "int", "baselineNumber", ",", "Date", "value", ")", "{", "set", "(", "selectField", "(", "TaskFieldLists", ".", "BASELINE_FINISHES", ",", "baselineNumber", ")", ",", "value", ")", ";", "}" ]
Set a baseline value. @param baselineNumber baseline index (1-10) @param value baseline value
[ "Set", "a", "baseline", "value", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Task.java#L4002-L4005
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java
ConditionalCheck.notEmpty
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalEmptyArgumentException.class }) public static void notEmpty(final boolean condition, final boolean expression, @Nullable final String name) { if (condition) { Check.notEmpty(expression, name); } }
java
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalEmptyArgumentException.class }) public static void notEmpty(final boolean condition, final boolean expression, @Nullable final String name) { if (condition) { Check.notEmpty(expression, name); } }
[ "@", "ArgumentsChecked", "@", "Throws", "(", "{", "IllegalNullArgumentException", ".", "class", ",", "IllegalEmptyArgumentException", ".", "class", "}", ")", "public", "static", "void", "notEmpty", "(", "final", "boolean", "condition", ",", "final", "boolean", "ex...
Ensures that a passed parameter of the calling method is not empty, using the passed expression to evaluate the emptiness. @param condition condition must be {@code true}^ so that the check will be performed @param expression the result of the expression to verify the emptiness of a reference ({@code true} means empty, {@code false} means not empty) @param name name of object reference (in source code) @throws IllegalEmptyArgumentException if the given argument {@code reference} is empty
[ "Ensures", "that", "a", "passed", "parameter", "of", "the", "calling", "method", "is", "not", "empty", "using", "the", "passed", "expression", "to", "evaluate", "the", "emptiness", "." ]
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/ConditionalCheck.java#L1183-L1189
Azure/azure-sdk-for-java
network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCircuitPeeringsInner.java
ExpressRouteCircuitPeeringsInner.beginCreateOrUpdate
public ExpressRouteCircuitPeeringInner beginCreateOrUpdate(String resourceGroupName, String circuitName, String peeringName, ExpressRouteCircuitPeeringInner peeringParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, peeringParameters).toBlocking().single().body(); }
java
public ExpressRouteCircuitPeeringInner beginCreateOrUpdate(String resourceGroupName, String circuitName, String peeringName, ExpressRouteCircuitPeeringInner peeringParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, circuitName, peeringName, peeringParameters).toBlocking().single().body(); }
[ "public", "ExpressRouteCircuitPeeringInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "circuitName", ",", "String", "peeringName", ",", "ExpressRouteCircuitPeeringInner", "peeringParameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResp...
Creates or updates a peering in the specified express route circuits. @param resourceGroupName The name of the resource group. @param circuitName The name of the express route circuit. @param peeringName The name of the peering. @param peeringParameters Parameters supplied to the create or update express route circuit peering operation. @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 ExpressRouteCircuitPeeringInner object if successful.
[ "Creates", "or", "updates", "a", "peering", "in", "the", "specified", "express", "route", "circuits", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/network/v2018_04_01/implementation/ExpressRouteCircuitPeeringsInner.java#L444-L446
alkacon/opencms-core
src/org/opencms/widgets/serialdate/CmsSerialDateValue.java
CmsSerialDateValue.readOptionalBoolean
private Boolean readOptionalBoolean(JSONObject json, String key) { try { return Boolean.valueOf(json.getBoolean(key)); } catch (JSONException e) { LOG.debug("Reading optional JSON boolean failed. Default to provided default value.", e); } return null; }
java
private Boolean readOptionalBoolean(JSONObject json, String key) { try { return Boolean.valueOf(json.getBoolean(key)); } catch (JSONException e) { LOG.debug("Reading optional JSON boolean failed. Default to provided default value.", e); } return null; }
[ "private", "Boolean", "readOptionalBoolean", "(", "JSONObject", "json", ",", "String", "key", ")", "{", "try", "{", "return", "Boolean", ".", "valueOf", "(", "json", ".", "getBoolean", "(", "key", ")", ")", ";", "}", "catch", "(", "JSONException", "e", "...
Read an optional boolean value form a JSON Object. @param json the JSON object to read from. @param key the key for the boolean value in the provided JSON object. @return the boolean or null if reading the boolean fails.
[ "Read", "an", "optional", "boolean", "value", "form", "a", "JSON", "Object", "." ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/widgets/serialdate/CmsSerialDateValue.java#L317-L325
couchbase/couchbase-lite-java
src/main/java/com/couchbase/lite/MutableDictionary.java
MutableDictionary.setBoolean
@NonNull @Override public MutableDictionary setBoolean(@NonNull String key, boolean value) { return setValue(key, value); }
java
@NonNull @Override public MutableDictionary setBoolean(@NonNull String key, boolean value) { return setValue(key, value); }
[ "@", "NonNull", "@", "Override", "public", "MutableDictionary", "setBoolean", "(", "@", "NonNull", "String", "key", ",", "boolean", "value", ")", "{", "return", "setValue", "(", "key", ",", "value", ")", ";", "}" ]
Set a boolean value for the given key. @param key The key @param value The boolean value. @return The self object.
[ "Set", "a", "boolean", "value", "for", "the", "given", "key", "." ]
train
https://github.com/couchbase/couchbase-lite-java/blob/cb72c44186456e6191a9ad0a7feb310011d0b081/src/main/java/com/couchbase/lite/MutableDictionary.java#L195-L199
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java
HsqlTimer.setPeriod
public static Object setPeriod(final Object task, final long period) { return (task instanceof Task) ? ((Task) task).setPeriod(period) : task; }
java
public static Object setPeriod(final Object task, final long period) { return (task instanceof Task) ? ((Task) task).setPeriod(period) : task; }
[ "public", "static", "Object", "setPeriod", "(", "final", "Object", "task", ",", "final", "long", "period", ")", "{", "return", "(", "task", "instanceof", "Task", ")", "?", "(", "(", "Task", ")", "task", ")", ".", "setPeriod", "(", "period", ")", ":", ...
Sets the periodicity of the designated task to a new value. <p> If the designated task is cancelled or the new period is identical to the task's current period, then this invocation has essentially no effect and the submitted object is returned. <p> Otherwise, if the new period is greater than the designated task's current period, then a simple assignment occurs and the submittted object is returned. <p> If neither case holds, then the designated task is cancelled and a new, equivalent task with the new period is scheduled for immediate first execution and returned to the caller. <p> @return a task reference, as per the rules stated above. @param task the task whose periodicity is to be set @param period the new period
[ "Sets", "the", "periodicity", "of", "the", "designated", "task", "to", "a", "new", "value", ".", "<p", ">" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/lib/HsqlTimer.java#L427-L430
pushtorefresh/storio
storio-sqlite/src/main/java/com/pushtorefresh/storio3/sqlite/operations/delete/DeleteResult.java
DeleteResult.newInstance
@NonNull public static DeleteResult newInstance( int numberOfRowsDeleted, @NonNull Set<String> affectedTables, @Nullable Collection<String> affectedTags ) { return new DeleteResult(numberOfRowsDeleted, affectedTables, nonNullSet(affectedTags)); }
java
@NonNull public static DeleteResult newInstance( int numberOfRowsDeleted, @NonNull Set<String> affectedTables, @Nullable Collection<String> affectedTags ) { return new DeleteResult(numberOfRowsDeleted, affectedTables, nonNullSet(affectedTags)); }
[ "@", "NonNull", "public", "static", "DeleteResult", "newInstance", "(", "int", "numberOfRowsDeleted", ",", "@", "NonNull", "Set", "<", "String", ">", "affectedTables", ",", "@", "Nullable", "Collection", "<", "String", ">", "affectedTags", ")", "{", "return", ...
Creates new instance of immutable container for results of Delete Operation. @param numberOfRowsDeleted number of rows that were deleted. @param affectedTables tables that were affected. @param affectedTags notification tags that were affected. @return new instance of immutable container for result of Delete Operation.
[ "Creates", "new", "instance", "of", "immutable", "container", "for", "results", "of", "Delete", "Operation", "." ]
train
https://github.com/pushtorefresh/storio/blob/58f53d81bcc7b069c8bb271c46a90e37775abe8d/storio-sqlite/src/main/java/com/pushtorefresh/storio3/sqlite/operations/delete/DeleteResult.java#L58-L65
liferay/com-liferay-commerce
commerce-tax-service/src/main/java/com/liferay/commerce/tax/service/persistence/impl/CommerceTaxMethodPersistenceImpl.java
CommerceTaxMethodPersistenceImpl.findByG_E
@Override public CommerceTaxMethod findByG_E(long groupId, String engineKey) throws NoSuchTaxMethodException { CommerceTaxMethod commerceTaxMethod = fetchByG_E(groupId, engineKey); if (commerceTaxMethod == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", engineKey="); msg.append(engineKey); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchTaxMethodException(msg.toString()); } return commerceTaxMethod; }
java
@Override public CommerceTaxMethod findByG_E(long groupId, String engineKey) throws NoSuchTaxMethodException { CommerceTaxMethod commerceTaxMethod = fetchByG_E(groupId, engineKey); if (commerceTaxMethod == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", engineKey="); msg.append(engineKey); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchTaxMethodException(msg.toString()); } return commerceTaxMethod; }
[ "@", "Override", "public", "CommerceTaxMethod", "findByG_E", "(", "long", "groupId", ",", "String", "engineKey", ")", "throws", "NoSuchTaxMethodException", "{", "CommerceTaxMethod", "commerceTaxMethod", "=", "fetchByG_E", "(", "groupId", ",", "engineKey", ")", ";", ...
Returns the commerce tax method where groupId = &#63; and engineKey = &#63; or throws a {@link NoSuchTaxMethodException} if it could not be found. @param groupId the group ID @param engineKey the engine key @return the matching commerce tax method @throws NoSuchTaxMethodException if a matching commerce tax method could not be found
[ "Returns", "the", "commerce", "tax", "method", "where", "groupId", "=", "&#63", ";", "and", "engineKey", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchTaxMethodException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-tax-service/src/main/java/com/liferay/commerce/tax/service/persistence/impl/CommerceTaxMethodPersistenceImpl.java#L624-L650
UrielCh/ovh-java-sdk
ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java
ApiOvhDomain.serviceName_owo_field_DELETE
public void serviceName_owo_field_DELETE(String serviceName, net.minidev.ovh.api.domain.OvhWhoisObfuscatorFieldsEnum field) throws IOException { String qPath = "/domain/{serviceName}/owo/{field}"; StringBuilder sb = path(qPath, serviceName, field); exec(qPath, "DELETE", sb.toString(), null); }
java
public void serviceName_owo_field_DELETE(String serviceName, net.minidev.ovh.api.domain.OvhWhoisObfuscatorFieldsEnum field) throws IOException { String qPath = "/domain/{serviceName}/owo/{field}"; StringBuilder sb = path(qPath, serviceName, field); exec(qPath, "DELETE", sb.toString(), null); }
[ "public", "void", "serviceName_owo_field_DELETE", "(", "String", "serviceName", ",", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "domain", ".", "OvhWhoisObfuscatorFieldsEnum", "field", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/domain/{...
Delete a whois obfuscator REST: DELETE /domain/{serviceName}/owo/{field} @param serviceName [required] The internal name of your domain @param field [required] Obfuscated field
[ "Delete", "a", "whois", "obfuscator" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-domain/src/main/java/net/minidev/ovh/api/ApiOvhDomain.java#L1486-L1490
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/KeyVaultClientImpl.java
KeyVaultClientImpl.deleteKeyAsync
public ServiceFuture<KeyBundle> deleteKeyAsync(String vaultBaseUrl, String keyName, final ServiceCallback<KeyBundle> serviceCallback) { return ServiceFuture.fromResponse(deleteKeyWithServiceResponseAsync(vaultBaseUrl, keyName), serviceCallback); }
java
public ServiceFuture<KeyBundle> deleteKeyAsync(String vaultBaseUrl, String keyName, final ServiceCallback<KeyBundle> serviceCallback) { return ServiceFuture.fromResponse(deleteKeyWithServiceResponseAsync(vaultBaseUrl, keyName), serviceCallback); }
[ "public", "ServiceFuture", "<", "KeyBundle", ">", "deleteKeyAsync", "(", "String", "vaultBaseUrl", ",", "String", "keyName", ",", "final", "ServiceCallback", "<", "KeyBundle", ">", "serviceCallback", ")", "{", "return", "ServiceFuture", ".", "fromResponse", "(", "...
Deletes a key of any type from storage in Azure Key Vault. The delete key operation cannot be used to remove individual versions of a key. This operation removes the cryptographic material associated with the key, which means the key is not usable for Sign/Verify, Wrap/Unwrap or Encrypt/Decrypt operations. Authorization: Requires the keys/delete permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param keyName The name of the key to delete. @param serviceCallback the async ServiceCallback to handle successful and failed responses. @return the {@link ServiceFuture} object
[ "Deletes", "a", "key", "of", "any", "type", "from", "storage", "in", "Azure", "Key", "Vault", ".", "The", "delete", "key", "operation", "cannot", "be", "used", "to", "remove", "individual", "versions", "of", "a", "key", ".", "This", "operation", "removes",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/KeyVaultClientImpl.java#L848-L850
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java
SDMath.clipByNorm
public SDVariable clipByNorm(SDVariable x, double clipValue, int... dimensions) { return clipByNorm(null, x, clipValue, dimensions); }
java
public SDVariable clipByNorm(SDVariable x, double clipValue, int... dimensions) { return clipByNorm(null, x, clipValue, dimensions); }
[ "public", "SDVariable", "clipByNorm", "(", "SDVariable", "x", ",", "double", "clipValue", ",", "int", "...", "dimensions", ")", "{", "return", "clipByNorm", "(", "null", ",", "x", ",", "clipValue", ",", "dimensions", ")", ";", "}" ]
Clipping by L2 norm, optionally along dimension(s)<br> if l2Norm(x,dimension) < clipValue, then input is returned unmodifed<br> Otherwise, out[i] = in[i] * clipValue / l2Norm(in, dimensions) where each value is clipped according to the corresponding l2Norm along the specified dimensions @param x Input variable @param clipValue Clipping value (maximum l2 norm) @param dimensions If not specified, all dimensions are used @return Output variable
[ "Clipping", "by", "L2", "norm", "optionally", "along", "dimension", "(", "s", ")", "<br", ">", "if", "l2Norm", "(", "x", "dimension", ")", "<", "clipValue", "then", "input", "is", "returned", "unmodifed<br", ">", "Otherwise", "out", "[", "i", "]", "=", ...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/ops/SDMath.java#L414-L416
demidenko05/beigesoft-bcommon
src/main/java/org/beigesoft/holder/HolderRapiFields.java
HolderRapiFields.getFor
@Override public final Field getFor(final Class<?> pClass, final String pFieldName) { Map<String, Field> fldMap = this.rapiFieldsMap.get(pClass); if (fldMap == null) { // There is no way to get from Map partially initialized bean // in this double-checked locking implementation // cause putting to the Map fully initialized bean synchronized (this.rapiFieldsMap) { fldMap = this.rapiFieldsMap.get(pClass); if (fldMap == null) { fldMap = new HashMap<String, Field>(); Field[] fields = getUtlReflection().retrieveFields(pClass); for (Field field : fields) { fldMap.put(field.getName(), field); } this.rapiFieldsMap.put(pClass, fldMap); } } } return fldMap.get(pFieldName); }
java
@Override public final Field getFor(final Class<?> pClass, final String pFieldName) { Map<String, Field> fldMap = this.rapiFieldsMap.get(pClass); if (fldMap == null) { // There is no way to get from Map partially initialized bean // in this double-checked locking implementation // cause putting to the Map fully initialized bean synchronized (this.rapiFieldsMap) { fldMap = this.rapiFieldsMap.get(pClass); if (fldMap == null) { fldMap = new HashMap<String, Field>(); Field[] fields = getUtlReflection().retrieveFields(pClass); for (Field field : fields) { fldMap.put(field.getName(), field); } this.rapiFieldsMap.put(pClass, fldMap); } } } return fldMap.get(pFieldName); }
[ "@", "Override", "public", "final", "Field", "getFor", "(", "final", "Class", "<", "?", ">", "pClass", ",", "final", "String", "pFieldName", ")", "{", "Map", "<", "String", ",", "Field", ">", "fldMap", "=", "this", ".", "rapiFieldsMap", ".", "get", "("...
<p>Get thing for given class and thing name.</p> @param pClass a Class @param pFieldName Thing Name @return a thing
[ "<p", ">", "Get", "thing", "for", "given", "class", "and", "thing", "name", ".", "<", "/", "p", ">" ]
train
https://github.com/demidenko05/beigesoft-bcommon/blob/bb446822b4fc9b5a6a8cd3cc98d0b3d83d718daf/src/main/java/org/beigesoft/holder/HolderRapiFields.java#L45-L65
super-csv/super-csv
super-csv/src/main/java/org/supercsv/util/ReflectionUtils.java
ReflectionUtils.getMethodNameForField
private static String getMethodNameForField(final String prefix, final String fieldName) { return prefix + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1); }
java
private static String getMethodNameForField(final String prefix, final String fieldName) { return prefix + fieldName.substring(0, 1).toUpperCase() + fieldName.substring(1); }
[ "private", "static", "String", "getMethodNameForField", "(", "final", "String", "prefix", ",", "final", "String", "fieldName", ")", "{", "return", "prefix", "+", "fieldName", ".", "substring", "(", "0", ",", "1", ")", ".", "toUpperCase", "(", ")", "+", "fi...
Gets the camelcase getter/setter method name for a field. @param prefix the method prefix @param fieldName the field name @return the method name
[ "Gets", "the", "camelcase", "getter", "/", "setter", "method", "name", "for", "a", "field", "." ]
train
https://github.com/super-csv/super-csv/blob/f18db724674dc1c4116e25142c1b5403ebf43e96/super-csv/src/main/java/org/supercsv/util/ReflectionUtils.java#L243-L245
nabedge/mixer2
src/main/java/org/mixer2/xhtml/util/GetDescendantsUtil.java
GetDescendantsUtil.getDescendants
public static <T extends AbstractJaxb> List<T> getDescendants(T target, List<T> resultList, String clazz, Class<T> tagType) { return execute(target, resultList, tagType, clazz); }
java
public static <T extends AbstractJaxb> List<T> getDescendants(T target, List<T> resultList, String clazz, Class<T> tagType) { return execute(target, resultList, tagType, clazz); }
[ "public", "static", "<", "T", "extends", "AbstractJaxb", ">", "List", "<", "T", ">", "getDescendants", "(", "T", "target", ",", "List", "<", "T", ">", "resultList", ",", "String", "clazz", ",", "Class", "<", "T", ">", "tagType", ")", "{", "return", "...
タグとclass指定で子孫要素を返す @param <T> tag class type. (i.e. Div.class, Span.class...) @param target objects for scan @param resultList usually, pass new ArrayList @param clazz class property of tag @param tagType tag class @return
[ "タグとclass指定で子孫要素を返す" ]
train
https://github.com/nabedge/mixer2/blob/8c2db27cfcd65bf0b1e0242ef9362ebd8033777c/src/main/java/org/mixer2/xhtml/util/GetDescendantsUtil.java#L34-L37
getlantern/kaleidoscope
src/main/java/org/kaleidoscope/LocalTrustGraph.java
LocalTrustGraph.addDirectedRoute
public void addDirectedRoute(final TrustGraphNodeId from, final TrustGraphNodeId to) { final TrustGraphNode fromNode = nodes.get(from); fromNode.getRoutingTable().addNeighbor(to); }
java
public void addDirectedRoute(final TrustGraphNodeId from, final TrustGraphNodeId to) { final TrustGraphNode fromNode = nodes.get(from); fromNode.getRoutingTable().addNeighbor(to); }
[ "public", "void", "addDirectedRoute", "(", "final", "TrustGraphNodeId", "from", ",", "final", "TrustGraphNodeId", "to", ")", "{", "final", "TrustGraphNode", "fromNode", "=", "nodes", ".", "get", "(", "from", ")", ";", "fromNode", ".", "getRoutingTable", "(", "...
create a directed trust link between two nodes. The node with id 'from' will trust the node with id 'to'. Note: Although this is useful for testing adverse conditions, relationships must be symmetric for the normal functioning of the algorithm. An advertising node must trust another node to send to it, and that same node must trust the sender in order to forward the message (find the next hop for the message). @param from the id of the node that is trusting @param to the id of node that is being trused by the node 'from'
[ "create", "a", "directed", "trust", "link", "between", "two", "nodes", ".", "The", "node", "with", "id", "from", "will", "trust", "the", "node", "with", "id", "to", "." ]
train
https://github.com/getlantern/kaleidoscope/blob/7516f05724c8f54e5d535d23da9116817c08a09f/src/main/java/org/kaleidoscope/LocalTrustGraph.java#L249-L252
spotify/helios
helios-tools/src/main/java/com/spotify/helios/cli/CliParser.java
CliParser.handleError
@SuppressWarnings("UseOfSystemOutOrSystemErr") private void handleError(ArgumentParser parser, ArgumentParserException ex) { System.err.println("# " + HELP_ISSUES); System.err.println("# " + HELP_WIKI); System.err.println("# ---------------------------------------------------------------"); parser.handleError(ex); }
java
@SuppressWarnings("UseOfSystemOutOrSystemErr") private void handleError(ArgumentParser parser, ArgumentParserException ex) { System.err.println("# " + HELP_ISSUES); System.err.println("# " + HELP_WIKI); System.err.println("# ---------------------------------------------------------------"); parser.handleError(ex); }
[ "@", "SuppressWarnings", "(", "\"UseOfSystemOutOrSystemErr\"", ")", "private", "void", "handleError", "(", "ArgumentParser", "parser", ",", "ArgumentParserException", "ex", ")", "{", "System", ".", "err", ".", "println", "(", "\"# \"", "+", "HELP_ISSUES", ")", ";"...
Use this instead of calling parser.handle error directly. This will print a header with links to jira and documentation before the standard error message is printed. @param parser the parser which will print the standard error message @param ex the exception that will be printed
[ "Use", "this", "instead", "of", "calling", "parser", ".", "handle", "error", "directly", ".", "This", "will", "print", "a", "header", "with", "links", "to", "jira", "and", "documentation", "before", "the", "standard", "error", "message", "is", "printed", "."...
train
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-tools/src/main/java/com/spotify/helios/cli/CliParser.java#L241-L247
elki-project/elki
elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/distance/SOS.java
SOS.sumOfProbabilities
public static double sumOfProbabilities(DBIDIter ignore, DBIDArrayIter di, double[] p) { double s = 0; for(di.seek(0); di.valid(); di.advance()) { if(DBIDUtil.equal(ignore, di)) { continue; } final double v = p[di.getOffset()]; if(!(v > 0)) { break; } s += v; } return s; }
java
public static double sumOfProbabilities(DBIDIter ignore, DBIDArrayIter di, double[] p) { double s = 0; for(di.seek(0); di.valid(); di.advance()) { if(DBIDUtil.equal(ignore, di)) { continue; } final double v = p[di.getOffset()]; if(!(v > 0)) { break; } s += v; } return s; }
[ "public", "static", "double", "sumOfProbabilities", "(", "DBIDIter", "ignore", ",", "DBIDArrayIter", "di", ",", "double", "[", "]", "p", ")", "{", "double", "s", "=", "0", ";", "for", "(", "di", ".", "seek", "(", "0", ")", ";", "di", ".", "valid", ...
Compute the sum of probabilities, stop at first 0, ignore query object. Note: while SOS ensures the 'ignore' object is not added in the first place, KNNSOS cannot do so efficiently (yet). @param ignore Object to ignore. @param di Object list @param p Probabilities @return Sum.
[ "Compute", "the", "sum", "of", "probabilities", "stop", "at", "first", "0", "ignore", "query", "object", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/distance/SOS.java#L164-L177
Red5/red5-server-common
src/main/java/org/red5/server/so/ClientSharedObject.java
ClientSharedObject.notifySendMessage
protected void notifySendMessage(String method, List<?> params) { for (ISharedObjectListener listener : listeners) { listener.onSharedObjectSend(this, method, params); } }
java
protected void notifySendMessage(String method, List<?> params) { for (ISharedObjectListener listener : listeners) { listener.onSharedObjectSend(this, method, params); } }
[ "protected", "void", "notifySendMessage", "(", "String", "method", ",", "List", "<", "?", ">", "params", ")", "{", "for", "(", "ISharedObjectListener", "listener", ":", "listeners", ")", "{", "listener", ".", "onSharedObjectSend", "(", "this", ",", "method", ...
Broadcast send event to listeners @param method Method name @param params Params
[ "Broadcast", "send", "event", "to", "listeners" ]
train
https://github.com/Red5/red5-server-common/blob/39ae73710c25bda86d70b13ef37ae707962217b9/src/main/java/org/red5/server/so/ClientSharedObject.java#L265-L269
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/xml/Dom4JXMLOutput.java
Dom4JXMLOutput.writeElementList
public void writeElementList(String tagName, Collection<String> listValues) { for (String listValue : listValues) { openTag(tagName); writeText(listValue); closeTag(tagName); } }
java
public void writeElementList(String tagName, Collection<String> listValues) { for (String listValue : listValues) { openTag(tagName); writeText(listValue); closeTag(tagName); } }
[ "public", "void", "writeElementList", "(", "String", "tagName", ",", "Collection", "<", "String", ">", "listValues", ")", "{", "for", "(", "String", "listValue", ":", "listValues", ")", "{", "openTag", "(", "tagName", ")", ";", "writeText", "(", "listValue",...
Add a list of Strings to document as elements with given tag name to the tree. @param tagName the tag name @param listValues Collection of String values to add
[ "Add", "a", "list", "of", "Strings", "to", "document", "as", "elements", "with", "given", "tag", "name", "to", "the", "tree", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/xml/Dom4JXMLOutput.java#L131-L137
shrinkwrap/shrinkwrap
impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarArchive.java
TarArchive.setUserInfo
public void setUserInfo(int userId, String userName, int groupId, String groupName) { this.userId = userId; this.userName = userName; this.groupId = groupId; this.groupName = groupName; }
java
public void setUserInfo(int userId, String userName, int groupId, String groupName) { this.userId = userId; this.userName = userName; this.groupId = groupId; this.groupName = groupName; }
[ "public", "void", "setUserInfo", "(", "int", "userId", ",", "String", "userName", ",", "int", "groupId", ",", "String", "groupName", ")", "{", "this", ".", "userId", "=", "userId", ";", "this", ".", "userName", "=", "userName", ";", "this", ".", "groupId...
Set user and group information that will be used to fill in the tar archive's entry headers. Since Java currently provides no means of determining a user name, user id, group name, or group id for a given File, TarArchive allows the programmer to specify values to be used in their place. @param userId The user Id to use in the headers. @param userName The user name to use in the headers. @param groupId The group id to use in the headers. @param groupName The group name to use in the headers.
[ "Set", "user", "and", "group", "information", "that", "will", "be", "used", "to", "fill", "in", "the", "tar", "archive", "s", "entry", "headers", ".", "Since", "Java", "currently", "provides", "no", "means", "of", "determining", "a", "user", "name", "user"...
train
https://github.com/shrinkwrap/shrinkwrap/blob/3f8a1a6d344651428c709a63ebb52d35343c5387/impl-base/src/main/java/org/jboss/shrinkwrap/impl/base/io/tar/TarArchive.java#L239-L244
line/armeria
core/src/main/java/com/linecorp/armeria/server/auth/HttpAuthServiceBuilder.java
HttpAuthServiceBuilder.newDecorator
public Function<Service<HttpRequest, HttpResponse>, HttpAuthService> newDecorator() { final Authorizer<HttpRequest> authorizer = authorizer(); final AuthSuccessHandler<HttpRequest, HttpResponse> successHandler = this.successHandler; final AuthFailureHandler<HttpRequest, HttpResponse> failureHandler = this.failureHandler; return service -> new HttpAuthService(service, authorizer, successHandler, failureHandler); }
java
public Function<Service<HttpRequest, HttpResponse>, HttpAuthService> newDecorator() { final Authorizer<HttpRequest> authorizer = authorizer(); final AuthSuccessHandler<HttpRequest, HttpResponse> successHandler = this.successHandler; final AuthFailureHandler<HttpRequest, HttpResponse> failureHandler = this.failureHandler; return service -> new HttpAuthService(service, authorizer, successHandler, failureHandler); }
[ "public", "Function", "<", "Service", "<", "HttpRequest", ",", "HttpResponse", ">", ",", "HttpAuthService", ">", "newDecorator", "(", ")", "{", "final", "Authorizer", "<", "HttpRequest", ">", "authorizer", "=", "authorizer", "(", ")", ";", "final", "AuthSucces...
Returns a newly-created decorator that decorates a {@link Service} with a new {@link HttpAuthService} based on the {@link Authorizer}s added to this builder.
[ "Returns", "a", "newly", "-", "created", "decorator", "that", "decorates", "a", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/auth/HttpAuthServiceBuilder.java#L170-L175
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/theta/ForwardCompatibility.java
ForwardCompatibility.heapify1to3
static final CompactSketch heapify1to3(final Memory srcMem, final long seed) { final int memCap = (int) srcMem.getCapacity(); final short seedHash = Util.computeSeedHash(seed); if (memCap <= 24) { //return empty return HeapCompactOrderedSketch .compact(new long[0], true, seedHash, 0, Long.MAX_VALUE); } final int curCount = srcMem.getInt(RETAINED_ENTRIES_INT); final int mdLongs = 3; final int reqBytesIn = (curCount + mdLongs) << 3; validateInputSize(reqBytesIn, memCap); final long thetaLong = srcMem.getLong(THETA_LONG); final long[] compactOrderedCache = new long[curCount]; srcMem.getLongArray(24, compactOrderedCache, 0, curCount); return HeapCompactOrderedSketch .compact(compactOrderedCache, false, seedHash, curCount, thetaLong); }
java
static final CompactSketch heapify1to3(final Memory srcMem, final long seed) { final int memCap = (int) srcMem.getCapacity(); final short seedHash = Util.computeSeedHash(seed); if (memCap <= 24) { //return empty return HeapCompactOrderedSketch .compact(new long[0], true, seedHash, 0, Long.MAX_VALUE); } final int curCount = srcMem.getInt(RETAINED_ENTRIES_INT); final int mdLongs = 3; final int reqBytesIn = (curCount + mdLongs) << 3; validateInputSize(reqBytesIn, memCap); final long thetaLong = srcMem.getLong(THETA_LONG); final long[] compactOrderedCache = new long[curCount]; srcMem.getLongArray(24, compactOrderedCache, 0, curCount); return HeapCompactOrderedSketch .compact(compactOrderedCache, false, seedHash, curCount, thetaLong); }
[ "static", "final", "CompactSketch", "heapify1to3", "(", "final", "Memory", "srcMem", ",", "final", "long", "seed", ")", "{", "final", "int", "memCap", "=", "(", "int", ")", "srcMem", ".", "getCapacity", "(", ")", ";", "final", "short", "seedHash", "=", "...
Convert a serialization version (SerVer) 1 sketch to a SerVer 3 HeapCompactOrderedSketch. Note: SerVer 1 sketches always have metadata-longs of 3 and are always stored in a compact ordered form, but with 3 different sketch types. All SerVer 1 sketches will be converted to a SerVer 3, HeapCompactOrderedSketch. @param srcMem the image of a SerVer 1 sketch @param seed <a href="{@docRoot}/resources/dictionary.html#seed">See Update Hash Seed</a>. The seed used for building the sketch image in srcMem. Note: SerVer 1 sketches do not have the concept of the SeedHash, so the seed provided here MUST be the actual seed that was used when the SerVer 1 sketches were built. @return a SerVer 3 HeapCompactOrderedSketch.
[ "Convert", "a", "serialization", "version", "(", "SerVer", ")", "1", "sketch", "to", "a", "SerVer", "3", "HeapCompactOrderedSketch", ".", "Note", ":", "SerVer", "1", "sketches", "always", "have", "metadata", "-", "longs", "of", "3", "and", "are", "always", ...
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/theta/ForwardCompatibility.java#L42-L64
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java
BundlesHandlerFactory.bundleListContains
private boolean bundleListContains(List<JoinableResourceBundle> bundles, String bundleName) { boolean contains = false; for (JoinableResourceBundle bundle : bundles) { if (bundle.getName().equals(bundleName)) { contains = true; break; } } return contains; }
java
private boolean bundleListContains(List<JoinableResourceBundle> bundles, String bundleName) { boolean contains = false; for (JoinableResourceBundle bundle : bundles) { if (bundle.getName().equals(bundleName)) { contains = true; break; } } return contains; }
[ "private", "boolean", "bundleListContains", "(", "List", "<", "JoinableResourceBundle", ">", "bundles", ",", "String", "bundleName", ")", "{", "boolean", "contains", "=", "false", ";", "for", "(", "JoinableResourceBundle", "bundle", ":", "bundles", ")", "{", "if...
Checks if the bundle name exists in the bundle list @param bundles the bundle list @param bundleName the bundle name @return true if the bundle name exists in the bundle list
[ "Checks", "if", "the", "bundle", "name", "exists", "in", "the", "bundle", "list" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/BundlesHandlerFactory.java#L725-L734
maxirosson/jdroid-android
jdroid-android-google-inappbilling/src/main/java/com/jdroid/android/google/inappbilling/client/utils/Security.java
Security.verifyPurchase
public static boolean verifyPurchase(String base64PublicKey, String signedData, String signature) { if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey) || TextUtils.isEmpty(signature)) { LOGGER.error("Purchase verification failed: missing data."); return false; } PublicKey key = Security.generatePublicKey(base64PublicKey); return Security.verify(key, signedData, signature); }
java
public static boolean verifyPurchase(String base64PublicKey, String signedData, String signature) { if (TextUtils.isEmpty(signedData) || TextUtils.isEmpty(base64PublicKey) || TextUtils.isEmpty(signature)) { LOGGER.error("Purchase verification failed: missing data."); return false; } PublicKey key = Security.generatePublicKey(base64PublicKey); return Security.verify(key, signedData, signature); }
[ "public", "static", "boolean", "verifyPurchase", "(", "String", "base64PublicKey", ",", "String", "signedData", ",", "String", "signature", ")", "{", "if", "(", "TextUtils", ".", "isEmpty", "(", "signedData", ")", "||", "TextUtils", ".", "isEmpty", "(", "base6...
Verifies that the data was signed with the given signature, and returns the verified purchase. The data is in JSON format and signed with a private key. @param base64PublicKey the base64-encoded public key to use for verifying. @param signedData the signed JSON string (signed, not encrypted) @param signature the signature for the data, signed with the private key @return Whether the verification was successful or not
[ "Verifies", "that", "the", "data", "was", "signed", "with", "the", "given", "signature", "and", "returns", "the", "verified", "purchase", ".", "The", "data", "is", "in", "JSON", "format", "and", "signed", "with", "a", "private", "key", "." ]
train
https://github.com/maxirosson/jdroid-android/blob/1ba9cae56a16fa36bdb2c9c04379853f0300707f/jdroid-android-google-inappbilling/src/main/java/com/jdroid/android/google/inappbilling/client/utils/Security.java#L50-L58
alkacon/opencms-core
src/org/opencms/ade/containerpage/CmsContainerpageService.java
CmsContainerpageService.isModelPage
private boolean isModelPage(CmsObject cms, CmsResource containerPage) { CmsADEConfigData config = getConfigData(containerPage.getRootPath()); for (CmsModelPageConfig modelConfig : config.getModelPages()) { if (modelConfig.getResource().getStructureId().equals(containerPage.getStructureId())) { return true; } } return false; }
java
private boolean isModelPage(CmsObject cms, CmsResource containerPage) { CmsADEConfigData config = getConfigData(containerPage.getRootPath()); for (CmsModelPageConfig modelConfig : config.getModelPages()) { if (modelConfig.getResource().getStructureId().equals(containerPage.getStructureId())) { return true; } } return false; }
[ "private", "boolean", "isModelPage", "(", "CmsObject", "cms", ",", "CmsResource", "containerPage", ")", "{", "CmsADEConfigData", "config", "=", "getConfigData", "(", "containerPage", ".", "getRootPath", "(", ")", ")", ";", "for", "(", "CmsModelPageConfig", "modelC...
Checks if a page is a model page.<p> @param cms the CMS context to use @param containerPage the page to check @return true if the resource is a model page
[ "Checks", "if", "a", "page", "is", "a", "model", "page", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/CmsContainerpageService.java#L2758-L2767
xmlunit/xmlunit
xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java
XMLAssert.assertXMLNotEqual
public static void assertXMLNotEqual(InputSource control, InputSource test) throws SAXException, IOException { assertXMLNotEqual(null, control, test); }
java
public static void assertXMLNotEqual(InputSource control, InputSource test) throws SAXException, IOException { assertXMLNotEqual(null, control, test); }
[ "public", "static", "void", "assertXMLNotEqual", "(", "InputSource", "control", ",", "InputSource", "test", ")", "throws", "SAXException", ",", "IOException", "{", "assertXMLNotEqual", "(", "null", ",", "control", ",", "test", ")", ";", "}" ]
Assert that two XML documents are NOT similar @param control XML to be compared against @param test XML to be tested @throws SAXException @throws IOException
[ "Assert", "that", "two", "XML", "documents", "are", "NOT", "similar" ]
train
https://github.com/xmlunit/xmlunit/blob/fe3d701d43f57ee83dcba336e4c1555619d3084b/xmlunit-legacy/src/main/java/org/custommonkey/xmlunit/XMLAssert.java#L269-L272
Samsung/GearVRf
GVRf/Extensions/3DCursor/IODevices/gearwear/GearWearIoDevice/src/main/java/com/gearvrf/io/gearwear/GearWearableDevice.java
GearWearableDevice.getSensitivity
private float getSensitivity(float x, float y) { double furthestDistance = MAX_DISTANCE; double distance = Math.sqrt(Math.pow(x - CENTER_X, 2) + Math.pow(y - CENTER_Y, 2)); double sens = MAX_SENSITIVITY * distance / furthestDistance; if (sens > MAX_SENSITIVITY) { sens = MAX_SENSITIVITY; } return (float) sens; }
java
private float getSensitivity(float x, float y) { double furthestDistance = MAX_DISTANCE; double distance = Math.sqrt(Math.pow(x - CENTER_X, 2) + Math.pow(y - CENTER_Y, 2)); double sens = MAX_SENSITIVITY * distance / furthestDistance; if (sens > MAX_SENSITIVITY) { sens = MAX_SENSITIVITY; } return (float) sens; }
[ "private", "float", "getSensitivity", "(", "float", "x", ",", "float", "y", ")", "{", "double", "furthestDistance", "=", "MAX_DISTANCE", ";", "double", "distance", "=", "Math", ".", "sqrt", "(", "Math", ".", "pow", "(", "x", "-", "CENTER_X", ",", "2", ...
Calculate sensitivity based on distance from center <p/> The farther from the center, the more sensitive the cursor should be (linearly)
[ "Calculate", "sensitivity", "based", "on", "distance", "from", "center", "<p", "/", ">", "The", "farther", "from", "the", "center", "the", "more", "sensitive", "the", "cursor", "should", "be", "(", "linearly", ")" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/3DCursor/IODevices/gearwear/GearWearIoDevice/src/main/java/com/gearvrf/io/gearwear/GearWearableDevice.java#L594-L602
OpenLiberty/open-liberty
dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigValidator.java
ConfigValidator.isSecureAttribute
private boolean isSecureAttribute(RegistryEntry registryEntry, String attributeName) { ExtendedAttributeDefinition attributeDefinition = getAttributeDefinition(registryEntry, attributeName); if (attributeDefinition == null) { return false; // No available definition; default to false. } // @formatter:off int attributeType = attributeDefinition.getType(); return ((attributeType == MetaTypeFactory.PASSWORD_TYPE) || (attributeType == MetaTypeFactory.HASHED_PASSWORD_TYPE)); // @formatter:on }
java
private boolean isSecureAttribute(RegistryEntry registryEntry, String attributeName) { ExtendedAttributeDefinition attributeDefinition = getAttributeDefinition(registryEntry, attributeName); if (attributeDefinition == null) { return false; // No available definition; default to false. } // @formatter:off int attributeType = attributeDefinition.getType(); return ((attributeType == MetaTypeFactory.PASSWORD_TYPE) || (attributeType == MetaTypeFactory.HASHED_PASSWORD_TYPE)); // @formatter:on }
[ "private", "boolean", "isSecureAttribute", "(", "RegistryEntry", "registryEntry", ",", "String", "attributeName", ")", "{", "ExtendedAttributeDefinition", "attributeDefinition", "=", "getAttributeDefinition", "(", "registryEntry", ",", "attributeName", ")", ";", "if", "("...
Test if an attribute is a secured / password type attribute. This is tested using the attribute type, as obtained from {@link ExtendedAttributeDefinition#getType()}. Attribute types {@link MetaTypeFactory#PASSWORD_TYPE} and {@link MetaTypeFactory#HASHED_PASSWORD_TYPE} are secured. All other attribute types are not secured. Answer false the attribute type cannot be obtained, either because the registry entry was null, had no class definition, or had no definition for the attribute. @param registryEntry The registry entry from which to obtain the attribute type. @param attributeName The name of the attribute which is to be tested. @return True or false telling if the attribute is a secured/password type attribute.
[ "Test", "if", "an", "attribute", "is", "a", "secured", "/", "password", "type", "attribute", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.config/src/com/ibm/ws/config/xml/internal/ConfigValidator.java#L127-L138
baratine/baratine
web/src/main/java/com/caucho/v5/http/protocol/RequestHttpBase.java
RequestHttpBase.addHeaderOutImpl
public void addHeaderOutImpl(String key, String value) { if (headerOutSpecial(key, value)) { return; } ArrayList<String> keys = _headerKeysOut; ArrayList<String> values = _headerValuesOut; int size = keys.size(); // webapp/1k32 for (int i = 0; i < size; i++) { if (keys.get(i).equals(key) && values.get(i).equals(value)) { return; } } keys.add(key); values.add(value); }
java
public void addHeaderOutImpl(String key, String value) { if (headerOutSpecial(key, value)) { return; } ArrayList<String> keys = _headerKeysOut; ArrayList<String> values = _headerValuesOut; int size = keys.size(); // webapp/1k32 for (int i = 0; i < size; i++) { if (keys.get(i).equals(key) && values.get(i).equals(value)) { return; } } keys.add(key); values.add(value); }
[ "public", "void", "addHeaderOutImpl", "(", "String", "key", ",", "String", "value", ")", "{", "if", "(", "headerOutSpecial", "(", "key", ",", "value", ")", ")", "{", "return", ";", "}", "ArrayList", "<", "String", ">", "keys", "=", "_headerKeysOut", ";",...
Adds a new header. If an old header with that name exists, both headers are output. @param key the header key. @param value the header value.
[ "Adds", "a", "new", "header", ".", "If", "an", "old", "header", "with", "that", "name", "exists", "both", "headers", "are", "output", "." ]
train
https://github.com/baratine/baratine/blob/db34b45c03c5a5e930d8142acc72319125569fcf/web/src/main/java/com/caucho/v5/http/protocol/RequestHttpBase.java#L1928-L1948
redisson/redisson
redisson/src/main/java/org/redisson/liveobject/misc/ClassUtils.java
ClassUtils.searchForMethod
public static Method searchForMethod(Class<?> type, String name, Class<?>[] parms) { try { return type.getMethod(name, parms); } catch (NoSuchMethodException e) {} Method[] methods = type.getMethods(); for (int i = 0; i < methods.length; i++) { // Has to be named the same of course. if (!methods[i].getName().equals(name)) { continue; } Class<?>[] types = methods[i].getParameterTypes(); // Does it have the same number of arguments that we're looking for. if (types.length != parms.length) { continue; } // Check for type compatibility if (areTypesCompatible(types, parms)) { return methods[i]; } } return null; }
java
public static Method searchForMethod(Class<?> type, String name, Class<?>[] parms) { try { return type.getMethod(name, parms); } catch (NoSuchMethodException e) {} Method[] methods = type.getMethods(); for (int i = 0; i < methods.length; i++) { // Has to be named the same of course. if (!methods[i].getName().equals(name)) { continue; } Class<?>[] types = methods[i].getParameterTypes(); // Does it have the same number of arguments that we're looking for. if (types.length != parms.length) { continue; } // Check for type compatibility if (areTypesCompatible(types, parms)) { return methods[i]; } } return null; }
[ "public", "static", "Method", "searchForMethod", "(", "Class", "<", "?", ">", "type", ",", "String", "name", ",", "Class", "<", "?", ">", "[", "]", "parms", ")", "{", "try", "{", "return", "type", ".", "getMethod", "(", "name", ",", "parms", ")", "...
Searches through all methods looking for one with the specified name that will take the specified paramaters even if the parameter types are more generic in the actual method implementation. This is similar to the findConstructor() method and has the similar limitations that it doesn't do a real widening scope search and simply processes the methods in order. @param type param @param name of class @param parms classes @return Method object
[ "Searches", "through", "all", "methods", "looking", "for", "one", "with", "the", "specified", "name", "that", "will", "take", "the", "specified", "paramaters", "even", "if", "the", "parameter", "types", "are", "more", "generic", "in", "the", "actual", "method"...
train
https://github.com/redisson/redisson/blob/d3acc0249b2d5d658d36d99e2c808ce49332ea44/redisson/src/main/java/org/redisson/liveobject/misc/ClassUtils.java#L169-L192
oehf/ipf-oht-atna
auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSAuditor.java
XDSAuditor.auditQueryEvent
protected void auditQueryEvent( boolean systemIsSource, // System Type IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome, // Event String auditSourceId, String auditSourceEnterpriseSiteId, // Audit Source String sourceUserId, String sourceAltUserId, String sourceUserName, String sourceNetworkId, // Source Participant String humanRequestor, // Human Participant String humanRequestorName, // Human Participant name boolean humanAfterDestination, String registryEndpointUri, String registryAltUserId, // Destination Participant String storedQueryUUID, String adhocQueryRequestPayload, String homeCommunityId, // Payload Object Participant String patientId, // Patient Object Participant List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { QueryEvent queryEvent = new QueryEvent(systemIsSource, eventOutcome, transaction, purposesOfUse); queryEvent.setAuditSourceId(auditSourceId, auditSourceEnterpriseSiteId); queryEvent.addSourceActiveParticipant(sourceUserId, sourceAltUserId, sourceUserName, sourceNetworkId, true); if (humanAfterDestination) { queryEvent.addDestinationActiveParticipant(registryEndpointUri, registryAltUserId, null, EventUtils.getAddressForUrl(registryEndpointUri, false), false); } if(!EventUtils.isEmptyOrNull(humanRequestorName)) { queryEvent.addHumanRequestorActiveParticipant(humanRequestorName, null, humanRequestorName, userRoles); } if (! humanAfterDestination) { queryEvent.addDestinationActiveParticipant(registryEndpointUri, registryAltUserId, null, EventUtils.getAddressForUrl(registryEndpointUri, false), false); } if (!EventUtils.isEmptyOrNull(patientId)) { queryEvent.addPatientParticipantObject(patientId); } byte[] queryRequestPayloadBytes = null; if (!EventUtils.isEmptyOrNull(adhocQueryRequestPayload)) { queryRequestPayloadBytes = adhocQueryRequestPayload.getBytes(); } queryEvent.addQueryParticipantObject(storedQueryUUID, homeCommunityId, queryRequestPayloadBytes, null, transaction); audit(queryEvent); }
java
protected void auditQueryEvent( boolean systemIsSource, // System Type IHETransactionEventTypeCodes transaction, RFC3881EventOutcomeCodes eventOutcome, // Event String auditSourceId, String auditSourceEnterpriseSiteId, // Audit Source String sourceUserId, String sourceAltUserId, String sourceUserName, String sourceNetworkId, // Source Participant String humanRequestor, // Human Participant String humanRequestorName, // Human Participant name boolean humanAfterDestination, String registryEndpointUri, String registryAltUserId, // Destination Participant String storedQueryUUID, String adhocQueryRequestPayload, String homeCommunityId, // Payload Object Participant String patientId, // Patient Object Participant List<CodedValueType> purposesOfUse, List<CodedValueType> userRoles) { QueryEvent queryEvent = new QueryEvent(systemIsSource, eventOutcome, transaction, purposesOfUse); queryEvent.setAuditSourceId(auditSourceId, auditSourceEnterpriseSiteId); queryEvent.addSourceActiveParticipant(sourceUserId, sourceAltUserId, sourceUserName, sourceNetworkId, true); if (humanAfterDestination) { queryEvent.addDestinationActiveParticipant(registryEndpointUri, registryAltUserId, null, EventUtils.getAddressForUrl(registryEndpointUri, false), false); } if(!EventUtils.isEmptyOrNull(humanRequestorName)) { queryEvent.addHumanRequestorActiveParticipant(humanRequestorName, null, humanRequestorName, userRoles); } if (! humanAfterDestination) { queryEvent.addDestinationActiveParticipant(registryEndpointUri, registryAltUserId, null, EventUtils.getAddressForUrl(registryEndpointUri, false), false); } if (!EventUtils.isEmptyOrNull(patientId)) { queryEvent.addPatientParticipantObject(patientId); } byte[] queryRequestPayloadBytes = null; if (!EventUtils.isEmptyOrNull(adhocQueryRequestPayload)) { queryRequestPayloadBytes = adhocQueryRequestPayload.getBytes(); } queryEvent.addQueryParticipantObject(storedQueryUUID, homeCommunityId, queryRequestPayloadBytes, null, transaction); audit(queryEvent); }
[ "protected", "void", "auditQueryEvent", "(", "boolean", "systemIsSource", ",", "// System Type", "IHETransactionEventTypeCodes", "transaction", ",", "RFC3881EventOutcomeCodes", "eventOutcome", ",", "// Event", "String", "auditSourceId", ",", "String", "auditSourceEnterpriseSite...
Audits a QUERY event for IHE XDS transactions, notably XDS Registry Query and XDS Registry Stored Query transactions. @param systemIsSource Whether the system sending the message is the source active participant @param transaction IHE Transaction sending the message @param eventOutcome The event outcome indicator @param auditSourceId The Audit Source Identification @param auditSourceEnterpriseSiteId The Audit Source Enterprise Site Identification @param sourceUserId The Source Active Participant User ID (varies by transaction) @param sourceAltUserId The Source Active Participant Alternate User ID @param sourceUserName The Source Active Participant UserName @param sourceNetworkId The Source Active Participant Network ID @param humanRequestor The Human Requestor Active Participant User ID @param humanRequestorName The Human Requestor Active Participant name @param registryEndpointUri The endpoint of the registry actor in this transaction (sets destination active participant user id and network id) @param registryAltUserId The registry alternate user id (for registry actors) @param storedQueryUUID The UUID for the stored query (if transaction is Registry Stored Query) @param adhocQueryRequestPayload The payload of the adhoc query request element @param homeCommunityId The home community id of the transaction (if present) @param patientId The patient ID queried (if query pertained to a patient id) @param purposesOfUse purpose of use codes (may be taken from XUA token) @param userRoles roles of the human user (may be taken from XUA token)
[ "Audits", "a", "QUERY", "event", "for", "IHE", "XDS", "transactions", "notably", "XDS", "Registry", "Query", "and", "XDS", "Registry", "Stored", "Query", "transactions", "." ]
train
https://github.com/oehf/ipf-oht-atna/blob/25ed1e926825169c94923a2c89a4618f60478ae8/auditor/src/main/java/org/openhealthtools/ihe/atna/auditor/XDSAuditor.java#L55-L95
lessthanoptimal/ejml
main/ejml-dsparse/src/org/ejml/sparse/csc/misc/TriangularSolver_DSCC.java
TriangularSolver_DSCC.solveTranL
public static void solveTranL(DMatrixSparseCSC L , double []x ) { final int N = L.numCols; for (int j = N-1; j >= 0; j--) { int idx0 = L.col_idx[j]; int idx1 = L.col_idx[j+1]; for (int p = idx0+1; p < idx1; p++) { x[j] -= L.nz_values[p]*x[L.nz_rows[p]]; } x[j] /= L.nz_values[idx0]; } }
java
public static void solveTranL(DMatrixSparseCSC L , double []x ) { final int N = L.numCols; for (int j = N-1; j >= 0; j--) { int idx0 = L.col_idx[j]; int idx1 = L.col_idx[j+1]; for (int p = idx0+1; p < idx1; p++) { x[j] -= L.nz_values[p]*x[L.nz_rows[p]]; } x[j] /= L.nz_values[idx0]; } }
[ "public", "static", "void", "solveTranL", "(", "DMatrixSparseCSC", "L", ",", "double", "[", "]", "x", ")", "{", "final", "int", "N", "=", "L", ".", "numCols", ";", "for", "(", "int", "j", "=", "N", "-", "1", ";", "j", ">=", "0", ";", "j", "--",...
Solves for the transpose of a lower triangular matrix against a dense matrix. L<sup>T</sup>*x = b @param L Lower triangular matrix. Diagonal elements are assumed to be non-zero @param x (Input) Solution matrix 'b'. (Output) matrix 'x'
[ "Solves", "for", "the", "transpose", "of", "a", "lower", "triangular", "matrix", "against", "a", "dense", "matrix", ".", "L<sup", ">", "T<", "/", "sup", ">", "*", "x", "=", "b" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-dsparse/src/org/ejml/sparse/csc/misc/TriangularSolver_DSCC.java#L65-L78
landawn/AbacusUtil
src/com/landawn/abacus/util/JdbcUtil.java
JdbcUtil.importData
public static int importData(final DataSet dataset, final Collection<String> selectColumnNames, final int offset, final int count, final PreparedStatement stmt) throws UncheckedSQLException { return importData(dataset, selectColumnNames, offset, count, stmt, 200, 0); }
java
public static int importData(final DataSet dataset, final Collection<String> selectColumnNames, final int offset, final int count, final PreparedStatement stmt) throws UncheckedSQLException { return importData(dataset, selectColumnNames, offset, count, stmt, 200, 0); }
[ "public", "static", "int", "importData", "(", "final", "DataSet", "dataset", ",", "final", "Collection", "<", "String", ">", "selectColumnNames", ",", "final", "int", "offset", ",", "final", "int", "count", ",", "final", "PreparedStatement", "stmt", ")", "thro...
Imports the data from <code>DataSet</code> to database. @param dataset @param selectColumnNames @param offset @param count @param stmt the column order in the sql must be consistent with the column order in the DataSet. @return @throws UncheckedSQLException
[ "Imports", "the", "data", "from", "<code", ">", "DataSet<", "/", "code", ">", "to", "database", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/JdbcUtil.java#L2204-L2207
jmurty/java-xmlbuilder
src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java
BaseXMLBuilder.textImpl
protected void textImpl(String value, boolean replaceText) { // Issue 10: null text values cause exceptions on subsequent call to // Transformer to render document, so we fail-fast here on bad data. if (value == null) { throw new IllegalArgumentException("Illegal null text value"); } if (replaceText) { xmlNode.setTextContent(value); } else { xmlNode.appendChild(getDocument().createTextNode(value)); } }
java
protected void textImpl(String value, boolean replaceText) { // Issue 10: null text values cause exceptions on subsequent call to // Transformer to render document, so we fail-fast here on bad data. if (value == null) { throw new IllegalArgumentException("Illegal null text value"); } if (replaceText) { xmlNode.setTextContent(value); } else { xmlNode.appendChild(getDocument().createTextNode(value)); } }
[ "protected", "void", "textImpl", "(", "String", "value", ",", "boolean", "replaceText", ")", "{", "// Issue 10: null text values cause exceptions on subsequent call to", "// Transformer to render document, so we fail-fast here on bad data.", "if", "(", "value", "==", "null", ")",...
Add or replace the text value of an element for this builder node. @param value the text value to set or add to the element. @param replaceText if True any existing text content of the node is replaced with the given text value, if the given value is appended to any existing text.
[ "Add", "or", "replace", "the", "text", "value", "of", "an", "element", "for", "this", "builder", "node", "." ]
train
https://github.com/jmurty/java-xmlbuilder/blob/7c224b8e8ed79808509322cb141dab5a88dd3cec/src/main/java/com/jamesmurty/utils/BaseXMLBuilder.java#L824-L836
TheHortonMachine/hortonmachine
gears/src/main/java/oms3/Compound.java
Compound.in2in
public void in2in(String in, Object... to) { for (Object cmd : to) { in2in(in, cmd, in); } }
java
public void in2in(String in, Object... to) { for (Object cmd : to) { in2in(in, cmd, in); } }
[ "public", "void", "in2in", "(", "String", "in", ",", "Object", "...", "to", ")", "{", "for", "(", "Object", "cmd", ":", "to", ")", "{", "in2in", "(", "in", ",", "cmd", ",", "in", ")", ";", "}", "}" ]
Maps a compound input to an internal simple input field. Both fields have the same name. @param in the name of the field @param to the commands to map to
[ "Maps", "a", "compound", "input", "to", "an", "internal", "simple", "input", "field", ".", "Both", "fields", "have", "the", "same", "name", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/Compound.java#L154-L158
pgjdbc/pgjdbc
pgjdbc/src/main/java/org/postgresql/ds/PGPoolingDataSource.java
PGPoolingDataSource.getReference
public Reference getReference() throws NamingException { Reference ref = super.getReference(); ref.add(new StringRefAddr("dataSourceName", dataSourceName)); if (initialConnections > 0) { ref.add(new StringRefAddr("initialConnections", Integer.toString(initialConnections))); } if (maxConnections > 0) { ref.add(new StringRefAddr("maxConnections", Integer.toString(maxConnections))); } return ref; }
java
public Reference getReference() throws NamingException { Reference ref = super.getReference(); ref.add(new StringRefAddr("dataSourceName", dataSourceName)); if (initialConnections > 0) { ref.add(new StringRefAddr("initialConnections", Integer.toString(initialConnections))); } if (maxConnections > 0) { ref.add(new StringRefAddr("maxConnections", Integer.toString(maxConnections))); } return ref; }
[ "public", "Reference", "getReference", "(", ")", "throws", "NamingException", "{", "Reference", "ref", "=", "super", ".", "getReference", "(", ")", ";", "ref", ".", "add", "(", "new", "StringRefAddr", "(", "\"dataSourceName\"", ",", "dataSourceName", ")", ")",...
Adds custom properties for this DataSource to the properties defined in the superclass.
[ "Adds", "custom", "properties", "for", "this", "DataSource", "to", "the", "properties", "defined", "in", "the", "superclass", "." ]
train
https://github.com/pgjdbc/pgjdbc/blob/95ba7b261e39754674c5817695ae5ebf9a341fae/pgjdbc/src/main/java/org/postgresql/ds/PGPoolingDataSource.java#L439-L449
dmak/jaxb-xew-plugin
src/main/java/com/sun/tools/xjc/addon/xew/CommonUtils.java
CommonUtils.addAnnotation
public static void addAnnotation(JVar field, JAnnotationUse annotation) { List<JAnnotationUse> annotations = getPrivateField(field, "annotations"); annotations.add(annotation); }
java
public static void addAnnotation(JVar field, JAnnotationUse annotation) { List<JAnnotationUse> annotations = getPrivateField(field, "annotations"); annotations.add(annotation); }
[ "public", "static", "void", "addAnnotation", "(", "JVar", "field", ",", "JAnnotationUse", "annotation", ")", "{", "List", "<", "JAnnotationUse", ">", "annotations", "=", "getPrivateField", "(", "field", ",", "\"annotations\"", ")", ";", "annotations", ".", "add"...
Append the given {@code annotation} to list of annotations for the given {@code field}.
[ "Append", "the", "given", "{" ]
train
https://github.com/dmak/jaxb-xew-plugin/blob/d564d6bf8e50c46b056cdb4b46d1d4bee4adfbe3/src/main/java/com/sun/tools/xjc/addon/xew/CommonUtils.java#L116-L119
janus-project/guava.janusproject.io
guava/src/com/google/common/collect/Multisets.java
Multisets.removeOccurrences
public static boolean removeOccurrences( Multiset<?> multisetToModify, Iterable<?> occurrencesToRemove) { if (occurrencesToRemove instanceof Multiset) { return removeOccurrencesImpl( multisetToModify, (Multiset<?>) occurrencesToRemove); } else { return removeOccurrencesImpl(multisetToModify, occurrencesToRemove); } }
java
public static boolean removeOccurrences( Multiset<?> multisetToModify, Iterable<?> occurrencesToRemove) { if (occurrencesToRemove instanceof Multiset) { return removeOccurrencesImpl( multisetToModify, (Multiset<?>) occurrencesToRemove); } else { return removeOccurrencesImpl(multisetToModify, occurrencesToRemove); } }
[ "public", "static", "boolean", "removeOccurrences", "(", "Multiset", "<", "?", ">", "multisetToModify", ",", "Iterable", "<", "?", ">", "occurrencesToRemove", ")", "{", "if", "(", "occurrencesToRemove", "instanceof", "Multiset", ")", "{", "return", "removeOccurren...
For each occurrence of an element {@code e} in {@code occurrencesToRemove}, removes one occurrence of {@code e} in {@code multisetToModify}. <p>Equivalently, this method modifies {@code multisetToModify} so that {@code multisetToModify.count(e)} is set to {@code Math.max(0, multisetToModify.count(e) - occurrencesToRemove.count(e))}. <p>This is <i>not</i> the same as {@code multisetToModify.} {@link Multiset#removeAll removeAll}{@code (occurrencesToRemove)}, which removes all occurrences of elements that appear in {@code occurrencesToRemove}. However, this operation <i>is</i> equivalent to, albeit sometimes more efficient than, the following: <pre> {@code for (E e : occurrencesToRemove) { multisetToModify.remove(e); }}</pre> @return {@code true} if {@code multisetToModify} was changed as a result of this operation @since 18.0 (present in 10.0 with a requirement that the second parameter be a {@code Multiset})
[ "For", "each", "occurrence", "of", "an", "element", "{", "@code", "e", "}", "in", "{", "@code", "occurrencesToRemove", "}", "removes", "one", "occurrence", "of", "{", "@code", "e", "}", "in", "{", "@code", "multisetToModify", "}", "." ]
train
https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/collect/Multisets.java#L729-L737
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/CouponSetUrl.java
CouponSetUrl.updateCouponSetUrl
public static MozuUrl updateCouponSetUrl(String couponSetCode, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/couponsets/{couponSetCode}?responseFields={responseFields}"); formatter.formatUrl("couponSetCode", couponSetCode); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl updateCouponSetUrl(String couponSetCode, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/couponsets/{couponSetCode}?responseFields={responseFields}"); formatter.formatUrl("couponSetCode", couponSetCode); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "updateCouponSetUrl", "(", "String", "couponSetCode", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/catalog/admin/couponsets/{couponSetCode}?responseFields={responseFields}\...
Get Resource Url for UpdateCouponSet @param couponSetCode The unique identifier of the coupon set. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @return String Resource Url
[ "Get", "Resource", "Url", "for", "UpdateCouponSet" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/catalog/admin/CouponSetUrl.java#L96-L102
Syncleus/aparapi
src/main/java/com/aparapi/Range.java
Range.create3D
public static Range create3D(Device _device, int _globalWidth, int _globalHeight, int _globalDepth, int _localWidth, int _localHeight, int _localDepth) { final Range range = new Range(_device, 3); range.setGlobalSize_0(_globalWidth); range.setLocalSize_0(_localWidth); range.setGlobalSize_1(_globalHeight); range.setLocalSize_1(_localHeight); range.setGlobalSize_2(_globalDepth); range.setLocalSize_2(_localDepth); range.setValid((range.getLocalSize_0() > 0) && (range.getLocalSize_1() > 0) && (range.getLocalSize_2() > 0) && ((range.getLocalSize_0() * range.getLocalSize_1() * range.getLocalSize_2()) <= range.getMaxWorkGroupSize()) && (range.getLocalSize_0() <= range.getMaxWorkItemSize()[0]) && (range.getLocalSize_1() <= range.getMaxWorkItemSize()[1]) && (range.getLocalSize_2() <= range.getMaxWorkItemSize()[2]) && ((range.getGlobalSize_0() % range.getLocalSize_0()) == 0) && ((range.getGlobalSize_1() % range.getLocalSize_1()) == 0) && ((range.getGlobalSize_2() % range.getLocalSize_2()) == 0)); return (range); }
java
public static Range create3D(Device _device, int _globalWidth, int _globalHeight, int _globalDepth, int _localWidth, int _localHeight, int _localDepth) { final Range range = new Range(_device, 3); range.setGlobalSize_0(_globalWidth); range.setLocalSize_0(_localWidth); range.setGlobalSize_1(_globalHeight); range.setLocalSize_1(_localHeight); range.setGlobalSize_2(_globalDepth); range.setLocalSize_2(_localDepth); range.setValid((range.getLocalSize_0() > 0) && (range.getLocalSize_1() > 0) && (range.getLocalSize_2() > 0) && ((range.getLocalSize_0() * range.getLocalSize_1() * range.getLocalSize_2()) <= range.getMaxWorkGroupSize()) && (range.getLocalSize_0() <= range.getMaxWorkItemSize()[0]) && (range.getLocalSize_1() <= range.getMaxWorkItemSize()[1]) && (range.getLocalSize_2() <= range.getMaxWorkItemSize()[2]) && ((range.getGlobalSize_0() % range.getLocalSize_0()) == 0) && ((range.getGlobalSize_1() % range.getLocalSize_1()) == 0) && ((range.getGlobalSize_2() % range.getLocalSize_2()) == 0)); return (range); }
[ "public", "static", "Range", "create3D", "(", "Device", "_device", ",", "int", "_globalWidth", ",", "int", "_globalHeight", ",", "int", "_globalDepth", ",", "int", "_localWidth", ",", "int", "_localHeight", ",", "int", "_localDepth", ")", "{", "final", "Range"...
Create a two dimensional range <code>0.._globalWidth * 0.._globalHeight *0../_globalDepth</code> in groups defined by <code>localWidth</code> * <code>localHeight</code> * <code>localDepth</code>. <p> Note that for this range to be valid <code>_globalWidth > 0 && _globalHeight >0 _globalDepth >0 && _localWidth>0 && _localHeight>0 && _localDepth>0 && _localWidth*_localHeight*_localDepth < MAX_GROUP_SIZE && _globalWidth%_localWidth==0 && _globalHeight%_localHeight==0 && _globalDepth%_localDepth==0</code>. @param _globalWidth the width of the 3D grid we wish to process @param _globalHeight the height of the 3D grid we wish to process @param _globalDepth the depth of the 3D grid we wish to process @param _localWidth the width of the 3D group we wish to process @param _localHeight the height of the 3D group we wish to process @param _localDepth the depth of the 3D group we wish to process @return
[ "Create", "a", "two", "dimensional", "range", "<code", ">", "0", "..", "_globalWidth", "*", "0", "..", "_globalHeight", "*", "0", "..", "/", "_globalDepth<", "/", "code", ">", "in", "groups", "defined", "by", "<code", ">", "localWidth<", "/", "code", ">"...
train
https://github.com/Syncleus/aparapi/blob/6d5892c8e69854b3968c541023de37cf4762bd24/src/main/java/com/aparapi/Range.java#L313-L333
jbundle/jbundle
thin/base/screen/cal/sample/remote/src/main/java/org/jbundle/thin/base/screen/cal/sample/message/CalendarProduct.java
CalendarProduct.changeRemoteDate
public void changeRemoteDate(Application application, String strParams, CachedItem productItem, Date dateStart, Date dateEnd) { //+ this.setIcon(BaseApplet.getSharedInstance().loadImageIcon("tour/buttons/Lookup.gif", "Lookup"), CalendarConstants.START_ICON + 1); //x this.setIcon(BaseApplet.getSharedInstance().loadImageIcon("tour/buttons/Price.gif", "Price"), CalendarConstants.START_ICON + 2); productItem.setStatus(productItem.getStatus() | (1 << 2)); //+ this.setIcon(BaseApplet.getSharedInstance().loadImageIcon("tour/buttons/Inventory.gif", "Inventory"), CalendarConstants.START_ICON + 3); //+ if (application == null) //+ application = BaseApplet.getSharedInstance().getApplication(); // Step 1 - Send a message to the subscriber that I want to lookup the date, price, and inventory. //+ CalendarDateChangeMessage message = new CalendarDateChangeMessage(strParams, productItem, dateStart, dateEnd); // Step 2 - Listen for messages that modify this object's information // I could potentially get 3 messages back: 1. chg date 2. set price 3. set avail. // message.getModel(); //x application.getTaskScheduler().addTask(message); //+ this.sendMessage(new CalendarDateChangeMessage(application, strParams, productItem, dateStart, dateEnd)); BaseApplet applet = BaseApplet.getSharedInstance(); try { //+ if (database == null) MessageSender sendQueue = null; String strSendQueueName = "lookupHotelRate"; Map<String,Object> properties = new Hashtable<String,Object>(); properties.put("rateType", "Rack"); properties.put("roomClass", "Single"); MessageManager messageManager = applet.getApplication().getMessageManager(); sendQueue = messageManager.getMessageQueue(strSendQueueName, null).getMessageSender(); if (gbFirstTime) { BaseMessageReceiver handler = (BaseMessageReceiver)messageManager.getMessageQueue("sendHotelRate", null).getMessageReceiver(); /*?JMessageListener listener =*/ new CalendarMessageListener(handler, m_model); gbFirstTime = false; } properties.put("correlationID", Integer.toString(this.hashCode())); sendQueue.sendMessage(new MapMessage(null, properties)); // See ya! } catch (Exception ex) { ex.printStackTrace(); } }
java
public void changeRemoteDate(Application application, String strParams, CachedItem productItem, Date dateStart, Date dateEnd) { //+ this.setIcon(BaseApplet.getSharedInstance().loadImageIcon("tour/buttons/Lookup.gif", "Lookup"), CalendarConstants.START_ICON + 1); //x this.setIcon(BaseApplet.getSharedInstance().loadImageIcon("tour/buttons/Price.gif", "Price"), CalendarConstants.START_ICON + 2); productItem.setStatus(productItem.getStatus() | (1 << 2)); //+ this.setIcon(BaseApplet.getSharedInstance().loadImageIcon("tour/buttons/Inventory.gif", "Inventory"), CalendarConstants.START_ICON + 3); //+ if (application == null) //+ application = BaseApplet.getSharedInstance().getApplication(); // Step 1 - Send a message to the subscriber that I want to lookup the date, price, and inventory. //+ CalendarDateChangeMessage message = new CalendarDateChangeMessage(strParams, productItem, dateStart, dateEnd); // Step 2 - Listen for messages that modify this object's information // I could potentially get 3 messages back: 1. chg date 2. set price 3. set avail. // message.getModel(); //x application.getTaskScheduler().addTask(message); //+ this.sendMessage(new CalendarDateChangeMessage(application, strParams, productItem, dateStart, dateEnd)); BaseApplet applet = BaseApplet.getSharedInstance(); try { //+ if (database == null) MessageSender sendQueue = null; String strSendQueueName = "lookupHotelRate"; Map<String,Object> properties = new Hashtable<String,Object>(); properties.put("rateType", "Rack"); properties.put("roomClass", "Single"); MessageManager messageManager = applet.getApplication().getMessageManager(); sendQueue = messageManager.getMessageQueue(strSendQueueName, null).getMessageSender(); if (gbFirstTime) { BaseMessageReceiver handler = (BaseMessageReceiver)messageManager.getMessageQueue("sendHotelRate", null).getMessageReceiver(); /*?JMessageListener listener =*/ new CalendarMessageListener(handler, m_model); gbFirstTime = false; } properties.put("correlationID", Integer.toString(this.hashCode())); sendQueue.sendMessage(new MapMessage(null, properties)); // See ya! } catch (Exception ex) { ex.printStackTrace(); } }
[ "public", "void", "changeRemoteDate", "(", "Application", "application", ",", "String", "strParams", ",", "CachedItem", "productItem", ",", "Date", "dateStart", ",", "Date", "dateEnd", ")", "{", "//+ this.setIcon(BaseApplet.getSharedInstance().loadImageIcon(\"tour/buttons...
Change the date of the actual data. Override this to change the date.
[ "Change", "the", "date", "of", "the", "actual", "data", ".", "Override", "this", "to", "change", "the", "date", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/thin/base/screen/cal/sample/remote/src/main/java/org/jbundle/thin/base/screen/cal/sample/message/CalendarProduct.java#L98-L143
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/InboundNatRulesInner.java
InboundNatRulesInner.beginCreateOrUpdate
public InboundNatRuleInner beginCreateOrUpdate(String resourceGroupName, String loadBalancerName, String inboundNatRuleName, InboundNatRuleInner inboundNatRuleParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters).toBlocking().single().body(); }
java
public InboundNatRuleInner beginCreateOrUpdate(String resourceGroupName, String loadBalancerName, String inboundNatRuleName, InboundNatRuleInner inboundNatRuleParameters) { return beginCreateOrUpdateWithServiceResponseAsync(resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters).toBlocking().single().body(); }
[ "public", "InboundNatRuleInner", "beginCreateOrUpdate", "(", "String", "resourceGroupName", ",", "String", "loadBalancerName", ",", "String", "inboundNatRuleName", ",", "InboundNatRuleInner", "inboundNatRuleParameters", ")", "{", "return", "beginCreateOrUpdateWithServiceResponseA...
Creates or updates a load balancer inbound nat rule. @param resourceGroupName The name of the resource group. @param loadBalancerName The name of the load balancer. @param inboundNatRuleName The name of the inbound nat rule. @param inboundNatRuleParameters Parameters supplied to the create or update inbound nat rule operation. @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 InboundNatRuleInner object if successful.
[ "Creates", "or", "updates", "a", "load", "balancer", "inbound", "nat", "rule", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/InboundNatRulesInner.java#L654-L656
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/transactions/impl/MSTransactionFactory.java
MSTransactionFactory.createLocalTransaction
public ExternalLocalTransaction createLocalTransaction() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createLocalTransaction"); ExternalLocalTransaction instance; if (_persistenceSupports1PCOptimisation) { instance = new MSDelegatingLocalTransactionSynchronization(_ms, _persistence, getMaximumTransactionSize()); } else { instance = new MSDelegatingLocalTransaction(_ms, _persistence, getMaximumTransactionSize()); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createLocalTransaction", "return="+instance); return instance; }
java
public ExternalLocalTransaction createLocalTransaction() { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createLocalTransaction"); ExternalLocalTransaction instance; if (_persistenceSupports1PCOptimisation) { instance = new MSDelegatingLocalTransactionSynchronization(_ms, _persistence, getMaximumTransactionSize()); } else { instance = new MSDelegatingLocalTransaction(_ms, _persistence, getMaximumTransactionSize()); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createLocalTransaction", "return="+instance); return instance; }
[ "public", "ExternalLocalTransaction", "createLocalTransaction", "(", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"createLocalTransaction\"",...
This method is used to create a LocalResource that can either be enlisted as a particpant in a WebSphere LocalTransactionCoordination scope or used directly to demarcate a one-phase Resource Manager Local Transaction. @return An instance of Object
[ "This", "method", "is", "used", "to", "create", "a", "LocalResource", "that", "can", "either", "be", "enlisted", "as", "a", "particpant", "in", "a", "WebSphere", "LocalTransactionCoordination", "scope", "or", "used", "directly", "to", "demarcate", "a", "one", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.msgstore/src/com/ibm/ws/sib/msgstore/transactions/impl/MSTransactionFactory.java#L77-L94
micronaut-projects/micronaut-core
tracing/src/main/java/io/micronaut/tracing/brave/instrument/http/HttpTracingFactory.java
HttpTracingFactory.httpClientHandler
@Singleton HttpClientHandler<HttpRequest<?>, HttpResponse<?>> httpClientHandler(HttpTracing httpTracing) { return HttpClientHandler.create(httpTracing, new HttpClientAdapter<HttpRequest<?>, HttpResponse<?>>() { @Override public String method(HttpRequest<?> request) { return request.getMethod().name(); } @Override public String url(HttpRequest<?> request) { return request.getUri().toString(); } @Override public String requestHeader(HttpRequest<?> request, String name) { return request.getHeaders().get(name); } @Override public Integer statusCode(HttpResponse<?> response) { return response.getStatus().getCode(); } @Override public boolean parseServerIpAndPort(HttpRequest<?> request, Endpoint.Builder builder) { InetAddress address = request.getServerAddress().getAddress(); return builder.parseIp(address); } @Override public String methodFromResponse(HttpResponse<?> httpResponse) { return httpResponse.getAttribute(HttpAttributes.METHOD_NAME, String.class) .orElseGet(() -> super.methodFromResponse(httpResponse)); } @Override public String route(HttpResponse<?> response) { Optional<String> value = response.getAttribute(HttpAttributes.URI_TEMPLATE, String.class); return value.orElseGet(() -> super.route(response)); } }); }
java
@Singleton HttpClientHandler<HttpRequest<?>, HttpResponse<?>> httpClientHandler(HttpTracing httpTracing) { return HttpClientHandler.create(httpTracing, new HttpClientAdapter<HttpRequest<?>, HttpResponse<?>>() { @Override public String method(HttpRequest<?> request) { return request.getMethod().name(); } @Override public String url(HttpRequest<?> request) { return request.getUri().toString(); } @Override public String requestHeader(HttpRequest<?> request, String name) { return request.getHeaders().get(name); } @Override public Integer statusCode(HttpResponse<?> response) { return response.getStatus().getCode(); } @Override public boolean parseServerIpAndPort(HttpRequest<?> request, Endpoint.Builder builder) { InetAddress address = request.getServerAddress().getAddress(); return builder.parseIp(address); } @Override public String methodFromResponse(HttpResponse<?> httpResponse) { return httpResponse.getAttribute(HttpAttributes.METHOD_NAME, String.class) .orElseGet(() -> super.methodFromResponse(httpResponse)); } @Override public String route(HttpResponse<?> response) { Optional<String> value = response.getAttribute(HttpAttributes.URI_TEMPLATE, String.class); return value.orElseGet(() -> super.route(response)); } }); }
[ "@", "Singleton", "HttpClientHandler", "<", "HttpRequest", "<", "?", ">", ",", "HttpResponse", "<", "?", ">", ">", "httpClientHandler", "(", "HttpTracing", "httpTracing", ")", "{", "return", "HttpClientHandler", ".", "create", "(", "httpTracing", ",", "new", "...
The {@link HttpClientHandler} bean. @param httpTracing The {@link HttpTracing} bean @return The {@link HttpClientHandler} bean
[ "The", "{", "@link", "HttpClientHandler", "}", "bean", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/tracing/src/main/java/io/micronaut/tracing/brave/instrument/http/HttpTracingFactory.java#L61-L102
mockito/mockito
src/main/java/org/mockito/internal/stubbing/StrictnessSelector.java
StrictnessSelector.determineStrictness
public static Strictness determineStrictness(Stubbing stubbing, MockCreationSettings mockSettings, Strictness testLevelStrictness) { if (stubbing != null && stubbing.getStrictness() != null) { return stubbing.getStrictness(); } if (mockSettings.isLenient()) { return Strictness.LENIENT; } return testLevelStrictness; }
java
public static Strictness determineStrictness(Stubbing stubbing, MockCreationSettings mockSettings, Strictness testLevelStrictness) { if (stubbing != null && stubbing.getStrictness() != null) { return stubbing.getStrictness(); } if (mockSettings.isLenient()) { return Strictness.LENIENT; } return testLevelStrictness; }
[ "public", "static", "Strictness", "determineStrictness", "(", "Stubbing", "stubbing", ",", "MockCreationSettings", "mockSettings", ",", "Strictness", "testLevelStrictness", ")", "{", "if", "(", "stubbing", "!=", "null", "&&", "stubbing", ".", "getStrictness", "(", "...
Determines the actual strictness in the following importance order: 1st - strictness configured when declaring stubbing; 2nd - strictness configured at mock level; 3rd - strictness configured at test level (rule, mockito session) @param stubbing stubbing to check for strictness. Null permitted. @param mockSettings settings of the mock object, may or may not have strictness configured. Must not be null. @param testLevelStrictness strictness configured using the test-level configuration (rule, mockito session). Null permitted. @return actual strictness, can be null.
[ "Determines", "the", "actual", "strictness", "in", "the", "following", "importance", "order", ":", "1st", "-", "strictness", "configured", "when", "declaring", "stubbing", ";", "2nd", "-", "strictness", "configured", "at", "mock", "level", ";", "3rd", "-", "st...
train
https://github.com/mockito/mockito/blob/c5e2b80af76e3192cae7c9550b70c4d1ab312034/src/main/java/org/mockito/internal/stubbing/StrictnessSelector.java#L28-L38
damianszczepanik/cucumber-reporting
src/main/java/net/masterthought/cucumber/util/Util.java
Util.formatAsPercentage
public static String formatAsPercentage(int value, int total) { // value '1F' is to force floating conversion instead of loosing decimal part float average = total == 0 ? 0 : 1F * value / total; return PERCENT_FORMATTER.format(average); }
java
public static String formatAsPercentage(int value, int total) { // value '1F' is to force floating conversion instead of loosing decimal part float average = total == 0 ? 0 : 1F * value / total; return PERCENT_FORMATTER.format(average); }
[ "public", "static", "String", "formatAsPercentage", "(", "int", "value", ",", "int", "total", ")", "{", "// value '1F' is to force floating conversion instead of loosing decimal part", "float", "average", "=", "total", "==", "0", "?", "0", ":", "1F", "*", "value", "...
Returns value converted to percentage format. @param value value to convert @param total sum of all values @return converted values including '%' character
[ "Returns", "value", "converted", "to", "percentage", "format", "." ]
train
https://github.com/damianszczepanik/cucumber-reporting/blob/9ffe0d4a9c0aec161b0988a930a8312ba36dc742/src/main/java/net/masterthought/cucumber/util/Util.java#L55-L59
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/EpicsApi.java
EpicsApi.getEpic
public Epic getEpic(Object groupIdOrPath, Integer epicIid) throws GitLabApiException { Response response = get(Response.Status.OK, null, "groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid); return (response.readEntity(Epic.class)); }
java
public Epic getEpic(Object groupIdOrPath, Integer epicIid) throws GitLabApiException { Response response = get(Response.Status.OK, null, "groups", getGroupIdOrPath(groupIdOrPath), "epics", epicIid); return (response.readEntity(Epic.class)); }
[ "public", "Epic", "getEpic", "(", "Object", "groupIdOrPath", ",", "Integer", "epicIid", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "null", ",", "\"groups\"", ",", "getGroupIdOrP...
Get a single epic for the specified group. <pre><code>GitLab Endpoint: GET /groups/:id/epics/:epic_iid</code></pre> @param groupIdOrPath the group ID, path of the group, or a Group instance holding the group ID or path @param epicIid the IID of the epic to get @return an Epic instance for the specified Epic @throws GitLabApiException if any exception occurs
[ "Get", "a", "single", "epic", "for", "the", "specified", "group", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/EpicsApi.java#L193-L196
linkhub-sdk/popbill.sdk.java
src/main/java/com/popbill/api/statement/StatementServiceImp.java
StatementServiceImp.sendFAX
@Override public Response sendFAX(String CorpNum, int ItemCode, String MgtKey, String Sender, String Receiver) throws PopbillException { return sendFAX(CorpNum, ItemCode, MgtKey, Sender, Receiver, null); }
java
@Override public Response sendFAX(String CorpNum, int ItemCode, String MgtKey, String Sender, String Receiver) throws PopbillException { return sendFAX(CorpNum, ItemCode, MgtKey, Sender, Receiver, null); }
[ "@", "Override", "public", "Response", "sendFAX", "(", "String", "CorpNum", ",", "int", "ItemCode", ",", "String", "MgtKey", ",", "String", "Sender", ",", "String", "Receiver", ")", "throws", "PopbillException", "{", "return", "sendFAX", "(", "CorpNum", ",", ...
/* (non-Javadoc) @see com.popbill.api.StatementService#sendFAX(java.lang.String, java.number.Integer, java.lang.String, java.lang.String, java.lang.String)
[ "/", "*", "(", "non", "-", "Javadoc", ")" ]
train
https://github.com/linkhub-sdk/popbill.sdk.java/blob/63a341fefe96d60a368776638f3d4c81888238b7/src/main/java/com/popbill/api/statement/StatementServiceImp.java#L305-L309
apache/groovy
src/main/java/org/codehaus/groovy/control/SourceUnit.java
SourceUnit.convert
public void convert() throws CompilationFailedException { if (this.phase == Phases.PARSING && this.phaseComplete) { gotoPhase(Phases.CONVERSION); } if (this.phase != Phases.CONVERSION) { throw new GroovyBugError("SourceUnit not ready for convert()"); } // // Build the AST try { this.ast = parserPlugin.buildAST(this, this.classLoader, this.cst); this.ast.setDescription(this.name); } catch (SyntaxException e) { if (this.ast == null) { // Create a dummy ModuleNode to represent a failed parse - in case a later phase attempts to use the ast this.ast = new ModuleNode(this); } getErrorCollector().addError(new SyntaxErrorMessage(e, this)); } String property = (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty("groovy.ast"); } }); if ("xml".equals(property)) { saveAsXML(name, ast); } }
java
public void convert() throws CompilationFailedException { if (this.phase == Phases.PARSING && this.phaseComplete) { gotoPhase(Phases.CONVERSION); } if (this.phase != Phases.CONVERSION) { throw new GroovyBugError("SourceUnit not ready for convert()"); } // // Build the AST try { this.ast = parserPlugin.buildAST(this, this.classLoader, this.cst); this.ast.setDescription(this.name); } catch (SyntaxException e) { if (this.ast == null) { // Create a dummy ModuleNode to represent a failed parse - in case a later phase attempts to use the ast this.ast = new ModuleNode(this); } getErrorCollector().addError(new SyntaxErrorMessage(e, this)); } String property = (String) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { return System.getProperty("groovy.ast"); } }); if ("xml".equals(property)) { saveAsXML(name, ast); } }
[ "public", "void", "convert", "(", ")", "throws", "CompilationFailedException", "{", "if", "(", "this", ".", "phase", "==", "Phases", ".", "PARSING", "&&", "this", ".", "phaseComplete", ")", "{", "gotoPhase", "(", "Phases", ".", "CONVERSION", ")", ";", "}",...
Generates an AST from the CST. You can retrieve it with getAST().
[ "Generates", "an", "AST", "from", "the", "CST", ".", "You", "can", "retrieve", "it", "with", "getAST", "()", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/control/SourceUnit.java#L235-L267
davidcarboni/cryptolite-java
src/main/java/com/github/davidcarboni/cryptolite/Keys.java
Keys.generateSecretKey
static SecretKey generateSecretKey(String password, String salt) { if (password == null) { return null; } // Get a SecretKeyFactory for ALGORITHM. // If PBKDF2WithHmacSHA256, add BouncyCastle and recurse to retry. SecretKeyFactory factory; try { factory = SecretKeyFactory.getInstance(SYMMETRIC_PASSWORD_ALGORITHM); } catch (NoSuchAlgorithmException e) { if (SecurityProvider.addProvider()) { // Retry return generateSecretKey(password, salt); } else { throw new IllegalStateException("Algorithm unavailable: " + SYMMETRIC_PASSWORD_ALGORITHM, e); } } // Generate the key: byte[] saltBytes = ByteArray.fromBase64(salt); PBEKeySpec pbeKeySpec = new PBEKeySpec(password.toCharArray(), saltBytes, SYMMETRIC_PASSWORD_ITERATIONS, SYMMETRIC_KEY_SIZE); SecretKey key; try { key = factory.generateSecret(pbeKeySpec); } catch (InvalidKeySpecException e) { throw new IllegalStateException("Error generating password-based key.", e); } // NB: At this point, key.getAlgorithm() returns PBKDF2WithHmacSHA256, // rather than AES, so create a new SecretKeySpec with the correct // Algorithm. // For an example of someone using this method, see: // http://stackoverflow.com/questions/2860943/suggestions-for-library-to-hash-passwords-in-java return new SecretKeySpec(key.getEncoded(), SYMMETRIC_ALGORITHM); }
java
static SecretKey generateSecretKey(String password, String salt) { if (password == null) { return null; } // Get a SecretKeyFactory for ALGORITHM. // If PBKDF2WithHmacSHA256, add BouncyCastle and recurse to retry. SecretKeyFactory factory; try { factory = SecretKeyFactory.getInstance(SYMMETRIC_PASSWORD_ALGORITHM); } catch (NoSuchAlgorithmException e) { if (SecurityProvider.addProvider()) { // Retry return generateSecretKey(password, salt); } else { throw new IllegalStateException("Algorithm unavailable: " + SYMMETRIC_PASSWORD_ALGORITHM, e); } } // Generate the key: byte[] saltBytes = ByteArray.fromBase64(salt); PBEKeySpec pbeKeySpec = new PBEKeySpec(password.toCharArray(), saltBytes, SYMMETRIC_PASSWORD_ITERATIONS, SYMMETRIC_KEY_SIZE); SecretKey key; try { key = factory.generateSecret(pbeKeySpec); } catch (InvalidKeySpecException e) { throw new IllegalStateException("Error generating password-based key.", e); } // NB: At this point, key.getAlgorithm() returns PBKDF2WithHmacSHA256, // rather than AES, so create a new SecretKeySpec with the correct // Algorithm. // For an example of someone using this method, see: // http://stackoverflow.com/questions/2860943/suggestions-for-library-to-hash-passwords-in-java return new SecretKeySpec(key.getEncoded(), SYMMETRIC_ALGORITHM); }
[ "static", "SecretKey", "generateSecretKey", "(", "String", "password", ",", "String", "salt", ")", "{", "if", "(", "password", "==", "null", ")", "{", "return", "null", ";", "}", "// Get a SecretKeyFactory for ALGORITHM.\r", "// If PBKDF2WithHmacSHA256, add BouncyCastle...
Generates a new secret (or symmetric) key for use with AES using the given password and salt values. Given the same password and salt, this method will always (re)generate the same key. @param password The starting point to use in generating the key. This can be a password, or any suitably secret string. It's worth noting that, if a user's plaintext password is used, this makes key derivation secure, but means the key can never be recovered if a user forgets their password. If a different value, such as a password hash is used, this is not really secure, but does mean the key can be recovered if a user forgets their password. It's all about risk, right? @param salt A value for this parameter can be generated by calling {@link Generate#salt()}. You'll need to store the salt value (this is ok to do because salt isn't particularly sensitive) and use the same salt each time in order to always generate the same key. Using salt is good practice as it ensures that keys generated from the same password will be different - i.e. if two users use the same password, having a salt value avoids the generated keys being identical which might give away someone's password. @return A deterministic secret key, defined by the given password and salt
[ "Generates", "a", "new", "secret", "(", "or", "symmetric", ")", "key", "for", "use", "with", "AES", "using", "the", "given", "password", "and", "salt", "values", "." ]
train
https://github.com/davidcarboni/cryptolite-java/blob/e67954181a04ffc9beb1d9abca1421195fcf9764/src/main/java/com/github/davidcarboni/cryptolite/Keys.java#L179-L215
unbescape/unbescape
src/main/java/org/unbescape/xml/XmlEscape.java
XmlEscape.escapeXml10AttributeMinimal
public static void escapeXml10AttributeMinimal(final String text, final Writer writer) throws IOException { escapeXml(text, writer, XmlEscapeSymbols.XML10_ATTRIBUTE_SYMBOLS, XmlEscapeType.CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA, XmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT); }
java
public static void escapeXml10AttributeMinimal(final String text, final Writer writer) throws IOException { escapeXml(text, writer, XmlEscapeSymbols.XML10_ATTRIBUTE_SYMBOLS, XmlEscapeType.CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA, XmlEscapeLevel.LEVEL_1_ONLY_MARKUP_SIGNIFICANT); }
[ "public", "static", "void", "escapeXml10AttributeMinimal", "(", "final", "String", "text", ",", "final", "Writer", "writer", ")", "throws", "IOException", "{", "escapeXml", "(", "text", ",", "writer", ",", "XmlEscapeSymbols", ".", "XML10_ATTRIBUTE_SYMBOLS", ",", "...
<p> Perform an XML 1.0 level 1 (only markup-significant chars) <strong>escape</strong> operation on a <tt>String</tt> input meant to be an XML attribute value, writing results to a <tt>Writer</tt>. </p> <p> <em>Level 1</em> means this method will only escape the five markup-significant characters which are <em>predefined</em> as Character Entity References in XML: <tt>&lt;</tt>, <tt>&gt;</tt>, <tt>&amp;</tt>, <tt>&quot;</tt> and <tt>&#39;</tt>. </p> <p> Besides, being an attribute value also <tt>&#92;t</tt>, <tt>&#92;n</tt> and <tt>&#92;r</tt> will be escaped to avoid white-space normalization from removing line feeds (turning them into white spaces) during future parsing operations. </p> <p> This method calls {@link #escapeXml10(String, Writer, XmlEscapeType, XmlEscapeLevel)} with the following preconfigured values: </p> <ul> <li><tt>type</tt>: {@link org.unbescape.xml.XmlEscapeType#CHARACTER_ENTITY_REFERENCES_DEFAULT_TO_HEXA}</li> <li><tt>level</tt>: {@link org.unbescape.xml.XmlEscapeLevel#LEVEL_1_ONLY_MARKUP_SIGNIFICANT}</li> </ul> <p> This method is <strong>thread-safe</strong>. </p> @param text the <tt>String</tt> to be escaped. @param writer the <tt>java.io.Writer</tt> to which the escaped result will be written. Nothing will be written at all to this writer if input is <tt>null</tt>. @throws IOException if an input/output exception occurs @since 1.1.5
[ "<p", ">", "Perform", "an", "XML", "1", ".", "0", "level", "1", "(", "only", "markup", "-", "significant", "chars", ")", "<strong", ">", "escape<", "/", "strong", ">", "operation", "on", "a", "<tt", ">", "String<", "/", "tt", ">", "input", "meant", ...
train
https://github.com/unbescape/unbescape/blob/ec5435fb3508c2eed25d8165dc27ded2602cae13/src/main/java/org/unbescape/xml/XmlEscape.java#L778-L783
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.telephony_lines_serviceName_hardware_GET
public OvhOrder telephony_lines_serviceName_hardware_GET(String serviceName, String hardware, String mondialRelayId, Boolean retractation, String shippingContactId) throws IOException { String qPath = "/order/telephony/lines/{serviceName}/hardware"; StringBuilder sb = path(qPath, serviceName); query(sb, "hardware", hardware); query(sb, "mondialRelayId", mondialRelayId); query(sb, "retractation", retractation); query(sb, "shippingContactId", shippingContactId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
java
public OvhOrder telephony_lines_serviceName_hardware_GET(String serviceName, String hardware, String mondialRelayId, Boolean retractation, String shippingContactId) throws IOException { String qPath = "/order/telephony/lines/{serviceName}/hardware"; StringBuilder sb = path(qPath, serviceName); query(sb, "hardware", hardware); query(sb, "mondialRelayId", mondialRelayId); query(sb, "retractation", retractation); query(sb, "shippingContactId", shippingContactId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOrder.class); }
[ "public", "OvhOrder", "telephony_lines_serviceName_hardware_GET", "(", "String", "serviceName", ",", "String", "hardware", ",", "String", "mondialRelayId", ",", "Boolean", "retractation", ",", "String", "shippingContactId", ")", "throws", "IOException", "{", "String", "...
Get prices and contracts information REST: GET /order/telephony/lines/{serviceName}/hardware @param hardware [required] The hardware you want to order for this specific line @param mondialRelayId [required] Use /supply/mondialRelay entry point to specify a relay point and ignore shipping contact address information entry. @param shippingContactId [required] Shipping contact information id from /me entry point @param retractation [required] Retractation rights if set @param serviceName [required] Your line number
[ "Get", "prices", "and", "contracts", "information" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L6903-L6912
mapcode-foundation/mapcode-java
src/main/java/com/mapcode/Mapcode.java
Mapcode.getCodeWithTerritoryFullname
@Nonnull public String getCodeWithTerritoryFullname(final int precision, @Nullable final Alphabet alphabet) throws IllegalArgumentException { return territory.getFullName() + ' ' + getCode(precision, alphabet); }
java
@Nonnull public String getCodeWithTerritoryFullname(final int precision, @Nullable final Alphabet alphabet) throws IllegalArgumentException { return territory.getFullName() + ' ' + getCode(precision, alphabet); }
[ "@", "Nonnull", "public", "String", "getCodeWithTerritoryFullname", "(", "final", "int", "precision", ",", "@", "Nullable", "final", "Alphabet", "alphabet", ")", "throws", "IllegalArgumentException", "{", "return", "territory", ".", "getFullName", "(", ")", "+", "...
Return the full international mapcode, including the full name of the territory and the mapcode code itself. The format of the string is: full-territory-name cde Example: Netherlands 49.4V (regular code) Netherlands 49.4V-K2 (high precision code) @param precision Precision specifier. Range: [0, 8]. @param alphabet Alphabet. @return Full international mapcode. @throws IllegalArgumentException Thrown if precision is out of range (must be in [0, 8]).
[ "Return", "the", "full", "international", "mapcode", "including", "the", "full", "name", "of", "the", "territory", "and", "the", "mapcode", "code", "itself", ".", "The", "format", "of", "the", "string", "is", ":", "full", "-", "territory", "-", "name", "cd...
train
https://github.com/mapcode-foundation/mapcode-java/blob/f12d4d9fbd460472ac0fff1f702f2ac716bc0ab8/src/main/java/com/mapcode/Mapcode.java#L183-L186
icode/ameba
src/main/java/ameba/db/ebean/internal/ModelInterceptor.java
ModelInterceptor.fetchRowCount
public static FutureRowCount fetchRowCount(MultivaluedMap<String, String> queryParams, Query query) { String reqTotalCount = getSingleParam(queryParams.get(REQ_TOTAL_COUNT_PARAM_NAME)); if (reqTotalCount != null && !"false".equalsIgnoreCase(reqTotalCount) && !"0".equals(reqTotalCount)) { return query.findFutureCount(); } return null; }
java
public static FutureRowCount fetchRowCount(MultivaluedMap<String, String> queryParams, Query query) { String reqTotalCount = getSingleParam(queryParams.get(REQ_TOTAL_COUNT_PARAM_NAME)); if (reqTotalCount != null && !"false".equalsIgnoreCase(reqTotalCount) && !"0".equals(reqTotalCount)) { return query.findFutureCount(); } return null; }
[ "public", "static", "FutureRowCount", "fetchRowCount", "(", "MultivaluedMap", "<", "String", ",", "String", ">", "queryParams", ",", "Query", "query", ")", "{", "String", "reqTotalCount", "=", "getSingleParam", "(", "queryParams", ".", "get", "(", "REQ_TOTAL_COUNT...
<p>fetchRowCount.</p> @param queryParams a {@link javax.ws.rs.core.MultivaluedMap} object. @param query a {@link io.ebean.Query} object. @return a {@link io.ebean.FutureRowCount} object.
[ "<p", ">", "fetchRowCount", ".", "<", "/", "p", ">" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/internal/ModelInterceptor.java#L253-L259
netplex/json-smart-v2
json-smart/src/main/java/net/minidev/json/JSONValue.java
JSONValue.toJSONString
public static String toJSONString(Object value, JSONStyle compression) { StringBuilder sb = new StringBuilder(); try { writeJSONString(value, sb, compression); } catch (IOException e) { // can not append on a StringBuilder } return sb.toString(); }
java
public static String toJSONString(Object value, JSONStyle compression) { StringBuilder sb = new StringBuilder(); try { writeJSONString(value, sb, compression); } catch (IOException e) { // can not append on a StringBuilder } return sb.toString(); }
[ "public", "static", "String", "toJSONString", "(", "Object", "value", ",", "JSONStyle", "compression", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "try", "{", "writeJSONString", "(", "value", ",", "sb", ",", "compression", ")...
Convert an object to JSON text. <p> If this object is a Map or a List, and it's also a JSONAware, JSONAware will be considered firstly. <p> DO NOT call this method from toJSONString() of a class that implements both JSONAware and Map or List with "this" as the parameter, use JSONObject.toJSONString(Map) or JSONArray.toJSONString(List) instead. @see JSONObject#toJSONString(Map) @see JSONArray#toJSONString(List) @return JSON text, or "null" if value is null or it's an NaN or an INF number.
[ "Convert", "an", "object", "to", "JSON", "text", ".", "<p", ">", "If", "this", "object", "is", "a", "Map", "or", "a", "List", "and", "it", "s", "also", "a", "JSONAware", "JSONAware", "will", "be", "considered", "firstly", ".", "<p", ">", "DO", "NOT",...
train
https://github.com/netplex/json-smart-v2/blob/bfb3daef039e22a7bbff5f76bf14ea23330cd70e/json-smart/src/main/java/net/minidev/json/JSONValue.java#L619-L627
pravega/pravega
segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java
SegmentAggregator.getFlushArgs
private FlushArgs getFlushArgs() throws DataCorruptionException { StorageOperation first = this.operations.getFirst(); if (!(first instanceof AggregatedAppendOperation)) { // Nothing to flush - first operation is not an AggregatedAppend. return new FlushArgs(null, 0, Collections.emptyMap()); } AggregatedAppendOperation appendOp = (AggregatedAppendOperation) first; int length = (int) appendOp.getLength(); InputStream data; if (length > 0) { data = this.dataSource.getAppendData(appendOp.getStreamSegmentId(), appendOp.getStreamSegmentOffset(), length); if (data == null) { if (this.metadata.isDeleted()) { // Segment was deleted - nothing more to do. return new FlushArgs(null, 0, Collections.emptyMap()); } throw new DataCorruptionException(String.format("Unable to retrieve CacheContents for '%s'.", appendOp)); } } else { if (appendOp.attributes.isEmpty()) { throw new DataCorruptionException(String.format("Found AggregatedAppendOperation with no data or attributes: '%s'.", appendOp)); } data = null; } appendOp.seal(); return new FlushArgs(data, length, appendOp.attributes); }
java
private FlushArgs getFlushArgs() throws DataCorruptionException { StorageOperation first = this.operations.getFirst(); if (!(first instanceof AggregatedAppendOperation)) { // Nothing to flush - first operation is not an AggregatedAppend. return new FlushArgs(null, 0, Collections.emptyMap()); } AggregatedAppendOperation appendOp = (AggregatedAppendOperation) first; int length = (int) appendOp.getLength(); InputStream data; if (length > 0) { data = this.dataSource.getAppendData(appendOp.getStreamSegmentId(), appendOp.getStreamSegmentOffset(), length); if (data == null) { if (this.metadata.isDeleted()) { // Segment was deleted - nothing more to do. return new FlushArgs(null, 0, Collections.emptyMap()); } throw new DataCorruptionException(String.format("Unable to retrieve CacheContents for '%s'.", appendOp)); } } else { if (appendOp.attributes.isEmpty()) { throw new DataCorruptionException(String.format("Found AggregatedAppendOperation with no data or attributes: '%s'.", appendOp)); } data = null; } appendOp.seal(); return new FlushArgs(data, length, appendOp.attributes); }
[ "private", "FlushArgs", "getFlushArgs", "(", ")", "throws", "DataCorruptionException", "{", "StorageOperation", "first", "=", "this", ".", "operations", ".", "getFirst", "(", ")", ";", "if", "(", "!", "(", "first", "instanceof", "AggregatedAppendOperation", ")", ...
Returns a FlushArgs which contains the data needing to be flushed to Storage. @return The aggregated object that can be used for flushing. @throws DataCorruptionException If a unable to retrieve required data from the Data Source.
[ "Returns", "a", "FlushArgs", "which", "contains", "the", "data", "needing", "to", "be", "flushed", "to", "Storage", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/segmentstore/server/src/main/java/io/pravega/segmentstore/server/writer/SegmentAggregator.java#L809-L837
cdk/cdk
descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java
XLogPDescriptor.getHalogenCount
private int getHalogenCount(IAtomContainer ac, IAtom atom) { List<IAtom> neighbours = ac.getConnectedAtomsList(atom); int acounter = 0; for (IAtom neighbour : neighbours) { if (neighbour.getSymbol().equals("F") || neighbour.getSymbol().equals("I") || neighbour.getSymbol().equals("Cl") || neighbour.getSymbol().equals("Br")) { acounter += 1; } } return acounter; }
java
private int getHalogenCount(IAtomContainer ac, IAtom atom) { List<IAtom> neighbours = ac.getConnectedAtomsList(atom); int acounter = 0; for (IAtom neighbour : neighbours) { if (neighbour.getSymbol().equals("F") || neighbour.getSymbol().equals("I") || neighbour.getSymbol().equals("Cl") || neighbour.getSymbol().equals("Br")) { acounter += 1; } } return acounter; }
[ "private", "int", "getHalogenCount", "(", "IAtomContainer", "ac", ",", "IAtom", "atom", ")", "{", "List", "<", "IAtom", ">", "neighbours", "=", "ac", ".", "getConnectedAtomsList", "(", "atom", ")", ";", "int", "acounter", "=", "0", ";", "for", "(", "IAto...
Gets the HalogenCount attribute of the XLogPDescriptor object. @param ac Description of the Parameter @param atom Description of the Parameter @return The alogenCount value
[ "Gets", "the", "HalogenCount", "attribute", "of", "the", "XLogPDescriptor", "object", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java#L1031-L1041
aws/aws-sdk-java
aws-java-sdk-pi/src/main/java/com/amazonaws/services/pi/model/MetricQuery.java
MetricQuery.withFilter
public MetricQuery withFilter(java.util.Map<String, String> filter) { setFilter(filter); return this; }
java
public MetricQuery withFilter(java.util.Map<String, String> filter) { setFilter(filter); return this; }
[ "public", "MetricQuery", "withFilter", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "filter", ")", "{", "setFilter", "(", "filter", ")", ";", "return", "this", ";", "}" ]
<p> One or more filters to apply in the request. Restrictions: </p> <ul> <li> <p> Any number of filters by the same dimension, as specified in the <code>GroupBy</code> parameter. </p> </li> <li> <p> A single filter for any other dimension in this dimension group. </p> </li> </ul> @param filter One or more filters to apply in the request. Restrictions:</p> <ul> <li> <p> Any number of filters by the same dimension, as specified in the <code>GroupBy</code> parameter. </p> </li> <li> <p> A single filter for any other dimension in this dimension group. </p> </li> @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "One", "or", "more", "filters", "to", "apply", "in", "the", "request", ".", "Restrictions", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "<p", ">", "Any", "number", "of", "filters", "by", "the", "same", "dimension", "as", "specified", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-pi/src/main/java/com/amazonaws/services/pi/model/MetricQuery.java#L375-L378
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/MessageProcessor.java
MessageProcessor.createConnection
protected SICoreConnection createConnection() throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createConnection"); SICoreConnection newConn = new ConnectionImpl(this, null, null); // Lock the connections so that we can't be stopped midway through a // create _connectionsLockManager.lock(); try { // Now we have a lock make sure we are started. checkStarted(); synchronized (_connections) { _connections.put(newConn, newConn); } } finally { _connectionsLockManager.unlock(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createConnection", newConn); return newConn; }
java
protected SICoreConnection createConnection() throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createConnection"); SICoreConnection newConn = new ConnectionImpl(this, null, null); // Lock the connections so that we can't be stopped midway through a // create _connectionsLockManager.lock(); try { // Now we have a lock make sure we are started. checkStarted(); synchronized (_connections) { _connections.put(newConn, newConn); } } finally { _connectionsLockManager.unlock(); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createConnection", newConn); return newConn; }
[ "protected", "SICoreConnection", "createConnection", "(", ")", "throws", "SIResourceException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"...
Connection locks are obtained on the connection lock manager. @return
[ "Connection", "locks", "are", "obtained", "on", "the", "connection", "lock", "manager", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/impl/MessageProcessor.java#L320-L347
Baidu-AIP/java-sdk
src/main/java/com/baidu/aip/kg/AipKnowledgeGraphic.java
AipKnowledgeGraphic.updateTask
public JSONObject updateTask(int id, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("id", id); if (options != null) { request.addBody(options); } request.setUri(KnowledgeGraphicConsts.UPDATE_TASK); postOperation(request); return requestServer(request); }
java
public JSONObject updateTask(int id, HashMap<String, String> options) { AipRequest request = new AipRequest(); preOperation(request); request.addBody("id", id); if (options != null) { request.addBody(options); } request.setUri(KnowledgeGraphicConsts.UPDATE_TASK); postOperation(request); return requestServer(request); }
[ "public", "JSONObject", "updateTask", "(", "int", "id", ",", "HashMap", "<", "String", ",", "String", ">", "options", ")", "{", "AipRequest", "request", "=", "new", "AipRequest", "(", ")", ";", "preOperation", "(", "request", ")", ";", "request", ".", "a...
更新任务接口 更新任务配置,在任务重新启动后生效 @param id - 任务ID @param options - 可选参数对象,key: value都为string类型 options - options列表: name 任务名字 template_content json string 解析模板内容 input_mapping_file 抓取结果映射文件的路径 url_pattern url pattern output_file 输出文件名字 @return JSONObject
[ "更新任务接口", "更新任务配置,在任务重新启动后生效" ]
train
https://github.com/Baidu-AIP/java-sdk/blob/16bb8b7bb8f9bbcb7c8af62d0a67a1e79eecad90/src/main/java/com/baidu/aip/kg/AipKnowledgeGraphic.java#L77-L88
code4everything/util
src/main/java/com/zhazhapan/util/dialog/Alerts.java
Alerts.showConfirmation
public static Optional<ButtonType> showConfirmation(String title, String content) { return showConfirmation(title, null, content); }
java
public static Optional<ButtonType> showConfirmation(String title, String content) { return showConfirmation(title, null, content); }
[ "public", "static", "Optional", "<", "ButtonType", ">", "showConfirmation", "(", "String", "title", ",", "String", "content", ")", "{", "return", "showConfirmation", "(", "title", ",", "null", ",", "content", ")", ";", "}" ]
弹出确认框 @param title 标题 @param content 内容 @return {@link ButtonType}
[ "弹出确认框" ]
train
https://github.com/code4everything/util/blob/1fc9f0ead1108f4d7208ba7c000df4244f708418/src/main/java/com/zhazhapan/util/dialog/Alerts.java#L107-L109
pippo-java/pippo
pippo-core/src/main/java/ro/pippo/core/Messages.java
Messages.getWithDefault
public String getWithDefault(String key, String defaultMessage, RouteContext routeContext, Object... args) { String language = languages.getLanguageOrDefault(routeContext); return getWithDefault(key, defaultMessage, language, args); }
java
public String getWithDefault(String key, String defaultMessage, RouteContext routeContext, Object... args) { String language = languages.getLanguageOrDefault(routeContext); return getWithDefault(key, defaultMessage, language, args); }
[ "public", "String", "getWithDefault", "(", "String", "key", ",", "String", "defaultMessage", ",", "RouteContext", "routeContext", ",", "Object", "...", "args", ")", "{", "String", "language", "=", "languages", ".", "getLanguageOrDefault", "(", "routeContext", ")",...
Gets the requested localized message. <p/> <p> The current Request and Response are used to help determine the messages resource to use. <ol> <li>Exact locale match, return the registered locale message <li>Language match, but not a locale match, return the registered language message <li>Return the supplied default message </ol> <p> The message can be formatted with optional arguments using the {@link java.text.MessageFormat} syntax. </p> <p> If the key does not exist in the messages resource, then the key name is returned. </p> @param key @param defaultMessage @param routeContext @param args @return the message or the key if the key does not exist
[ "Gets", "the", "requested", "localized", "message", ".", "<p", "/", ">", "<p", ">", "The", "current", "Request", "and", "Response", "are", "used", "to", "help", "determine", "the", "messages", "resource", "to", "use", ".", "<ol", ">", "<li", ">", "Exact"...
train
https://github.com/pippo-java/pippo/blob/cb5ccb453bffcc3cf386adc660674812d10b9726/pippo-core/src/main/java/ro/pippo/core/Messages.java#L151-L154
Netflix/frigga
src/main/java/com/netflix/frigga/NameValidation.java
NameValidation.usesReservedFormat
public static Boolean usesReservedFormat(String name) { return checkMatch(name, PUSH_FORMAT_PATTERN) || checkMatch(name, LABELED_VARIABLE_PATTERN); }
java
public static Boolean usesReservedFormat(String name) { return checkMatch(name, PUSH_FORMAT_PATTERN) || checkMatch(name, LABELED_VARIABLE_PATTERN); }
[ "public", "static", "Boolean", "usesReservedFormat", "(", "String", "name", ")", "{", "return", "checkMatch", "(", "name", ",", "PUSH_FORMAT_PATTERN", ")", "||", "checkMatch", "(", "name", ",", "LABELED_VARIABLE_PATTERN", ")", ";", "}" ]
Determines whether a name ends with the reserved format -v000 where 0 represents any digit, or starts with the reserved format z0 where z is any letter, or contains a hyphen-separated token that starts with the z0 format. @param name to inspect @return true if the name ends with the reserved format
[ "Determines", "whether", "a", "name", "ends", "with", "the", "reserved", "format", "-", "v000", "where", "0", "represents", "any", "digit", "or", "starts", "with", "the", "reserved", "format", "z0", "where", "z", "is", "any", "letter", "or", "contains", "a...
train
https://github.com/Netflix/frigga/blob/38afefd1726116f3431b95fcb96a6af640b99d10/src/main/java/com/netflix/frigga/NameValidation.java#L93-L95
LearnLib/automatalib
incremental/src/main/java/net/automatalib/incremental/dfa/tree/Node.java
Node.setChild
public void setChild(int idx, int alphabetSize, Node<I> child) { if (children == null) { children = new ResizingArrayStorage<>(Node.class, alphabetSize); } children.array[idx] = child; }
java
public void setChild(int idx, int alphabetSize, Node<I> child) { if (children == null) { children = new ResizingArrayStorage<>(Node.class, alphabetSize); } children.array[idx] = child; }
[ "public", "void", "setChild", "(", "int", "idx", ",", "int", "alphabetSize", ",", "Node", "<", "I", ">", "child", ")", "{", "if", "(", "children", "==", "null", ")", "{", "children", "=", "new", "ResizingArrayStorage", "<>", "(", "Node", ".", "class", ...
Sets the child for a given index. @param idx the alphabet symbol index @param alphabetSize the overall alphabet size; this is needed if a new children array needs to be created @param child the new child
[ "Sets", "the", "child", "for", "a", "given", "index", "." ]
train
https://github.com/LearnLib/automatalib/blob/8a462ec52f6eaab9f8996e344f2163a72cb8aa6e/incremental/src/main/java/net/automatalib/incremental/dfa/tree/Node.java#L102-L107
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java
ReflectUtil.setFieldValue
public static void setFieldValue(Object obj, String fieldName, Object value) throws UtilException { Assert.notNull(obj); Assert.notBlank(fieldName); setFieldValue(obj, getField(obj.getClass(), fieldName), value); }
java
public static void setFieldValue(Object obj, String fieldName, Object value) throws UtilException { Assert.notNull(obj); Assert.notBlank(fieldName); setFieldValue(obj, getField(obj.getClass(), fieldName), value); }
[ "public", "static", "void", "setFieldValue", "(", "Object", "obj", ",", "String", "fieldName", ",", "Object", "value", ")", "throws", "UtilException", "{", "Assert", ".", "notNull", "(", "obj", ")", ";", "Assert", ".", "notBlank", "(", "fieldName", ")", ";...
设置字段值 @param obj 对象 @param fieldName 字段名 @param value 值,值类型必须与字段类型匹配,不会自动转换对象类型 @throws UtilException 包装IllegalAccessException异常
[ "设置字段值" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ReflectUtil.java#L236-L240
Netflix/conductor
client/src/main/java/com/netflix/conductor/client/http/WorkflowClient.java
WorkflowClient.startWorkflow
public String startWorkflow(StartWorkflowRequest startWorkflowRequest) { Preconditions.checkNotNull(startWorkflowRequest, "StartWorkflowRequest cannot be null"); Preconditions.checkArgument(StringUtils.isNotBlank(startWorkflowRequest.getName()), "Workflow name cannot be null or empty"); Preconditions.checkArgument(StringUtils.isBlank(startWorkflowRequest.getExternalInputPayloadStoragePath()), "External Storage Path must not be set"); String version = startWorkflowRequest.getVersion() != null ? startWorkflowRequest.getVersion().toString() : "latest"; try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) { objectMapper.writeValue(byteArrayOutputStream, startWorkflowRequest.getInput()); byte[] workflowInputBytes = byteArrayOutputStream.toByteArray(); long workflowInputSize = workflowInputBytes.length; WorkflowTaskMetrics.recordWorkflowInputPayloadSize(startWorkflowRequest.getName(), version, workflowInputSize); if (workflowInputSize > conductorClientConfiguration.getWorkflowInputPayloadThresholdKB() * 1024) { if (!conductorClientConfiguration.isExternalPayloadStorageEnabled() || (workflowInputSize > conductorClientConfiguration.getWorkflowInputMaxPayloadThresholdKB() * 1024)) { String errorMsg = String.format("Input payload larger than the allowed threshold of: %d KB", conductorClientConfiguration.getWorkflowInputPayloadThresholdKB()); throw new ConductorClientException(errorMsg); } else { WorkflowTaskMetrics.incrementExternalPayloadUsedCount(startWorkflowRequest.getName(), ExternalPayloadStorage.Operation.WRITE.name(), ExternalPayloadStorage.PayloadType.WORKFLOW_INPUT.name()); String externalStoragePath = uploadToExternalPayloadStorage(ExternalPayloadStorage.PayloadType.WORKFLOW_INPUT, workflowInputBytes, workflowInputSize); startWorkflowRequest.setExternalInputPayloadStoragePath(externalStoragePath); startWorkflowRequest.setInput(null); } } } catch (IOException e) { String errorMsg = String.format("Unable to start workflow:%s, version:%s", startWorkflowRequest.getName(), version); logger.error(errorMsg, e); throw new ConductorClientException(errorMsg, e); } return postForEntity("workflow", startWorkflowRequest, null, String.class, startWorkflowRequest.getName()); }
java
public String startWorkflow(StartWorkflowRequest startWorkflowRequest) { Preconditions.checkNotNull(startWorkflowRequest, "StartWorkflowRequest cannot be null"); Preconditions.checkArgument(StringUtils.isNotBlank(startWorkflowRequest.getName()), "Workflow name cannot be null or empty"); Preconditions.checkArgument(StringUtils.isBlank(startWorkflowRequest.getExternalInputPayloadStoragePath()), "External Storage Path must not be set"); String version = startWorkflowRequest.getVersion() != null ? startWorkflowRequest.getVersion().toString() : "latest"; try (ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream()) { objectMapper.writeValue(byteArrayOutputStream, startWorkflowRequest.getInput()); byte[] workflowInputBytes = byteArrayOutputStream.toByteArray(); long workflowInputSize = workflowInputBytes.length; WorkflowTaskMetrics.recordWorkflowInputPayloadSize(startWorkflowRequest.getName(), version, workflowInputSize); if (workflowInputSize > conductorClientConfiguration.getWorkflowInputPayloadThresholdKB() * 1024) { if (!conductorClientConfiguration.isExternalPayloadStorageEnabled() || (workflowInputSize > conductorClientConfiguration.getWorkflowInputMaxPayloadThresholdKB() * 1024)) { String errorMsg = String.format("Input payload larger than the allowed threshold of: %d KB", conductorClientConfiguration.getWorkflowInputPayloadThresholdKB()); throw new ConductorClientException(errorMsg); } else { WorkflowTaskMetrics.incrementExternalPayloadUsedCount(startWorkflowRequest.getName(), ExternalPayloadStorage.Operation.WRITE.name(), ExternalPayloadStorage.PayloadType.WORKFLOW_INPUT.name()); String externalStoragePath = uploadToExternalPayloadStorage(ExternalPayloadStorage.PayloadType.WORKFLOW_INPUT, workflowInputBytes, workflowInputSize); startWorkflowRequest.setExternalInputPayloadStoragePath(externalStoragePath); startWorkflowRequest.setInput(null); } } } catch (IOException e) { String errorMsg = String.format("Unable to start workflow:%s, version:%s", startWorkflowRequest.getName(), version); logger.error(errorMsg, e); throw new ConductorClientException(errorMsg, e); } return postForEntity("workflow", startWorkflowRequest, null, String.class, startWorkflowRequest.getName()); }
[ "public", "String", "startWorkflow", "(", "StartWorkflowRequest", "startWorkflowRequest", ")", "{", "Preconditions", ".", "checkNotNull", "(", "startWorkflowRequest", ",", "\"StartWorkflowRequest cannot be null\"", ")", ";", "Preconditions", ".", "checkArgument", "(", "Stri...
Starts a workflow. If the size of the workflow input payload is bigger than {@link ConductorClientConfiguration#getWorkflowInputPayloadThresholdKB()}, it is uploaded to {@link ExternalPayloadStorage}, if enabled, else the workflow is rejected. @param startWorkflowRequest the {@link StartWorkflowRequest} object to start the workflow @return the id of the workflow instance that can be used for tracking @throws ConductorClientException if {@link ExternalPayloadStorage} is disabled or if the payload size is greater than {@link ConductorClientConfiguration#getWorkflowInputMaxPayloadThresholdKB()}
[ "Starts", "a", "workflow", ".", "If", "the", "size", "of", "the", "workflow", "input", "payload", "is", "bigger", "than", "{", "@link", "ConductorClientConfiguration#getWorkflowInputPayloadThresholdKB", "()", "}", "it", "is", "uploaded", "to", "{", "@link", "Exter...
train
https://github.com/Netflix/conductor/blob/78fae0ed9ddea22891f9eebb96a2ec0b2783dca0/client/src/main/java/com/netflix/conductor/client/http/WorkflowClient.java#L106-L135
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/PipelineApi.java
PipelineApi.createPipeline
public Pipeline createPipeline(Object projectIdOrPath, String ref, Map<String, String> variables) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("ref", ref, true) .withParam("variables", variables, false); Response response = post(Response.Status.CREATED, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "pipeline"); return (response.readEntity(Pipeline.class)); }
java
public Pipeline createPipeline(Object projectIdOrPath, String ref, Map<String, String> variables) throws GitLabApiException { GitLabApiForm formData = new GitLabApiForm() .withParam("ref", ref, true) .withParam("variables", variables, false); Response response = post(Response.Status.CREATED, formData.asMap(), "projects", getProjectIdOrPath(projectIdOrPath), "pipeline"); return (response.readEntity(Pipeline.class)); }
[ "public", "Pipeline", "createPipeline", "(", "Object", "projectIdOrPath", ",", "String", "ref", ",", "Map", "<", "String", ",", "String", ">", "variables", ")", "throws", "GitLabApiException", "{", "GitLabApiForm", "formData", "=", "new", "GitLabApiForm", "(", "...
Create a pipelines in a project. <pre><code>GitLab Endpoint: POST /projects/:id/pipeline</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param ref reference to commit @param variables a Map containing the variables available in the pipeline @return a Pipeline instance with the newly created pipeline info @throws GitLabApiException if any exception occurs during execution
[ "Create", "a", "pipelines", "in", "a", "project", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/PipelineApi.java#L243-L250
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/trees/GrammaticalRelation.java
GrammaticalRelation.valueOf
public static GrammaticalRelation valueOf(String s, Collection<GrammaticalRelation> values) { for (GrammaticalRelation reln : values) { if (reln.toString().equals(s)) return reln; } return null; }
java
public static GrammaticalRelation valueOf(String s, Collection<GrammaticalRelation> values) { for (GrammaticalRelation reln : values) { if (reln.toString().equals(s)) return reln; } return null; }
[ "public", "static", "GrammaticalRelation", "valueOf", "(", "String", "s", ",", "Collection", "<", "GrammaticalRelation", ">", "values", ")", "{", "for", "(", "GrammaticalRelation", "reln", ":", "values", ")", "{", "if", "(", "reln", ".", "toString", "(", ")"...
Returns the GrammaticalRelation having the given string representation (e.g. "nsubj"), or null if no such is found. @param s The short name of the GrammaticalRelation @param values The set of GrammaticalRelations to look for it among. @return The GrammaticalRelation with that name
[ "Returns", "the", "GrammaticalRelation", "having", "the", "given", "string", "representation", "(", "e", ".", "g", ".", "nsubj", ")", "or", "null", "if", "no", "such", "is", "found", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/trees/GrammaticalRelation.java#L155-L161
Samsung/GearVRf
GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBehavior.java
GVRScriptBehavior.setScriptText
public void setScriptText(String scriptText, String language) { GVRScriptFile newScript = new GVRJavascriptScriptFile(getGVRContext(), scriptText); mLanguage = GVRScriptManager.LANG_JAVASCRIPT; setScriptFile(newScript); }
java
public void setScriptText(String scriptText, String language) { GVRScriptFile newScript = new GVRJavascriptScriptFile(getGVRContext(), scriptText); mLanguage = GVRScriptManager.LANG_JAVASCRIPT; setScriptFile(newScript); }
[ "public", "void", "setScriptText", "(", "String", "scriptText", ",", "String", "language", ")", "{", "GVRScriptFile", "newScript", "=", "new", "GVRJavascriptScriptFile", "(", "getGVRContext", "(", ")", ",", "scriptText", ")", ";", "mLanguage", "=", "GVRScriptManag...
Loads the script from a text string. @param scriptText text string containing script to execute. @param language language ("js" or "lua")
[ "Loads", "the", "script", "from", "a", "text", "string", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/script/src/main/java/org/gearvrf/script/GVRScriptBehavior.java#L126-L131
spring-projects/spring-data-solr
src/main/java/org/springframework/data/solr/core/query/DefaultValueFunction.java
DefaultValueFunction.defaultValue
public static DefaultValueFunction defaultValue(String fieldName, Object defaultValue) { Assert.hasText(fieldName, "Fieldname must not be 'empty' for default value operation."); Assert.notNull(defaultValue, "DefaultValue must not be 'null'."); return defaultValue(new SimpleField(fieldName), defaultValue); }
java
public static DefaultValueFunction defaultValue(String fieldName, Object defaultValue) { Assert.hasText(fieldName, "Fieldname must not be 'empty' for default value operation."); Assert.notNull(defaultValue, "DefaultValue must not be 'null'."); return defaultValue(new SimpleField(fieldName), defaultValue); }
[ "public", "static", "DefaultValueFunction", "defaultValue", "(", "String", "fieldName", ",", "Object", "defaultValue", ")", "{", "Assert", ".", "hasText", "(", "fieldName", ",", "\"Fieldname must not be 'empty' for default value operation.\"", ")", ";", "Assert", ".", "...
Creates new {@link DefaultValueFunction} representing {@code def(fieldname, defaultValue))} @param fieldName must not be empty @param defaultValue must not be null @return
[ "Creates", "new", "{", "@link", "DefaultValueFunction", "}", "representing", "{", "@code", "def", "(", "fieldname", "defaultValue", "))", "}" ]
train
https://github.com/spring-projects/spring-data-solr/blob/20be5cb82498b70134dfda6c1a91ad21f8e657e0/src/main/java/org/springframework/data/solr/core/query/DefaultValueFunction.java#L43-L49
segmentio/analytics-android
analytics/src/main/java/com/segment/analytics/Analytics.java
Analytics.onIntegrationReady
public <T> void onIntegrationReady(final String key, final Callback<T> callback) { if (isNullOrEmpty(key)) { throw new IllegalArgumentException("key cannot be null or empty."); } analyticsExecutor.submit( new Runnable() { @Override public void run() { HANDLER.post( new Runnable() { @Override public void run() { performCallback(key, callback); } }); } }); }
java
public <T> void onIntegrationReady(final String key, final Callback<T> callback) { if (isNullOrEmpty(key)) { throw new IllegalArgumentException("key cannot be null or empty."); } analyticsExecutor.submit( new Runnable() { @Override public void run() { HANDLER.post( new Runnable() { @Override public void run() { performCallback(key, callback); } }); } }); }
[ "public", "<", "T", ">", "void", "onIntegrationReady", "(", "final", "String", "key", ",", "final", "Callback", "<", "T", ">", "callback", ")", "{", "if", "(", "isNullOrEmpty", "(", "key", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "...
Register to be notified when a bundled integration is ready. <p>In most cases, integrations would have already been initialized, and the callback will be invoked fairly quickly. However there may be a latency the first time the app is launched, and we don't have settings for bundled integrations yet. This is compounded if the user is offline on the first run. <p>You can only register for one callback per integration at a time, and passing in a {@code callback} will remove the previous callback for that integration. <p>Usage: <pre> <code> analytics.onIntegrationReady("Amplitude", new Callback() { {@literal @}Override public void onIntegrationReady(Object instance) { Amplitude.enableLocationListening(); } }); analytics.onIntegrationReady("Mixpanel", new Callback<>() { {@literal @}Override public void onIntegrationReady(MixpanelAPI mixpanel) { mixpanel.clearSuperProperties(); } })* </code> </pre>
[ "Register", "to", "be", "notified", "when", "a", "bundled", "integration", "is", "ready", "." ]
train
https://github.com/segmentio/analytics-android/blob/93c7d5bb09b593440a2347a6089db3e9f74012da/analytics/src/main/java/com/segment/analytics/Analytics.java#L950-L968
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/TreeUtil.java
TreeUtil.findNodeByLabel
public static Treenode findNodeByLabel(Treeview tree, String label, boolean caseSensitive) { for (Treenode item : tree.getChildren(Treenode.class)) { if (caseSensitive ? label.equals(item.getLabel()) : label.equalsIgnoreCase(item.getLabel())) { return item; } } return null; }
java
public static Treenode findNodeByLabel(Treeview tree, String label, boolean caseSensitive) { for (Treenode item : tree.getChildren(Treenode.class)) { if (caseSensitive ? label.equals(item.getLabel()) : label.equalsIgnoreCase(item.getLabel())) { return item; } } return null; }
[ "public", "static", "Treenode", "findNodeByLabel", "(", "Treeview", "tree", ",", "String", "label", ",", "boolean", "caseSensitive", ")", "{", "for", "(", "Treenode", "item", ":", "tree", ".", "getChildren", "(", "Treenode", ".", "class", ")", ")", "{", "i...
Search the entire tree for a tree item matching the specified label. @param tree Tree containing the item of interest. @param label Label to match. @param caseSensitive If true, match is case-sensitive. @return The matching tree item, or null if not found.
[ "Search", "the", "entire", "tree", "for", "a", "tree", "item", "matching", "the", "specified", "label", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/util/TreeUtil.java#L172-L180
EasyinnovaSL/Tiff-Library-4J
src/main/java/com/easyinnova/tiff/profiles/BaselineProfile.java
BaselineProfile.CheckCIELab
private void CheckCIELab(IfdTags metadata, int n) { // BitsPerSample if (!metadata.containsTagId(TiffTags.getTagId("BitsPerSample"))) { validation.addErrorLoc("Missing BitsPerSample", "IFD" + n); } else { for (abstractTiffType vi : metadata.get(TiffTags.getTagId("BitsPerSample")).getValue()) { if (vi.toInt() != 8) { validation.addError("Invalid BitsPerSample", "IFD" + n, vi.toInt()); break; } } } }
java
private void CheckCIELab(IfdTags metadata, int n) { // BitsPerSample if (!metadata.containsTagId(TiffTags.getTagId("BitsPerSample"))) { validation.addErrorLoc("Missing BitsPerSample", "IFD" + n); } else { for (abstractTiffType vi : metadata.get(TiffTags.getTagId("BitsPerSample")).getValue()) { if (vi.toInt() != 8) { validation.addError("Invalid BitsPerSample", "IFD" + n, vi.toInt()); break; } } } }
[ "private", "void", "CheckCIELab", "(", "IfdTags", "metadata", ",", "int", "n", ")", "{", "// BitsPerSample", "if", "(", "!", "metadata", ".", "containsTagId", "(", "TiffTags", ".", "getTagId", "(", "\"BitsPerSample\"", ")", ")", ")", "{", "validation", ".", ...
Check CIELab. @param metadata the metadata @param n the IFD number
[ "Check", "CIELab", "." ]
train
https://github.com/EasyinnovaSL/Tiff-Library-4J/blob/682605d3ed207a66213278c054c98f1b909472b7/src/main/java/com/easyinnova/tiff/profiles/BaselineProfile.java#L411-L423
nutzam/nutzwx
src/main/java/org/nutz/weixin/impl/WxApi2Impl.java
WxApi2Impl.card_code_get
@Override public WxResp card_code_get(String code, String cardId, Boolean checkConsume) { NutMap body = NutMap.NEW().addv("code", code); if (cardId != null) { body.addv("card_id", cardId); } if (checkConsume != null) { body.addv("check_consume", checkConsume); } // 由于查询Code API中没有“/cgi-bin”,所以uri不能只写“/card/code/get” return postJson("https://api.weixin.qq.com/card/code/get", body); }
java
@Override public WxResp card_code_get(String code, String cardId, Boolean checkConsume) { NutMap body = NutMap.NEW().addv("code", code); if (cardId != null) { body.addv("card_id", cardId); } if (checkConsume != null) { body.addv("check_consume", checkConsume); } // 由于查询Code API中没有“/cgi-bin”,所以uri不能只写“/card/code/get” return postJson("https://api.weixin.qq.com/card/code/get", body); }
[ "@", "Override", "public", "WxResp", "card_code_get", "(", "String", "code", ",", "String", "cardId", ",", "Boolean", "checkConsume", ")", "{", "NutMap", "body", "=", "NutMap", ".", "NEW", "(", ")", ".", "addv", "(", "\"code\"", ",", "code", ")", ";", ...
微信卡券:查询Code @author JinYi @param code 卡券Code码,一张卡券的唯一标识,必填 @param cardId 卡券ID代表一类卡券,null表示不填此参数。自定义code卡券必填 @param checkConsume 是否校验code核销状态,填入true和false时的code异常状态返回数据不同,null表示不填此参数 @return
[ "微信卡券:查询Code" ]
train
https://github.com/nutzam/nutzwx/blob/e6c8831b75f8a96bcc060b0c5562b882eefcf5ee/src/main/java/org/nutz/weixin/impl/WxApi2Impl.java#L333-L345
googleapis/google-cloud-java
google-cloud-clients/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/v1beta1/ErrorStatsServiceClient.java
ErrorStatsServiceClient.listEvents
public final ListEventsPagedResponse listEvents(String projectName, String groupId) { ListEventsRequest request = ListEventsRequest.newBuilder().setProjectName(projectName).setGroupId(groupId).build(); return listEvents(request); }
java
public final ListEventsPagedResponse listEvents(String projectName, String groupId) { ListEventsRequest request = ListEventsRequest.newBuilder().setProjectName(projectName).setGroupId(groupId).build(); return listEvents(request); }
[ "public", "final", "ListEventsPagedResponse", "listEvents", "(", "String", "projectName", ",", "String", "groupId", ")", "{", "ListEventsRequest", "request", "=", "ListEventsRequest", ".", "newBuilder", "(", ")", ".", "setProjectName", "(", "projectName", ")", ".", ...
Lists the specified events. <p>Sample code: <pre><code> try (ErrorStatsServiceClient errorStatsServiceClient = ErrorStatsServiceClient.create()) { ProjectName projectName = ProjectName.of("[PROJECT]"); String groupId = ""; for (ErrorEvent element : errorStatsServiceClient.listEvents(projectName.toString(), groupId).iterateAll()) { // doThingsWith(element); } } </code></pre> @param projectName [Required] The resource name of the Google Cloud Platform project. Written as `projects/` plus the [Google Cloud Platform project ID](https://support.google.com/cloud/answer/6158840). Example: `projects/my-project-123`. @param groupId [Required] The group for which events shall be returned. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Lists", "the", "specified", "events", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-errorreporting/src/main/java/com/google/cloud/errorreporting/v1beta1/ErrorStatsServiceClient.java#L387-L391
kiegroup/jbpm
jbpm-human-task/jbpm-human-task-jpa/src/main/java/org/jbpm/services/task/impl/model/TaskDataImpl.java
TaskDataImpl.setDocument
public void setDocument(long documentID, ContentData documentConentData) { setDocumentContentId(documentID); setDocumentAccessType(documentConentData.getAccessType()); setDocumentType(documentConentData.getType()); }
java
public void setDocument(long documentID, ContentData documentConentData) { setDocumentContentId(documentID); setDocumentAccessType(documentConentData.getAccessType()); setDocumentType(documentConentData.getType()); }
[ "public", "void", "setDocument", "(", "long", "documentID", ",", "ContentData", "documentConentData", ")", "{", "setDocumentContentId", "(", "documentID", ")", ";", "setDocumentAccessType", "(", "documentConentData", ".", "getAccessType", "(", ")", ")", ";", "setDoc...
Sets the document content data for this task data. It will set the <field>documentContentId</field> from the specified documentID, <field>documentAccessType</field>, <field>documentType</field> from the specified documentConentData. @param documentID id of document content @param documentConentData ContentData
[ "Sets", "the", "document", "content", "data", "for", "this", "task", "data", ".", "It", "will", "set", "the", "<field", ">", "documentContentId<", "/", "field", ">", "from", "the", "specified", "documentID", "<field", ">", "documentAccessType<", "/", "field", ...
train
https://github.com/kiegroup/jbpm/blob/c3473c728aa382ebbea01e380c5e754a96647b82/jbpm-human-task/jbpm-human-task-jpa/src/main/java/org/jbpm/services/task/impl/model/TaskDataImpl.java#L531-L535
glyptodon/guacamole-client
extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUserContext.java
SharedUserContext.init
public void init(AuthenticationProvider authProvider, RemoteAuthenticatedUser user) { // Associate the originating authentication provider this.authProvider = authProvider; // Provide access to all connections shared with the given user this.connectionDirectory.init(user); // The connection group directory contains only the root group this.rootGroup = new SharedRootConnectionGroup(this); // Create internal pseudo-account representing the authenticated user this.self = new SharedUser(user, this); }
java
public void init(AuthenticationProvider authProvider, RemoteAuthenticatedUser user) { // Associate the originating authentication provider this.authProvider = authProvider; // Provide access to all connections shared with the given user this.connectionDirectory.init(user); // The connection group directory contains only the root group this.rootGroup = new SharedRootConnectionGroup(this); // Create internal pseudo-account representing the authenticated user this.self = new SharedUser(user, this); }
[ "public", "void", "init", "(", "AuthenticationProvider", "authProvider", ",", "RemoteAuthenticatedUser", "user", ")", "{", "// Associate the originating authentication provider", "this", ".", "authProvider", "=", "authProvider", ";", "// Provide access to all connections shared w...
Creates a new SharedUserContext which provides access ONLY to the given user, the SharedConnections associated with the share keys used by that user, and an internal root connection group containing only those SharedConnections. @param authProvider The AuthenticationProvider that created this SharedUserContext; @param user The RemoteAuthenticatedUser for whom this SharedUserContext is being created.
[ "Creates", "a", "new", "SharedUserContext", "which", "provides", "access", "ONLY", "to", "the", "given", "user", "the", "SharedConnections", "associated", "with", "the", "share", "keys", "used", "by", "that", "user", "and", "an", "internal", "root", "connection"...
train
https://github.com/glyptodon/guacamole-client/blob/ea1b10e9d1e3f1fa640dff2ca64d61b44bf1ace9/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/sharing/user/SharedUserContext.java#L80-L94
pietermartin/sqlg
sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Partition.java
Partition.createListPartition
static Partition createListPartition(SqlgGraph sqlgGraph, AbstractLabel abstractLabel, String name, String in) { Preconditions.checkArgument(!abstractLabel.getSchema().isSqlgSchema(), "createListPartition may not be called for \"%s\"", Topology.SQLG_SCHEMA); Partition partition = new Partition(sqlgGraph, abstractLabel, name, in, PartitionType.NONE, null); partition.createListPartitionOnDb(); if (abstractLabel instanceof VertexLabel) { TopologyManager.addVertexLabelPartition( sqlgGraph, abstractLabel.getSchema().getName(), abstractLabel.getName(), name, in, PartitionType.NONE, null); } else { TopologyManager.addEdgeLabelPartition(sqlgGraph, abstractLabel, name, in, PartitionType.NONE, null); } partition.committed = false; return partition; }
java
static Partition createListPartition(SqlgGraph sqlgGraph, AbstractLabel abstractLabel, String name, String in) { Preconditions.checkArgument(!abstractLabel.getSchema().isSqlgSchema(), "createListPartition may not be called for \"%s\"", Topology.SQLG_SCHEMA); Partition partition = new Partition(sqlgGraph, abstractLabel, name, in, PartitionType.NONE, null); partition.createListPartitionOnDb(); if (abstractLabel instanceof VertexLabel) { TopologyManager.addVertexLabelPartition( sqlgGraph, abstractLabel.getSchema().getName(), abstractLabel.getName(), name, in, PartitionType.NONE, null); } else { TopologyManager.addEdgeLabelPartition(sqlgGraph, abstractLabel, name, in, PartitionType.NONE, null); } partition.committed = false; return partition; }
[ "static", "Partition", "createListPartition", "(", "SqlgGraph", "sqlgGraph", ",", "AbstractLabel", "abstractLabel", ",", "String", "name", ",", "String", "in", ")", "{", "Preconditions", ".", "checkArgument", "(", "!", "abstractLabel", ".", "getSchema", "(", ")", ...
Create a list partition on an {@link AbstractLabel} @param sqlgGraph @param abstractLabel @param name @param in @return
[ "Create", "a", "list", "partition", "on", "an", "{", "@link", "AbstractLabel", "}" ]
train
https://github.com/pietermartin/sqlg/blob/c1845a1b31328a5ffda646873b0369ee72af56a7/sqlg-core/src/main/java/org/umlg/sqlg/structure/topology/Partition.java#L224-L242
antlrjavaparser/antlr-java-parser
src/main/java/com/github/antlrjavaparser/ASTHelper.java
ASTHelper.addMember
public static void addMember(TypeDeclaration type, BodyDeclaration decl) { List<BodyDeclaration> members = type.getMembers(); if (members == null) { members = new ArrayList<BodyDeclaration>(); type.setMembers(members); } members.add(decl); }
java
public static void addMember(TypeDeclaration type, BodyDeclaration decl) { List<BodyDeclaration> members = type.getMembers(); if (members == null) { members = new ArrayList<BodyDeclaration>(); type.setMembers(members); } members.add(decl); }
[ "public", "static", "void", "addMember", "(", "TypeDeclaration", "type", ",", "BodyDeclaration", "decl", ")", "{", "List", "<", "BodyDeclaration", ">", "members", "=", "type", ".", "getMembers", "(", ")", ";", "if", "(", "members", "==", "null", ")", "{", ...
Adds the given declaration to the specified type. The list of members will be initialized if it is <code>null</code>. @param type type declaration @param decl member declaration
[ "Adds", "the", "given", "declaration", "to", "the", "specified", "type", ".", "The", "list", "of", "members", "will", "be", "initialized", "if", "it", "is", "<code", ">", "null<", "/", "code", ">", "." ]
train
https://github.com/antlrjavaparser/antlr-java-parser/blob/077160deb44d952c40c442800abd91af7e6fe006/src/main/java/com/github/antlrjavaparser/ASTHelper.java#L274-L281
lecho/hellocharts-android
hellocharts-library/src/lecho/lib/hellocharts/renderer/AxesRenderer.java
AxesRenderer.initAxis
private void initAxis(Axis axis, int position) { if (null == axis) { return; } initAxisAttributes(axis, position); initAxisMargin(axis, position); initAxisMeasurements(axis, position); }
java
private void initAxis(Axis axis, int position) { if (null == axis) { return; } initAxisAttributes(axis, position); initAxisMargin(axis, position); initAxisMeasurements(axis, position); }
[ "private", "void", "initAxis", "(", "Axis", "axis", ",", "int", "position", ")", "{", "if", "(", "null", "==", "axis", ")", "{", "return", ";", "}", "initAxisAttributes", "(", "axis", ",", "position", ")", ";", "initAxisMargin", "(", "axis", ",", "posi...
Initialize attributes and measurement for axes(left, right, top, bottom);
[ "Initialize", "attributes", "and", "measurement", "for", "axes", "(", "left", "right", "top", "bottom", ")", ";" ]
train
https://github.com/lecho/hellocharts-android/blob/c41419c9afa097452dee823c7eba0e5136aa96bd/hellocharts-library/src/lecho/lib/hellocharts/renderer/AxesRenderer.java#L140-L147
SonarSource/sonarqube
server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java
DatabaseUtils.executeLargeInputsWithoutOutput
public static <T> void executeLargeInputsWithoutOutput(Collection<T> input, Consumer<List<T>> consumer) { if (input.isEmpty()) { return; } List<List<T>> partitions = Lists.partition(newArrayList(input), PARTITION_SIZE_FOR_ORACLE); for (List<T> partition : partitions) { consumer.accept(partition); } }
java
public static <T> void executeLargeInputsWithoutOutput(Collection<T> input, Consumer<List<T>> consumer) { if (input.isEmpty()) { return; } List<List<T>> partitions = Lists.partition(newArrayList(input), PARTITION_SIZE_FOR_ORACLE); for (List<T> partition : partitions) { consumer.accept(partition); } }
[ "public", "static", "<", "T", ">", "void", "executeLargeInputsWithoutOutput", "(", "Collection", "<", "T", ">", "input", ",", "Consumer", "<", "List", "<", "T", ">", ">", "consumer", ")", "{", "if", "(", "input", ".", "isEmpty", "(", ")", ")", "{", "...
Partition by 1000 elements a list of input and execute a consumer on each part. The goal is to prevent issue with ORACLE when there's more than 1000 elements in a 'in ('X', 'Y', ...)' and with MsSQL when there's more than 2000 parameters in a query
[ "Partition", "by", "1000", "elements", "a", "list", "of", "input", "and", "execute", "a", "consumer", "on", "each", "part", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-db-core/src/main/java/org/sonar/db/DatabaseUtils.java#L207-L216
ginere/ginere-base
src/main/java/eu/ginere/base/util/i18n/I18NConnector.java
I18NConnector.getLabel
public static String getLabel(Language lang, Class<?> sectionClass, String isInSection) { return getLabel(lang, sectionClass.getName(), isInSection); }
java
public static String getLabel(Language lang, Class<?> sectionClass, String isInSection) { return getLabel(lang, sectionClass.getName(), isInSection); }
[ "public", "static", "String", "getLabel", "(", "Language", "lang", ",", "Class", "<", "?", ">", "sectionClass", ",", "String", "isInSection", ")", "{", "return", "getLabel", "(", "lang", ",", "sectionClass", ".", "getName", "(", ")", ",", "isInSection", ")...
Returns the value for this label (setion,idInSection) for this lang @param lang @param sectionClass @param isInSection @return
[ "Returns", "the", "value", "for", "this", "label", "(", "setion", "idInSection", ")", "for", "this", "lang" ]
train
https://github.com/ginere/ginere-base/blob/b1cc1c5834bd8a31df475c6f3fc0ee51273c5a24/src/main/java/eu/ginere/base/util/i18n/I18NConnector.java#L54-L58
alexa/alexa-skills-kit-sdk-for-java
ask-sdk-core/src/com/amazon/ask/response/ResponseBuilder.java
ResponseBuilder.withSimpleCard
public ResponseBuilder withSimpleCard(String cardTitle, String cardText) { this.card = SimpleCard.builder() .withContent(cardText) .withTitle(cardTitle) .build(); return this; }
java
public ResponseBuilder withSimpleCard(String cardTitle, String cardText) { this.card = SimpleCard.builder() .withContent(cardText) .withTitle(cardTitle) .build(); return this; }
[ "public", "ResponseBuilder", "withSimpleCard", "(", "String", "cardTitle", ",", "String", "cardText", ")", "{", "this", ".", "card", "=", "SimpleCard", ".", "builder", "(", ")", ".", "withContent", "(", "cardText", ")", ".", "withTitle", "(", "cardTitle", ")...
Sets a simple {@link Card} on the response with the specified title and content. @param cardTitle title for card @param cardText text in the card @return response builder
[ "Sets", "a", "simple", "{", "@link", "Card", "}", "on", "the", "response", "with", "the", "specified", "title", "and", "content", "." ]
train
https://github.com/alexa/alexa-skills-kit-sdk-for-java/blob/c49194da0693898c70f3f2c4a372f5a12da04e3e/ask-sdk-core/src/com/amazon/ask/response/ResponseBuilder.java#L118-L124
cdk/cdk
descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java
XLogPDescriptor.getPresenceOfNitro
private boolean getPresenceOfNitro(IAtomContainer ac, IAtom atom) { List neighbours = ac.getConnectedAtomsList(atom); List second = null; IBond bond = null; //int counter = 0; for (int i = 0; i < neighbours.size(); i++) { IAtom neighbour = (IAtom) neighbours.get(i); if (neighbour.getSymbol().equals("N")) { second = ac.getConnectedAtomsList(neighbour); for (int b = 0; b < second.size(); b++) { IAtom conAtom = (IAtom) second.get(b); if (conAtom.getSymbol().equals("O")) { bond = ac.getBond(neighbour, conAtom); if (bond.getOrder() == IBond.Order.DOUBLE) { return true; } } } } } return false; }
java
private boolean getPresenceOfNitro(IAtomContainer ac, IAtom atom) { List neighbours = ac.getConnectedAtomsList(atom); List second = null; IBond bond = null; //int counter = 0; for (int i = 0; i < neighbours.size(); i++) { IAtom neighbour = (IAtom) neighbours.get(i); if (neighbour.getSymbol().equals("N")) { second = ac.getConnectedAtomsList(neighbour); for (int b = 0; b < second.size(); b++) { IAtom conAtom = (IAtom) second.get(b); if (conAtom.getSymbol().equals("O")) { bond = ac.getBond(neighbour, conAtom); if (bond.getOrder() == IBond.Order.DOUBLE) { return true; } } } } } return false; }
[ "private", "boolean", "getPresenceOfNitro", "(", "IAtomContainer", "ac", ",", "IAtom", "atom", ")", "{", "List", "neighbours", "=", "ac", ".", "getConnectedAtomsList", "(", "atom", ")", ";", "List", "second", "=", "null", ";", "IBond", "bond", "=", "null", ...
Gets the presenceOfN=O attribute of the XLogPDescriptor object. @param ac Description of the Parameter @param atom Description of the Parameter @return The presenceOfNitor [boolean]
[ "Gets", "the", "presenceOfN", "=", "O", "attribute", "of", "the", "XLogPDescriptor", "object", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/XLogPDescriptor.java#L1315-L1336
diirt/util
src/main/java/org/epics/util/array/ListNumbers.java
ListNumbers.linearList
public static ListNumber linearList(final double initialValue, final double increment, final int size) { if (size <= 0) { throw new IllegalArgumentException("Size must be positive (was " + size + " )"); } return new LinearListDouble(size, initialValue, increment); }
java
public static ListNumber linearList(final double initialValue, final double increment, final int size) { if (size <= 0) { throw new IllegalArgumentException("Size must be positive (was " + size + " )"); } return new LinearListDouble(size, initialValue, increment); }
[ "public", "static", "ListNumber", "linearList", "(", "final", "double", "initialValue", ",", "final", "double", "increment", ",", "final", "int", "size", ")", "{", "if", "(", "size", "<=", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Si...
Creates a list of equally spaced values given the first value, the step between element and the size of the list. @param initialValue the first value in the list @param increment the difference between elements @param size the size of the list @return a new list
[ "Creates", "a", "list", "of", "equally", "spaced", "values", "given", "the", "first", "value", "the", "step", "between", "element", "and", "the", "size", "of", "the", "list", "." ]
train
https://github.com/diirt/util/blob/24aca0a173a635aaf0b78d213a3fee8d4f91c077/src/main/java/org/epics/util/array/ListNumbers.java#L167-L172
Trilarion/java-vorbis-support
src/main/java/com/github/trilarion/sound/vorbis/sampled/spi/VorbisAudioFileReader.java
VorbisAudioFileReader.getAudioFileFormat
@Override public AudioFileFormat getAudioFileFormat(InputStream inputStream, long medialength) throws UnsupportedAudioFileException, IOException { return getAudioFileFormat(inputStream, (int) medialength, AudioSystem.NOT_SPECIFIED); }
java
@Override public AudioFileFormat getAudioFileFormat(InputStream inputStream, long medialength) throws UnsupportedAudioFileException, IOException { return getAudioFileFormat(inputStream, (int) medialength, AudioSystem.NOT_SPECIFIED); }
[ "@", "Override", "public", "AudioFileFormat", "getAudioFileFormat", "(", "InputStream", "inputStream", ",", "long", "medialength", ")", "throws", "UnsupportedAudioFileException", ",", "IOException", "{", "return", "getAudioFileFormat", "(", "inputStream", ",", "(", "int...
Return the AudioFileFormat from the given InputStream and length in bytes. @param medialength @return @throws javax.sound.sampled.UnsupportedAudioFileException @throws java.io.IOException
[ "Return", "the", "AudioFileFormat", "from", "the", "given", "InputStream", "and", "length", "in", "bytes", "." ]
train
https://github.com/Trilarion/java-vorbis-support/blob/f72aba7d97167fe0ff20b1b719fdb5bb662ff736/src/main/java/com/github/trilarion/sound/vorbis/sampled/spi/VorbisAudioFileReader.java#L161-L164