repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
listlengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
codecentric/zucchini
zucchini-bdd/src/main/java/de/codecentric/zucchini/bdd/util/Assert.java
Assert.assertEquals
public static void assertEquals(String message, Object expected, Object actual) { """ Asserts that two objects are equal, i.e. {@code expected.equals(actual) == true}, and fails otherwise. @param message The message of the thrown {@link java.lang.AssertionError}. @param expected The expected object. @param actual The actual object. """ if (expected == null && actual != null || expected != null && !expected.equals(actual)) { fail(message); } }
java
public static void assertEquals(String message, Object expected, Object actual) { if (expected == null && actual != null || expected != null && !expected.equals(actual)) { fail(message); } }
[ "public", "static", "void", "assertEquals", "(", "String", "message", ",", "Object", "expected", ",", "Object", "actual", ")", "{", "if", "(", "expected", "==", "null", "&&", "actual", "!=", "null", "||", "expected", "!=", "null", "&&", "!", "expected", ...
Asserts that two objects are equal, i.e. {@code expected.equals(actual) == true}, and fails otherwise. @param message The message of the thrown {@link java.lang.AssertionError}. @param expected The expected object. @param actual The actual object.
[ "Asserts", "that", "two", "objects", "are", "equal", "i", ".", "e", ".", "{", "@code", "expected", ".", "equals", "(", "actual", ")", "==", "true", "}", "and", "fails", "otherwise", "." ]
train
https://github.com/codecentric/zucchini/blob/61541cd8ce666ef21ad943486a7c0eb53310ed5a/zucchini-bdd/src/main/java/de/codecentric/zucchini/bdd/util/Assert.java#L50-L54
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/jboss/logging/Logger.java
Logger.infov
public void infov(String format, Object... params) { """ Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting. @param format the message format string @param params the parameters """ doLog(Level.INFO, FQCN, format, params, null); }
java
public void infov(String format, Object... params) { doLog(Level.INFO, FQCN, format, params, null); }
[ "public", "void", "infov", "(", "String", "format", ",", "Object", "...", "params", ")", "{", "doLog", "(", "Level", ".", "INFO", ",", "FQCN", ",", "format", ",", "params", ",", "null", ")", ";", "}" ]
Issue a log message with a level of INFO using {@link java.text.MessageFormat}-style formatting. @param format the message format string @param params the parameters
[ "Issue", "a", "log", "message", "with", "a", "level", "of", "INFO", "using", "{", "@link", "java", ".", "text", ".", "MessageFormat", "}", "-", "style", "formatting", "." ]
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/jboss/logging/Logger.java#L1022-L1024
alkacon/opencms-core
src-gwt/org/opencms/acacia/client/CmsAttributeHandler.java
CmsAttributeHandler.createNestedEntitiesForChoicePath
public void createNestedEntitiesForChoicePath(CmsEntity value, List<String> choicePath) { """ Creates a sequence of nested entities according to a given path of choice attribute names.<p> @param value the entity into which the new entities for the given path should be inserted @param choicePath the path of choice attributes """ CmsEntity parentValue = value; for (String attributeChoice : choicePath) { CmsType choiceType = m_entityBackEnd.getType(parentValue.getTypeName()).getAttributeType( CmsType.CHOICE_ATTRIBUTE_NAME); CmsEntity choice = m_entityBackEnd.createEntity(null, choiceType.getId()); parentValue.addAttributeValue(CmsType.CHOICE_ATTRIBUTE_NAME, choice); CmsType choiceOptionType = choiceType.getAttributeType(attributeChoice); if (choiceOptionType.isSimpleType()) { String choiceValue = m_widgetService.getDefaultAttributeValue(attributeChoice, getSimplePath(0)); choice.addAttributeValue(attributeChoice, choiceValue); break; } else { CmsEntity choiceValue = m_entityBackEnd.createEntity(null, choiceOptionType.getId()); choice.addAttributeValue(attributeChoice, choiceValue); parentValue = choiceValue; } } }
java
public void createNestedEntitiesForChoicePath(CmsEntity value, List<String> choicePath) { CmsEntity parentValue = value; for (String attributeChoice : choicePath) { CmsType choiceType = m_entityBackEnd.getType(parentValue.getTypeName()).getAttributeType( CmsType.CHOICE_ATTRIBUTE_NAME); CmsEntity choice = m_entityBackEnd.createEntity(null, choiceType.getId()); parentValue.addAttributeValue(CmsType.CHOICE_ATTRIBUTE_NAME, choice); CmsType choiceOptionType = choiceType.getAttributeType(attributeChoice); if (choiceOptionType.isSimpleType()) { String choiceValue = m_widgetService.getDefaultAttributeValue(attributeChoice, getSimplePath(0)); choice.addAttributeValue(attributeChoice, choiceValue); break; } else { CmsEntity choiceValue = m_entityBackEnd.createEntity(null, choiceOptionType.getId()); choice.addAttributeValue(attributeChoice, choiceValue); parentValue = choiceValue; } } }
[ "public", "void", "createNestedEntitiesForChoicePath", "(", "CmsEntity", "value", ",", "List", "<", "String", ">", "choicePath", ")", "{", "CmsEntity", "parentValue", "=", "value", ";", "for", "(", "String", "attributeChoice", ":", "choicePath", ")", "{", "CmsTy...
Creates a sequence of nested entities according to a given path of choice attribute names.<p> @param value the entity into which the new entities for the given path should be inserted @param choicePath the path of choice attributes
[ "Creates", "a", "sequence", "of", "nested", "entities", "according", "to", "a", "given", "path", "of", "choice", "attribute", "names", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/acacia/client/CmsAttributeHandler.java#L422-L441
googleads/googleads-java-lib
modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/Maps.java
Maps.toArray
public static <K, V, T> T[] toArray(Map<K, V> map, T[] entryArray) { """ Generates an array of entries from a map. Entries are defined in the API as a class which consists of a {@code key} and {@code value} with a name typically in the form of {@code Key_ValueMapEntry}, represented here as {@code T}. The generated array can be used in objects where {@code List<Key_ValueMapEntry>} is taken as a value. The input map must have same type {@code K} as the {@code key} within {@code Key_ValueMapEntry}. The same applies for {@code V} and {@code value} within {@code Key_ValueMapEntry}. @param <K> the type of the entry key @param <V> the type of the entry value @param <T> the map entry type @param map a map of type {@code K} and {@code V} representing the entry array @param entryArray the entry array that entries will be added into @return an array all map entries contained within the map parameter into the provided array or a new array if there was not enough room """ return toList(map, entryArray.getClass().getComponentType()).toArray(entryArray); }
java
public static <K, V, T> T[] toArray(Map<K, V> map, T[] entryArray) { return toList(map, entryArray.getClass().getComponentType()).toArray(entryArray); }
[ "public", "static", "<", "K", ",", "V", ",", "T", ">", "T", "[", "]", "toArray", "(", "Map", "<", "K", ",", "V", ">", "map", ",", "T", "[", "]", "entryArray", ")", "{", "return", "toList", "(", "map", ",", "entryArray", ".", "getClass", "(", ...
Generates an array of entries from a map. Entries are defined in the API as a class which consists of a {@code key} and {@code value} with a name typically in the form of {@code Key_ValueMapEntry}, represented here as {@code T}. The generated array can be used in objects where {@code List<Key_ValueMapEntry>} is taken as a value. The input map must have same type {@code K} as the {@code key} within {@code Key_ValueMapEntry}. The same applies for {@code V} and {@code value} within {@code Key_ValueMapEntry}. @param <K> the type of the entry key @param <V> the type of the entry value @param <T> the map entry type @param map a map of type {@code K} and {@code V} representing the entry array @param entryArray the entry array that entries will be added into @return an array all map entries contained within the map parameter into the provided array or a new array if there was not enough room
[ "Generates", "an", "array", "of", "entries", "from", "a", "map", ".", "Entries", "are", "defined", "in", "the", "API", "as", "a", "class", "which", "consists", "of", "a", "{", "@code", "key", "}", "and", "{", "@code", "value", "}", "with", "a", "name...
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/modules/ads_lib/src/main/java/com/google/api/ads/common/lib/utils/Maps.java#L123-L125
pac4j/pac4j
pac4j-core/src/main/java/org/pac4j/core/engine/DefaultSecurityLogic.java
DefaultSecurityLogic.redirectToIdentityProvider
protected HttpAction redirectToIdentityProvider(final C context, final List<Client> currentClients) { """ Perform a redirection to start the login process of the first indirect client. @param context the web context @param currentClients the current clients @return the performed redirection """ final IndirectClient currentClient = (IndirectClient) currentClients.get(0); return (HttpAction) currentClient.redirect(context).get(); }
java
protected HttpAction redirectToIdentityProvider(final C context, final List<Client> currentClients) { final IndirectClient currentClient = (IndirectClient) currentClients.get(0); return (HttpAction) currentClient.redirect(context).get(); }
[ "protected", "HttpAction", "redirectToIdentityProvider", "(", "final", "C", "context", ",", "final", "List", "<", "Client", ">", "currentClients", ")", "{", "final", "IndirectClient", "currentClient", "=", "(", "IndirectClient", ")", "currentClients", ".", "get", ...
Perform a redirection to start the login process of the first indirect client. @param context the web context @param currentClients the current clients @return the performed redirection
[ "Perform", "a", "redirection", "to", "start", "the", "login", "process", "of", "the", "first", "indirect", "client", "." ]
train
https://github.com/pac4j/pac4j/blob/d9cd029f8783792b31dd48bf1e32f80628f2c4a3/pac4j-core/src/main/java/org/pac4j/core/engine/DefaultSecurityLogic.java#L217-L220
Azure/azure-sdk-for-java
cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java
ModelsImpl.listHierarchicalEntitiesAsync
public Observable<List<HierarchicalEntityExtractor>> listHierarchicalEntitiesAsync(UUID appId, String versionId, ListHierarchicalEntitiesOptionalParameter listHierarchicalEntitiesOptionalParameter) { """ Gets information about the hierarchical entity models. @param appId The application ID. @param versionId The version ID. @param listHierarchicalEntitiesOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;HierarchicalEntityExtractor&gt; object """ return listHierarchicalEntitiesWithServiceResponseAsync(appId, versionId, listHierarchicalEntitiesOptionalParameter).map(new Func1<ServiceResponse<List<HierarchicalEntityExtractor>>, List<HierarchicalEntityExtractor>>() { @Override public List<HierarchicalEntityExtractor> call(ServiceResponse<List<HierarchicalEntityExtractor>> response) { return response.body(); } }); }
java
public Observable<List<HierarchicalEntityExtractor>> listHierarchicalEntitiesAsync(UUID appId, String versionId, ListHierarchicalEntitiesOptionalParameter listHierarchicalEntitiesOptionalParameter) { return listHierarchicalEntitiesWithServiceResponseAsync(appId, versionId, listHierarchicalEntitiesOptionalParameter).map(new Func1<ServiceResponse<List<HierarchicalEntityExtractor>>, List<HierarchicalEntityExtractor>>() { @Override public List<HierarchicalEntityExtractor> call(ServiceResponse<List<HierarchicalEntityExtractor>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "HierarchicalEntityExtractor", ">", ">", "listHierarchicalEntitiesAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "ListHierarchicalEntitiesOptionalParameter", "listHierarchicalEntitiesOptionalParameter", ")", "{", "retu...
Gets information about the hierarchical entity models. @param appId The application ID. @param versionId The version ID. @param listHierarchicalEntitiesOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;HierarchicalEntityExtractor&gt; object
[ "Gets", "information", "about", "the", "hierarchical", "entity", "models", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/language/luis/authoring/src/main/java/com/microsoft/azure/cognitiveservices/language/luis/authoring/implementation/ModelsImpl.java#L1400-L1407
liyiorg/weixin-popular
src/main/java/weixin/popular/api/PayMchAPI.java
PayMchAPI.mmpaymkttransfersGettransferinfo
public static GettransferinfoResult mmpaymkttransfersGettransferinfo(Gettransferinfo gettransferinfo,String key) { """ 查询企业付款 @since 2.8.5 @param gettransferinfo gettransferinfo @param key key @return GettransferinfoResult """ Map<String,String> map = MapUtil.objectToMap( gettransferinfo); String sign = SignatureUtil.generateSign(map,gettransferinfo.getSign_type(),key); gettransferinfo.setSign(sign); String secapiPayRefundXML = XMLConverUtil.convertToXML( gettransferinfo); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(xmlHeader) .setUri(baseURI()+ "/mmpaymkttransfers/gettransferinfo") .setEntity(new StringEntity(secapiPayRefundXML,Charset.forName("utf-8"))) .build(); return LocalHttpClient.keyStoreExecuteXmlResult(gettransferinfo.getMch_id(),httpUriRequest,GettransferinfoResult.class,gettransferinfo.getSign_type(),key); }
java
public static GettransferinfoResult mmpaymkttransfersGettransferinfo(Gettransferinfo gettransferinfo,String key){ Map<String,String> map = MapUtil.objectToMap( gettransferinfo); String sign = SignatureUtil.generateSign(map,gettransferinfo.getSign_type(),key); gettransferinfo.setSign(sign); String secapiPayRefundXML = XMLConverUtil.convertToXML( gettransferinfo); HttpUriRequest httpUriRequest = RequestBuilder.post() .setHeader(xmlHeader) .setUri(baseURI()+ "/mmpaymkttransfers/gettransferinfo") .setEntity(new StringEntity(secapiPayRefundXML,Charset.forName("utf-8"))) .build(); return LocalHttpClient.keyStoreExecuteXmlResult(gettransferinfo.getMch_id(),httpUriRequest,GettransferinfoResult.class,gettransferinfo.getSign_type(),key); }
[ "public", "static", "GettransferinfoResult", "mmpaymkttransfersGettransferinfo", "(", "Gettransferinfo", "gettransferinfo", ",", "String", "key", ")", "{", "Map", "<", "String", ",", "String", ">", "map", "=", "MapUtil", ".", "objectToMap", "(", "gettransferinfo", "...
查询企业付款 @since 2.8.5 @param gettransferinfo gettransferinfo @param key key @return GettransferinfoResult
[ "查询企业付款" ]
train
https://github.com/liyiorg/weixin-popular/blob/c64255292d41463bdb671938feaabf42a335d82c/src/main/java/weixin/popular/api/PayMchAPI.java#L593-L604
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/PropertyChangeSupport.java
PropertyChangeSupport.removePropertyChangeListener
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { """ Remove a PropertyChangeListener for a specific property. @param propertyName The name of the property that was listened on. @param listener The PropertyChangeListener to be removed """ if (children == null) { return; } PropertyChangeSupport child = (PropertyChangeSupport) children.get(propertyName); if (child == null) { return; } child.removePropertyChangeListener(listener); }
java
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { if (children == null) { return; } PropertyChangeSupport child = (PropertyChangeSupport) children.get(propertyName); if (child == null) { return; } child.removePropertyChangeListener(listener); }
[ "public", "void", "removePropertyChangeListener", "(", "String", "propertyName", ",", "PropertyChangeListener", "listener", ")", "{", "if", "(", "children", "==", "null", ")", "{", "return", ";", "}", "PropertyChangeSupport", "child", "=", "(", "PropertyChangeSuppor...
Remove a PropertyChangeListener for a specific property. @param propertyName The name of the property that was listened on. @param listener The PropertyChangeListener to be removed
[ "Remove", "a", "PropertyChangeListener", "for", "a", "specific", "property", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/binding/value/support/PropertyChangeSupport.java#L178-L187
dropbox/dropbox-sdk-java
src/main/java/com/dropbox/core/v1/DbxClientV1.java
DbxClientV1.getDeltaWithPathPrefix
public DbxDelta<DbxEntry> getDeltaWithPathPrefix(/*@Nullable*/String cursor, String pathPrefix, boolean includeMediaInfo) throws DbxException { """ Same as {@link #getDelta}, except results are limited to files and folders whose paths are equal to or under the specified {@code pathPrefix}. <p> The {@code pathPrefix} is fixed for a given cursor. Whatever {@code pathPrefix} you use on the first call to {@code getDelta()} must also be passed in on subsequent calls that use the returned cursor. </p> @param pathPrefix A path on Dropbox to limit results to. """ DbxPathV1.checkArg("path", pathPrefix); return _getDelta(cursor, pathPrefix, includeMediaInfo); }
java
public DbxDelta<DbxEntry> getDeltaWithPathPrefix(/*@Nullable*/String cursor, String pathPrefix, boolean includeMediaInfo) throws DbxException { DbxPathV1.checkArg("path", pathPrefix); return _getDelta(cursor, pathPrefix, includeMediaInfo); }
[ "public", "DbxDelta", "<", "DbxEntry", ">", "getDeltaWithPathPrefix", "(", "/*@Nullable*/", "String", "cursor", ",", "String", "pathPrefix", ",", "boolean", "includeMediaInfo", ")", "throws", "DbxException", "{", "DbxPathV1", ".", "checkArg", "(", "\"path\"", ",", ...
Same as {@link #getDelta}, except results are limited to files and folders whose paths are equal to or under the specified {@code pathPrefix}. <p> The {@code pathPrefix} is fixed for a given cursor. Whatever {@code pathPrefix} you use on the first call to {@code getDelta()} must also be passed in on subsequent calls that use the returned cursor. </p> @param pathPrefix A path on Dropbox to limit results to.
[ "Same", "as", "{", "@link", "#getDelta", "}", "except", "results", "are", "limited", "to", "files", "and", "folders", "whose", "paths", "are", "equal", "to", "or", "under", "the", "specified", "{", "@code", "pathPrefix", "}", "." ]
train
https://github.com/dropbox/dropbox-sdk-java/blob/d86157005fad6233c18b4b0f10f00b8d9d56ae92/src/main/java/com/dropbox/core/v1/DbxClientV1.java#L1527-L1533
aws/aws-sdk-java
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/crypto/S3CryptoModuleBase.java
S3CryptoModuleBase.fetchInstructionFile
final S3ObjectWrapper fetchInstructionFile(S3ObjectId s3ObjectId, String instFileSuffix) { """ Retrieves an instruction file from S3; or null if no instruction file is found. @param s3ObjectId the S3 object id (not the instruction file id) @param instFileSuffix suffix of the instruction file to be retrieved; or null to use the default suffix. @return an instruction file, or null if no instruction file is found. """ try { S3Object o = s3.getObject( createInstructionGetRequest(s3ObjectId, instFileSuffix)); return o == null ? null : new S3ObjectWrapper(o, s3ObjectId); } catch (AmazonServiceException e) { // If no instruction file is found, log a debug message, and return // null. if (log.isDebugEnabled()) { log.debug("Unable to retrieve instruction file : " + e.getMessage()); } return null; } }
java
final S3ObjectWrapper fetchInstructionFile(S3ObjectId s3ObjectId, String instFileSuffix) { try { S3Object o = s3.getObject( createInstructionGetRequest(s3ObjectId, instFileSuffix)); return o == null ? null : new S3ObjectWrapper(o, s3ObjectId); } catch (AmazonServiceException e) { // If no instruction file is found, log a debug message, and return // null. if (log.isDebugEnabled()) { log.debug("Unable to retrieve instruction file : " + e.getMessage()); } return null; } }
[ "final", "S3ObjectWrapper", "fetchInstructionFile", "(", "S3ObjectId", "s3ObjectId", ",", "String", "instFileSuffix", ")", "{", "try", "{", "S3Object", "o", "=", "s3", ".", "getObject", "(", "createInstructionGetRequest", "(", "s3ObjectId", ",", "instFileSuffix", ")...
Retrieves an instruction file from S3; or null if no instruction file is found. @param s3ObjectId the S3 object id (not the instruction file id) @param instFileSuffix suffix of the instruction file to be retrieved; or null to use the default suffix. @return an instruction file, or null if no instruction file is found.
[ "Retrieves", "an", "instruction", "file", "from", "S3", ";", "or", "null", "if", "no", "instruction", "file", "is", "found", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/internal/crypto/S3CryptoModuleBase.java#L773-L788
lessthanoptimal/ejml
main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java
RandomMatrices_DDRM.span
public static DMatrixRMaj[] span(int dimen, int numVectors , Random rand ) { """ is there a faster algorithm out there? This one is a bit sluggish """ if( dimen < numVectors ) throw new IllegalArgumentException("The number of vectors must be less than or equal to the dimension"); DMatrixRMaj u[] = new DMatrixRMaj[numVectors]; u[0] = RandomMatrices_DDRM.rectangle(dimen,1,-1,1,rand); NormOps_DDRM.normalizeF(u[0]); for( int i = 1; i < numVectors; i++ ) { // System.out.println(" i = "+i); DMatrixRMaj a = new DMatrixRMaj(dimen,1); DMatrixRMaj r=null; for( int j = 0; j < i; j++ ) { // System.out.println("j = "+j); if( j == 0 ) r = RandomMatrices_DDRM.rectangle(dimen,1,-1,1,rand); // find a vector that is normal to vector j // u[i] = (1/2)*(r + Q[j]*r) a.set(r); VectorVectorMult_DDRM.householder(-2.0,u[j],r,a); CommonOps_DDRM.add(r,a,a); CommonOps_DDRM.scale(0.5,a); // UtilEjml.print(a); DMatrixRMaj t = a; a = r; r = t; // normalize it so it doesn't get too small double val = NormOps_DDRM.normF(r); if( val == 0 || Double.isNaN(val) || Double.isInfinite(val)) throw new RuntimeException("Failed sanity check"); CommonOps_DDRM.divide(r,val); } u[i] = r; } return u; }
java
public static DMatrixRMaj[] span(int dimen, int numVectors , Random rand ) { if( dimen < numVectors ) throw new IllegalArgumentException("The number of vectors must be less than or equal to the dimension"); DMatrixRMaj u[] = new DMatrixRMaj[numVectors]; u[0] = RandomMatrices_DDRM.rectangle(dimen,1,-1,1,rand); NormOps_DDRM.normalizeF(u[0]); for( int i = 1; i < numVectors; i++ ) { // System.out.println(" i = "+i); DMatrixRMaj a = new DMatrixRMaj(dimen,1); DMatrixRMaj r=null; for( int j = 0; j < i; j++ ) { // System.out.println("j = "+j); if( j == 0 ) r = RandomMatrices_DDRM.rectangle(dimen,1,-1,1,rand); // find a vector that is normal to vector j // u[i] = (1/2)*(r + Q[j]*r) a.set(r); VectorVectorMult_DDRM.householder(-2.0,u[j],r,a); CommonOps_DDRM.add(r,a,a); CommonOps_DDRM.scale(0.5,a); // UtilEjml.print(a); DMatrixRMaj t = a; a = r; r = t; // normalize it so it doesn't get too small double val = NormOps_DDRM.normF(r); if( val == 0 || Double.isNaN(val) || Double.isInfinite(val)) throw new RuntimeException("Failed sanity check"); CommonOps_DDRM.divide(r,val); } u[i] = r; } return u; }
[ "public", "static", "DMatrixRMaj", "[", "]", "span", "(", "int", "dimen", ",", "int", "numVectors", ",", "Random", "rand", ")", "{", "if", "(", "dimen", "<", "numVectors", ")", "throw", "new", "IllegalArgumentException", "(", "\"The number of vectors must be les...
is there a faster algorithm out there? This one is a bit sluggish
[ "is", "there", "a", "faster", "algorithm", "out", "there?", "This", "one", "is", "a", "bit", "sluggish" ]
train
https://github.com/lessthanoptimal/ejml/blob/1444680cc487af5e866730e62f48f5f9636850d9/main/ejml-ddense/src/org/ejml/dense/row/RandomMatrices_DDRM.java#L58-L101
igniterealtime/Smack
smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java
StringUtils.requireNotNullOrEmpty
@Deprecated public static <CS extends CharSequence> CS requireNotNullOrEmpty(CS cs, String message) { """ Require a {@link CharSequence} to be neither null, nor empty. @deprecated use {@link #requireNotNullNorEmpty(CharSequence, String)} instead. @param cs CharSequence @param message error message @param <CS> CharSequence type @return cs """ return requireNotNullNorEmpty(cs, message); }
java
@Deprecated public static <CS extends CharSequence> CS requireNotNullOrEmpty(CS cs, String message) { return requireNotNullNorEmpty(cs, message); }
[ "@", "Deprecated", "public", "static", "<", "CS", "extends", "CharSequence", ">", "CS", "requireNotNullOrEmpty", "(", "CS", "cs", ",", "String", "message", ")", "{", "return", "requireNotNullNorEmpty", "(", "cs", ",", "message", ")", ";", "}" ]
Require a {@link CharSequence} to be neither null, nor empty. @deprecated use {@link #requireNotNullNorEmpty(CharSequence, String)} instead. @param cs CharSequence @param message error message @param <CS> CharSequence type @return cs
[ "Require", "a", "{", "@link", "CharSequence", "}", "to", "be", "neither", "null", "nor", "empty", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-core/src/main/java/org/jivesoftware/smack/util/StringUtils.java#L436-L439
citrusframework/citrus
modules/citrus-core/src/main/java/com/consol/citrus/variable/dictionary/xml/XpathMappingDataDictionary.java
XpathMappingDataDictionary.containsNode
private boolean containsNode(NodeList findings, Node node) { """ Checks if given node set contains node. @param findings @param node @return """ for (int i = 0; i < findings.getLength(); i++) { if (findings.item(i).equals(node)) { return true; } } return false; }
java
private boolean containsNode(NodeList findings, Node node) { for (int i = 0; i < findings.getLength(); i++) { if (findings.item(i).equals(node)) { return true; } } return false; }
[ "private", "boolean", "containsNode", "(", "NodeList", "findings", ",", "Node", "node", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "findings", ".", "getLength", "(", ")", ";", "i", "++", ")", "{", "if", "(", "findings", ".", "item",...
Checks if given node set contains node. @param findings @param node @return
[ "Checks", "if", "given", "node", "set", "contains", "node", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-core/src/main/java/com/consol/citrus/variable/dictionary/xml/XpathMappingDataDictionary.java#L75-L83
primefaces/primefaces
src/main/java/org/primefaces/renderkit/InputRenderer.java
InputRenderer.renderARIARequired
protected void renderARIARequired(FacesContext context, UIInput component) throws IOException { """ Adds "aria-required" if the component is required. @param context the {@link FacesContext} @param component the {@link UIInput} component to add attributes for @throws IOException if any error occurs writing the response """ if (component.isRequired()) { ResponseWriter writer = context.getResponseWriter(); writer.writeAttribute(HTML.ARIA_REQUIRED, "true", null); } }
java
protected void renderARIARequired(FacesContext context, UIInput component) throws IOException { if (component.isRequired()) { ResponseWriter writer = context.getResponseWriter(); writer.writeAttribute(HTML.ARIA_REQUIRED, "true", null); } }
[ "protected", "void", "renderARIARequired", "(", "FacesContext", "context", ",", "UIInput", "component", ")", "throws", "IOException", "{", "if", "(", "component", ".", "isRequired", "(", ")", ")", "{", "ResponseWriter", "writer", "=", "context", ".", "getRespons...
Adds "aria-required" if the component is required. @param context the {@link FacesContext} @param component the {@link UIInput} component to add attributes for @throws IOException if any error occurs writing the response
[ "Adds", "aria", "-", "required", "if", "the", "component", "is", "required", "." ]
train
https://github.com/primefaces/primefaces/blob/b8cdd5ed395d09826e40e3302d6b14901d3ef4e7/src/main/java/org/primefaces/renderkit/InputRenderer.java#L81-L86
3pillarlabs/spring-data-simpledb
spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/attributeutil/AmazonSimpleDBUtil.java
AmazonSimpleDBUtil.encodeByteArray
public static String encodeByteArray(byte[] byteArray) { """ Encodes byteArray value into a base64-encoded string. @return string representation of the date value """ try { return new String(Base64.encodeBase64(byteArray), UTF8_ENCODING); } catch(UnsupportedEncodingException e) { throw new MappingException("Could not encode byteArray to UTF8 encoding", e); } }
java
public static String encodeByteArray(byte[] byteArray) { try { return new String(Base64.encodeBase64(byteArray), UTF8_ENCODING); } catch(UnsupportedEncodingException e) { throw new MappingException("Could not encode byteArray to UTF8 encoding", e); } }
[ "public", "static", "String", "encodeByteArray", "(", "byte", "[", "]", "byteArray", ")", "{", "try", "{", "return", "new", "String", "(", "Base64", ".", "encodeBase64", "(", "byteArray", ")", ",", "UTF8_ENCODING", ")", ";", "}", "catch", "(", "Unsupported...
Encodes byteArray value into a base64-encoded string. @return string representation of the date value
[ "Encodes", "byteArray", "value", "into", "a", "base64", "-", "encoded", "string", "." ]
train
https://github.com/3pillarlabs/spring-data-simpledb/blob/f1e0eb4e48ec4674d3966e8f5bc04c95031f93ae/spring-data-simpledb-impl/src/main/java/org/springframework/data/simpledb/attributeutil/AmazonSimpleDBUtil.java#L172-L178
micronaut-projects/micronaut-core
inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java
AbstractBeanDefinition.addPostConstruct
@SuppressWarnings("unused") @Internal @UsedByGeneratedCode protected final AbstractBeanDefinition addPostConstruct(Class declaringType, String method, @Nullable Argument[] arguments, @Nullable AnnotationMetadata annotationMetadata, boolean requiresReflection) { """ Adds a post construct method definition. @param declaringType The declaring type @param method The method @param arguments The arguments @param annotationMetadata The annotation metadata @param requiresReflection Whether the method requires reflection @return This bean definition """ return addInjectionPointInternal(declaringType, method, arguments, annotationMetadata, requiresReflection, this.postConstructMethods); }
java
@SuppressWarnings("unused") @Internal @UsedByGeneratedCode protected final AbstractBeanDefinition addPostConstruct(Class declaringType, String method, @Nullable Argument[] arguments, @Nullable AnnotationMetadata annotationMetadata, boolean requiresReflection) { return addInjectionPointInternal(declaringType, method, arguments, annotationMetadata, requiresReflection, this.postConstructMethods); }
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "@", "Internal", "@", "UsedByGeneratedCode", "protected", "final", "AbstractBeanDefinition", "addPostConstruct", "(", "Class", "declaringType", ",", "String", "method", ",", "@", "Nullable", "Argument", "[", "]", "arg...
Adds a post construct method definition. @param declaringType The declaring type @param method The method @param arguments The arguments @param annotationMetadata The annotation metadata @param requiresReflection Whether the method requires reflection @return This bean definition
[ "Adds", "a", "post", "construct", "method", "definition", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/inject/src/main/java/io/micronaut/context/AbstractBeanDefinition.java#L542-L551
UrielCh/ovh-java-sdk
ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java
ApiOvhVps.serviceName_distribution_software_softwareId_GET
public OvhSoftware serviceName_distribution_software_softwareId_GET(String serviceName, Long softwareId) throws IOException { """ Get this object properties REST: GET /vps/{serviceName}/distribution/software/{softwareId} @param serviceName [required] The internal name of your VPS offer @param softwareId [required] """ String qPath = "/vps/{serviceName}/distribution/software/{softwareId}"; StringBuilder sb = path(qPath, serviceName, softwareId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhSoftware.class); }
java
public OvhSoftware serviceName_distribution_software_softwareId_GET(String serviceName, Long softwareId) throws IOException { String qPath = "/vps/{serviceName}/distribution/software/{softwareId}"; StringBuilder sb = path(qPath, serviceName, softwareId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhSoftware.class); }
[ "public", "OvhSoftware", "serviceName_distribution_software_softwareId_GET", "(", "String", "serviceName", ",", "Long", "softwareId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/vps/{serviceName}/distribution/software/{softwareId}\"", ";", "StringBuilder", "s...
Get this object properties REST: GET /vps/{serviceName}/distribution/software/{softwareId} @param serviceName [required] The internal name of your VPS offer @param softwareId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-vps/src/main/java/net/minidev/ovh/api/ApiOvhVps.java#L459-L464
googleapis/google-cloud-java
google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/ProductSearchClient.java
ProductSearchClient.removeProductFromProductSet
public final void removeProductFromProductSet(String name, String product) { """ Removes a Product from the specified ProductSet. <p>Possible errors: <p>&#42; Returns NOT_FOUND If the Product is not found under the ProductSet. <p>Sample code: <pre><code> try (ProductSearchClient productSearchClient = ProductSearchClient.create()) { ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]"); productSearchClient.removeProductFromProductSet(name.toString(), product.toString()); } </code></pre> @param name The resource name for the ProductSet to modify. <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` @param product The resource name for the Product to be removed from this ProductSet. <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` @throws com.google.api.gax.rpc.ApiException if the remote call fails """ RemoveProductFromProductSetRequest request = RemoveProductFromProductSetRequest.newBuilder().setName(name).setProduct(product).build(); removeProductFromProductSet(request); }
java
public final void removeProductFromProductSet(String name, String product) { RemoveProductFromProductSetRequest request = RemoveProductFromProductSetRequest.newBuilder().setName(name).setProduct(product).build(); removeProductFromProductSet(request); }
[ "public", "final", "void", "removeProductFromProductSet", "(", "String", "name", ",", "String", "product", ")", "{", "RemoveProductFromProductSetRequest", "request", "=", "RemoveProductFromProductSetRequest", ".", "newBuilder", "(", ")", ".", "setName", "(", "name", "...
Removes a Product from the specified ProductSet. <p>Possible errors: <p>&#42; Returns NOT_FOUND If the Product is not found under the ProductSet. <p>Sample code: <pre><code> try (ProductSearchClient productSearchClient = ProductSearchClient.create()) { ProductSetName name = ProductSetName.of("[PROJECT]", "[LOCATION]", "[PRODUCT_SET]"); ProductName product = ProductName.of("[PROJECT]", "[LOCATION]", "[PRODUCT]"); productSearchClient.removeProductFromProductSet(name.toString(), product.toString()); } </code></pre> @param name The resource name for the ProductSet to modify. <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/productSets/PRODUCT_SET_ID` @param product The resource name for the Product to be removed from this ProductSet. <p>Format is: `projects/PROJECT_ID/locations/LOC_ID/products/PRODUCT_ID` @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Removes", "a", "Product", "from", "the", "specified", "ProductSet", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-vision/src/main/java/com/google/cloud/vision/v1/ProductSearchClient.java#L2423-L2428
alkacon/opencms-core
src/org/opencms/ade/containerpage/CmsContainerpageService.java
CmsContainerpageService.getContainerBeanToSave
private CmsContainerBean getContainerBeanToSave(CmsContainer container, String containerpageRootPath) throws CmsException { """ Helper method for converting a CmsContainer to a CmsContainerBean when saving a container page.<p> @param container the container for which the CmsContainerBean should be created @param containerpageRootPath the container page root path @return a container bean @throws CmsException in case generating the container data fails """ CmsObject cms = getCmsObject(); List<CmsContainerElementBean> elements = new ArrayList<CmsContainerElementBean>(); for (CmsContainerElement elementData : container.getElements()) { if (!elementData.isNew()) { CmsContainerElementBean newElementBean = getContainerElementBeanToSave( cms, containerpageRootPath, container, elementData); if (newElementBean != null) { elements.add(newElementBean); } } } CmsContainerBean result = new CmsContainerBean( container.getName(), container.getType(), container.getParentInstanceId(), container.isRootContainer(), elements); return result; }
java
private CmsContainerBean getContainerBeanToSave(CmsContainer container, String containerpageRootPath) throws CmsException { CmsObject cms = getCmsObject(); List<CmsContainerElementBean> elements = new ArrayList<CmsContainerElementBean>(); for (CmsContainerElement elementData : container.getElements()) { if (!elementData.isNew()) { CmsContainerElementBean newElementBean = getContainerElementBeanToSave( cms, containerpageRootPath, container, elementData); if (newElementBean != null) { elements.add(newElementBean); } } } CmsContainerBean result = new CmsContainerBean( container.getName(), container.getType(), container.getParentInstanceId(), container.isRootContainer(), elements); return result; }
[ "private", "CmsContainerBean", "getContainerBeanToSave", "(", "CmsContainer", "container", ",", "String", "containerpageRootPath", ")", "throws", "CmsException", "{", "CmsObject", "cms", "=", "getCmsObject", "(", ")", ";", "List", "<", "CmsContainerElementBean", ">", ...
Helper method for converting a CmsContainer to a CmsContainerBean when saving a container page.<p> @param container the container for which the CmsContainerBean should be created @param containerpageRootPath the container page root path @return a container bean @throws CmsException in case generating the container data fails
[ "Helper", "method", "for", "converting", "a", "CmsContainer", "to", "a", "CmsContainerBean", "when", "saving", "a", "container", "page", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/CmsContainerpageService.java#L2061-L2085
Netflix/ribbon
ribbon-core/src/main/java/com/netflix/client/ssl/AbstractSslContextFactory.java
AbstractSslContextFactory.createSSLContext
private SSLContext createSSLContext() throws ClientSslSocketFactoryException { """ Creates the SSL context needed to create the socket factory used by this factory. The key and trust store parameters are optional. If they are null then the JRE defaults will be used. @return the newly created SSL context @throws ClientSslSocketFactoryException if an error is detected loading the specified key or trust stores """ final KeyManager[] keyManagers = this.keyStore != null ? createKeyManagers() : null; final TrustManager[] trustManagers = this.trustStore != null ? createTrustManagers() : null; try { final SSLContext sslcontext = SSLContext.getInstance(SOCKET_ALGORITHM); sslcontext.init(keyManagers, trustManagers, null); return sslcontext; } catch (NoSuchAlgorithmException e) { throw new ClientSslSocketFactoryException(String.format("Failed to create an SSL context that supports algorithm %s: %s", SOCKET_ALGORITHM, e.getMessage()), e); } catch (KeyManagementException e) { throw new ClientSslSocketFactoryException(String.format("Failed to initialize an SSL context: %s", e.getMessage()), e); } }
java
private SSLContext createSSLContext() throws ClientSslSocketFactoryException { final KeyManager[] keyManagers = this.keyStore != null ? createKeyManagers() : null; final TrustManager[] trustManagers = this.trustStore != null ? createTrustManagers() : null; try { final SSLContext sslcontext = SSLContext.getInstance(SOCKET_ALGORITHM); sslcontext.init(keyManagers, trustManagers, null); return sslcontext; } catch (NoSuchAlgorithmException e) { throw new ClientSslSocketFactoryException(String.format("Failed to create an SSL context that supports algorithm %s: %s", SOCKET_ALGORITHM, e.getMessage()), e); } catch (KeyManagementException e) { throw new ClientSslSocketFactoryException(String.format("Failed to initialize an SSL context: %s", e.getMessage()), e); } }
[ "private", "SSLContext", "createSSLContext", "(", ")", "throws", "ClientSslSocketFactoryException", "{", "final", "KeyManager", "[", "]", "keyManagers", "=", "this", ".", "keyStore", "!=", "null", "?", "createKeyManagers", "(", ")", ":", "null", ";", "final", "T...
Creates the SSL context needed to create the socket factory used by this factory. The key and trust store parameters are optional. If they are null then the JRE defaults will be used. @return the newly created SSL context @throws ClientSslSocketFactoryException if an error is detected loading the specified key or trust stores
[ "Creates", "the", "SSL", "context", "needed", "to", "create", "the", "socket", "factory", "used", "by", "this", "factory", ".", "The", "key", "and", "trust", "store", "parameters", "are", "optional", ".", "If", "they", "are", "null", "then", "the", "JRE", ...
train
https://github.com/Netflix/ribbon/blob/d15cd7715b0bf2f64ae6ca98c5e4d184f178e261/ribbon-core/src/main/java/com/netflix/client/ssl/AbstractSslContextFactory.java#L100-L115
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/context/EventLogQueue.java
EventLogQueue.onEvent
void onEvent(EventLog log, EventType eventType) { """ On event. @param log the log @param eventType the event type """ switch (eventType) { case INSERT: onInsert(log); break; case UPDATE: onUpdate(log); break; case DELETE: onDelete(log); break; default: throw new KunderaException("Invalid event type:" + eventType); } }
java
void onEvent(EventLog log, EventType eventType) { switch (eventType) { case INSERT: onInsert(log); break; case UPDATE: onUpdate(log); break; case DELETE: onDelete(log); break; default: throw new KunderaException("Invalid event type:" + eventType); } }
[ "void", "onEvent", "(", "EventLog", "log", ",", "EventType", "eventType", ")", "{", "switch", "(", "eventType", ")", "{", "case", "INSERT", ":", "onInsert", "(", "log", ")", ";", "break", ";", "case", "UPDATE", ":", "onUpdate", "(", "log", ")", ";", ...
On event. @param log the log @param eventType the event type
[ "On", "event", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/persistence/context/EventLogQueue.java#L49-L72
Samsung/GearVRf
GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/WidgetFactory.java
WidgetFactory.createWidget
@SuppressWarnings("unchecked") static Widget createWidget(final GVRSceneObject sceneObject) throws InstantiationException { """ Create a {@link Widget} to wrap the specified {@link GVRSceneObject}. By default, {@code sceneObject} is wrapped in an {@link GroupWidget}. If another {@code Widget} class is specified in {@code sceneObject}'s metadata (as "{@code class_WidgetClassName}"), it will be wrapped in an instance of the specified class instead. @see NameDemangler#demangleString(String) @param sceneObject The {@code GVRSceneObject} to wrap. @return A new {@code Widget} instance. @throws InstantiationException If the {@code Widget} can't be instantiated for any reason. """ Class<? extends Widget> widgetClass = GroupWidget.class; NodeEntry attributes = new NodeEntry(sceneObject); String className = attributes.getClassName(); if (className != null) { try { widgetClass = (Class<? extends Widget>) Class .forName(className); } catch (ClassNotFoundException e) { e.printStackTrace(); Log.e(TAG, e, "createWidget()"); throw new InstantiationException(e.getLocalizedMessage()); } } Log.d(TAG, "createWidget(): widgetClass: %s", widgetClass.getSimpleName()); return createWidget(sceneObject, attributes, widgetClass); }
java
@SuppressWarnings("unchecked") static Widget createWidget(final GVRSceneObject sceneObject) throws InstantiationException { Class<? extends Widget> widgetClass = GroupWidget.class; NodeEntry attributes = new NodeEntry(sceneObject); String className = attributes.getClassName(); if (className != null) { try { widgetClass = (Class<? extends Widget>) Class .forName(className); } catch (ClassNotFoundException e) { e.printStackTrace(); Log.e(TAG, e, "createWidget()"); throw new InstantiationException(e.getLocalizedMessage()); } } Log.d(TAG, "createWidget(): widgetClass: %s", widgetClass.getSimpleName()); return createWidget(sceneObject, attributes, widgetClass); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "static", "Widget", "createWidget", "(", "final", "GVRSceneObject", "sceneObject", ")", "throws", "InstantiationException", "{", "Class", "<", "?", "extends", "Widget", ">", "widgetClass", "=", "GroupWidget", ".", ...
Create a {@link Widget} to wrap the specified {@link GVRSceneObject}. By default, {@code sceneObject} is wrapped in an {@link GroupWidget}. If another {@code Widget} class is specified in {@code sceneObject}'s metadata (as "{@code class_WidgetClassName}"), it will be wrapped in an instance of the specified class instead. @see NameDemangler#demangleString(String) @param sceneObject The {@code GVRSceneObject} to wrap. @return A new {@code Widget} instance. @throws InstantiationException If the {@code Widget} can't be instantiated for any reason.
[ "Create", "a", "{", "@link", "Widget", "}", "to", "wrap", "the", "specified", "{", "@link", "GVRSceneObject", "}", ".", "By", "default", "{", "@code", "sceneObject", "}", "is", "wrapped", "in", "an", "{", "@link", "GroupWidget", "}", ".", "If", "another"...
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Extensions/widgetLib/src/org/gearvrf/widgetlib/widget/WidgetFactory.java#L33-L54
umano/AndroidSlidingUpPanel
library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java
ViewDragHelper.isViewUnder
public boolean isViewUnder(View view, int x, int y) { """ Determine if the supplied view is under the given point in the parent view's coordinate system. @param view Child view of the parent to hit test @param x X position to test in the parent's coordinate system @param y Y position to test in the parent's coordinate system @return true if the supplied view is under the given point, false otherwise """ if (view == null) { return false; } return x >= view.getLeft() && x < view.getRight() && y >= view.getTop() && y < view.getBottom(); }
java
public boolean isViewUnder(View view, int x, int y) { if (view == null) { return false; } return x >= view.getLeft() && x < view.getRight() && y >= view.getTop() && y < view.getBottom(); }
[ "public", "boolean", "isViewUnder", "(", "View", "view", ",", "int", "x", ",", "int", "y", ")", "{", "if", "(", "view", "==", "null", ")", "{", "return", "false", ";", "}", "return", "x", ">=", "view", ".", "getLeft", "(", ")", "&&", "x", "<", ...
Determine if the supplied view is under the given point in the parent view's coordinate system. @param view Child view of the parent to hit test @param x X position to test in the parent's coordinate system @param y Y position to test in the parent's coordinate system @return true if the supplied view is under the given point, false otherwise
[ "Determine", "if", "the", "supplied", "view", "is", "under", "the", "given", "point", "in", "the", "parent", "view", "s", "coordinate", "system", "." ]
train
https://github.com/umano/AndroidSlidingUpPanel/blob/45a460435b07e764138a700328836cafc1ed5c42/library/src/main/java/com/sothree/slidinguppanel/ViewDragHelper.java#L1462-L1470
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionValueRelPersistenceImpl.java
CPDefinitionOptionValueRelPersistenceImpl.findByCompanyId
@Override public List<CPDefinitionOptionValueRel> findByCompanyId(long companyId, int start, int end) { """ Returns a range of all the cp definition option value rels where companyId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionOptionValueRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param companyId the company ID @param start the lower bound of the range of cp definition option value rels @param end the upper bound of the range of cp definition option value rels (not inclusive) @return the range of matching cp definition option value rels """ return findByCompanyId(companyId, start, end, null); }
java
@Override public List<CPDefinitionOptionValueRel> findByCompanyId(long companyId, int start, int end) { return findByCompanyId(companyId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CPDefinitionOptionValueRel", ">", "findByCompanyId", "(", "long", "companyId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByCompanyId", "(", "companyId", ",", "start", ",", "end", ",", "null", ")...
Returns a range of all the cp definition option value rels where companyId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionOptionValueRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param companyId the company ID @param start the lower bound of the range of cp definition option value rels @param end the upper bound of the range of cp definition option value rels (not inclusive) @return the range of matching cp definition option value rels
[ "Returns", "a", "range", "of", "all", "the", "cp", "definition", "option", "value", "rels", "where", "companyId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionOptionValueRelPersistenceImpl.java#L2069-L2073
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/java/net/AddressCache.java
AddressCache.get
public Object get(String hostname, int netId) { """ Returns the cached InetAddress[] for 'hostname' on network 'netId'. Returns null if nothing is known about 'hostname'. Returns a String suitable for use as an UnknownHostException detail message if 'hostname' is known not to exist. """ AddressCacheEntry entry = cache.get(new AddressCacheKey(hostname, netId)); // Do we have a valid cache entry? if (entry != null && entry.expiryNanos >= System.nanoTime()) { return entry.value; } // Either we didn't find anything, or it had expired. // No need to remove expired entries: the caller will provide a replacement shortly. return null; }
java
public Object get(String hostname, int netId) { AddressCacheEntry entry = cache.get(new AddressCacheKey(hostname, netId)); // Do we have a valid cache entry? if (entry != null && entry.expiryNanos >= System.nanoTime()) { return entry.value; } // Either we didn't find anything, or it had expired. // No need to remove expired entries: the caller will provide a replacement shortly. return null; }
[ "public", "Object", "get", "(", "String", "hostname", ",", "int", "netId", ")", "{", "AddressCacheEntry", "entry", "=", "cache", ".", "get", "(", "new", "AddressCacheKey", "(", "hostname", ",", "netId", ")", ")", ";", "// Do we have a valid cache entry?", "if"...
Returns the cached InetAddress[] for 'hostname' on network 'netId'. Returns null if nothing is known about 'hostname'. Returns a String suitable for use as an UnknownHostException detail message if 'hostname' is known not to exist.
[ "Returns", "the", "cached", "InetAddress", "[]", "for", "hostname", "on", "network", "netId", ".", "Returns", "null", "if", "nothing", "is", "known", "about", "hostname", ".", "Returns", "a", "String", "suitable", "for", "use", "as", "an", "UnknownHostExceptio...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/java/net/AddressCache.java#L102-L111
radkovo/CSSBox
src/main/java/org/fit/cssbox/layout/VisualContext.java
VisualContext.updateForGraphics
public void updateForGraphics(NodeData style, Graphics2D g) { """ Updates this context according to the given style. Moreover given Graphics is updated to this style and used for taking the font metrics. @param style the style data to be used @param g Graphics to be updated and used """ if (style != null) update(style); updateGraphics(g); fm = g.getFontMetrics(); //update the width units //em has been updated in update() FontRenderContext frc = new FontRenderContext(null, false, false); TextLayout layout = new TextLayout("x", font, frc); ex = layout.getBounds().getHeight(); ch = fm.charWidth('0'); }
java
public void updateForGraphics(NodeData style, Graphics2D g) { if (style != null) update(style); updateGraphics(g); fm = g.getFontMetrics(); //update the width units //em has been updated in update() FontRenderContext frc = new FontRenderContext(null, false, false); TextLayout layout = new TextLayout("x", font, frc); ex = layout.getBounds().getHeight(); ch = fm.charWidth('0'); }
[ "public", "void", "updateForGraphics", "(", "NodeData", "style", ",", "Graphics2D", "g", ")", "{", "if", "(", "style", "!=", "null", ")", "update", "(", "style", ")", ";", "updateGraphics", "(", "g", ")", ";", "fm", "=", "g", ".", "getFontMetrics", "("...
Updates this context according to the given style. Moreover given Graphics is updated to this style and used for taking the font metrics. @param style the style data to be used @param g Graphics to be updated and used
[ "Updates", "this", "context", "according", "to", "the", "given", "style", ".", "Moreover", "given", "Graphics", "is", "updated", "to", "this", "style", "and", "used", "for", "taking", "the", "font", "metrics", "." ]
train
https://github.com/radkovo/CSSBox/blob/38aaf8f22d233d7b4dbc12a56cdbc72b447bc559/src/main/java/org/fit/cssbox/layout/VisualContext.java#L390-L404
Jasig/uPortal
uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/ResourceLoader.java
ResourceLoader.getResourceAsStream
public static InputStream getResourceAsStream(Class<?> requestingClass, String resource) throws ResourceMissingException, IOException { """ Returns the requested resource as a stream. @param requestingClass the java.lang.Class object of the class that is attempting to load the resource @param resource a String describing the full or partial URL of the resource to load @return the requested resource as a stream @throws ResourceMissingException @throws java.io.IOException """ return getResourceAsURL(requestingClass, resource).openStream(); }
java
public static InputStream getResourceAsStream(Class<?> requestingClass, String resource) throws ResourceMissingException, IOException { return getResourceAsURL(requestingClass, resource).openStream(); }
[ "public", "static", "InputStream", "getResourceAsStream", "(", "Class", "<", "?", ">", "requestingClass", ",", "String", "resource", ")", "throws", "ResourceMissingException", ",", "IOException", "{", "return", "getResourceAsURL", "(", "requestingClass", ",", "resourc...
Returns the requested resource as a stream. @param requestingClass the java.lang.Class object of the class that is attempting to load the resource @param resource a String describing the full or partial URL of the resource to load @return the requested resource as a stream @throws ResourceMissingException @throws java.io.IOException
[ "Returns", "the", "requested", "resource", "as", "a", "stream", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/ResourceLoader.java#L212-L215
datacleaner/DataCleaner
desktop/ui/src/main/java/org/datacleaner/widgets/tabs/CloseableTabbedPaneUI.java
CloseableTabbedPaneUI.paintContentBorder
@Override protected void paintContentBorder(final Graphics g, final int tabPlacement, final int tabIndex) { """ Paints the border for the tab's content, ie. the area below the tabs """ final int w = tabPane.getWidth(); final int h = tabPane.getHeight(); final Insets tabAreaInsets = getTabAreaInsets(tabPlacement); final int x = 0; final int y = calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight) + tabAreaInsets.bottom; g.setColor(_tabSelectedBackgroundColor); g.fillRect(x, y, w, h); g.setColor(_tabBorderColor); // top line, except below selected tab final Rectangle selectTabBounds = getTabBounds(tabPane, tabIndex); g.drawLine(x, y, selectTabBounds.x, y); g.drawLine(selectTabBounds.x + selectTabBounds.width, y, x + w, y); }
java
@Override protected void paintContentBorder(final Graphics g, final int tabPlacement, final int tabIndex) { final int w = tabPane.getWidth(); final int h = tabPane.getHeight(); final Insets tabAreaInsets = getTabAreaInsets(tabPlacement); final int x = 0; final int y = calculateTabAreaHeight(tabPlacement, runCount, maxTabHeight) + tabAreaInsets.bottom; g.setColor(_tabSelectedBackgroundColor); g.fillRect(x, y, w, h); g.setColor(_tabBorderColor); // top line, except below selected tab final Rectangle selectTabBounds = getTabBounds(tabPane, tabIndex); g.drawLine(x, y, selectTabBounds.x, y); g.drawLine(selectTabBounds.x + selectTabBounds.width, y, x + w, y); }
[ "@", "Override", "protected", "void", "paintContentBorder", "(", "final", "Graphics", "g", ",", "final", "int", "tabPlacement", ",", "final", "int", "tabIndex", ")", "{", "final", "int", "w", "=", "tabPane", ".", "getWidth", "(", ")", ";", "final", "int", ...
Paints the border for the tab's content, ie. the area below the tabs
[ "Paints", "the", "border", "for", "the", "tab", "s", "content", "ie", ".", "the", "area", "below", "the", "tabs" ]
train
https://github.com/datacleaner/DataCleaner/blob/9aa01fdac3560cef51c55df3cb2ac5c690b57639/desktop/ui/src/main/java/org/datacleaner/widgets/tabs/CloseableTabbedPaneUI.java#L224-L242
OpenLiberty/open-liberty
dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_MethodBindingToMethodExpression.java
_MethodBindingToMethodExpression.getMethodInfo
@Override public MethodInfo getMethodInfo(ELContext context) throws PropertyNotFoundException, MethodNotFoundException, ELException { """ Note: MethodInfo.getParamTypes() may incorrectly return an empty class array if invoke() has not been called. @throws IllegalStateException if expected params types have not been determined. """ checkNullArgument(context, "elcontext"); checkNullState(methodBinding, "methodBinding"); if (methodInfo == null) { final FacesContext facesContext = (FacesContext)context.getContext(FacesContext.class); if (facesContext != null) { methodInfo = invoke(new Invoker<MethodInfo>() { public MethodInfo invoke() { return new MethodInfo(null, methodBinding.getType(facesContext), null); } }); } } return methodInfo; }
java
@Override public MethodInfo getMethodInfo(ELContext context) throws PropertyNotFoundException, MethodNotFoundException, ELException { checkNullArgument(context, "elcontext"); checkNullState(methodBinding, "methodBinding"); if (methodInfo == null) { final FacesContext facesContext = (FacesContext)context.getContext(FacesContext.class); if (facesContext != null) { methodInfo = invoke(new Invoker<MethodInfo>() { public MethodInfo invoke() { return new MethodInfo(null, methodBinding.getType(facesContext), null); } }); } } return methodInfo; }
[ "@", "Override", "public", "MethodInfo", "getMethodInfo", "(", "ELContext", "context", ")", "throws", "PropertyNotFoundException", ",", "MethodNotFoundException", ",", "ELException", "{", "checkNullArgument", "(", "context", ",", "\"elcontext\"", ")", ";", "checkNullSta...
Note: MethodInfo.getParamTypes() may incorrectly return an empty class array if invoke() has not been called. @throws IllegalStateException if expected params types have not been determined.
[ "Note", ":", "MethodInfo", ".", "getParamTypes", "()", "may", "incorrectly", "return", "an", "empty", "class", "array", "if", "invoke", "()", "has", "not", "been", "called", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.jsf.2.2/src/javax/faces/component/_MethodBindingToMethodExpression.java#L81-L103
forge/javaee-descriptors
impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/webapp30/WebAppDescriptorImpl.java
WebAppDescriptorImpl.addNamespace
public WebAppDescriptor addNamespace(String name, String value) { """ Adds a new namespace @return the current instance of <code>WebAppDescriptor</code> """ model.attribute(name, value); return this; }
java
public WebAppDescriptor addNamespace(String name, String value) { model.attribute(name, value); return this; }
[ "public", "WebAppDescriptor", "addNamespace", "(", "String", "name", ",", "String", "value", ")", "{", "model", ".", "attribute", "(", "name", ",", "value", ")", ";", "return", "this", ";", "}" ]
Adds a new namespace @return the current instance of <code>WebAppDescriptor</code>
[ "Adds", "a", "new", "namespace" ]
train
https://github.com/forge/javaee-descriptors/blob/cb914330a1a0b04bfc1d0f199bd9cde3bbf0b3ed/impl/src/main/java/org/jboss/shrinkwrap/descriptor/impl/webapp30/WebAppDescriptorImpl.java#L143-L147
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.getAt
public static List getAt(Collection coll, String property) { """ Support the subscript operator for Collection. <pre class="groovyTestCase"> assert [String, Long, Integer] == ["a",5L,2]["class"] </pre> @param coll a Collection @param property a String @return a List @since 1.0 """ List<Object> answer = new ArrayList<Object>(coll.size()); return getAtIterable(coll, property, answer); }
java
public static List getAt(Collection coll, String property) { List<Object> answer = new ArrayList<Object>(coll.size()); return getAtIterable(coll, property, answer); }
[ "public", "static", "List", "getAt", "(", "Collection", "coll", ",", "String", "property", ")", "{", "List", "<", "Object", ">", "answer", "=", "new", "ArrayList", "<", "Object", ">", "(", "coll", ".", "size", "(", ")", ")", ";", "return", "getAtIterab...
Support the subscript operator for Collection. <pre class="groovyTestCase"> assert [String, Long, Integer] == ["a",5L,2]["class"] </pre> @param coll a Collection @param property a String @return a List @since 1.0
[ "Support", "the", "subscript", "operator", "for", "Collection", ".", "<pre", "class", "=", "groovyTestCase", ">", "assert", "[", "String", "Long", "Integer", "]", "==", "[", "a", "5L", "2", "]", "[", "class", "]", "<", "/", "pre", ">" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L8222-L8225
haifengl/smile
math/src/main/java/smile/math/matrix/BiconjugateGradient.java
BiconjugateGradient.diagonalPreconditioner
private static Preconditioner diagonalPreconditioner(Matrix A) { """ Returns a simple preconditioner matrix that is the trivial diagonal part of A in some cases. """ return new Preconditioner() { public void asolve(double[] b, double[] x) { double[] diag = A.diag(); int n = diag.length; for (int i = 0; i < n; i++) { x[i] = diag[i] != 0.0 ? b[i] / diag[i] : b[i]; } } }; }
java
private static Preconditioner diagonalPreconditioner(Matrix A) { return new Preconditioner() { public void asolve(double[] b, double[] x) { double[] diag = A.diag(); int n = diag.length; for (int i = 0; i < n; i++) { x[i] = diag[i] != 0.0 ? b[i] / diag[i] : b[i]; } } }; }
[ "private", "static", "Preconditioner", "diagonalPreconditioner", "(", "Matrix", "A", ")", "{", "return", "new", "Preconditioner", "(", ")", "{", "public", "void", "asolve", "(", "double", "[", "]", "b", ",", "double", "[", "]", "x", ")", "{", "double", "...
Returns a simple preconditioner matrix that is the trivial diagonal part of A in some cases.
[ "Returns", "a", "simple", "preconditioner", "matrix", "that", "is", "the", "trivial", "diagonal", "part", "of", "A", "in", "some", "cases", "." ]
train
https://github.com/haifengl/smile/blob/e27e43e90fbaacce3f99d30120cf9dd6a764c33d/math/src/main/java/smile/math/matrix/BiconjugateGradient.java#L35-L46
joniles/mpxj
src/main/java/net/sf/mpxj/json/JsonWriter.java
JsonWriter.writeField
private void writeField(FieldType field, Object value) throws IOException { """ Write the appropriate data for a field to the JSON file based on its type. @param field field type @param value field value """ String fieldName = field.name().toLowerCase(); writeField(fieldName, field.getDataType(), value); }
java
private void writeField(FieldType field, Object value) throws IOException { String fieldName = field.name().toLowerCase(); writeField(fieldName, field.getDataType(), value); }
[ "private", "void", "writeField", "(", "FieldType", "field", ",", "Object", "value", ")", "throws", "IOException", "{", "String", "fieldName", "=", "field", ".", "name", "(", ")", ".", "toLowerCase", "(", ")", ";", "writeField", "(", "fieldName", ",", "fiel...
Write the appropriate data for a field to the JSON file based on its type. @param field field type @param value field value
[ "Write", "the", "appropriate", "data", "for", "a", "field", "to", "the", "JSON", "file", "based", "on", "its", "type", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonWriter.java#L275-L279
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/SecretKeyFactory.java
SecretKeyFactory.translateKey
public final SecretKey translateKey(SecretKey key) throws InvalidKeyException { """ Translates a key object, whose provider may be unknown or potentially untrusted, into a corresponding key object of this secret-key factory. @param key the key whose provider is unknown or untrusted @return the translated key @exception InvalidKeyException if the given key cannot be processed by this secret-key factory. """ if (serviceIterator == null) { return spi.engineTranslateKey(key); } Exception failure = null; SecretKeyFactorySpi mySpi = spi; do { try { return mySpi.engineTranslateKey(key); } catch (Exception e) { if (failure == null) { failure = e; } mySpi = nextSpi(mySpi); } } while (mySpi != null); if (failure instanceof InvalidKeyException) { throw (InvalidKeyException)failure; } throw new InvalidKeyException ("Could not translate key", failure); }
java
public final SecretKey translateKey(SecretKey key) throws InvalidKeyException { if (serviceIterator == null) { return spi.engineTranslateKey(key); } Exception failure = null; SecretKeyFactorySpi mySpi = spi; do { try { return mySpi.engineTranslateKey(key); } catch (Exception e) { if (failure == null) { failure = e; } mySpi = nextSpi(mySpi); } } while (mySpi != null); if (failure instanceof InvalidKeyException) { throw (InvalidKeyException)failure; } throw new InvalidKeyException ("Could not translate key", failure); }
[ "public", "final", "SecretKey", "translateKey", "(", "SecretKey", "key", ")", "throws", "InvalidKeyException", "{", "if", "(", "serviceIterator", "==", "null", ")", "{", "return", "spi", ".", "engineTranslateKey", "(", "key", ")", ";", "}", "Exception", "failu...
Translates a key object, whose provider may be unknown or potentially untrusted, into a corresponding key object of this secret-key factory. @param key the key whose provider is unknown or untrusted @return the translated key @exception InvalidKeyException if the given key cannot be processed by this secret-key factory.
[ "Translates", "a", "key", "object", "whose", "provider", "may", "be", "unknown", "or", "potentially", "untrusted", "into", "a", "corresponding", "key", "object", "of", "this", "secret", "-", "key", "factory", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/SecretKeyFactory.java#L590-L612
OpenLiberty/open-liberty
dev/com.ibm.ws.security.audit.reader/src/com/ibm/ws/security/audit/reader/tasks/BaseCommandTask.java
BaseCommandTask.promptForText
protected String promptForText(com.ibm.ws.security.audit.reader.utils.ConsoleWrapper stdin, PrintStream stdout) { """ Prompt the user to enter text to encode. Prompts twice and compares to ensure it was entered correctly. @return Entered String """ return promptForText(stdin, stdout, "encode.enterText", "encode.reenterText", "encode.readError", "encode.entriesDidNotMatch"); }
java
protected String promptForText(com.ibm.ws.security.audit.reader.utils.ConsoleWrapper stdin, PrintStream stdout) { return promptForText(stdin, stdout, "encode.enterText", "encode.reenterText", "encode.readError", "encode.entriesDidNotMatch"); }
[ "protected", "String", "promptForText", "(", "com", ".", "ibm", ".", "ws", ".", "security", ".", "audit", ".", "reader", ".", "utils", ".", "ConsoleWrapper", "stdin", ",", "PrintStream", "stdout", ")", "{", "return", "promptForText", "(", "stdin", ",", "st...
Prompt the user to enter text to encode. Prompts twice and compares to ensure it was entered correctly. @return Entered String
[ "Prompt", "the", "user", "to", "enter", "text", "to", "encode", ".", "Prompts", "twice", "and", "compares", "to", "ensure", "it", "was", "entered", "correctly", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.audit.reader/src/com/ibm/ws/security/audit/reader/tasks/BaseCommandTask.java#L191-L195
apache/incubator-atlas
notification/src/main/java/org/apache/atlas/hook/AtlasHook.java
AtlasHook.getUser
public static String getUser(String userName, UserGroupInformation ugi) { """ Returns the user. Order of preference: 1. Given userName 2. ugi.getShortUserName() 3. UserGroupInformation.getCurrentUser().getShortUserName() 4. System.getProperty("user.name") """ if (StringUtils.isNotEmpty(userName)) { if (LOG.isDebugEnabled()) { LOG.debug("Returning userName {}", userName); } return userName; } if (ugi != null && StringUtils.isNotEmpty(ugi.getShortUserName())) { if (LOG.isDebugEnabled()) { LOG.debug("Returning ugi.getShortUserName {}", userName); } return ugi.getShortUserName(); } try { return UserGroupInformation.getCurrentUser().getShortUserName(); } catch (IOException e) { LOG.warn("Failed for UserGroupInformation.getCurrentUser() ", e); return System.getProperty("user.name"); } }
java
public static String getUser(String userName, UserGroupInformation ugi) { if (StringUtils.isNotEmpty(userName)) { if (LOG.isDebugEnabled()) { LOG.debug("Returning userName {}", userName); } return userName; } if (ugi != null && StringUtils.isNotEmpty(ugi.getShortUserName())) { if (LOG.isDebugEnabled()) { LOG.debug("Returning ugi.getShortUserName {}", userName); } return ugi.getShortUserName(); } try { return UserGroupInformation.getCurrentUser().getShortUserName(); } catch (IOException e) { LOG.warn("Failed for UserGroupInformation.getCurrentUser() ", e); return System.getProperty("user.name"); } }
[ "public", "static", "String", "getUser", "(", "String", "userName", ",", "UserGroupInformation", "ugi", ")", "{", "if", "(", "StringUtils", ".", "isNotEmpty", "(", "userName", ")", ")", "{", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "L...
Returns the user. Order of preference: 1. Given userName 2. ugi.getShortUserName() 3. UserGroupInformation.getCurrentUser().getShortUserName() 4. System.getProperty("user.name")
[ "Returns", "the", "user", ".", "Order", "of", "preference", ":", "1", ".", "Given", "userName", "2", ".", "ugi", ".", "getShortUserName", "()", "3", ".", "UserGroupInformation", ".", "getCurrentUser", "()", ".", "getShortUserName", "()", "4", ".", "System", ...
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/notification/src/main/java/org/apache/atlas/hook/AtlasHook.java#L195-L216
BotMill/fb-botmill
src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/AttachmentMessageBuilder.java
AttachmentMessageBuilder.build
public FbBotMillResponse build(MessageEnvelope envelope) { """ {@inheritDoc} Returns a response containing an {@link Attachment}. """ User recipient = getRecipient(envelope); Message message = new AttachmentMessage(attachment); message.setQuickReplies(quickReplies); return new FbBotMillMessageResponse(recipient, message); }
java
public FbBotMillResponse build(MessageEnvelope envelope) { User recipient = getRecipient(envelope); Message message = new AttachmentMessage(attachment); message.setQuickReplies(quickReplies); return new FbBotMillMessageResponse(recipient, message); }
[ "public", "FbBotMillResponse", "build", "(", "MessageEnvelope", "envelope", ")", "{", "User", "recipient", "=", "getRecipient", "(", "envelope", ")", ";", "Message", "message", "=", "new", "AttachmentMessage", "(", "attachment", ")", ";", "message", ".", "setQui...
{@inheritDoc} Returns a response containing an {@link Attachment}.
[ "{" ]
train
https://github.com/BotMill/fb-botmill/blob/d94da3615a7339822c137ef75c92a03d791ee969/src/main/java/co/aurasphere/botmill/fb/model/outcoming/factory/AttachmentMessageBuilder.java#L124-L129
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java
DiagnosticsInner.listSiteDetectorsSlotWithServiceResponseAsync
public Observable<ServiceResponse<Page<DetectorDefinitionInner>>> listSiteDetectorsSlotWithServiceResponseAsync(final String resourceGroupName, final String siteName, final String diagnosticCategory, final String slot) { """ Get Detectors. Get Detectors. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Site Name @param diagnosticCategory Diagnostic Category @param slot Slot Name @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DetectorDefinitionInner&gt; object """ return listSiteDetectorsSlotSinglePageAsync(resourceGroupName, siteName, diagnosticCategory, slot) .concatMap(new Func1<ServiceResponse<Page<DetectorDefinitionInner>>, Observable<ServiceResponse<Page<DetectorDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<DetectorDefinitionInner>>> call(ServiceResponse<Page<DetectorDefinitionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listSiteDetectorsSlotNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<DetectorDefinitionInner>>> listSiteDetectorsSlotWithServiceResponseAsync(final String resourceGroupName, final String siteName, final String diagnosticCategory, final String slot) { return listSiteDetectorsSlotSinglePageAsync(resourceGroupName, siteName, diagnosticCategory, slot) .concatMap(new Func1<ServiceResponse<Page<DetectorDefinitionInner>>, Observable<ServiceResponse<Page<DetectorDefinitionInner>>>>() { @Override public Observable<ServiceResponse<Page<DetectorDefinitionInner>>> call(ServiceResponse<Page<DetectorDefinitionInner>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(listSiteDetectorsSlotNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "DetectorDefinitionInner", ">", ">", ">", "listSiteDetectorsSlotWithServiceResponseAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "siteName", ",", "final", "String", "diagnos...
Get Detectors. Get Detectors. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Site Name @param diagnosticCategory Diagnostic Category @param slot Slot Name @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;DetectorDefinitionInner&gt; object
[ "Get", "Detectors", ".", "Get", "Detectors", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java#L2141-L2153
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ActivationCodeGen.java
ActivationCodeGen.writeClassBody
@Override public void writeClassBody(Definition def, Writer out) throws IOException { """ Output class @param def definition @param out Writer @throws IOException ioException """ out.write("public class " + getClassName(def)); writeLeftCurlyBracket(out, 0); writeEol(out); int indent = 1; writeWithIndent(out, indent, "/** The resource adapter */\n"); writeWithIndent(out, indent, "private " + def.getRaClass() + " ra;\n\n"); writeWithIndent(out, indent, "/** Activation spec */\n"); writeWithIndent(out, indent, "private " + def.getAsClass() + " spec;\n\n"); writeWithIndent(out, indent, "/** The message endpoint factory */\n"); writeWithIndent(out, indent, "private MessageEndpointFactory endpointFactory;\n\n"); writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Default constructor\n"); writeWithIndent(out, indent, " * @exception ResourceException Thrown if an error occurs\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public " + getClassName(def) + "() throws ResourceException"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "this(null, null, null);"); writeRightCurlyBracket(out, indent); writeEol(out); //constructor writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Constructor\n"); writeWithIndent(out, indent, " * @param ra " + def.getRaClass()); writeEol(out); writeWithIndent(out, indent, " * @param endpointFactory MessageEndpointFactory\n"); writeWithIndent(out, indent, " * @param spec " + def.getAsClass()); writeEol(out); writeWithIndent(out, indent, " * @exception ResourceException Thrown if an error occurs\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public " + getClassName(def) + "(" + def.getRaClass() + " ra, \n"); writeWithIndent(out, indent + 1, "MessageEndpointFactory endpointFactory,\n"); writeWithIndent(out, indent + 1, def.getAsClass() + " spec) throws ResourceException\n"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "this.ra = ra;\n"); writeWithIndent(out, indent + 1, "this.endpointFactory = endpointFactory;\n"); writeWithIndent(out, indent + 1, "this.spec = spec;"); writeRightCurlyBracket(out, indent); writeEol(out); writeGetAs(def, out, indent); writeMef(def, out, indent); writeStartStop(def, out, indent); writeRightCurlyBracket(out, 0); }
java
@Override public void writeClassBody(Definition def, Writer out) throws IOException { out.write("public class " + getClassName(def)); writeLeftCurlyBracket(out, 0); writeEol(out); int indent = 1; writeWithIndent(out, indent, "/** The resource adapter */\n"); writeWithIndent(out, indent, "private " + def.getRaClass() + " ra;\n\n"); writeWithIndent(out, indent, "/** Activation spec */\n"); writeWithIndent(out, indent, "private " + def.getAsClass() + " spec;\n\n"); writeWithIndent(out, indent, "/** The message endpoint factory */\n"); writeWithIndent(out, indent, "private MessageEndpointFactory endpointFactory;\n\n"); writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Default constructor\n"); writeWithIndent(out, indent, " * @exception ResourceException Thrown if an error occurs\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public " + getClassName(def) + "() throws ResourceException"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "this(null, null, null);"); writeRightCurlyBracket(out, indent); writeEol(out); //constructor writeWithIndent(out, indent, "/**\n"); writeWithIndent(out, indent, " * Constructor\n"); writeWithIndent(out, indent, " * @param ra " + def.getRaClass()); writeEol(out); writeWithIndent(out, indent, " * @param endpointFactory MessageEndpointFactory\n"); writeWithIndent(out, indent, " * @param spec " + def.getAsClass()); writeEol(out); writeWithIndent(out, indent, " * @exception ResourceException Thrown if an error occurs\n"); writeWithIndent(out, indent, " */\n"); writeWithIndent(out, indent, "public " + getClassName(def) + "(" + def.getRaClass() + " ra, \n"); writeWithIndent(out, indent + 1, "MessageEndpointFactory endpointFactory,\n"); writeWithIndent(out, indent + 1, def.getAsClass() + " spec) throws ResourceException\n"); writeLeftCurlyBracket(out, indent); writeWithIndent(out, indent + 1, "this.ra = ra;\n"); writeWithIndent(out, indent + 1, "this.endpointFactory = endpointFactory;\n"); writeWithIndent(out, indent + 1, "this.spec = spec;"); writeRightCurlyBracket(out, indent); writeEol(out); writeGetAs(def, out, indent); writeMef(def, out, indent); writeStartStop(def, out, indent); writeRightCurlyBracket(out, 0); }
[ "@", "Override", "public", "void", "writeClassBody", "(", "Definition", "def", ",", "Writer", "out", ")", "throws", "IOException", "{", "out", ".", "write", "(", "\"public class \"", "+", "getClassName", "(", "def", ")", ")", ";", "writeLeftCurlyBracket", "(",...
Output class @param def definition @param out Writer @throws IOException ioException
[ "Output", "class" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ActivationCodeGen.java#L44-L98
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaStringGenerator.java
SibRaStringGenerator.addParent
void addParent(final String name, final Object value) throws IllegalStateException { """ Adds a string representation of the given parent object. Does not call <code>toString</code> on the object to avoid infinite recursion. @param name the name of the field @param value the value of the field @throws IllegalStateException if the string representation has already been completed """ checkNotCompleted(); _buffer.append(" <"); _buffer.append(name); _buffer.append("="); addObjectIdentity(value); _buffer.append(">"); }
java
void addParent(final String name, final Object value) throws IllegalStateException { checkNotCompleted(); _buffer.append(" <"); _buffer.append(name); _buffer.append("="); addObjectIdentity(value); _buffer.append(">"); }
[ "void", "addParent", "(", "final", "String", "name", ",", "final", "Object", "value", ")", "throws", "IllegalStateException", "{", "checkNotCompleted", "(", ")", ";", "_buffer", ".", "append", "(", "\" <\"", ")", ";", "_buffer", ".", "append", "(", "name", ...
Adds a string representation of the given parent object. Does not call <code>toString</code> on the object to avoid infinite recursion. @param name the name of the field @param value the value of the field @throws IllegalStateException if the string representation has already been completed
[ "Adds", "a", "string", "representation", "of", "the", "given", "parent", "object", ".", "Does", "not", "call", "<code", ">", "toString<", "/", "code", ">", "on", "the", "object", "to", "avoid", "infinite", "recursion", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/ra/inbound/impl/SibRaStringGenerator.java#L53-L63
samskivert/samskivert
src/main/java/com/samskivert/util/FileUtil.java
FileUtil.newFile
public static File newFile (File root, String... parts) { """ Creates a file from the supplied root using the specified child components. For example: <code>fromPath(new File("dir"), "subdir", "anotherdir", "file.txt")</code> creates a file with the Unix path <code>dir/subdir/anotherdir/file.txt</code>. """ File path = root; for (String part : parts) { path = new File(path, part); } return path; }
java
public static File newFile (File root, String... parts) { File path = root; for (String part : parts) { path = new File(path, part); } return path; }
[ "public", "static", "File", "newFile", "(", "File", "root", ",", "String", "...", "parts", ")", "{", "File", "path", "=", "root", ";", "for", "(", "String", "part", ":", "parts", ")", "{", "path", "=", "new", "File", "(", "path", ",", "part", ")", ...
Creates a file from the supplied root using the specified child components. For example: <code>fromPath(new File("dir"), "subdir", "anotherdir", "file.txt")</code> creates a file with the Unix path <code>dir/subdir/anotherdir/file.txt</code>.
[ "Creates", "a", "file", "from", "the", "supplied", "root", "using", "the", "specified", "child", "components", ".", "For", "example", ":", "<code", ">", "fromPath", "(", "new", "File", "(", "dir", ")", "subdir", "anotherdir", "file", ".", "txt", ")", "<"...
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/util/FileUtil.java#L31-L38
maven-nar/nar-maven-plugin
src/main/java/com/github/maven_nar/cpptasks/borland/BorlandProcessor.java
BorlandProcessor.prepareResponseFile
public static String[] prepareResponseFile(final File outputFile, final String[] args, final String continuation) throws IOException { """ Prepares argument list to execute the linker using a response file. @param outputFile linker output file @param args output of prepareArguments @return arguments for runTask """ final String baseName = outputFile.getName(); final File commandFile = new File(outputFile.getParent(), baseName + ".rsp"); final FileWriter writer = new FileWriter(commandFile); for (int i = 1; i < args.length - 1; i++) { writer.write(args[i]); // // if either the current argument ends with // or next argument starts with a comma then // don't split the line if (args[i].endsWith(",") || args[i + 1].startsWith(",")) { writer.write(' '); } else { // // split the line to make it more readable // writer.write(continuation); } } // // write the last argument // if (args.length > 1) { writer.write(args[args.length - 1]); } writer.close(); final String[] execArgs = new String[2]; execArgs[0] = args[0]; // // left for the caller to decorate execArgs[1] = commandFile.toString(); return execArgs; }
java
public static String[] prepareResponseFile(final File outputFile, final String[] args, final String continuation) throws IOException { final String baseName = outputFile.getName(); final File commandFile = new File(outputFile.getParent(), baseName + ".rsp"); final FileWriter writer = new FileWriter(commandFile); for (int i = 1; i < args.length - 1; i++) { writer.write(args[i]); // // if either the current argument ends with // or next argument starts with a comma then // don't split the line if (args[i].endsWith(",") || args[i + 1].startsWith(",")) { writer.write(' '); } else { // // split the line to make it more readable // writer.write(continuation); } } // // write the last argument // if (args.length > 1) { writer.write(args[args.length - 1]); } writer.close(); final String[] execArgs = new String[2]; execArgs[0] = args[0]; // // left for the caller to decorate execArgs[1] = commandFile.toString(); return execArgs; }
[ "public", "static", "String", "[", "]", "prepareResponseFile", "(", "final", "File", "outputFile", ",", "final", "String", "[", "]", "args", ",", "final", "String", "continuation", ")", "throws", "IOException", "{", "final", "String", "baseName", "=", "outputF...
Prepares argument list to execute the linker using a response file. @param outputFile linker output file @param args output of prepareArguments @return arguments for runTask
[ "Prepares", "argument", "list", "to", "execute", "the", "linker", "using", "a", "response", "file", "." ]
train
https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/borland/BorlandProcessor.java#L177-L210
cdk/cdk
display/renderbasic/src/main/java/org/openscience/cdk/renderer/AbstractRenderer.java
AbstractRenderer.convertToDiagramBounds
protected Rectangle convertToDiagramBounds(Rectangle2D modelBounds) { """ Calculate the bounds of the diagram on screen, given the current scale, zoom, and margin. @param modelBounds the bounds in model space of the chem object @return the bounds in screen space of the drawn diagram """ double xCenter = modelBounds.getCenterX(); double yCenter = modelBounds.getCenterY(); double modelWidth = modelBounds.getWidth(); double modelHeight = modelBounds.getHeight(); double scale = rendererModel.getParameter(Scale.class).getValue(); double zoom = rendererModel.getParameter(ZoomFactor.class).getValue(); Point2d screenCoord = this.toScreenCoordinates(xCenter, yCenter); // special case for 0 or 1 atoms if (modelWidth == 0 && modelHeight == 0) { return new Rectangle((int) screenCoord.x, (int) screenCoord.y, 0, 0); } double margin = rendererModel.getParameter(Margin.class).getValue(); int width = (int) ((scale * zoom * modelWidth) + (2 * margin)); int height = (int) ((scale * zoom * modelHeight) + (2 * margin)); int xCoord = (int) (screenCoord.x - width / 2); int yCoord = (int) (screenCoord.y - height / 2); return new Rectangle(xCoord, yCoord, width, height); }
java
protected Rectangle convertToDiagramBounds(Rectangle2D modelBounds) { double xCenter = modelBounds.getCenterX(); double yCenter = modelBounds.getCenterY(); double modelWidth = modelBounds.getWidth(); double modelHeight = modelBounds.getHeight(); double scale = rendererModel.getParameter(Scale.class).getValue(); double zoom = rendererModel.getParameter(ZoomFactor.class).getValue(); Point2d screenCoord = this.toScreenCoordinates(xCenter, yCenter); // special case for 0 or 1 atoms if (modelWidth == 0 && modelHeight == 0) { return new Rectangle((int) screenCoord.x, (int) screenCoord.y, 0, 0); } double margin = rendererModel.getParameter(Margin.class).getValue(); int width = (int) ((scale * zoom * modelWidth) + (2 * margin)); int height = (int) ((scale * zoom * modelHeight) + (2 * margin)); int xCoord = (int) (screenCoord.x - width / 2); int yCoord = (int) (screenCoord.y - height / 2); return new Rectangle(xCoord, yCoord, width, height); }
[ "protected", "Rectangle", "convertToDiagramBounds", "(", "Rectangle2D", "modelBounds", ")", "{", "double", "xCenter", "=", "modelBounds", ".", "getCenterX", "(", ")", ";", "double", "yCenter", "=", "modelBounds", ".", "getCenterY", "(", ")", ";", "double", "mode...
Calculate the bounds of the diagram on screen, given the current scale, zoom, and margin. @param modelBounds the bounds in model space of the chem object @return the bounds in screen space of the drawn diagram
[ "Calculate", "the", "bounds", "of", "the", "diagram", "on", "screen", "given", "the", "current", "scale", "zoom", "and", "margin", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/display/renderbasic/src/main/java/org/openscience/cdk/renderer/AbstractRenderer.java#L411-L434
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/utils/DeepEquals.java
DeepEquals.compareOrdered
private static boolean compareOrdered(DualKey dualKey, LinkedList<DualKey> stack, Collection visited) { """ Compare two Collections that must be same length and in same order. @param dualKey DualKey represents the two Collections to compare @param visited Collection of objects already compared (prevents cycles) @param stack add items to compare to the Stack (Stack versus recursion) @return boolean false if the Collections are not the same length, otherwise place collection items on Stack to be further compared. """ Collection col1 = (Collection) dualKey._key1; Collection col2 = (Collection) dualKey._key2; if (ProxyHelper.isProxyCollection(col1) || ProxyHelper.isProxyCollection(col2)) { return false; } if (col1.size() != col2.size()) { return false; } Iterator i1 = col1.iterator(); Iterator i2 = col2.iterator(); while (i1.hasNext()) { DualKey dk = new DualKey(i1.next(), i2.next()); if (!visited.contains(dk)) { stack.addFirst(dk); } } return true; }
java
private static boolean compareOrdered(DualKey dualKey, LinkedList<DualKey> stack, Collection visited) { Collection col1 = (Collection) dualKey._key1; Collection col2 = (Collection) dualKey._key2; if (ProxyHelper.isProxyCollection(col1) || ProxyHelper.isProxyCollection(col2)) { return false; } if (col1.size() != col2.size()) { return false; } Iterator i1 = col1.iterator(); Iterator i2 = col2.iterator(); while (i1.hasNext()) { DualKey dk = new DualKey(i1.next(), i2.next()); if (!visited.contains(dk)) { stack.addFirst(dk); } } return true; }
[ "private", "static", "boolean", "compareOrdered", "(", "DualKey", "dualKey", ",", "LinkedList", "<", "DualKey", ">", "stack", ",", "Collection", "visited", ")", "{", "Collection", "col1", "=", "(", "Collection", ")", "dualKey", ".", "_key1", ";", "Collection",...
Compare two Collections that must be same length and in same order. @param dualKey DualKey represents the two Collections to compare @param visited Collection of objects already compared (prevents cycles) @param stack add items to compare to the Stack (Stack versus recursion) @return boolean false if the Collections are not the same length, otherwise place collection items on Stack to be further compared.
[ "Compare", "two", "Collections", "that", "must", "be", "same", "length", "and", "in", "same", "order", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/utils/DeepEquals.java#L348-L375
Azure/azure-sdk-for-java
automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/SchedulesInner.java
SchedulesInner.createOrUpdateAsync
public Observable<ScheduleInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String scheduleName, ScheduleCreateOrUpdateParameters parameters) { """ Create a schedule. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param scheduleName The schedule name. @param parameters The parameters supplied to the create or update schedule operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ScheduleInner object """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, scheduleName, parameters).map(new Func1<ServiceResponse<ScheduleInner>, ScheduleInner>() { @Override public ScheduleInner call(ServiceResponse<ScheduleInner> response) { return response.body(); } }); }
java
public Observable<ScheduleInner> createOrUpdateAsync(String resourceGroupName, String automationAccountName, String scheduleName, ScheduleCreateOrUpdateParameters parameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, automationAccountName, scheduleName, parameters).map(new Func1<ServiceResponse<ScheduleInner>, ScheduleInner>() { @Override public ScheduleInner call(ServiceResponse<ScheduleInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ScheduleInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "automationAccountName", ",", "String", "scheduleName", ",", "ScheduleCreateOrUpdateParameters", "parameters", ")", "{", "return", "createOrUpdateWit...
Create a schedule. @param resourceGroupName Name of an Azure Resource group. @param automationAccountName The name of the automation account. @param scheduleName The schedule name. @param parameters The parameters supplied to the create or update schedule operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ScheduleInner object
[ "Create", "a", "schedule", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/automation/resource-manager/v2015_10_31/src/main/java/com/microsoft/azure/management/automation/v2015_10_31/implementation/SchedulesInner.java#L134-L141
kiswanij/jk-util
src/main/java/com/jk/util/cache/simple/JKCacheUtil.java
JKCacheUtil.buildDynamicKey
public static String buildDynamicKey(final Object[] paramNames, final Object[] paramValues) { """ Builds the dynamic key. @param paramNames the param names @param paramValues the param values @return the string """ return Arrays.toString(paramNames).concat(Arrays.toString(paramValues)); }
java
public static String buildDynamicKey(final Object[] paramNames, final Object[] paramValues) { return Arrays.toString(paramNames).concat(Arrays.toString(paramValues)); }
[ "public", "static", "String", "buildDynamicKey", "(", "final", "Object", "[", "]", "paramNames", ",", "final", "Object", "[", "]", "paramValues", ")", "{", "return", "Arrays", ".", "toString", "(", "paramNames", ")", ".", "concat", "(", "Arrays", ".", "toS...
Builds the dynamic key. @param paramNames the param names @param paramValues the param values @return the string
[ "Builds", "the", "dynamic", "key", "." ]
train
https://github.com/kiswanij/jk-util/blob/8e0c85818423406f769444c76194a748e0a0fc0a/src/main/java/com/jk/util/cache/simple/JKCacheUtil.java#L36-L38
dwdyer/watchmaker
examples/src/java/main/org/uncommons/watchmaker/examples/biomorphs/BiomorphApplet.java
BiomorphApplet.prepareGUI
@Override protected void prepareGUI(Container container) { """ Initialise and layout the GUI. @param container The Swing component that will contain the GUI controls. """ renderer = new SwingBiomorphRenderer(); console = new SwingConsole(5); selectionDialog = new JDialog((JFrame) null, "Biomorph Selection", true); biomorphHolder = new JPanel(new GridLayout(1, 1)); container.add(new ControlPanel(), BorderLayout.WEST); container.add(biomorphHolder, BorderLayout.CENTER); biomorphHolder.setBorder(BorderFactory.createTitledBorder("Last Evolved Biomorph")); biomorphHolder.add(new JLabel("Nothing generated yet.", JLabel.CENTER)); selectionDialog.add(console, BorderLayout.CENTER); selectionDialog.setSize(800, 600); selectionDialog.validate(); }
java
@Override protected void prepareGUI(Container container) { renderer = new SwingBiomorphRenderer(); console = new SwingConsole(5); selectionDialog = new JDialog((JFrame) null, "Biomorph Selection", true); biomorphHolder = new JPanel(new GridLayout(1, 1)); container.add(new ControlPanel(), BorderLayout.WEST); container.add(biomorphHolder, BorderLayout.CENTER); biomorphHolder.setBorder(BorderFactory.createTitledBorder("Last Evolved Biomorph")); biomorphHolder.add(new JLabel("Nothing generated yet.", JLabel.CENTER)); selectionDialog.add(console, BorderLayout.CENTER); selectionDialog.setSize(800, 600); selectionDialog.validate(); }
[ "@", "Override", "protected", "void", "prepareGUI", "(", "Container", "container", ")", "{", "renderer", "=", "new", "SwingBiomorphRenderer", "(", ")", ";", "console", "=", "new", "SwingConsole", "(", "5", ")", ";", "selectionDialog", "=", "new", "JDialog", ...
Initialise and layout the GUI. @param container The Swing component that will contain the GUI controls.
[ "Initialise", "and", "layout", "the", "GUI", "." ]
train
https://github.com/dwdyer/watchmaker/blob/33d942350e6bf7d9a17b9262a4f898158530247e/examples/src/java/main/org/uncommons/watchmaker/examples/biomorphs/BiomorphApplet.java#L69-L84
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/wishlists/WishlistItemUrl.java
WishlistItemUrl.deleteWishlistItemUrl
public static MozuUrl deleteWishlistItemUrl(String wishlistId, String wishlistItemId) { """ Get Resource Url for DeleteWishlistItem @param wishlistId Unique identifier of the wish list. @param wishlistItemId Unique identifier of the item to remove from the shopper wish list. @return String Resource Url """ UrlFormatter formatter = new UrlFormatter("/api/commerce/wishlists/{wishlistId}/items/{wishlistItemId}"); formatter.formatUrl("wishlistId", wishlistId); formatter.formatUrl("wishlistItemId", wishlistItemId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl deleteWishlistItemUrl(String wishlistId, String wishlistItemId) { UrlFormatter formatter = new UrlFormatter("/api/commerce/wishlists/{wishlistId}/items/{wishlistItemId}"); formatter.formatUrl("wishlistId", wishlistId); formatter.formatUrl("wishlistItemId", wishlistItemId); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "deleteWishlistItemUrl", "(", "String", "wishlistId", ",", "String", "wishlistItemId", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/wishlists/{wishlistId}/items/{wishlistItemId}\"", ")", ";", "format...
Get Resource Url for DeleteWishlistItem @param wishlistId Unique identifier of the wish list. @param wishlistItemId Unique identifier of the item to remove from the shopper wish list. @return String Resource Url
[ "Get", "Resource", "Url", "for", "DeleteWishlistItem" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/wishlists/WishlistItemUrl.java#L144-L150
ops4j/org.ops4j.base
ops4j-base-util-xml/src/main/java/org/ops4j/util/xml/ElementHelper.java
ElementHelper.getAttribute
public static String getAttribute( Element node, String key, String def ) { """ Return the value of an element attribute. @param node the DOM node @param key the attribute key @param def the default value if the attribute is undefined @return the attribute value or the default value if undefined """ if( null == node ) { return def; } String value = node.getAttribute( key ); if( null == value ) { return def; } if( "".equals( value ) ) { return def; } return normalize( value ); }
java
public static String getAttribute( Element node, String key, String def ) { if( null == node ) { return def; } String value = node.getAttribute( key ); if( null == value ) { return def; } if( "".equals( value ) ) { return def; } return normalize( value ); }
[ "public", "static", "String", "getAttribute", "(", "Element", "node", ",", "String", "key", ",", "String", "def", ")", "{", "if", "(", "null", "==", "node", ")", "{", "return", "def", ";", "}", "String", "value", "=", "node", ".", "getAttribute", "(", ...
Return the value of an element attribute. @param node the DOM node @param key the attribute key @param def the default value if the attribute is undefined @return the attribute value or the default value if undefined
[ "Return", "the", "value", "of", "an", "element", "attribute", "." ]
train
https://github.com/ops4j/org.ops4j.base/blob/b0e742c0d9511f6b19ca64da2ebaf30b7a47256a/ops4j-base-util-xml/src/main/java/org/ops4j/util/xml/ElementHelper.java#L241-L257
lets-blade/blade
src/main/java/com/blade/kit/ReflectKit.java
ReflectKit.invokeMethod
public static Object invokeMethod(Object bean, Method method, Object... args) throws Exception { """ invoke method @param bean bean instance @param method method instance @param args method arguments @return return method returned value @throws Exception throws Exception """ Class<?>[] types = method.getParameterTypes(); int argCount = args == null ? 0 : args.length; // 参数个数对不上 if (argCount != types.length) { throw new IllegalStateException(String.format("%s in %s", method.getName(), bean)); } // 转参数类型 for (int i = 0; i < argCount; i++) { args[i] = cast(args[i], types[i]); } return method.invoke(bean, args); }
java
public static Object invokeMethod(Object bean, Method method, Object... args) throws Exception { Class<?>[] types = method.getParameterTypes(); int argCount = args == null ? 0 : args.length; // 参数个数对不上 if (argCount != types.length) { throw new IllegalStateException(String.format("%s in %s", method.getName(), bean)); } // 转参数类型 for (int i = 0; i < argCount; i++) { args[i] = cast(args[i], types[i]); } return method.invoke(bean, args); }
[ "public", "static", "Object", "invokeMethod", "(", "Object", "bean", ",", "Method", "method", ",", "Object", "...", "args", ")", "throws", "Exception", "{", "Class", "<", "?", ">", "[", "]", "types", "=", "method", ".", "getParameterTypes", "(", ")", ";"...
invoke method @param bean bean instance @param method method instance @param args method arguments @return return method returned value @throws Exception throws Exception
[ "invoke", "method" ]
train
https://github.com/lets-blade/blade/blob/60624ee528be12122c49a9ad1713e336b959e59a/src/main/java/com/blade/kit/ReflectKit.java#L163-L176
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/util/ClassHelper.java
ClassHelper.newInstance
public static Object newInstance(String className, Class type, Object arg) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, ClassNotFoundException { """ Returns a new instance of the class with the given qualified name using the constructor with the specified parameter. @param className The qualified name of the class to instantiate @param type The types of the single parameter of the constructor @param arg The argument @return The instance """ return newInstance(className, new Class[]{type}, new Object[]{arg}); }
java
public static Object newInstance(String className, Class type, Object arg) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException, ClassNotFoundException { return newInstance(className, new Class[]{type}, new Object[]{arg}); }
[ "public", "static", "Object", "newInstance", "(", "String", "className", ",", "Class", "type", ",", "Object", "arg", ")", "throws", "InstantiationException", ",", "IllegalAccessException", ",", "IllegalArgumentException", ",", "InvocationTargetException", ",", "NoSuchMe...
Returns a new instance of the class with the given qualified name using the constructor with the specified parameter. @param className The qualified name of the class to instantiate @param type The types of the single parameter of the constructor @param arg The argument @return The instance
[ "Returns", "a", "new", "instance", "of", "the", "class", "with", "the", "given", "qualified", "name", "using", "the", "constructor", "with", "the", "specified", "parameter", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/util/ClassHelper.java#L339-L348
UrielCh/ovh-java-sdk
ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java
ApiOvhOrder.overTheBox_new_GET
public ArrayList<String> overTheBox_new_GET(String deviceId, String offer, String voucher) throws IOException { """ Get allowed durations for 'new' option REST: GET /order/overTheBox/new @param offer [required] Offer name @param deviceId [required] The id of the device @param voucher [required] An optional voucher """ String qPath = "/order/overTheBox/new"; StringBuilder sb = path(qPath); query(sb, "deviceId", deviceId); query(sb, "offer", offer); query(sb, "voucher", voucher); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> overTheBox_new_GET(String deviceId, String offer, String voucher) throws IOException { String qPath = "/order/overTheBox/new"; StringBuilder sb = path(qPath); query(sb, "deviceId", deviceId); query(sb, "offer", offer); query(sb, "voucher", voucher); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "overTheBox_new_GET", "(", "String", "deviceId", ",", "String", "offer", ",", "String", "voucher", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/order/overTheBox/new\"", ";", "StringBuilder", "sb", "=", ...
Get allowed durations for 'new' option REST: GET /order/overTheBox/new @param offer [required] Offer name @param deviceId [required] The id of the device @param voucher [required] An optional voucher
[ "Get", "allowed", "durations", "for", "new", "option" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-order/src/main/java/net/minidev/ovh/api/ApiOvhOrder.java#L3065-L3073
grails/gorm-hibernate5
grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernateUtil.java
GrailsHibernateUtil.populateArgumentsForCriteria
@Deprecated @SuppressWarnings("rawtypes") public static void populateArgumentsForCriteria(Class<?> targetClass, Criteria c, Map argMap, ConversionService conversionService) { """ Populates criteria arguments for the given target class and arguments map @param targetClass The target class @param c The criteria instance @param argMap The arguments map """ populateArgumentsForCriteria(null, targetClass, c, argMap, conversionService); }
java
@Deprecated @SuppressWarnings("rawtypes") public static void populateArgumentsForCriteria(Class<?> targetClass, Criteria c, Map argMap, ConversionService conversionService) { populateArgumentsForCriteria(null, targetClass, c, argMap, conversionService); }
[ "@", "Deprecated", "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "static", "void", "populateArgumentsForCriteria", "(", "Class", "<", "?", ">", "targetClass", ",", "Criteria", "c", ",", "Map", "argMap", ",", "ConversionService", "conversionService", ...
Populates criteria arguments for the given target class and arguments map @param targetClass The target class @param c The criteria instance @param argMap The arguments map
[ "Populates", "criteria", "arguments", "for", "the", "given", "target", "class", "and", "arguments", "map" ]
train
https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernateUtil.java#L182-L186
google/error-prone-javac
src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java
Main.processJarFile
boolean processJarFile(String jarname, Collection<String> classNames) throws IOException { """ Processes named class files from the given jar file, or all classes if classNames is empty. @param jarname the name of the jar file to process @param classNames the names of classes to process @return true for success, false for failure @throws IOException if an I/O error occurs """ classPath.add(0, new File(jarname)); if (classNames.isEmpty()) { return doJarFile(jarname); } else { return doClassNames(classNames); } }
java
boolean processJarFile(String jarname, Collection<String> classNames) throws IOException { classPath.add(0, new File(jarname)); if (classNames.isEmpty()) { return doJarFile(jarname); } else { return doClassNames(classNames); } }
[ "boolean", "processJarFile", "(", "String", "jarname", ",", "Collection", "<", "String", ">", "classNames", ")", "throws", "IOException", "{", "classPath", ".", "add", "(", "0", ",", "new", "File", "(", "jarname", ")", ")", ";", "if", "(", "classNames", ...
Processes named class files from the given jar file, or all classes if classNames is empty. @param jarname the name of the jar file to process @param classNames the names of classes to process @return true for success, false for failure @throws IOException if an I/O error occurs
[ "Processes", "named", "class", "files", "from", "the", "given", "jar", "file", "or", "all", "classes", "if", "classNames", "is", "empty", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.jdeps/share/classes/com/sun/tools/jdeprscan/Main.java#L281-L289
aoindustries/aocode-public
src/main/java/com/aoindustries/util/LongArrayList.java
LongArrayList.addAll
@Override public boolean addAll(int index, Collection<? extends Long> c) { """ Inserts all of the elements in the specified Collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the list in the order that they are returned by the specified Collection's iterator. @param index index at which to insert first element from the specified collection. @param c elements to be inserted into this list. @return <tt>true</tt> if this list changed as a result of the call. @throws IndexOutOfBoundsException if index out of range <tt>(index &lt; 0 || index &gt; size())</tt>. @throws NullPointerException if the specified Collection is null. """ if (index > size || index < 0) throw new IndexOutOfBoundsException( "Index: " + index + ", Size: " + size); int numNew = c.size(); ensureCapacity(size + numNew); // Increments modCount int numMoved = size - index; if (numMoved > 0) System.arraycopy(elementData, index, elementData, index + numNew, numMoved); Iterator<? extends Long> iter=c.iterator(); int pos = index; while(iter.hasNext()) elementData[pos++]=iter.next(); size += numNew; return numNew != 0; }
java
@Override public boolean addAll(int index, Collection<? extends Long> c) { if (index > size || index < 0) throw new IndexOutOfBoundsException( "Index: " + index + ", Size: " + size); int numNew = c.size(); ensureCapacity(size + numNew); // Increments modCount int numMoved = size - index; if (numMoved > 0) System.arraycopy(elementData, index, elementData, index + numNew, numMoved); Iterator<? extends Long> iter=c.iterator(); int pos = index; while(iter.hasNext()) elementData[pos++]=iter.next(); size += numNew; return numNew != 0; }
[ "@", "Override", "public", "boolean", "addAll", "(", "int", "index", ",", "Collection", "<", "?", "extends", "Long", ">", "c", ")", "{", "if", "(", "index", ">", "size", "||", "index", "<", "0", ")", "throw", "new", "IndexOutOfBoundsException", "(", "\...
Inserts all of the elements in the specified Collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the list in the order that they are returned by the specified Collection's iterator. @param index index at which to insert first element from the specified collection. @param c elements to be inserted into this list. @return <tt>true</tt> if this list changed as a result of the call. @throws IndexOutOfBoundsException if index out of range <tt>(index &lt; 0 || index &gt; size())</tt>. @throws NullPointerException if the specified Collection is null.
[ "Inserts", "all", "of", "the", "elements", "in", "the", "specified", "Collection", "into", "this", "list", "starting", "at", "the", "specified", "position", ".", "Shifts", "the", "element", "currently", "at", "that", "position", "(", "if", "any", ")", "and",...
train
https://github.com/aoindustries/aocode-public/blob/c7bc1d08aee1d02dfaeeb1421fad21aca1aad4c3/src/main/java/com/aoindustries/util/LongArrayList.java#L605-L624
citrusframework/citrus
modules/citrus-ssh/src/main/java/com/consol/citrus/ssh/SshCommand.java
SshCommand.copyToStream
private void copyToStream(String txt, OutputStream stream) throws IOException { """ Copy character sequence to outbput stream. @param txt @param stream @throws IOException """ if (txt != null) { stream.write(txt.getBytes()); } }
java
private void copyToStream(String txt, OutputStream stream) throws IOException { if (txt != null) { stream.write(txt.getBytes()); } }
[ "private", "void", "copyToStream", "(", "String", "txt", ",", "OutputStream", "stream", ")", "throws", "IOException", "{", "if", "(", "txt", "!=", "null", ")", "{", "stream", ".", "write", "(", "txt", ".", "getBytes", "(", ")", ")", ";", "}", "}" ]
Copy character sequence to outbput stream. @param txt @param stream @throws IOException
[ "Copy", "character", "sequence", "to", "outbput", "stream", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ssh/src/main/java/com/consol/citrus/ssh/SshCommand.java#L135-L139
wcm-io/wcm-io-sling
commons/src/main/java/io/wcm/sling/commons/adapter/AdaptTo.java
AdaptTo.notNull
@SuppressWarnings("null") public static <T> @NotNull T notNull(@NotNull Adaptable adaptable, @NotNull Class<T> type) { """ Try to adapt the adaptable to the given type and ensures that it succeeds. @param adaptable Adaptable @param type Type @param <T> Type @return Adaption result (not null) @throws UnableToAdaptException if the adaption was not successful """ T object = adaptable.adaptTo(type); if (object == null) { throw new UnableToAdaptException(adaptable, type); } return object; }
java
@SuppressWarnings("null") public static <T> @NotNull T notNull(@NotNull Adaptable adaptable, @NotNull Class<T> type) { T object = adaptable.adaptTo(type); if (object == null) { throw new UnableToAdaptException(adaptable, type); } return object; }
[ "@", "SuppressWarnings", "(", "\"null\"", ")", "public", "static", "<", "T", ">", "@", "NotNull", "T", "notNull", "(", "@", "NotNull", "Adaptable", "adaptable", ",", "@", "NotNull", "Class", "<", "T", ">", "type", ")", "{", "T", "object", "=", "adaptab...
Try to adapt the adaptable to the given type and ensures that it succeeds. @param adaptable Adaptable @param type Type @param <T> Type @return Adaption result (not null) @throws UnableToAdaptException if the adaption was not successful
[ "Try", "to", "adapt", "the", "adaptable", "to", "the", "given", "type", "and", "ensures", "that", "it", "succeeds", "." ]
train
https://github.com/wcm-io/wcm-io-sling/blob/90adbe432469378794b5695c72e9cdfa2b7d36f1/commons/src/main/java/io/wcm/sling/commons/adapter/AdaptTo.java#L44-L51
wisdom-framework/wisdom
core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java
CryptoServiceSingleton.encryptAESWithCBC
@Override public String encryptAESWithCBC(String value, String salt) { """ Encrypt a String with the AES encryption advanced using 'AES/CBC/PKCS5Padding'. Unlike the regular encode/decode AES method using ECB (Electronic Codebook), it uses Cipher-block chaining (CBC). The salt must be valid hexadecimal String. This method uses parts of the application secret as private key and initialization vector. @param value The message to encrypt @param salt The salt (hexadecimal String) @return encrypted String encoded using Base64 """ return encryptAESWithCBC(value, getSecretPrefix(), salt, getDefaultIV()); }
java
@Override public String encryptAESWithCBC(String value, String salt) { return encryptAESWithCBC(value, getSecretPrefix(), salt, getDefaultIV()); }
[ "@", "Override", "public", "String", "encryptAESWithCBC", "(", "String", "value", ",", "String", "salt", ")", "{", "return", "encryptAESWithCBC", "(", "value", ",", "getSecretPrefix", "(", ")", ",", "salt", ",", "getDefaultIV", "(", ")", ")", ";", "}" ]
Encrypt a String with the AES encryption advanced using 'AES/CBC/PKCS5Padding'. Unlike the regular encode/decode AES method using ECB (Electronic Codebook), it uses Cipher-block chaining (CBC). The salt must be valid hexadecimal String. This method uses parts of the application secret as private key and initialization vector. @param value The message to encrypt @param salt The salt (hexadecimal String) @return encrypted String encoded using Base64
[ "Encrypt", "a", "String", "with", "the", "AES", "encryption", "advanced", "using", "AES", "/", "CBC", "/", "PKCS5Padding", ".", "Unlike", "the", "regular", "encode", "/", "decode", "AES", "method", "using", "ECB", "(", "Electronic", "Codebook", ")", "it", ...
train
https://github.com/wisdom-framework/wisdom/blob/a35b6431200fec56b178c0ff60837ed73fd7874d/core/crypto/src/main/java/org/wisdom/crypto/CryptoServiceSingleton.java#L120-L123
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/TagsInner.java
TagsInner.deleteValueAsync
public Observable<Void> deleteValueAsync(String tagName, String tagValue) { """ Deletes a tag value. @param tagName The name of the tag. @param tagValue The value of the tag to delete. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return deleteValueWithServiceResponseAsync(tagName, tagValue).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> deleteValueAsync(String tagName, String tagValue) { return deleteValueWithServiceResponseAsync(tagName, tagValue).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "deleteValueAsync", "(", "String", "tagName", ",", "String", "tagValue", ")", "{", "return", "deleteValueWithServiceResponseAsync", "(", "tagName", ",", "tagValue", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResp...
Deletes a tag value. @param tagName The name of the tag. @param tagValue The value of the tag to delete. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Deletes", "a", "tag", "value", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/TagsInner.java#L122-L129
OpenCompare/OpenCompare
org.opencompare/pcmdata-importers/src/main/java/data_off/OFFDumpRetriever.java
OFFDumpRetriever.unTar
private List<File> unTar(final File inputFile, final File outputDir) throws FileNotFoundException, IOException, ArchiveException { """ Untar an input file into an output file. The output file is created in the output folder, having the same name as the input file, minus the '.tar' extension. @param inputFile the input .tar file @param outputDir the output directory file. @throws IOException @throws FileNotFoundException @return The {@link List} of {@link File}s with the untared content. @throws ArchiveException """ _log.info(String.format("Untaring %s to dir %s.", inputFile.getAbsolutePath(), outputDir.getAbsolutePath())); final List<File> untaredFiles = new LinkedList<File>(); final InputStream is = new FileInputStream(inputFile); final TarArchiveInputStream debInputStream = (TarArchiveInputStream) new ArchiveStreamFactory().createArchiveInputStream("tar", is); TarArchiveEntry entry = null; while ((entry = (TarArchiveEntry)debInputStream.getNextEntry()) != null) { final File outputFile = new File(outputDir, entry.getName()); if (entry.isDirectory()) { _log.info(String.format("Attempting to write output directory %s.", outputFile.getAbsolutePath())); if (!outputFile.exists()) { _log.info(String.format("Attempting to create output directory %s.", outputFile.getAbsolutePath())); if (!outputFile.mkdirs()) { throw new IllegalStateException(String.format("Couldn't create directory %s.", outputFile.getAbsolutePath())); } } } else { _log.info(String.format("Creating output file %s.", outputFile.getAbsolutePath())); final OutputStream outputFileStream = new FileOutputStream(outputFile); IOUtils.copy(debInputStream, outputFileStream); outputFileStream.close(); } untaredFiles.add(outputFile); } debInputStream.close(); return untaredFiles; }
java
private List<File> unTar(final File inputFile, final File outputDir) throws FileNotFoundException, IOException, ArchiveException { _log.info(String.format("Untaring %s to dir %s.", inputFile.getAbsolutePath(), outputDir.getAbsolutePath())); final List<File> untaredFiles = new LinkedList<File>(); final InputStream is = new FileInputStream(inputFile); final TarArchiveInputStream debInputStream = (TarArchiveInputStream) new ArchiveStreamFactory().createArchiveInputStream("tar", is); TarArchiveEntry entry = null; while ((entry = (TarArchiveEntry)debInputStream.getNextEntry()) != null) { final File outputFile = new File(outputDir, entry.getName()); if (entry.isDirectory()) { _log.info(String.format("Attempting to write output directory %s.", outputFile.getAbsolutePath())); if (!outputFile.exists()) { _log.info(String.format("Attempting to create output directory %s.", outputFile.getAbsolutePath())); if (!outputFile.mkdirs()) { throw new IllegalStateException(String.format("Couldn't create directory %s.", outputFile.getAbsolutePath())); } } } else { _log.info(String.format("Creating output file %s.", outputFile.getAbsolutePath())); final OutputStream outputFileStream = new FileOutputStream(outputFile); IOUtils.copy(debInputStream, outputFileStream); outputFileStream.close(); } untaredFiles.add(outputFile); } debInputStream.close(); return untaredFiles; }
[ "private", "List", "<", "File", ">", "unTar", "(", "final", "File", "inputFile", ",", "final", "File", "outputDir", ")", "throws", "FileNotFoundException", ",", "IOException", ",", "ArchiveException", "{", "_log", ".", "info", "(", "String", ".", "format", "...
Untar an input file into an output file. The output file is created in the output folder, having the same name as the input file, minus the '.tar' extension. @param inputFile the input .tar file @param outputDir the output directory file. @throws IOException @throws FileNotFoundException @return The {@link List} of {@link File}s with the untared content. @throws ArchiveException
[ "Untar", "an", "input", "file", "into", "an", "output", "file", "." ]
train
https://github.com/OpenCompare/OpenCompare/blob/6cd776466b375cb8ecca08fcd94e573d65e20b14/org.opencompare/pcmdata-importers/src/main/java/data_off/OFFDumpRetriever.java#L56-L85
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/config/Config.java
Config.setCountDownLatchConfigs
public Config setCountDownLatchConfigs(Map<String, CountDownLatchConfig> countDownLatchConfigs) { """ Sets the map of CountDownLatch configurations, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future. @param countDownLatchConfigs the CountDownLatch configuration map to set @return this config instance """ this.countDownLatchConfigs.clear(); this.countDownLatchConfigs.putAll(countDownLatchConfigs); for (Entry<String, CountDownLatchConfig> entry : countDownLatchConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
java
public Config setCountDownLatchConfigs(Map<String, CountDownLatchConfig> countDownLatchConfigs) { this.countDownLatchConfigs.clear(); this.countDownLatchConfigs.putAll(countDownLatchConfigs); for (Entry<String, CountDownLatchConfig> entry : countDownLatchConfigs.entrySet()) { entry.getValue().setName(entry.getKey()); } return this; }
[ "public", "Config", "setCountDownLatchConfigs", "(", "Map", "<", "String", ",", "CountDownLatchConfig", ">", "countDownLatchConfigs", ")", "{", "this", ".", "countDownLatchConfigs", ".", "clear", "(", ")", ";", "this", ".", "countDownLatchConfigs", ".", "putAll", ...
Sets the map of CountDownLatch configurations, mapped by config name. The config name may be a pattern with which the configuration will be obtained in the future. @param countDownLatchConfigs the CountDownLatch configuration map to set @return this config instance
[ "Sets", "the", "map", "of", "CountDownLatch", "configurations", "mapped", "by", "config", "name", ".", "The", "config", "name", "may", "be", "a", "pattern", "with", "which", "the", "configuration", "will", "be", "obtained", "in", "the", "future", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/config/Config.java#L1578-L1585
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheUnitImpl.java
CacheUnitImpl.addExternalCacheAdapter
public void addExternalCacheAdapter(String groupId, String address, String beanName) throws DynamicCacheServiceNotStarted { """ This implements the method in the CacheUnit interface. This is delegated to the ExternalCacheServices. It calls ServletCacheUnit to perform this operation. @param groupId The external cache group id. @param address The IP address of the target external cache. @param beanName The bean name (bean instance or class) of the ExternalCacheAdaptor that can deal with the protocol of the target external cache. """ if (servletCacheUnit == null) { throw new DynamicCacheServiceNotStarted("Servlet cache service has not been started."); } servletCacheUnit.addExternalCacheAdapter(groupId, address, beanName); }
java
public void addExternalCacheAdapter(String groupId, String address, String beanName) throws DynamicCacheServiceNotStarted { if (servletCacheUnit == null) { throw new DynamicCacheServiceNotStarted("Servlet cache service has not been started."); } servletCacheUnit.addExternalCacheAdapter(groupId, address, beanName); }
[ "public", "void", "addExternalCacheAdapter", "(", "String", "groupId", ",", "String", "address", ",", "String", "beanName", ")", "throws", "DynamicCacheServiceNotStarted", "{", "if", "(", "servletCacheUnit", "==", "null", ")", "{", "throw", "new", "DynamicCacheServi...
This implements the method in the CacheUnit interface. This is delegated to the ExternalCacheServices. It calls ServletCacheUnit to perform this operation. @param groupId The external cache group id. @param address The IP address of the target external cache. @param beanName The bean name (bean instance or class) of the ExternalCacheAdaptor that can deal with the protocol of the target external cache.
[ "This", "implements", "the", "method", "in", "the", "CacheUnit", "interface", ".", "This", "is", "delegated", "to", "the", "ExternalCacheServices", ".", "It", "calls", "ServletCacheUnit", "to", "perform", "this", "operation", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheUnitImpl.java#L216-L221
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java
TermOfUsePanel.newGeneralTermsAndConditionsPanel
protected Component newGeneralTermsAndConditionsPanel(final String id, final IModel<HeaderContentListModelBean> model) { """ Factory method for creating the new {@link Component} for the general terms and conditions. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a new {@link Component} for the general terms and conditions. @param id the id @param model the model @return the new {@link Component} for the general terms and conditions """ return new GeneralTermsAndConditionsPanel(id, Model.of(model.getObject())); }
java
protected Component newGeneralTermsAndConditionsPanel(final String id, final IModel<HeaderContentListModelBean> model) { return new GeneralTermsAndConditionsPanel(id, Model.of(model.getObject())); }
[ "protected", "Component", "newGeneralTermsAndConditionsPanel", "(", "final", "String", "id", ",", "final", "IModel", "<", "HeaderContentListModelBean", ">", "model", ")", "{", "return", "new", "GeneralTermsAndConditionsPanel", "(", "id", ",", "Model", ".", "of", "("...
Factory method for creating the new {@link Component} for the general terms and conditions. This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a new {@link Component} for the general terms and conditions. @param id the id @param model the model @return the new {@link Component} for the general terms and conditions
[ "Factory", "method", "for", "creating", "the", "new", "{", "@link", "Component", "}", "for", "the", "general", "terms", "and", "conditions", ".", "This", "method", "is", "invoked", "in", "the", "constructor", "from", "the", "derived", "classes", "and", "can"...
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/termofuse/TermOfUsePanel.java#L278-L282
apollographql/apollo-android
apollo-runtime/src/main/java/com/apollographql/apollo/internal/ApolloCallTracker.java
ApolloCallTracker.activeQueryWatchers
@NotNull Set<ApolloQueryWatcher> activeQueryWatchers(@NotNull OperationName operationName) { """ Returns currently active {@link ApolloQueryWatcher} query watchers by operation name. @param operationName query watcher operation name @return set of active query watchers """ return activeCalls(activeQueryWatchers, operationName); }
java
@NotNull Set<ApolloQueryWatcher> activeQueryWatchers(@NotNull OperationName operationName) { return activeCalls(activeQueryWatchers, operationName); }
[ "@", "NotNull", "Set", "<", "ApolloQueryWatcher", ">", "activeQueryWatchers", "(", "@", "NotNull", "OperationName", "operationName", ")", "{", "return", "activeCalls", "(", "activeQueryWatchers", ",", "operationName", ")", ";", "}" ]
Returns currently active {@link ApolloQueryWatcher} query watchers by operation name. @param operationName query watcher operation name @return set of active query watchers
[ "Returns", "currently", "active", "{", "@link", "ApolloQueryWatcher", "}", "query", "watchers", "by", "operation", "name", "." ]
train
https://github.com/apollographql/apollo-android/blob/a78869a76e17f77e42c7a88f0099914fe7ffa5b6/apollo-runtime/src/main/java/com/apollographql/apollo/internal/ApolloCallTracker.java#L225-L227
VoltDB/voltdb
src/frontend/org/voltdb/compiler/VoltCompiler.java
VoltCompiler.compileDDLString
public boolean compileDDLString(String ddl, String jarPath) { """ Compile from DDL in a single string @param ddl The inline DDL text @param jarPath The location to put the finished JAR to. @return true if successful @throws VoltCompilerException """ final File schemaFile = VoltProjectBuilder.writeStringToTempFile(ddl); schemaFile.deleteOnExit(); final String schemaPath = schemaFile.getPath(); return compileFromDDL(jarPath, schemaPath); }
java
public boolean compileDDLString(String ddl, String jarPath) { final File schemaFile = VoltProjectBuilder.writeStringToTempFile(ddl); schemaFile.deleteOnExit(); final String schemaPath = schemaFile.getPath(); return compileFromDDL(jarPath, schemaPath); }
[ "public", "boolean", "compileDDLString", "(", "String", "ddl", ",", "String", "jarPath", ")", "{", "final", "File", "schemaFile", "=", "VoltProjectBuilder", ".", "writeStringToTempFile", "(", "ddl", ")", ";", "schemaFile", ".", "deleteOnExit", "(", ")", ";", "...
Compile from DDL in a single string @param ddl The inline DDL text @param jarPath The location to put the finished JAR to. @return true if successful @throws VoltCompilerException
[ "Compile", "from", "DDL", "in", "a", "single", "string" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/compiler/VoltCompiler.java#L599-L605
trustathsh/ifmapj
src/main/java/de/hshannover/f4/trust/ifmapj/IfmapJHelper.java
IfmapJHelper.loadKeyStore
private static KeyStore loadKeyStore(InputStream is, String pass) throws InitializationException, KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { """ Helper to load a {@link KeyStore} instance. @param is {@link InputStream} representing contents of a keyStore @param pass the password of the keyStore @return an instance of the new loaded {@link KeyStore} @throws NoSuchAlgorithmException @throws CertificateException @throws IOException @throws KeyStoreException """ KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); ks.load(is, pass.toCharArray()); return ks; }
java
private static KeyStore loadKeyStore(InputStream is, String pass) throws InitializationException, KeyStoreException, NoSuchAlgorithmException, CertificateException, IOException { KeyStore ks = KeyStore.getInstance(KeyStore.getDefaultType()); ks.load(is, pass.toCharArray()); return ks; }
[ "private", "static", "KeyStore", "loadKeyStore", "(", "InputStream", "is", ",", "String", "pass", ")", "throws", "InitializationException", ",", "KeyStoreException", ",", "NoSuchAlgorithmException", ",", "CertificateException", ",", "IOException", "{", "KeyStore", "ks",...
Helper to load a {@link KeyStore} instance. @param is {@link InputStream} representing contents of a keyStore @param pass the password of the keyStore @return an instance of the new loaded {@link KeyStore} @throws NoSuchAlgorithmException @throws CertificateException @throws IOException @throws KeyStoreException
[ "Helper", "to", "load", "a", "{", "@link", "KeyStore", "}", "instance", "." ]
train
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/IfmapJHelper.java#L201-L207
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java
DiagnosticsInner.executeSiteDetectorAsync
public Observable<DiagnosticDetectorResponseInner> executeSiteDetectorAsync(String resourceGroupName, String siteName, String detectorName, String diagnosticCategory, DateTime startTime, DateTime endTime, String timeGrain) { """ Execute Detector. Execute Detector. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Site Name @param detectorName Detector Resource Name @param diagnosticCategory Category Name @param startTime Start Time @param endTime End Time @param timeGrain Time Grain @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DiagnosticDetectorResponseInner object """ return executeSiteDetectorWithServiceResponseAsync(resourceGroupName, siteName, detectorName, diagnosticCategory, startTime, endTime, timeGrain).map(new Func1<ServiceResponse<DiagnosticDetectorResponseInner>, DiagnosticDetectorResponseInner>() { @Override public DiagnosticDetectorResponseInner call(ServiceResponse<DiagnosticDetectorResponseInner> response) { return response.body(); } }); }
java
public Observable<DiagnosticDetectorResponseInner> executeSiteDetectorAsync(String resourceGroupName, String siteName, String detectorName, String diagnosticCategory, DateTime startTime, DateTime endTime, String timeGrain) { return executeSiteDetectorWithServiceResponseAsync(resourceGroupName, siteName, detectorName, diagnosticCategory, startTime, endTime, timeGrain).map(new Func1<ServiceResponse<DiagnosticDetectorResponseInner>, DiagnosticDetectorResponseInner>() { @Override public DiagnosticDetectorResponseInner call(ServiceResponse<DiagnosticDetectorResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "DiagnosticDetectorResponseInner", ">", "executeSiteDetectorAsync", "(", "String", "resourceGroupName", ",", "String", "siteName", ",", "String", "detectorName", ",", "String", "diagnosticCategory", ",", "DateTime", "startTime", ",", "DateTime...
Execute Detector. Execute Detector. @param resourceGroupName Name of the resource group to which the resource belongs. @param siteName Site Name @param detectorName Detector Resource Name @param diagnosticCategory Category Name @param startTime Start Time @param endTime End Time @param timeGrain Time Grain @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the DiagnosticDetectorResponseInner object
[ "Execute", "Detector", ".", "Execute", "Detector", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/DiagnosticsInner.java#L1274-L1281
epam/parso
src/main/java/com/epam/parso/impl/CSVDataWriterImpl.java
CSVDataWriterImpl.writeRow
@Override public void writeRow(List<Column> columns, Object[] row) throws IOException { """ The method to export a row from sas7bdat file (stored as an object of the {@link SasFileReaderImpl} class) using {@link CSVDataWriterImpl#writer}. @param columns the {@link Column} class variables list that stores columns description from the sas7bdat file. @param row the Objects arrays that stores data from the sas7bdat file. @throws java.io.IOException appears if the output into writer is impossible. """ if (row == null) { return; } Writer writer = getWriter(); List<String> valuesToPrint = DataWriterUtil.getRowValues(columns, row, getLocale(), columnFormatters); for (int currentColumnIndex = 0; currentColumnIndex < columns.size(); currentColumnIndex++) { writer.write(checkSurroundByQuotes(getDelimiter(), valuesToPrint.get(currentColumnIndex))); if (currentColumnIndex != columns.size() - 1) { writer.write(getDelimiter()); } } writer.write(getEndline()); writer.flush(); }
java
@Override public void writeRow(List<Column> columns, Object[] row) throws IOException { if (row == null) { return; } Writer writer = getWriter(); List<String> valuesToPrint = DataWriterUtil.getRowValues(columns, row, getLocale(), columnFormatters); for (int currentColumnIndex = 0; currentColumnIndex < columns.size(); currentColumnIndex++) { writer.write(checkSurroundByQuotes(getDelimiter(), valuesToPrint.get(currentColumnIndex))); if (currentColumnIndex != columns.size() - 1) { writer.write(getDelimiter()); } } writer.write(getEndline()); writer.flush(); }
[ "@", "Override", "public", "void", "writeRow", "(", "List", "<", "Column", ">", "columns", ",", "Object", "[", "]", "row", ")", "throws", "IOException", "{", "if", "(", "row", "==", "null", ")", "{", "return", ";", "}", "Writer", "writer", "=", "getW...
The method to export a row from sas7bdat file (stored as an object of the {@link SasFileReaderImpl} class) using {@link CSVDataWriterImpl#writer}. @param columns the {@link Column} class variables list that stores columns description from the sas7bdat file. @param row the Objects arrays that stores data from the sas7bdat file. @throws java.io.IOException appears if the output into writer is impossible.
[ "The", "method", "to", "export", "a", "row", "from", "sas7bdat", "file", "(", "stored", "as", "an", "object", "of", "the", "{", "@link", "SasFileReaderImpl", "}", "class", ")", "using", "{", "@link", "CSVDataWriterImpl#writer", "}", "." ]
train
https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/CSVDataWriterImpl.java#L96-L111
jamesagnew/hapi-fhir
hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/filters/Filter.java
Filter.checkParams
public final void checkParams(Object[] params, int expected) { """ Check the number of parameters and throws an exception if needed. @param params the parameters to check. @param expected the expected number of parameters. """ if(params == null || params.length != expected) { throw new RuntimeException("Liquid error: wrong number of arguments (" + (params == null ? 0 : params.length + 1) + " for " + (expected + 1) + ")"); } }
java
public final void checkParams(Object[] params, int expected) { if(params == null || params.length != expected) { throw new RuntimeException("Liquid error: wrong number of arguments (" + (params == null ? 0 : params.length + 1) + " for " + (expected + 1) + ")"); } }
[ "public", "final", "void", "checkParams", "(", "Object", "[", "]", "params", ",", "int", "expected", ")", "{", "if", "(", "params", "==", "null", "||", "params", ".", "length", "!=", "expected", ")", "{", "throw", "new", "RuntimeException", "(", "\"Liqui...
Check the number of parameters and throws an exception if needed. @param params the parameters to check. @param expected the expected number of parameters.
[ "Check", "the", "number", "of", "parameters", "and", "throws", "an", "exception", "if", "needed", "." ]
train
https://github.com/jamesagnew/hapi-fhir/blob/150a84d52fe691b7f48fcb28247c4bddb7aec352/hapi-fhir-narrativegenerator/src/main/java/ca/uhn/fhir/narrative/template/filters/Filter.java#L102-L107
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java
ComputerVisionImpl.recognizeTextAsync
public Observable<Void> recognizeTextAsync(String url, TextRecognitionMode mode) { """ Recognize Text operation. When you use the Recognize Text interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your Get Recognize Text Operation Result operation. @param mode Type of text to recognize. Possible values include: 'Handwritten', 'Printed' @param url Publicly reachable URL of an image @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful. """ return recognizeTextWithServiceResponseAsync(url, mode).map(new Func1<ServiceResponseWithHeaders<Void, RecognizeTextHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, RecognizeTextHeaders> response) { return response.body(); } }); }
java
public Observable<Void> recognizeTextAsync(String url, TextRecognitionMode mode) { return recognizeTextWithServiceResponseAsync(url, mode).map(new Func1<ServiceResponseWithHeaders<Void, RecognizeTextHeaders>, Void>() { @Override public Void call(ServiceResponseWithHeaders<Void, RecognizeTextHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "recognizeTextAsync", "(", "String", "url", ",", "TextRecognitionMode", "mode", ")", "{", "return", "recognizeTextWithServiceResponseAsync", "(", "url", ",", "mode", ")", ".", "map", "(", "new", "Func1", "<", "ServiceRes...
Recognize Text operation. When you use the Recognize Text interface, the response contains a field called 'Operation-Location'. The 'Operation-Location' field contains the URL that you must use for your Get Recognize Text Operation Result operation. @param mode Type of text to recognize. Possible values include: 'Handwritten', 'Printed' @param url Publicly reachable URL of an image @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponseWithHeaders} object if successful.
[ "Recognize", "Text", "operation", ".", "When", "you", "use", "the", "Recognize", "Text", "interface", "the", "response", "contains", "a", "field", "called", "Operation", "-", "Location", ".", "The", "Operation", "-", "Location", "field", "contains", "the", "UR...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L1351-L1358
apache/incubator-shardingsphere
sharding-core/sharding-core-api/src/main/java/org/apache/shardingsphere/api/hint/HintManager.java
HintManager.addDatabaseShardingValue
public void addDatabaseShardingValue(final String logicTable, final Comparable<?> value) { """ Add sharding value for database. <p>The sharding operator is {@code =}</p> @param logicTable logic table name @param value sharding value """ databaseShardingValues.put(logicTable, value); databaseShardingOnly = false; }
java
public void addDatabaseShardingValue(final String logicTable, final Comparable<?> value) { databaseShardingValues.put(logicTable, value); databaseShardingOnly = false; }
[ "public", "void", "addDatabaseShardingValue", "(", "final", "String", "logicTable", ",", "final", "Comparable", "<", "?", ">", "value", ")", "{", "databaseShardingValues", ".", "put", "(", "logicTable", ",", "value", ")", ";", "databaseShardingOnly", "=", "false...
Add sharding value for database. <p>The sharding operator is {@code =}</p> @param logicTable logic table name @param value sharding value
[ "Add", "sharding", "value", "for", "database", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-core/sharding-core-api/src/main/java/org/apache/shardingsphere/api/hint/HintManager.java#L82-L85
albfernandez/itext2
src/main/java/com/lowagie/text/html/HtmlPeer.java
HtmlPeer.addAlias
public void addAlias(String name, String alias) { """ Sets an alias for an attribute. @param name the iText tagname @param alias the custom tagname """ attributeAliases.put(alias.toLowerCase(), name); }
java
public void addAlias(String name, String alias) { attributeAliases.put(alias.toLowerCase(), name); }
[ "public", "void", "addAlias", "(", "String", "name", ",", "String", "alias", ")", "{", "attributeAliases", ".", "put", "(", "alias", ".", "toLowerCase", "(", ")", ",", "name", ")", ";", "}" ]
Sets an alias for an attribute. @param name the iText tagname @param alias the custom tagname
[ "Sets", "an", "alias", "for", "an", "attribute", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/html/HtmlPeer.java#L87-L89
thrau/jarchivelib
src/main/java/org/rauschig/jarchivelib/ArchiverFactory.java
ArchiverFactory.createArchiver
public static Archiver createArchiver(ArchiveFormat archiveFormat, CompressionType compression) { """ Creates an Archiver for the given archive format that uses compression. @param archiveFormat the archive format @param compression the compression algorithm @return a new Archiver instance that also handles compression """ CommonsArchiver archiver = new CommonsArchiver(archiveFormat); CommonsCompressor compressor = new CommonsCompressor(compression); return new ArchiverCompressorDecorator(archiver, compressor); }
java
public static Archiver createArchiver(ArchiveFormat archiveFormat, CompressionType compression) { CommonsArchiver archiver = new CommonsArchiver(archiveFormat); CommonsCompressor compressor = new CommonsCompressor(compression); return new ArchiverCompressorDecorator(archiver, compressor); }
[ "public", "static", "Archiver", "createArchiver", "(", "ArchiveFormat", "archiveFormat", ",", "CompressionType", "compression", ")", "{", "CommonsArchiver", "archiver", "=", "new", "CommonsArchiver", "(", "archiveFormat", ")", ";", "CommonsCompressor", "compressor", "="...
Creates an Archiver for the given archive format that uses compression. @param archiveFormat the archive format @param compression the compression algorithm @return a new Archiver instance that also handles compression
[ "Creates", "an", "Archiver", "for", "the", "given", "archive", "format", "that", "uses", "compression", "." ]
train
https://github.com/thrau/jarchivelib/blob/8afee5124c588f589306796985b722d63572bbfa/src/main/java/org/rauschig/jarchivelib/ArchiverFactory.java#L96-L101
apache/groovy
src/main/groovy/groovy/util/FactoryBuilderSupport.java
FactoryBuilderSupport.nodeCompleted
protected void nodeCompleted(Object parent, Object node) { """ A hook to allow nodes to be processed once they have had all of their children applied. @param node the current node being processed @param parent the parent of the node being processed """ getProxyBuilder().getCurrentFactory().onNodeCompleted(getProxyBuilder().getChildBuilder(), parent, node); }
java
protected void nodeCompleted(Object parent, Object node) { getProxyBuilder().getCurrentFactory().onNodeCompleted(getProxyBuilder().getChildBuilder(), parent, node); }
[ "protected", "void", "nodeCompleted", "(", "Object", "parent", ",", "Object", "node", ")", "{", "getProxyBuilder", "(", ")", ".", "getCurrentFactory", "(", ")", ".", "onNodeCompleted", "(", "getProxyBuilder", "(", ")", ".", "getChildBuilder", "(", ")", ",", ...
A hook to allow nodes to be processed once they have had all of their children applied. @param node the current node being processed @param parent the parent of the node being processed
[ "A", "hook", "to", "allow", "nodes", "to", "be", "processed", "once", "they", "have", "had", "all", "of", "their", "children", "applied", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/groovy/groovy/util/FactoryBuilderSupport.java#L1004-L1006
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/otf/OtfHeaderDecoder.java
OtfHeaderDecoder.getTemplateId
public int getTemplateId(final DirectBuffer buffer, final int bufferOffset) { """ Get the template id from the message header. @param buffer from which to read the value. @param bufferOffset in the buffer at which the message header begins. @return the value of the template id. """ return Types.getInt(buffer, bufferOffset + templateIdOffset, templateIdType, templateIdByteOrder); }
java
public int getTemplateId(final DirectBuffer buffer, final int bufferOffset) { return Types.getInt(buffer, bufferOffset + templateIdOffset, templateIdType, templateIdByteOrder); }
[ "public", "int", "getTemplateId", "(", "final", "DirectBuffer", "buffer", ",", "final", "int", "bufferOffset", ")", "{", "return", "Types", ".", "getInt", "(", "buffer", ",", "bufferOffset", "+", "templateIdOffset", ",", "templateIdType", ",", "templateIdByteOrder...
Get the template id from the message header. @param buffer from which to read the value. @param bufferOffset in the buffer at which the message header begins. @return the value of the template id.
[ "Get", "the", "template", "id", "from", "the", "message", "header", "." ]
train
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/otf/OtfHeaderDecoder.java#L106-L109
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/clustering/criterion/BaseFunction.java
BaseFunction.modifiedMagnitude
protected static double modifiedMagnitude(DoubleVector c, DoubleVector v) { """ Returns the magnitude of {@code c} as if {@code v} was added to the the vector. We do this because it would be more costly, garbage collection wise, to create a new vector for each alternate cluster and * vector. """ return Math.sqrt(modifiedMagnitudeSqrd(c, v)); }
java
protected static double modifiedMagnitude(DoubleVector c, DoubleVector v) { return Math.sqrt(modifiedMagnitudeSqrd(c, v)); }
[ "protected", "static", "double", "modifiedMagnitude", "(", "DoubleVector", "c", ",", "DoubleVector", "v", ")", "{", "return", "Math", ".", "sqrt", "(", "modifiedMagnitudeSqrd", "(", "c", ",", "v", ")", ")", ";", "}" ]
Returns the magnitude of {@code c} as if {@code v} was added to the the vector. We do this because it would be more costly, garbage collection wise, to create a new vector for each alternate cluster and * vector.
[ "Returns", "the", "magnitude", "of", "{" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/clustering/criterion/BaseFunction.java#L378-L380
btaz/data-util
src/main/java/com/btaz/util/collections/Sets.java
Sets.isSubset
public static <T> boolean isSubset(Set<T> setA, Set<T> setB) { """ This method returns true if set A is a subset of set B i.e. it answers the question if all items in A exists in B @param setA set A @param setB set B @param <T> type @return {@code boolean} true if A is a subset of B """ return setB.containsAll(setA); }
java
public static <T> boolean isSubset(Set<T> setA, Set<T> setB) { return setB.containsAll(setA); }
[ "public", "static", "<", "T", ">", "boolean", "isSubset", "(", "Set", "<", "T", ">", "setA", ",", "Set", "<", "T", ">", "setB", ")", "{", "return", "setB", ".", "containsAll", "(", "setA", ")", ";", "}" ]
This method returns true if set A is a subset of set B i.e. it answers the question if all items in A exists in B @param setA set A @param setB set B @param <T> type @return {@code boolean} true if A is a subset of B
[ "This", "method", "returns", "true", "if", "set", "A", "is", "a", "subset", "of", "set", "B", "i", ".", "e", ".", "it", "answers", "the", "question", "if", "all", "items", "in", "A", "exists", "in", "B" ]
train
https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/collections/Sets.java#L127-L129
Azure/azure-sdk-for-java
compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetVMsInner.java
VirtualMachineScaleSetVMsInner.beginDeallocate
public OperationStatusResponseInner beginDeallocate(String resourceGroupName, String vmScaleSetName, String instanceId) { """ Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @param instanceId The instance ID of the virtual machine. @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 OperationStatusResponseInner object if successful. """ return beginDeallocateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId).toBlocking().single().body(); }
java
public OperationStatusResponseInner beginDeallocate(String resourceGroupName, String vmScaleSetName, String instanceId) { return beginDeallocateWithServiceResponseAsync(resourceGroupName, vmScaleSetName, instanceId).toBlocking().single().body(); }
[ "public", "OperationStatusResponseInner", "beginDeallocate", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ",", "String", "instanceId", ")", "{", "return", "beginDeallocateWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmScaleSetName", ",", ...
Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute resources it uses. You are not billed for the compute resources of this virtual machine once it is deallocated. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @param instanceId The instance ID of the virtual machine. @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 OperationStatusResponseInner object if successful.
[ "Deallocates", "a", "specific", "virtual", "machine", "in", "a", "VM", "scale", "set", ".", "Shuts", "down", "the", "virtual", "machine", "and", "releases", "the", "compute", "resources", "it", "uses", ".", "You", "are", "not", "billed", "for", "the", "com...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineScaleSetVMsInner.java#L590-L592
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRLight.java
GVRLight.setVec4
public void setVec4(String key, float x, float y, float z, float w) { """ Set the value for a floating point vector of length 4. @param key name of uniform to set. @param x new X value @param y new Y value @param z new Z value @param w new W value @see #getVec4 @see #getFloatVec(String) """ checkKeyIsUniform(key); NativeLight.setVec4(getNative(), key, x, y, z, w); }
java
public void setVec4(String key, float x, float y, float z, float w) { checkKeyIsUniform(key); NativeLight.setVec4(getNative(), key, x, y, z, w); }
[ "public", "void", "setVec4", "(", "String", "key", ",", "float", "x", ",", "float", "y", ",", "float", "z", ",", "float", "w", ")", "{", "checkKeyIsUniform", "(", "key", ")", ";", "NativeLight", ".", "setVec4", "(", "getNative", "(", ")", ",", "key",...
Set the value for a floating point vector of length 4. @param key name of uniform to set. @param x new X value @param y new Y value @param z new Z value @param w new W value @see #getVec4 @see #getFloatVec(String)
[ "Set", "the", "value", "for", "a", "floating", "point", "vector", "of", "length", "4", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRLight.java#L453-L457
Stratio/bdt
src/main/java/com/stratio/qa/utils/ElasticSearchUtils.java
ElasticSearchUtils.setSettings
public void setSettings(LinkedHashMap<String, Object> settings) { """ Set settings about ES connector. @param settings : LinkedHashMap with all the settings about ES connection """ Settings.Builder builder = Settings.settingsBuilder(); for (Map.Entry<String, Object> entry : settings.entrySet()) { builder.put(entry.getKey(), entry.getValue()); } this.settings = builder.build(); }
java
public void setSettings(LinkedHashMap<String, Object> settings) { Settings.Builder builder = Settings.settingsBuilder(); for (Map.Entry<String, Object> entry : settings.entrySet()) { builder.put(entry.getKey(), entry.getValue()); } this.settings = builder.build(); }
[ "public", "void", "setSettings", "(", "LinkedHashMap", "<", "String", ",", "Object", ">", "settings", ")", "{", "Settings", ".", "Builder", "builder", "=", "Settings", ".", "settingsBuilder", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ...
Set settings about ES connector. @param settings : LinkedHashMap with all the settings about ES connection
[ "Set", "settings", "about", "ES", "connector", "." ]
train
https://github.com/Stratio/bdt/blob/55324d19e7497764ad3dd7139923e13eb9841d75/src/main/java/com/stratio/qa/utils/ElasticSearchUtils.java#L76-L82
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-store/xwiki-commons-crypto-store-filesystem/src/main/java/org/xwiki/crypto/store/filesystem/internal/AbstractX509FileSystemStore.java
AbstractX509FileSystemStore.processObject
protected Object processObject(BufferedReader in, String line, byte[] password) throws IOException, GeneralSecurityException { """ Process an object from a PEM like file. @param in the input reader to read from. @param line the last read line. @param password a password to decrypt encrypted objects. May be null if the object is not encrypted. @return the object read, or null if the line was not a recognized PEM header. @throws IOException on I/O error. @throws GeneralSecurityException on decryption error. """ if (line.contains(PEM_BEGIN + CERTIFICATE + DASHES)) { return this.certificateFactory.decode(readBytes(in, PEM_END + CERTIFICATE + DASHES)); } return null; }
java
protected Object processObject(BufferedReader in, String line, byte[] password) throws IOException, GeneralSecurityException { if (line.contains(PEM_BEGIN + CERTIFICATE + DASHES)) { return this.certificateFactory.decode(readBytes(in, PEM_END + CERTIFICATE + DASHES)); } return null; }
[ "protected", "Object", "processObject", "(", "BufferedReader", "in", ",", "String", "line", ",", "byte", "[", "]", "password", ")", "throws", "IOException", ",", "GeneralSecurityException", "{", "if", "(", "line", ".", "contains", "(", "PEM_BEGIN", "+", "CERTI...
Process an object from a PEM like file. @param in the input reader to read from. @param line the last read line. @param password a password to decrypt encrypted objects. May be null if the object is not encrypted. @return the object read, or null if the line was not a recognized PEM header. @throws IOException on I/O error. @throws GeneralSecurityException on decryption error.
[ "Process", "an", "object", "from", "a", "PEM", "like", "file", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-crypto/xwiki-commons-crypto-store/xwiki-commons-crypto-store-filesystem/src/main/java/org/xwiki/crypto/store/filesystem/internal/AbstractX509FileSystemStore.java#L232-L239
navnorth/LRJavaLib
src/com/navnorth/learningregistry/LRActivity.java
LRActivity.addContextToVerb
public boolean addContextToVerb(String objectType, String id, String description) { """ Add a context object to the verb within this activity @param objectType The type of context @param id The id of the context @param description Description of the context @return True if added, false if not (due to lack of "verb") """ Map<String, Object> container = new HashMap<String, Object>(); if (objectType != null) { container.put("objectType", objectType); } if (id != null) { container.put("id", id); } if (description != null) { container.put("description", description); } String[] pathKeys = {"verb"}; return addChild("context", container, pathKeys); }
java
public boolean addContextToVerb(String objectType, String id, String description) { Map<String, Object> container = new HashMap<String, Object>(); if (objectType != null) { container.put("objectType", objectType); } if (id != null) { container.put("id", id); } if (description != null) { container.put("description", description); } String[] pathKeys = {"verb"}; return addChild("context", container, pathKeys); }
[ "public", "boolean", "addContextToVerb", "(", "String", "objectType", ",", "String", "id", ",", "String", "description", ")", "{", "Map", "<", "String", ",", "Object", ">", "container", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ...
Add a context object to the verb within this activity @param objectType The type of context @param id The id of the context @param description Description of the context @return True if added, false if not (due to lack of "verb")
[ "Add", "a", "context", "object", "to", "the", "verb", "within", "this", "activity" ]
train
https://github.com/navnorth/LRJavaLib/blob/27af28b9f80d772273592414e7d0dccffaac09e1/src/com/navnorth/learningregistry/LRActivity.java#L238-L257
UrielCh/ovh-java-sdk
ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java
ApiOvhDedicatedCloud.serviceName_user_userId_right_rightId_PUT
public void serviceName_user_userId_right_rightId_PUT(String serviceName, Long userId, Long rightId, OvhRight body) throws IOException { """ Alter this object properties REST: PUT /dedicatedCloud/{serviceName}/user/{userId}/right/{rightId} @param body [required] New object properties @param serviceName [required] Domain of the service @param userId [required] @param rightId [required] """ String qPath = "/dedicatedCloud/{serviceName}/user/{userId}/right/{rightId}"; StringBuilder sb = path(qPath, serviceName, userId, rightId); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_user_userId_right_rightId_PUT(String serviceName, Long userId, Long rightId, OvhRight body) throws IOException { String qPath = "/dedicatedCloud/{serviceName}/user/{userId}/right/{rightId}"; StringBuilder sb = path(qPath, serviceName, userId, rightId); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_user_userId_right_rightId_PUT", "(", "String", "serviceName", ",", "Long", "userId", ",", "Long", "rightId", ",", "OvhRight", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dedicatedCloud/{serviceName}/user/{userId}/r...
Alter this object properties REST: PUT /dedicatedCloud/{serviceName}/user/{userId}/right/{rightId} @param body [required] New object properties @param serviceName [required] Domain of the service @param userId [required] @param rightId [required]
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dedicatedCloud/src/main/java/net/minidev/ovh/api/ApiOvhDedicatedCloud.java#L746-L750
fabric8io/fabric8-forge
addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/helper/CamelCatalogHelper.java
CamelCatalogHelper.getPrefix
public static String getPrefix(CamelCatalog camelCatalog, String scheme, String key) { """ Checks whether the given key is a multi valued option @param scheme the component name @param key the option key @return <tt>true</tt> if the key is multi valued, <tt>false</tt> otherwise """ // use the camel catalog String json = camelCatalog.componentJSonSchema(scheme); if (json == null) { throw new IllegalArgumentException("Could not find catalog entry for component name: " + scheme); } List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true); if (data != null) { for (Map<String, String> propertyMap : data) { String name = propertyMap.get("name"); String prefix = propertyMap.get("prefix"); if (key.equals(name)) { return prefix; } } } return null; }
java
public static String getPrefix(CamelCatalog camelCatalog, String scheme, String key) { // use the camel catalog String json = camelCatalog.componentJSonSchema(scheme); if (json == null) { throw new IllegalArgumentException("Could not find catalog entry for component name: " + scheme); } List<Map<String, String>> data = JSonSchemaHelper.parseJsonSchema("properties", json, true); if (data != null) { for (Map<String, String> propertyMap : data) { String name = propertyMap.get("name"); String prefix = propertyMap.get("prefix"); if (key.equals(name)) { return prefix; } } } return null; }
[ "public", "static", "String", "getPrefix", "(", "CamelCatalog", "camelCatalog", ",", "String", "scheme", ",", "String", "key", ")", "{", "// use the camel catalog", "String", "json", "=", "camelCatalog", ".", "componentJSonSchema", "(", "scheme", ")", ";", "if", ...
Checks whether the given key is a multi valued option @param scheme the component name @param key the option key @return <tt>true</tt> if the key is multi valued, <tt>false</tt> otherwise
[ "Checks", "whether", "the", "given", "key", "is", "a", "multi", "valued", "option" ]
train
https://github.com/fabric8io/fabric8-forge/blob/a59871bae4d5c5d3ece10f1e8758e73663087f19/addons/camel/src/main/java/io/fabric8/forge/camel/commands/project/helper/CamelCatalogHelper.java#L234-L252
javagl/CommonUI
src/main/java/de/javagl/common/ui/SpinnerDraggingHandler.java
SpinnerDraggingHandler.addTimes
private Number addTimes(Object n, Number toAdd, int times) { """ Computes n+toAdd*times, obeying the types of the numbers @param n The input @param toAdd The addend @param times The factor @return The result """ Number m = (Number)n; if (m instanceof Double) { return m.doubleValue() + times * toAdd.doubleValue(); } return m.intValue() + times * toAdd.intValue(); }
java
private Number addTimes(Object n, Number toAdd, int times) { Number m = (Number)n; if (m instanceof Double) { return m.doubleValue() + times * toAdd.doubleValue(); } return m.intValue() + times * toAdd.intValue(); }
[ "private", "Number", "addTimes", "(", "Object", "n", ",", "Number", "toAdd", ",", "int", "times", ")", "{", "Number", "m", "=", "(", "Number", ")", "n", ";", "if", "(", "m", "instanceof", "Double", ")", "{", "return", "m", ".", "doubleValue", "(", ...
Computes n+toAdd*times, obeying the types of the numbers @param n The input @param toAdd The addend @param times The factor @return The result
[ "Computes", "n", "+", "toAdd", "*", "times", "obeying", "the", "types", "of", "the", "numbers" ]
train
https://github.com/javagl/CommonUI/blob/b2c7a7637d4e288271392ba148dc17e4c9780255/src/main/java/de/javagl/common/ui/SpinnerDraggingHandler.java#L120-L128
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/VoiceApi.java
VoiceApi.switchToBargeIn
public ApiSuccessResponse switchToBargeIn(String id, MonitoringScopeData monitoringScopeData) throws ApiException { """ Switch to barge-in Switch to the barge-in monitoring mode. If the agent is currently on a call and T-Server is configured to allow barge-in, the supervisor is immediately added to the call. Both the monitored agent and the customer are able to hear and speak with the supervisor. If the target agent is not on a call at the time of the request, the supervisor is brought into the call when the agent receives a new call. @param id The connection ID of the call being monitored. (required) @param monitoringScopeData (optional) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<ApiSuccessResponse> resp = switchToBargeInWithHttpInfo(id, monitoringScopeData); return resp.getData(); }
java
public ApiSuccessResponse switchToBargeIn(String id, MonitoringScopeData monitoringScopeData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = switchToBargeInWithHttpInfo(id, monitoringScopeData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "switchToBargeIn", "(", "String", "id", ",", "MonitoringScopeData", "monitoringScopeData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "switchToBargeInWithHttpInfo", "(", "id", ",", "mon...
Switch to barge-in Switch to the barge-in monitoring mode. If the agent is currently on a call and T-Server is configured to allow barge-in, the supervisor is immediately added to the call. Both the monitored agent and the customer are able to hear and speak with the supervisor. If the target agent is not on a call at the time of the request, the supervisor is brought into the call when the agent receives a new call. @param id The connection ID of the call being monitored. (required) @param monitoringScopeData (optional) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Switch", "to", "barge", "-", "in", "Switch", "to", "the", "barge", "-", "in", "monitoring", "mode", ".", "If", "the", "agent", "is", "currently", "on", "a", "call", "and", "T", "-", "Server", "is", "configured", "to", "allow", "barge", "-", "in", "t...
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/VoiceApi.java#L4972-L4975
lightbend/config
config/src/main/java/com/typesafe/config/ConfigFactory.java
ConfigFactory.parseResources
public static Config parseResources(Class<?> klass, String resource) { """ Like {@link #parseResources(Class,String,ConfigParseOptions)} but always uses default parse options. @param klass <code>klass.getClassLoader()</code> will be used to load resources, and non-absolute resource names will have this class's package added @param resource resource to look up, relative to <code>klass</code>'s package or absolute starting with a "/" @return the parsed configuration """ return parseResources(klass, resource, ConfigParseOptions.defaults()); }
java
public static Config parseResources(Class<?> klass, String resource) { return parseResources(klass, resource, ConfigParseOptions.defaults()); }
[ "public", "static", "Config", "parseResources", "(", "Class", "<", "?", ">", "klass", ",", "String", "resource", ")", "{", "return", "parseResources", "(", "klass", ",", "resource", ",", "ConfigParseOptions", ".", "defaults", "(", ")", ")", ";", "}" ]
Like {@link #parseResources(Class,String,ConfigParseOptions)} but always uses default parse options. @param klass <code>klass.getClassLoader()</code> will be used to load resources, and non-absolute resource names will have this class's package added @param resource resource to look up, relative to <code>klass</code>'s package or absolute starting with a "/" @return the parsed configuration
[ "Like", "{", "@link", "#parseResources", "(", "Class", "String", "ConfigParseOptions", ")", "}", "but", "always", "uses", "default", "parse", "options", "." ]
train
https://github.com/lightbend/config/blob/68cebfde5e861e9a5fdc75ceff366ed95e17d475/config/src/main/java/com/typesafe/config/ConfigFactory.java#L854-L856
Azure/azure-sdk-for-java
edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java
DevicesInner.getNetworkSettings
public NetworkSettingsInner getNetworkSettings(String deviceName, String resourceGroupName) { """ Gets the network settings of the specified data box edge/gateway device. @param deviceName The device name. @param resourceGroupName The resource group name. @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 NetworkSettingsInner object if successful. """ return getNetworkSettingsWithServiceResponseAsync(deviceName, resourceGroupName).toBlocking().single().body(); }
java
public NetworkSettingsInner getNetworkSettings(String deviceName, String resourceGroupName) { return getNetworkSettingsWithServiceResponseAsync(deviceName, resourceGroupName).toBlocking().single().body(); }
[ "public", "NetworkSettingsInner", "getNetworkSettings", "(", "String", "deviceName", ",", "String", "resourceGroupName", ")", "{", "return", "getNetworkSettingsWithServiceResponseAsync", "(", "deviceName", ",", "resourceGroupName", ")", ".", "toBlocking", "(", ")", ".", ...
Gets the network settings of the specified data box edge/gateway device. @param deviceName The device name. @param resourceGroupName The resource group name. @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 NetworkSettingsInner object if successful.
[ "Gets", "the", "network", "settings", "of", "the", "specified", "data", "box", "edge", "/", "gateway", "device", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/edgegateway/resource-manager/v2019_03_01/src/main/java/com/microsoft/azure/management/edgegateway/v2019_03_01/implementation/DevicesInner.java#L1597-L1599
Erudika/para
para-core/src/main/java/com/erudika/para/core/App.java
App.addAllSettings
public App addAllSettings(Map<String, Object> settings) { """ Adds all settings to map of app settings and invokes all {@link AppSettingAddedListener}s. @param settings a map settings to add @return this """ // add the new settings one at a time so the add setting listeners are invoked if (settings != null && !settings.isEmpty()) { for (Map.Entry<String, Object> iter : settings.entrySet()) { addSetting(iter.getKey(), iter.getValue()); } } return this; }
java
public App addAllSettings(Map<String, Object> settings) { // add the new settings one at a time so the add setting listeners are invoked if (settings != null && !settings.isEmpty()) { for (Map.Entry<String, Object> iter : settings.entrySet()) { addSetting(iter.getKey(), iter.getValue()); } } return this; }
[ "public", "App", "addAllSettings", "(", "Map", "<", "String", ",", "Object", ">", "settings", ")", "{", "// add the new settings one at a time so the add setting listeners are invoked", "if", "(", "settings", "!=", "null", "&&", "!", "settings", ".", "isEmpty", "(", ...
Adds all settings to map of app settings and invokes all {@link AppSettingAddedListener}s. @param settings a map settings to add @return this
[ "Adds", "all", "settings", "to", "map", "of", "app", "settings", "and", "invokes", "all", "{" ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-core/src/main/java/com/erudika/para/core/App.java#L190-L198
mapsforge/mapsforge
mapsforge-core/src/main/java/org/mapsforge/core/model/BoundingBox.java
BoundingBox.extendDegrees
public BoundingBox extendDegrees(double verticalExpansion, double horizontalExpansion) { """ Creates a BoundingBox that is a fixed degree amount larger on all sides (but does not cross date line/poles). @param verticalExpansion degree extension (must be >= 0) @param horizontalExpansion degree extension (must be >= 0) @return an extended BoundingBox or this (if degrees == 0) """ if (verticalExpansion == 0 && horizontalExpansion == 0) { return this; } else if (verticalExpansion < 0 || horizontalExpansion < 0) { throw new IllegalArgumentException("BoundingBox extend operation does not accept negative values"); } double minLat = Math.max(MercatorProjection.LATITUDE_MIN, this.minLatitude - verticalExpansion); double minLon = Math.max(-180, this.minLongitude - horizontalExpansion); double maxLat = Math.min(MercatorProjection.LATITUDE_MAX, this.maxLatitude + verticalExpansion); double maxLon = Math.min(180, this.maxLongitude + horizontalExpansion); return new BoundingBox(minLat, minLon, maxLat, maxLon); }
java
public BoundingBox extendDegrees(double verticalExpansion, double horizontalExpansion) { if (verticalExpansion == 0 && horizontalExpansion == 0) { return this; } else if (verticalExpansion < 0 || horizontalExpansion < 0) { throw new IllegalArgumentException("BoundingBox extend operation does not accept negative values"); } double minLat = Math.max(MercatorProjection.LATITUDE_MIN, this.minLatitude - verticalExpansion); double minLon = Math.max(-180, this.minLongitude - horizontalExpansion); double maxLat = Math.min(MercatorProjection.LATITUDE_MAX, this.maxLatitude + verticalExpansion); double maxLon = Math.min(180, this.maxLongitude + horizontalExpansion); return new BoundingBox(minLat, minLon, maxLat, maxLon); }
[ "public", "BoundingBox", "extendDegrees", "(", "double", "verticalExpansion", ",", "double", "horizontalExpansion", ")", "{", "if", "(", "verticalExpansion", "==", "0", "&&", "horizontalExpansion", "==", "0", ")", "{", "return", "this", ";", "}", "else", "if", ...
Creates a BoundingBox that is a fixed degree amount larger on all sides (but does not cross date line/poles). @param verticalExpansion degree extension (must be >= 0) @param horizontalExpansion degree extension (must be >= 0) @return an extended BoundingBox or this (if degrees == 0)
[ "Creates", "a", "BoundingBox", "that", "is", "a", "fixed", "degree", "amount", "larger", "on", "all", "sides", "(", "but", "does", "not", "cross", "date", "line", "/", "poles", ")", "." ]
train
https://github.com/mapsforge/mapsforge/blob/c49c83f7f727552f793dff15cefa532ade030842/mapsforge-core/src/main/java/org/mapsforge/core/model/BoundingBox.java#L199-L212
lkwg82/enforcer-rules
src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java
RequirePluginVersions.parsePluginString
protected Plugin parsePluginString( String pluginString, String field ) throws MojoExecutionException { """ Helper method to parse and inject a Plugin. @param pluginString @param field @throws MojoExecutionException @return the plugin """ if ( pluginString != null ) { String[] pluginStrings = pluginString.split( ":" ); if ( pluginStrings.length == 2 ) { Plugin plugin = new Plugin(); plugin.setGroupId( StringUtils.strip( pluginStrings[0] ) ); plugin.setArtifactId( StringUtils.strip( pluginStrings[1] ) ); return plugin; } else { throw new MojoExecutionException( "Invalid " + field + " string: " + pluginString ); } } else { throw new MojoExecutionException( "Invalid " + field + " string: " + pluginString ); } }
java
protected Plugin parsePluginString( String pluginString, String field ) throws MojoExecutionException { if ( pluginString != null ) { String[] pluginStrings = pluginString.split( ":" ); if ( pluginStrings.length == 2 ) { Plugin plugin = new Plugin(); plugin.setGroupId( StringUtils.strip( pluginStrings[0] ) ); plugin.setArtifactId( StringUtils.strip( pluginStrings[1] ) ); return plugin; } else { throw new MojoExecutionException( "Invalid " + field + " string: " + pluginString ); } } else { throw new MojoExecutionException( "Invalid " + field + " string: " + pluginString ); } }
[ "protected", "Plugin", "parsePluginString", "(", "String", "pluginString", ",", "String", "field", ")", "throws", "MojoExecutionException", "{", "if", "(", "pluginString", "!=", "null", ")", "{", "String", "[", "]", "pluginStrings", "=", "pluginString", ".", "sp...
Helper method to parse and inject a Plugin. @param pluginString @param field @throws MojoExecutionException @return the plugin
[ "Helper", "method", "to", "parse", "and", "inject", "a", "Plugin", "." ]
train
https://github.com/lkwg82/enforcer-rules/blob/fa2d309af7907b17fc8eaf386f8056d77b654749/src/main/java/org/apache/maven/plugins/enforcer/RequirePluginVersions.java#L461-L485
iipc/openwayback-access-control
oracle/src/main/java/org/archive/accesscontrol/oracle/RulesController.java
RulesController.getRules
public ModelAndView getRules(HttpServletRequest request, HttpServletResponse response, boolean isHead) throws UnsupportedEncodingException, ParseException { """ protected SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); """ String prefix = request.getParameter("prefix"); if (prefix != null) { return new ModelAndView(view, "object", ruleDao.getRulesWithSurtPrefix(prefix)); } String surt = request.getParameter("surt"); if (surt != null) { return new ModelAndView(view, "object", ruleDao.getRulesWithExactSurt(surt)); } List<Rule> rules = null; String modifiedAfter = request.getParameter("modifiedAfter"); String who = request.getParameter("who"); if (modifiedAfter != null || who != null) { rules = ruleDao.getRulesModifiedAfter(modifiedAfter, who, view.getCustomRestrict()); } if (rules == null) { rules = ruleDao.getAllRules(); } response.addIntHeader(HttpRuleDao.ORACLE_NUM_RULES, rules.size()); return new ModelAndView(view, "object", rules); }
java
public ModelAndView getRules(HttpServletRequest request, HttpServletResponse response, boolean isHead) throws UnsupportedEncodingException, ParseException { String prefix = request.getParameter("prefix"); if (prefix != null) { return new ModelAndView(view, "object", ruleDao.getRulesWithSurtPrefix(prefix)); } String surt = request.getParameter("surt"); if (surt != null) { return new ModelAndView(view, "object", ruleDao.getRulesWithExactSurt(surt)); } List<Rule> rules = null; String modifiedAfter = request.getParameter("modifiedAfter"); String who = request.getParameter("who"); if (modifiedAfter != null || who != null) { rules = ruleDao.getRulesModifiedAfter(modifiedAfter, who, view.getCustomRestrict()); } if (rules == null) { rules = ruleDao.getAllRules(); } response.addIntHeader(HttpRuleDao.ORACLE_NUM_RULES, rules.size()); return new ModelAndView(view, "object", rules); }
[ "public", "ModelAndView", "getRules", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "boolean", "isHead", ")", "throws", "UnsupportedEncodingException", ",", "ParseException", "{", "String", "prefix", "=", "request", ".", "getParamete...
protected SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
[ "protected", "SimpleDateFormat", "dateFormat", "=", "new", "SimpleDateFormat", "(", "yyyy", "-", "MM", "-", "dd", "HH", ":", "mm", ":", "ss", ")", ";" ]
train
https://github.com/iipc/openwayback-access-control/blob/4a0f70f200fd8d7b6e313624b7628656d834bf31/oracle/src/main/java/org/archive/accesscontrol/oracle/RulesController.java#L216-L243
j-a-w-r/jawr
jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/ClassLoaderResourceUtils.java
ClassLoaderResourceUtils.buildObjectInstance
public static Object buildObjectInstance(String classname, Object[] params) { """ Builds a class instance using reflection, by using its classname. The class must have a zero-arg constructor. @param classname the class to build an instance of. @param params the parameters @return the class instance """ Object rets = null; Class<?>[] paramTypes = new Class[params.length]; for (int x = 0; x < params.length; x++) { paramTypes[x] = params[x].getClass(); } try { Class<?> clazz = getClass(classname); rets = clazz.getConstructor(paramTypes).newInstance(params); } catch (Exception e) { throw new BundlingProcessException(e.getMessage() + " [The custom class " + classname + " could not be instantiated, check wether it is available on the classpath and" + " verify that it has a zero-arg constructor].\n" + " The specific error message is: " + e.getClass().getName() + ":" + e.getMessage(), e); } return rets; }
java
public static Object buildObjectInstance(String classname, Object[] params) { Object rets = null; Class<?>[] paramTypes = new Class[params.length]; for (int x = 0; x < params.length; x++) { paramTypes[x] = params[x].getClass(); } try { Class<?> clazz = getClass(classname); rets = clazz.getConstructor(paramTypes).newInstance(params); } catch (Exception e) { throw new BundlingProcessException(e.getMessage() + " [The custom class " + classname + " could not be instantiated, check wether it is available on the classpath and" + " verify that it has a zero-arg constructor].\n" + " The specific error message is: " + e.getClass().getName() + ":" + e.getMessage(), e); } return rets; }
[ "public", "static", "Object", "buildObjectInstance", "(", "String", "classname", ",", "Object", "[", "]", "params", ")", "{", "Object", "rets", "=", "null", ";", "Class", "<", "?", ">", "[", "]", "paramTypes", "=", "new", "Class", "[", "params", ".", "...
Builds a class instance using reflection, by using its classname. The class must have a zero-arg constructor. @param classname the class to build an instance of. @param params the parameters @return the class instance
[ "Builds", "a", "class", "instance", "using", "reflection", "by", "using", "its", "classname", ".", "The", "class", "must", "have", "a", "zero", "-", "arg", "constructor", "." ]
train
https://github.com/j-a-w-r/jawr/blob/1fa7cd46ebcd36908bd90b298ca316fa5b0c1b0d/jawr-core/src/main/java/net/jawr/web/resource/bundle/factory/util/ClassLoaderResourceUtils.java#L322-L341
app55/app55-java
src/support/java/com/googlecode/openbeans/beancontext/BeanContextServicesSupport.java
BeanContextServicesSupport.addService
@SuppressWarnings("unchecked") protected boolean addService(Class serviceClass, BeanContextServiceProvider provider, boolean fireEvent) { """ Add a service to this context. <p> If the service already exists in the context, simply return false. Otherwise, the service is added and event is fired if required. </p> @param serviceClass the service class @param provider the provider of the service @param fireEvent the flag indicating to fire event or not @return true if the service is added; or false if the context already has this service """ if (serviceClass == null || provider == null) { throw new NullPointerException(); } synchronized (globalHierarchyLock) { synchronized (services) { if (services.containsKey(serviceClass)) { return false; } // add to services services.put(serviceClass, createBCSSServiceProvider(serviceClass, provider)); // count Serializable if (provider instanceof Serializable) { serializable++; } } } if (fireEvent) { // notify all listeners and BeanContextServices children notifyServiceAvailable(new BeanContextServiceAvailableEvent(this, serviceClass)); } return true; }
java
@SuppressWarnings("unchecked") protected boolean addService(Class serviceClass, BeanContextServiceProvider provider, boolean fireEvent) { if (serviceClass == null || provider == null) { throw new NullPointerException(); } synchronized (globalHierarchyLock) { synchronized (services) { if (services.containsKey(serviceClass)) { return false; } // add to services services.put(serviceClass, createBCSSServiceProvider(serviceClass, provider)); // count Serializable if (provider instanceof Serializable) { serializable++; } } } if (fireEvent) { // notify all listeners and BeanContextServices children notifyServiceAvailable(new BeanContextServiceAvailableEvent(this, serviceClass)); } return true; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "boolean", "addService", "(", "Class", "serviceClass", ",", "BeanContextServiceProvider", "provider", ",", "boolean", "fireEvent", ")", "{", "if", "(", "serviceClass", "==", "null", "||", "provider", ...
Add a service to this context. <p> If the service already exists in the context, simply return false. Otherwise, the service is added and event is fired if required. </p> @param serviceClass the service class @param provider the provider of the service @param fireEvent the flag indicating to fire event or not @return true if the service is added; or false if the context already has this service
[ "Add", "a", "service", "to", "this", "context", ".", "<p", ">", "If", "the", "service", "already", "exists", "in", "the", "context", "simply", "return", "false", ".", "Otherwise", "the", "service", "is", "added", "and", "event", "is", "fired", "if", "req...
train
https://github.com/app55/app55-java/blob/73e51d0f3141a859dfbd37ca9becef98477e553e/src/support/java/com/googlecode/openbeans/beancontext/BeanContextServicesSupport.java#L342-L374
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRLight.java
GVRLight.setFloat
public void setFloat(String key, float value) { """ Bind a {@code float} to the shader uniform {@code key}. Throws an exception of the key is not found. @param key Name of the shader uniform @param value New data """ checkKeyIsUniform(key); checkFloatNotNaNOrInfinity("value", value); NativeLight.setFloat(getNative(), key, value); }
java
public void setFloat(String key, float value) { checkKeyIsUniform(key); checkFloatNotNaNOrInfinity("value", value); NativeLight.setFloat(getNative(), key, value); }
[ "public", "void", "setFloat", "(", "String", "key", ",", "float", "value", ")", "{", "checkKeyIsUniform", "(", "key", ")", ";", "checkFloatNotNaNOrInfinity", "(", "\"value\"", ",", "value", ")", ";", "NativeLight", ".", "setFloat", "(", "getNative", "(", ")"...
Bind a {@code float} to the shader uniform {@code key}. Throws an exception of the key is not found. @param key Name of the shader uniform @param value New data
[ "Bind", "a", "{", "@code", "float", "}", "to", "the", "shader", "uniform", "{", "@code", "key", "}", ".", "Throws", "an", "exception", "of", "the", "key", "is", "not", "found", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRLight.java#L323-L328
googleapis/google-cloud-java
google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceClient.java
KeyManagementServiceClient.createKeyRing
public final KeyRing createKeyRing(LocationName parent, String keyRingId, KeyRing keyRing) { """ Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location. <p>Sample code: <pre><code> try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); String keyRingId = ""; KeyRing keyRing = KeyRing.newBuilder().build(); KeyRing response = keyManagementServiceClient.createKeyRing(parent, keyRingId, keyRing); } </code></pre> @param parent Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/&#42;/locations/&#42;`. @param keyRingId Required. It must be unique within a location and match the regular expression `[a-zA-Z0-9_-]{1,63}` @param keyRing A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values. @throws com.google.api.gax.rpc.ApiException if the remote call fails """ CreateKeyRingRequest request = CreateKeyRingRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setKeyRingId(keyRingId) .setKeyRing(keyRing) .build(); return createKeyRing(request); }
java
public final KeyRing createKeyRing(LocationName parent, String keyRingId, KeyRing keyRing) { CreateKeyRingRequest request = CreateKeyRingRequest.newBuilder() .setParent(parent == null ? null : parent.toString()) .setKeyRingId(keyRingId) .setKeyRing(keyRing) .build(); return createKeyRing(request); }
[ "public", "final", "KeyRing", "createKeyRing", "(", "LocationName", "parent", ",", "String", "keyRingId", ",", "KeyRing", "keyRing", ")", "{", "CreateKeyRingRequest", "request", "=", "CreateKeyRingRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "pare...
Create a new [KeyRing][google.cloud.kms.v1.KeyRing] in a given Project and Location. <p>Sample code: <pre><code> try (KeyManagementServiceClient keyManagementServiceClient = KeyManagementServiceClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); String keyRingId = ""; KeyRing keyRing = KeyRing.newBuilder().build(); KeyRing response = keyManagementServiceClient.createKeyRing(parent, keyRingId, keyRing); } </code></pre> @param parent Required. The resource name of the location associated with the [KeyRings][google.cloud.kms.v1.KeyRing], in the format `projects/&#42;/locations/&#42;`. @param keyRingId Required. It must be unique within a location and match the regular expression `[a-zA-Z0-9_-]{1,63}` @param keyRing A [KeyRing][google.cloud.kms.v1.KeyRing] with initial field values. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Create", "a", "new", "[", "KeyRing", "]", "[", "google", ".", "cloud", ".", "kms", ".", "v1", ".", "KeyRing", "]", "in", "a", "given", "Project", "and", "Location", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/KeyManagementServiceClient.java#L883-L892
apache/groovy
subprojects/groovy-jmx/src/main/java/groovy/jmx/builder/JmxBuilderModelMBean.java
JmxBuilderModelMBean.addEventListeners
public void addEventListeners(MBeanServer server, Map<String, Map<String, Object>> descriptor) { """ Sets up event listeners for this MBean as described in the descriptor. The descriptor contains a map with layout {item -&gt; Map[event:"...", from:ObjectName, callback:&amp;Closure],...,} @param server the MBeanServer is to be registered. @param descriptor a map containing info about the event """ for (Map.Entry<String, Map<String, Object>> item : descriptor.entrySet()) { Map<String, Object> listener = item.getValue(); // register with server ObjectName broadcaster = (ObjectName) listener.get("from"); try { String eventType = (String) listener.get("event"); if (eventType != null) { NotificationFilterSupport filter = new NotificationFilterSupport(); filter.enableType(eventType); server.addNotificationListener(broadcaster, JmxEventListener.getListener(), filter, listener); } else { server.addNotificationListener(broadcaster, JmxEventListener.getListener(), null, listener); } } catch (InstanceNotFoundException e) { throw new JmxBuilderException(e); } } }
java
public void addEventListeners(MBeanServer server, Map<String, Map<String, Object>> descriptor) { for (Map.Entry<String, Map<String, Object>> item : descriptor.entrySet()) { Map<String, Object> listener = item.getValue(); // register with server ObjectName broadcaster = (ObjectName) listener.get("from"); try { String eventType = (String) listener.get("event"); if (eventType != null) { NotificationFilterSupport filter = new NotificationFilterSupport(); filter.enableType(eventType); server.addNotificationListener(broadcaster, JmxEventListener.getListener(), filter, listener); } else { server.addNotificationListener(broadcaster, JmxEventListener.getListener(), null, listener); } } catch (InstanceNotFoundException e) { throw new JmxBuilderException(e); } } }
[ "public", "void", "addEventListeners", "(", "MBeanServer", "server", ",", "Map", "<", "String", ",", "Map", "<", "String", ",", "Object", ">", ">", "descriptor", ")", "{", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Map", "<", "String", ",", ...
Sets up event listeners for this MBean as described in the descriptor. The descriptor contains a map with layout {item -&gt; Map[event:"...", from:ObjectName, callback:&amp;Closure],...,} @param server the MBeanServer is to be registered. @param descriptor a map containing info about the event
[ "Sets", "up", "event", "listeners", "for", "this", "MBean", "as", "described", "in", "the", "descriptor", ".", "The", "descriptor", "contains", "a", "map", "with", "layout", "{", "item", "-", "&gt", ";", "Map", "[", "event", ":", "...", "from", ":", "O...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/subprojects/groovy-jmx/src/main/java/groovy/jmx/builder/JmxBuilderModelMBean.java#L118-L138
hortonworks/dstream
dstream-api/src/main/java/io/dstream/support/SourceSupplier.java
SourceSupplier.create
@SuppressWarnings( { """ Factory method that constructs the instance of the SourceSupplier by using execution configuration properties and the name of the pipeline to which it is supplying sources to. See {@link DStreamConstants#SOURCE} and {@link DStreamConstants#SOURCE_SUPPLIER} properties. """ "rawtypes", "unchecked" }) public static <T> SourceSupplier<T> create(Properties executionConfig, String pipelineName, SourceFilter<?> sourceFilter){ try { Class<? extends SourceSupplier<?>> sourceSupplierClass; if (executionConfig.containsKey(DStreamConstants.SOURCE_SUPPLIER + pipelineName)){ sourceSupplierClass = (Class<? extends SourceSupplier<?>>) Class .forName(executionConfig.getProperty(DStreamConstants.SOURCE_SUPPLIER + pipelineName), false, Thread.currentThread().getContextClassLoader()); } else { sourceSupplierClass = UriSourceSupplier.class; } SourceSupplier sourceSupplier = ReflectionUtils.newInstance(sourceSupplierClass, new Class[]{Properties.class, String.class}, new Object[]{executionConfig, pipelineName}); return sourceSupplier; } catch (Exception e) { throw new IllegalStateException("Failure while creating SurceSupplier.", e); } }
java
@SuppressWarnings({ "rawtypes", "unchecked" }) public static <T> SourceSupplier<T> create(Properties executionConfig, String pipelineName, SourceFilter<?> sourceFilter){ try { Class<? extends SourceSupplier<?>> sourceSupplierClass; if (executionConfig.containsKey(DStreamConstants.SOURCE_SUPPLIER + pipelineName)){ sourceSupplierClass = (Class<? extends SourceSupplier<?>>) Class .forName(executionConfig.getProperty(DStreamConstants.SOURCE_SUPPLIER + pipelineName), false, Thread.currentThread().getContextClassLoader()); } else { sourceSupplierClass = UriSourceSupplier.class; } SourceSupplier sourceSupplier = ReflectionUtils.newInstance(sourceSupplierClass, new Class[]{Properties.class, String.class}, new Object[]{executionConfig, pipelineName}); return sourceSupplier; } catch (Exception e) { throw new IllegalStateException("Failure while creating SurceSupplier.", e); } }
[ "@", "SuppressWarnings", "(", "{", "\"rawtypes\"", ",", "\"unchecked\"", "}", ")", "public", "static", "<", "T", ">", "SourceSupplier", "<", "T", ">", "create", "(", "Properties", "executionConfig", ",", "String", "pipelineName", ",", "SourceFilter", "<", "?",...
Factory method that constructs the instance of the SourceSupplier by using execution configuration properties and the name of the pipeline to which it is supplying sources to. See {@link DStreamConstants#SOURCE} and {@link DStreamConstants#SOURCE_SUPPLIER} properties.
[ "Factory", "method", "that", "constructs", "the", "instance", "of", "the", "SourceSupplier", "by", "using", "execution", "configuration", "properties", "and", "the", "name", "of", "the", "pipeline", "to", "which", "it", "is", "supplying", "sources", "to", ".", ...
train
https://github.com/hortonworks/dstream/blob/3a106c0f14725b028fe7fe2dbc660406d9a5f142/dstream-api/src/main/java/io/dstream/support/SourceSupplier.java#L60-L79
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_service_serviceName_diagnosticReports_GET
public ArrayList<OvhDiagnosticReport> billingAccount_service_serviceName_diagnosticReports_GET(String billingAccount, String serviceName, OvhDiagnosticReportIndexEnum dayInterval) throws IOException { """ Get Relevant informations of the service detected from the MOS or the signal leg in SIP/MGCP protocol. REST: GET /telephony/{billingAccount}/service/{serviceName}/diagnosticReports @param dayInterval [required] The date index interval @param billingAccount [required] The name of your billingAccount @param serviceName [required] """ String qPath = "/telephony/{billingAccount}/service/{serviceName}/diagnosticReports"; StringBuilder sb = path(qPath, billingAccount, serviceName); query(sb, "dayInterval", dayInterval); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t12); }
java
public ArrayList<OvhDiagnosticReport> billingAccount_service_serviceName_diagnosticReports_GET(String billingAccount, String serviceName, OvhDiagnosticReportIndexEnum dayInterval) throws IOException { String qPath = "/telephony/{billingAccount}/service/{serviceName}/diagnosticReports"; StringBuilder sb = path(qPath, billingAccount, serviceName); query(sb, "dayInterval", dayInterval); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t12); }
[ "public", "ArrayList", "<", "OvhDiagnosticReport", ">", "billingAccount_service_serviceName_diagnosticReports_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "OvhDiagnosticReportIndexEnum", "dayInterval", ")", "throws", "IOException", "{", "String", ...
Get Relevant informations of the service detected from the MOS or the signal leg in SIP/MGCP protocol. REST: GET /telephony/{billingAccount}/service/{serviceName}/diagnosticReports @param dayInterval [required] The date index interval @param billingAccount [required] The name of your billingAccount @param serviceName [required]
[ "Get", "Relevant", "informations", "of", "the", "service", "detected", "from", "the", "MOS", "or", "the", "signal", "leg", "in", "SIP", "/", "MGCP", "protocol", "." ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3859-L3865
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java
DfuServiceInitiator.setBinOrHex
@Deprecated public DfuServiceInitiator setBinOrHex(@FileType final int fileType, @NonNull final String path) { """ Sets the URI of the BIN or HEX file containing the new firmware. For DFU Bootloader version 0.5 or newer the init file must be specified using one of {@link #setInitFile(String)} methods. @param fileType see {@link #setBinOrHex(int, Uri)} for details @param path path to the file @return the builder """ if (fileType == DfuBaseService.TYPE_AUTO) throw new UnsupportedOperationException("You must specify the file type"); return init(null, path, 0, fileType, DfuBaseService.MIME_TYPE_OCTET_STREAM); }
java
@Deprecated public DfuServiceInitiator setBinOrHex(@FileType final int fileType, @NonNull final String path) { if (fileType == DfuBaseService.TYPE_AUTO) throw new UnsupportedOperationException("You must specify the file type"); return init(null, path, 0, fileType, DfuBaseService.MIME_TYPE_OCTET_STREAM); }
[ "@", "Deprecated", "public", "DfuServiceInitiator", "setBinOrHex", "(", "@", "FileType", "final", "int", "fileType", ",", "@", "NonNull", "final", "String", "path", ")", "{", "if", "(", "fileType", "==", "DfuBaseService", ".", "TYPE_AUTO", ")", "throw", "new",...
Sets the URI of the BIN or HEX file containing the new firmware. For DFU Bootloader version 0.5 or newer the init file must be specified using one of {@link #setInitFile(String)} methods. @param fileType see {@link #setBinOrHex(int, Uri)} for details @param path path to the file @return the builder
[ "Sets", "the", "URI", "of", "the", "BIN", "or", "HEX", "file", "containing", "the", "new", "firmware", ".", "For", "DFU", "Bootloader", "version", "0", ".", "5", "or", "newer", "the", "init", "file", "must", "be", "specified", "using", "one", "of", "{"...
train
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java#L638-L643