repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_DELETE
public void billingAccount_DELETE(String billingAccount, String details, OvhTerminationReasonEnum reason) throws IOException { String qPath = "/telephony/{billingAccount}"; StringBuilder sb = path(qPath, billingAccount); query(sb, "details", details); query(sb, "reason", reason); exec(qPath, "DELETE", sb.toString(), null); }
java
public void billingAccount_DELETE(String billingAccount, String details, OvhTerminationReasonEnum reason) throws IOException { String qPath = "/telephony/{billingAccount}"; StringBuilder sb = path(qPath, billingAccount); query(sb, "details", details); query(sb, "reason", reason); exec(qPath, "DELETE", sb.toString(), null); }
[ "public", "void", "billingAccount_DELETE", "(", "String", "billingAccount", ",", "String", "details", ",", "OvhTerminationReasonEnum", "reason", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}\"", ";", "StringBuilder", "sb", "="...
Ask for a billing account termination. REST: DELETE /telephony/{billingAccount} @param details [required] Termination reason details @param reason [required] Termination reason @param billingAccount [required] The name of your billingAccount
[ "Ask", "for", "a", "billing", "account", "termination", "." ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L3689-L3695
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java
UTF16.countCodePoint
public static int countCodePoint(String source) { if (source == null || source.length() == 0) { return 0; } return findCodePointOffset(source, source.length()); }
java
public static int countCodePoint(String source) { if (source == null || source.length() == 0) { return 0; } return findCodePointOffset(source, source.length()); }
[ "public", "static", "int", "countCodePoint", "(", "String", "source", ")", "{", "if", "(", "source", "==", "null", "||", "source", ".", "length", "(", ")", "==", "0", ")", "{", "return", "0", ";", "}", "return", "findCodePointOffset", "(", "source", ",...
Number of codepoints in a UTF16 String @param source UTF16 string @return number of codepoint in string
[ "Number", "of", "codepoints", "in", "a", "UTF16", "String" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UTF16.java#L1038-L1043
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.deleteResource
public void deleteResource(CmsResource res, CmsResourceDeleteMode deletePreserveSiblings) throws CmsException { getResourceType(res).deleteResource(this, m_securityManager, res, deletePreserveSiblings); }
java
public void deleteResource(CmsResource res, CmsResourceDeleteMode deletePreserveSiblings) throws CmsException { getResourceType(res).deleteResource(this, m_securityManager, res, deletePreserveSiblings); }
[ "public", "void", "deleteResource", "(", "CmsResource", "res", ",", "CmsResourceDeleteMode", "deletePreserveSiblings", ")", "throws", "CmsException", "{", "getResourceType", "(", "res", ")", ".", "deleteResource", "(", "this", ",", "m_securityManager", ",", "res", "...
Deletes a resource.<p> The <code>siblingMode</code> parameter controls how to handle siblings during the delete operation.<br> Possible values for this parameter are: <br> <ul> <li><code>{@link CmsResource#DELETE_REMOVE_SIBLINGS}</code></li> <li><code>{@link CmsResource#DELETE_PRESERVE_SIBLINGS}</code></li> </ul><p> @param res the resource to delete @param deletePreserveSiblings indicates how to handle siblings of the deleted resource @throws CmsException if something goes wrong
[ "Deletes", "a", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L1042-L1045
before/quality-check
modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/util/MethodUtil.java
MethodUtil.determineAccessorName
public static String determineAccessorName(@Nonnull final AccessorPrefix prefix, @Nonnull final String fieldName) { Check.notNull(prefix, "prefix"); Check.notEmpty(fieldName, "fieldName"); final Matcher m = PATTERN.matcher(fieldName); Check.stateIsTrue(m.find(), "passed field name '%s' is not applicable", fieldName); final String name = m.group(); return prefix.getPrefix() + name.substring(0, 1).toUpperCase() + name.substring(1); }
java
public static String determineAccessorName(@Nonnull final AccessorPrefix prefix, @Nonnull final String fieldName) { Check.notNull(prefix, "prefix"); Check.notEmpty(fieldName, "fieldName"); final Matcher m = PATTERN.matcher(fieldName); Check.stateIsTrue(m.find(), "passed field name '%s' is not applicable", fieldName); final String name = m.group(); return prefix.getPrefix() + name.substring(0, 1).toUpperCase() + name.substring(1); }
[ "public", "static", "String", "determineAccessorName", "(", "@", "Nonnull", "final", "AccessorPrefix", "prefix", ",", "@", "Nonnull", "final", "String", "fieldName", ")", "{", "Check", ".", "notNull", "(", "prefix", ",", "\"prefix\"", ")", ";", "Check", ".", ...
Determines the accessor method name based on a field name. @param fieldName a field name @return the resulting method name
[ "Determines", "the", "accessor", "method", "name", "based", "on", "a", "field", "name", "." ]
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-immutable-object/src/main/java/net/sf/qualitycheck/immutableobject/util/MethodUtil.java#L41-L48
mabe02/lanterna
src/main/java/com/googlecode/lanterna/gui2/Label.java
Label.getBounds
protected TerminalSize getBounds(String[] lines, TerminalSize currentBounds) { if(currentBounds == null) { currentBounds = TerminalSize.ZERO; } currentBounds = currentBounds.withRows(lines.length); if(labelWidth == null || labelWidth == 0) { int preferredWidth = 0; for(String line : lines) { int lineWidth = TerminalTextUtils.getColumnWidth(line); if(preferredWidth < lineWidth) { preferredWidth = lineWidth; } } currentBounds = currentBounds.withColumns(preferredWidth); } else { List<String> wordWrapped = TerminalTextUtils.getWordWrappedText(labelWidth, lines); currentBounds = currentBounds.withColumns(labelWidth).withRows(wordWrapped.size()); } return currentBounds; }
java
protected TerminalSize getBounds(String[] lines, TerminalSize currentBounds) { if(currentBounds == null) { currentBounds = TerminalSize.ZERO; } currentBounds = currentBounds.withRows(lines.length); if(labelWidth == null || labelWidth == 0) { int preferredWidth = 0; for(String line : lines) { int lineWidth = TerminalTextUtils.getColumnWidth(line); if(preferredWidth < lineWidth) { preferredWidth = lineWidth; } } currentBounds = currentBounds.withColumns(preferredWidth); } else { List<String> wordWrapped = TerminalTextUtils.getWordWrappedText(labelWidth, lines); currentBounds = currentBounds.withColumns(labelWidth).withRows(wordWrapped.size()); } return currentBounds; }
[ "protected", "TerminalSize", "getBounds", "(", "String", "[", "]", "lines", ",", "TerminalSize", "currentBounds", ")", "{", "if", "(", "currentBounds", "==", "null", ")", "{", "currentBounds", "=", "TerminalSize", ".", "ZERO", ";", "}", "currentBounds", "=", ...
Returns the area, in terminal columns and rows, required to fully draw the lines passed in. @param lines Lines to measure the size of @param currentBounds Optional (can pass {@code null}) terminal size to use for storing the output values. If the method is called many times and always returning the same value, passing in an external reference of this size will avoid creating new {@code TerminalSize} objects every time @return Size that is required to draw the lines
[ "Returns", "the", "area", "in", "terminal", "columns", "and", "rows", "required", "to", "fully", "draw", "the", "lines", "passed", "in", "." ]
train
https://github.com/mabe02/lanterna/blob/8dfd62206ff46ab10223b2ef2dbb0a2c51850954/src/main/java/com/googlecode/lanterna/gui2/Label.java#L110-L130
GoogleCloudPlatform/appengine-gcs-client
java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/URLFetchUtils.java
URLFetchUtils.getSingleHeader
static String getSingleHeader(HTTPResponse resp, String headerName) { return Iterables.getOnlyElement(getHeaders(resp, headerName)).getValue(); }
java
static String getSingleHeader(HTTPResponse resp, String headerName) { return Iterables.getOnlyElement(getHeaders(resp, headerName)).getValue(); }
[ "static", "String", "getSingleHeader", "(", "HTTPResponse", "resp", ",", "String", "headerName", ")", "{", "return", "Iterables", ".", "getOnlyElement", "(", "getHeaders", "(", "resp", ",", "headerName", ")", ")", ".", "getValue", "(", ")", ";", "}" ]
Checks that exactly one header named {@code headerName} is present and returns its value.
[ "Checks", "that", "exactly", "one", "header", "named", "{" ]
train
https://github.com/GoogleCloudPlatform/appengine-gcs-client/blob/d11078331ecd915d753c886e96a80133599f3f98/java/src/main/java/com/google/appengine/tools/cloudstorage/oauth/URLFetchUtils.java#L180-L182
UrielCh/ovh-java-sdk
ovh-java-sdk-dbaasqueue/src/main/java/net/minidev/ovh/api/ApiOvhDbaasqueue.java
ApiOvhDbaasqueue.serviceName_topic_topicId_GET
public OvhTopic serviceName_topic_topicId_GET(String serviceName, String topicId) throws IOException { String qPath = "/dbaas/queue/{serviceName}/topic/{topicId}"; StringBuilder sb = path(qPath, serviceName, topicId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhTopic.class); }
java
public OvhTopic serviceName_topic_topicId_GET(String serviceName, String topicId) throws IOException { String qPath = "/dbaas/queue/{serviceName}/topic/{topicId}"; StringBuilder sb = path(qPath, serviceName, topicId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhTopic.class); }
[ "public", "OvhTopic", "serviceName_topic_topicId_GET", "(", "String", "serviceName", ",", "String", "topicId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dbaas/queue/{serviceName}/topic/{topicId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPa...
Get a topic REST: GET /dbaas/queue/{serviceName}/topic/{topicId} @param serviceName [required] Application ID @param topicId [required] Topic ID API beta
[ "Get", "a", "topic" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaasqueue/src/main/java/net/minidev/ovh/api/ApiOvhDbaasqueue.java#L242-L247
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.listDiagnosticsAsync
public Observable<List<HostingEnvironmentDiagnosticsInner>> listDiagnosticsAsync(String resourceGroupName, String name) { return listDiagnosticsWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<List<HostingEnvironmentDiagnosticsInner>>, List<HostingEnvironmentDiagnosticsInner>>() { @Override public List<HostingEnvironmentDiagnosticsInner> call(ServiceResponse<List<HostingEnvironmentDiagnosticsInner>> response) { return response.body(); } }); }
java
public Observable<List<HostingEnvironmentDiagnosticsInner>> listDiagnosticsAsync(String resourceGroupName, String name) { return listDiagnosticsWithServiceResponseAsync(resourceGroupName, name).map(new Func1<ServiceResponse<List<HostingEnvironmentDiagnosticsInner>>, List<HostingEnvironmentDiagnosticsInner>>() { @Override public List<HostingEnvironmentDiagnosticsInner> call(ServiceResponse<List<HostingEnvironmentDiagnosticsInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "List", "<", "HostingEnvironmentDiagnosticsInner", ">", ">", "listDiagnosticsAsync", "(", "String", "resourceGroupName", ",", "String", "name", ")", "{", "return", "listDiagnosticsWithServiceResponseAsync", "(", "resourceGroupName", ",", "name...
Get diagnostic information for an App Service Environment. Get diagnostic information for an App Service Environment. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the List&lt;HostingEnvironmentDiagnosticsInner&gt; object
[ "Get", "diagnostic", "information", "for", "an", "App", "Service", "Environment", ".", "Get", "diagnostic", "information", "for", "an", "App", "Service", "Environment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L1543-L1550
bmwcarit/joynr
java/messaging/bounceproxy/bounceproxy-controller/src/main/java/io/joynr/messaging/bounceproxy/controller/RemoteBounceProxyFacade.java
RemoteBounceProxyFacade.createChannel
public URI createChannel(ControlledBounceProxyInformation bpInfo, String ccid, String trackingId) throws JoynrProtocolException { try { // Try to create a channel on a bounce proxy with maximum number of // retries. return createChannelLoop(bpInfo, ccid, trackingId, sendCreateChannelMaxRetries); } catch (JoynrProtocolException e) { logger.error("Unexpected bounce proxy behaviour: message: {}", e.getMessage()); throw e; } catch (JoynrRuntimeException e) { logger.error("Channel creation on bounce proxy failed: message: {}", e.getMessage()); throw e; } catch (Exception e) { logger.error("Uncaught exception in channel creation: message: {}", e.getMessage()); throw new JoynrRuntimeException("Unknown exception when creating channel '" + ccid + "' on bounce proxy '" + bpInfo.getId() + "'", e); } }
java
public URI createChannel(ControlledBounceProxyInformation bpInfo, String ccid, String trackingId) throws JoynrProtocolException { try { // Try to create a channel on a bounce proxy with maximum number of // retries. return createChannelLoop(bpInfo, ccid, trackingId, sendCreateChannelMaxRetries); } catch (JoynrProtocolException e) { logger.error("Unexpected bounce proxy behaviour: message: {}", e.getMessage()); throw e; } catch (JoynrRuntimeException e) { logger.error("Channel creation on bounce proxy failed: message: {}", e.getMessage()); throw e; } catch (Exception e) { logger.error("Uncaught exception in channel creation: message: {}", e.getMessage()); throw new JoynrRuntimeException("Unknown exception when creating channel '" + ccid + "' on bounce proxy '" + bpInfo.getId() + "'", e); } }
[ "public", "URI", "createChannel", "(", "ControlledBounceProxyInformation", "bpInfo", ",", "String", "ccid", ",", "String", "trackingId", ")", "throws", "JoynrProtocolException", "{", "try", "{", "// Try to create a channel on a bounce proxy with maximum number of", "// retries....
Creates a channel on the remote bounce proxy. @param bpInfo information for a bounce proxy, including the cluster the bounce proxy is running on @param ccid the channel id @param trackingId the tracking id @return URI representing the channel @throws JoynrProtocolException if the bounce proxy rejects channel creation
[ "Creates", "a", "channel", "on", "the", "remote", "bounce", "proxy", "." ]
train
https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy/bounceproxy-controller/src/main/java/io/joynr/messaging/bounceproxy/controller/RemoteBounceProxyFacade.java#L78-L98
kaazing/gateway
util/src/main/java/org/kaazing/gateway/util/asn1/Asn1Utils.java
Asn1Utils.sizeOfBitString
public static int sizeOfBitString(BitSet value, int nbits) { return DerUtils.sizeOf(ASN1_BIT_STRING_TAG_NUM, (int) Math.ceil(nbits / 8.0d) + 1); // +1 for padding }
java
public static int sizeOfBitString(BitSet value, int nbits) { return DerUtils.sizeOf(ASN1_BIT_STRING_TAG_NUM, (int) Math.ceil(nbits / 8.0d) + 1); // +1 for padding }
[ "public", "static", "int", "sizeOfBitString", "(", "BitSet", "value", ",", "int", "nbits", ")", "{", "return", "DerUtils", ".", "sizeOf", "(", "ASN1_BIT_STRING_TAG_NUM", ",", "(", "int", ")", "Math", ".", "ceil", "(", "nbits", "/", "8.0d", ")", "+", "1",...
Size of an ASN.1 BIT STRING. @param value the BIT STRING value @param nbits the number of bits in the bit string @return the size of the encoded data
[ "Size", "of", "an", "ASN", ".", "1", "BIT", "STRING", "." ]
train
https://github.com/kaazing/gateway/blob/06017b19273109b3b992e528e702586446168d57/util/src/main/java/org/kaazing/gateway/util/asn1/Asn1Utils.java#L393-L395
jlinn/quartz-redis-jobstore
src/main/java/net/joelinn/quartz/jobstore/RedisJobStore.java
RedisJobStore.storeJob
@Override public void storeJob(final JobDetail newJob, final boolean replaceExisting) throws ObjectAlreadyExistsException, JobPersistenceException { try { doWithLock(new LockCallbackWithoutResult() { @Override public Void doWithLock(JedisCommands jedis) throws JobPersistenceException { storage.storeJob(newJob, replaceExisting, jedis); return null; } }); } catch (ObjectAlreadyExistsException e) { logger.info("Job hash already exists"); throw e; } catch (Exception e) { logger.error("Could not store job.", e); throw new JobPersistenceException(e.getMessage(), e); } }
java
@Override public void storeJob(final JobDetail newJob, final boolean replaceExisting) throws ObjectAlreadyExistsException, JobPersistenceException { try { doWithLock(new LockCallbackWithoutResult() { @Override public Void doWithLock(JedisCommands jedis) throws JobPersistenceException { storage.storeJob(newJob, replaceExisting, jedis); return null; } }); } catch (ObjectAlreadyExistsException e) { logger.info("Job hash already exists"); throw e; } catch (Exception e) { logger.error("Could not store job.", e); throw new JobPersistenceException(e.getMessage(), e); } }
[ "@", "Override", "public", "void", "storeJob", "(", "final", "JobDetail", "newJob", ",", "final", "boolean", "replaceExisting", ")", "throws", "ObjectAlreadyExistsException", ",", "JobPersistenceException", "{", "try", "{", "doWithLock", "(", "new", "LockCallbackWitho...
Store the given <code>{@link org.quartz.JobDetail}</code>. @param newJob The <code>JobDetail</code> to be stored. @param replaceExisting If <code>true</code>, any <code>Job</code> existing in the <code>JobStore</code> with the same name & group should be over-written. @throws org.quartz.ObjectAlreadyExistsException if a <code>Job</code> with the same name/group already exists, and replaceExisting is set to false.
[ "Store", "the", "given", "<code", ">", "{", "@link", "org", ".", "quartz", ".", "JobDetail", "}", "<", "/", "code", ">", "." ]
train
https://github.com/jlinn/quartz-redis-jobstore/blob/be9a52ee776d8a09866fe99fd9718bc13a0cb992/src/main/java/net/joelinn/quartz/jobstore/RedisJobStore.java#L287-L304
grails/gorm-hibernate5
grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java
GrailsDomainBinder.configureNamingStrategy
public static void configureNamingStrategy(final String datasourceName, final Object strategy) throws ClassNotFoundException, InstantiationException, IllegalAccessException { Class<?> namingStrategyClass = null; NamingStrategy namingStrategy; if (strategy instanceof Class<?>) { namingStrategyClass = (Class<?>)strategy; } else if (strategy instanceof CharSequence) { namingStrategyClass = Thread.currentThread().getContextClassLoader().loadClass(strategy.toString()); } if (namingStrategyClass == null) { namingStrategy = (NamingStrategy)strategy; } else { namingStrategy = (NamingStrategy)namingStrategyClass.newInstance(); } NAMING_STRATEGIES.put(datasourceName, namingStrategy); }
java
public static void configureNamingStrategy(final String datasourceName, final Object strategy) throws ClassNotFoundException, InstantiationException, IllegalAccessException { Class<?> namingStrategyClass = null; NamingStrategy namingStrategy; if (strategy instanceof Class<?>) { namingStrategyClass = (Class<?>)strategy; } else if (strategy instanceof CharSequence) { namingStrategyClass = Thread.currentThread().getContextClassLoader().loadClass(strategy.toString()); } if (namingStrategyClass == null) { namingStrategy = (NamingStrategy)strategy; } else { namingStrategy = (NamingStrategy)namingStrategyClass.newInstance(); } NAMING_STRATEGIES.put(datasourceName, namingStrategy); }
[ "public", "static", "void", "configureNamingStrategy", "(", "final", "String", "datasourceName", ",", "final", "Object", "strategy", ")", "throws", "ClassNotFoundException", ",", "InstantiationException", ",", "IllegalAccessException", "{", "Class", "<", "?", ">", "na...
Override the default naming strategy given a Class or a full class name, or an instance of a NamingStrategy. @param datasourceName the datasource name @param strategy the class, name, or instance @throws ClassNotFoundException When the class was not found for specified strategy @throws InstantiationException When an error occurred instantiating the strategy @throws IllegalAccessException When an error occurred instantiating the strategy
[ "Override", "the", "default", "naming", "strategy", "given", "a", "Class", "or", "a", "full", "class", "name", "or", "an", "instance", "of", "a", "NamingStrategy", "." ]
train
https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java#L190-L208
arquillian/arquillian-extension-warp
impl/src/main/java/org/jboss/arquillian/warp/impl/utils/URLUtils.java
URLUtils.buildUrl
public static URL buildUrl(URL context, String... relocations) { URL url = context; for (String move : relocations) { try { url = new URL(url, move); } catch (MalformedURLException e) { throw new AssertionError("URL('" + url + "', '" + move + "') isn't valid URL"); } } return url; }
java
public static URL buildUrl(URL context, String... relocations) { URL url = context; for (String move : relocations) { try { url = new URL(url, move); } catch (MalformedURLException e) { throw new AssertionError("URL('" + url + "', '" + move + "') isn't valid URL"); } } return url; }
[ "public", "static", "URL", "buildUrl", "(", "URL", "context", ",", "String", "...", "relocations", ")", "{", "URL", "url", "=", "context", ";", "for", "(", "String", "move", ":", "relocations", ")", "{", "try", "{", "url", "=", "new", "URL", "(", "ur...
Use URL context and one or more relocations to build end URL. @param context first URL used like a context root for all relocation changes @param relocations array of relocation URLs @return end url after all changes made on context with relocations @throws AssertionError when context or some of relocations are malformed URLs
[ "Use", "URL", "context", "and", "one", "or", "more", "relocations", "to", "build", "end", "URL", "." ]
train
https://github.com/arquillian/arquillian-extension-warp/blob/e958f4d782851baf7f40e39835d3d1ad185b74dd/impl/src/main/java/org/jboss/arquillian/warp/impl/utils/URLUtils.java#L56-L68
zaproxy/zaproxy
src/org/zaproxy/zap/utils/ApiUtils.java
ApiUtils.getNonEmptyStringParam
public static String getNonEmptyStringParam(JSONObject params, String paramName) throws ApiException { if (!params.containsKey(paramName)) { throw new ApiException(Type.MISSING_PARAMETER, paramName); } String value = params.getString(paramName); if (value == null || value.isEmpty()) { throw new ApiException(Type.MISSING_PARAMETER, paramName); } return value; }
java
public static String getNonEmptyStringParam(JSONObject params, String paramName) throws ApiException { if (!params.containsKey(paramName)) { throw new ApiException(Type.MISSING_PARAMETER, paramName); } String value = params.getString(paramName); if (value == null || value.isEmpty()) { throw new ApiException(Type.MISSING_PARAMETER, paramName); } return value; }
[ "public", "static", "String", "getNonEmptyStringParam", "(", "JSONObject", "params", ",", "String", "paramName", ")", "throws", "ApiException", "{", "if", "(", "!", "params", ".", "containsKey", "(", "paramName", ")", ")", "{", "throw", "new", "ApiException", ...
Gets the non empty string param with a given name and throws an exception accordingly if not found or empty. @param params the params @param paramName the param name @return the non empty string param @throws ApiException the api exception thown if param not found or string empty
[ "Gets", "the", "non", "empty", "string", "param", "with", "a", "given", "name", "and", "throws", "an", "exception", "accordingly", "if", "not", "found", "or", "empty", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/ApiUtils.java#L104-L113
Azure/azure-sdk-for-java
appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java
AppServiceEnvironmentsInner.listWorkerPoolSkusAsync
public Observable<Page<SkuInfoInner>> listWorkerPoolSkusAsync(final String resourceGroupName, final String name, final String workerPoolName) { return listWorkerPoolSkusWithServiceResponseAsync(resourceGroupName, name, workerPoolName) .map(new Func1<ServiceResponse<Page<SkuInfoInner>>, Page<SkuInfoInner>>() { @Override public Page<SkuInfoInner> call(ServiceResponse<Page<SkuInfoInner>> response) { return response.body(); } }); }
java
public Observable<Page<SkuInfoInner>> listWorkerPoolSkusAsync(final String resourceGroupName, final String name, final String workerPoolName) { return listWorkerPoolSkusWithServiceResponseAsync(resourceGroupName, name, workerPoolName) .map(new Func1<ServiceResponse<Page<SkuInfoInner>>, Page<SkuInfoInner>>() { @Override public Page<SkuInfoInner> call(ServiceResponse<Page<SkuInfoInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "SkuInfoInner", ">", ">", "listWorkerPoolSkusAsync", "(", "final", "String", "resourceGroupName", ",", "final", "String", "name", ",", "final", "String", "workerPoolName", ")", "{", "return", "listWorkerPoolSkusWithServiceResp...
Get available SKUs for scaling a worker pool. Get available SKUs for scaling a worker pool. @param resourceGroupName Name of the resource group to which the resource belongs. @param name Name of the App Service Environment. @param workerPoolName Name of the worker pool. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SkuInfoInner&gt; object
[ "Get", "available", "SKUs", "for", "scaling", "a", "worker", "pool", ".", "Get", "available", "SKUs", "for", "scaling", "a", "worker", "pool", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2016_09_01/src/main/java/com/microsoft/azure/management/appservice/v2016_09_01/implementation/AppServiceEnvironmentsInner.java#L6388-L6396
codeprimate-software/cp-elements
src/main/java/org/cp/elements/net/NetworkUtils.java
NetworkUtils.parsePort
public static int parsePort(String port, Integer defaultPort) { try { return Integer.parseInt(trim(port)); } catch (NumberFormatException cause) { return Optional.ofNullable(defaultPort) .orElseThrow(() -> newIllegalArgumentException(cause, "Port [%s] is not valid", port)); } }
java
public static int parsePort(String port, Integer defaultPort) { try { return Integer.parseInt(trim(port)); } catch (NumberFormatException cause) { return Optional.ofNullable(defaultPort) .orElseThrow(() -> newIllegalArgumentException(cause, "Port [%s] is not valid", port)); } }
[ "public", "static", "int", "parsePort", "(", "String", "port", ",", "Integer", "defaultPort", ")", "{", "try", "{", "return", "Integer", ".", "parseInt", "(", "trim", "(", "port", ")", ")", ";", "}", "catch", "(", "NumberFormatException", "cause", ")", "...
Parses the given {@link String} as a numeric port number. @param port {@link String} to parse as a numeric port number. @param defaultPort {@link Integer} value used as the default port number if the {@link String} port number is not valid. @return a numeric port number from the given {@link String}. @throws IllegalArgumentException if the {@link String} port number is not valid and {@code defaultPort} is {@literal null}. @see java.lang.Integer#parseInt(String)
[ "Parses", "the", "given", "{", "@link", "String", "}", "as", "a", "numeric", "port", "number", "." ]
train
https://github.com/codeprimate-software/cp-elements/blob/f2163c149fbbef05015e688132064ebcac7c49ab/src/main/java/org/cp/elements/net/NetworkUtils.java#L170-L178
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.addClosedListAsync
public Observable<UUID> addClosedListAsync(UUID appId, String versionId, ClosedListModelCreateObject closedListModelCreateObject) { return addClosedListWithServiceResponseAsync(appId, versionId, closedListModelCreateObject).map(new Func1<ServiceResponse<UUID>, UUID>() { @Override public UUID call(ServiceResponse<UUID> response) { return response.body(); } }); }
java
public Observable<UUID> addClosedListAsync(UUID appId, String versionId, ClosedListModelCreateObject closedListModelCreateObject) { return addClosedListWithServiceResponseAsync(appId, versionId, closedListModelCreateObject).map(new Func1<ServiceResponse<UUID>, UUID>() { @Override public UUID call(ServiceResponse<UUID> response) { return response.body(); } }); }
[ "public", "Observable", "<", "UUID", ">", "addClosedListAsync", "(", "UUID", "appId", ",", "String", "versionId", ",", "ClosedListModelCreateObject", "closedListModelCreateObject", ")", "{", "return", "addClosedListWithServiceResponseAsync", "(", "appId", ",", "versionId"...
Adds a closed list model to the application. @param appId The application ID. @param versionId The version ID. @param closedListModelCreateObject A model containing the name and words for the new closed list entity extractor. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the UUID object
[ "Adds", "a", "closed", "list", "model", "to", "the", "application", "." ]
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#L2025-L2032
pravega/pravega
common/src/main/java/io/pravega/common/function/Callbacks.java
Callbacks.invokeSafely
public static <T1, T2> void invokeSafely(BiConsumer<T1, T2> consumer, T1 argument1, T2 argument2, Consumer<Throwable> failureHandler) { Preconditions.checkNotNull(consumer, "consumer"); try { consumer.accept(argument1, argument2); } catch (Exception ex) { if (failureHandler != null) { invokeSafely(failureHandler, ex, null); } } }
java
public static <T1, T2> void invokeSafely(BiConsumer<T1, T2> consumer, T1 argument1, T2 argument2, Consumer<Throwable> failureHandler) { Preconditions.checkNotNull(consumer, "consumer"); try { consumer.accept(argument1, argument2); } catch (Exception ex) { if (failureHandler != null) { invokeSafely(failureHandler, ex, null); } } }
[ "public", "static", "<", "T1", ",", "T2", ">", "void", "invokeSafely", "(", "BiConsumer", "<", "T1", ",", "T2", ">", "consumer", ",", "T1", "argument1", ",", "T2", "argument2", ",", "Consumer", "<", "Throwable", ">", "failureHandler", ")", "{", "Precondi...
Invokes the given Consumer with the given argument, and catches any exceptions that it may throw. @param consumer The consumer to invoke. @param argument1 The first argument to pass to the consumer. @param argument2 The second argument to pass to the consumer. @param failureHandler An optional callback to invoke if the consumer threw any exceptions. @param <T1> The type of the first argument. @param <T2> The type of the second argument. @throws NullPointerException If the consumer is null.
[ "Invokes", "the", "given", "Consumer", "with", "the", "given", "argument", "and", "catches", "any", "exceptions", "that", "it", "may", "throw", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/function/Callbacks.java#L73-L83
redkale/redkale
src/org/redkale/util/ResourceFactory.java
ResourceFactory.register
public <A> A register(final boolean autoSync, final Class<? extends A> clazz, final A rs) { return register(autoSync, "", clazz, rs); }
java
public <A> A register(final boolean autoSync, final Class<? extends A> clazz, final A rs) { return register(autoSync, "", clazz, rs); }
[ "public", "<", "A", ">", "A", "register", "(", "final", "boolean", "autoSync", ",", "final", "Class", "<", "?", "extends", "A", ">", "clazz", ",", "final", "A", "rs", ")", "{", "return", "register", "(", "autoSync", ",", "\"\"", ",", "clazz", ",", ...
将对象指定类型且name=""注入到资源池中 @param <A> 泛型 @param autoSync 是否同步已被注入的资源 @param clazz 资源类型 @param rs 资源对象 @return 旧资源对象
[ "将对象指定类型且name", "=", "注入到资源池中" ]
train
https://github.com/redkale/redkale/blob/ea5169b5c5ea7412fd762331c0c497165832e901/src/org/redkale/util/ResourceFactory.java#L134-L136
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableResourceManager.java
TransactionableResourceManager.putSharedObject
public void putSharedObject(String key, Object value) { TransactionContext ctx = contexts.get(); if (ctx == null) { throw new IllegalStateException("There is no active transaction context"); } XidContext xidCtx = ctx.getXidContext(); if (xidCtx == null) { throw new IllegalStateException("There is no active xid context"); } xidCtx.putSharedObject(key, value); }
java
public void putSharedObject(String key, Object value) { TransactionContext ctx = contexts.get(); if (ctx == null) { throw new IllegalStateException("There is no active transaction context"); } XidContext xidCtx = ctx.getXidContext(); if (xidCtx == null) { throw new IllegalStateException("There is no active xid context"); } xidCtx.putSharedObject(key, value); }
[ "public", "void", "putSharedObject", "(", "String", "key", ",", "Object", "value", ")", "{", "TransactionContext", "ctx", "=", "contexts", ".", "get", "(", ")", ";", "if", "(", "ctx", "==", "null", ")", "{", "throw", "new", "IllegalStateException", "(", ...
Registers an object to be shared within the XidContext @param key the key of the shared object @param value the shared object
[ "Registers", "an", "object", "to", "be", "shared", "within", "the", "XidContext" ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/session/TransactionableResourceManager.java#L166-L179
nwillc/almost-functional
src/main/java/almost/functional/Stream.java
Stream.reduce
public <R> R reduce(final R initial, final BiFunction<R, ? super T, R> accumulator) { R returnValue = initial; while (iterator.hasNext()) { returnValue = accumulator.apply(returnValue, iterator.next()); } return returnValue; }
java
public <R> R reduce(final R initial, final BiFunction<R, ? super T, R> accumulator) { R returnValue = initial; while (iterator.hasNext()) { returnValue = accumulator.apply(returnValue, iterator.next()); } return returnValue; }
[ "public", "<", "R", ">", "R", "reduce", "(", "final", "R", "initial", ",", "final", "BiFunction", "<", "R", ",", "?", "super", "T", ",", "R", ">", "accumulator", ")", "{", "R", "returnValue", "=", "initial", ";", "while", "(", "iterator", ".", "has...
Performs a reduction on the elements of this stream, using the provided initial value and accumulation functions. @param initial the initial value @param accumulator the acummulation function @param <R> return type @return the result of the reduction
[ "Performs", "a", "reduction", "on", "the", "elements", "of", "this", "stream", "using", "the", "provided", "initial", "value", "and", "accumulation", "functions", "." ]
train
https://github.com/nwillc/almost-functional/blob/a6cc7c73b2be475ed1bce5128c24b2eb9c27d666/src/main/java/almost/functional/Stream.java#L117-L123
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/lss/LssClient.java
LssClient.createNotification
public CreateNotificationResponse createNotification(CreateNotificationRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getName(), "The parameter name should NOT be null or empty string."); checkStringNotEmpty(request.getEndpoint(), "The parameter endpoint should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, LIVE_NOTIFICATION); return invokeHttpClient(internalRequest, CreateNotificationResponse.class); }
java
public CreateNotificationResponse createNotification(CreateNotificationRequest request) { checkNotNull(request, "The parameter request should NOT be null."); checkStringNotEmpty(request.getName(), "The parameter name should NOT be null or empty string."); checkStringNotEmpty(request.getEndpoint(), "The parameter endpoint should NOT be null or empty string."); InternalRequest internalRequest = createRequest(HttpMethodName.POST, request, LIVE_NOTIFICATION); return invokeHttpClient(internalRequest, CreateNotificationResponse.class); }
[ "public", "CreateNotificationResponse", "createNotification", "(", "CreateNotificationRequest", "request", ")", "{", "checkNotNull", "(", "request", ",", "\"The parameter request should NOT be null.\"", ")", ";", "checkStringNotEmpty", "(", "request", ".", "getName", "(", "...
Create a live notification in the live stream service. @param request The request object containing all options for creating live notification. @return the response
[ "Create", "a", "live", "notification", "in", "the", "live", "stream", "service", "." ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/lss/LssClient.java#L1226-L1236
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java
CoverageDataCore.valueToPixelValue
private double valueToPixelValue(GriddedTile griddedTile, double value) { double pixelValue = value; if (griddedCoverage != null && griddedCoverage.getDataType() == GriddedCoverageDataType.INTEGER) { pixelValue -= griddedCoverage.getOffset(); pixelValue /= griddedCoverage.getScale(); if (griddedTile != null) { pixelValue -= griddedTile.getOffset(); pixelValue /= griddedTile.getScale(); } } return pixelValue; }
java
private double valueToPixelValue(GriddedTile griddedTile, double value) { double pixelValue = value; if (griddedCoverage != null && griddedCoverage.getDataType() == GriddedCoverageDataType.INTEGER) { pixelValue -= griddedCoverage.getOffset(); pixelValue /= griddedCoverage.getScale(); if (griddedTile != null) { pixelValue -= griddedTile.getOffset(); pixelValue /= griddedTile.getScale(); } } return pixelValue; }
[ "private", "double", "valueToPixelValue", "(", "GriddedTile", "griddedTile", ",", "double", "value", ")", "{", "double", "pixelValue", "=", "value", ";", "if", "(", "griddedCoverage", "!=", "null", "&&", "griddedCoverage", ".", "getDataType", "(", ")", "==", "...
Convert integer coverage typed coverage data value to a pixel value through offsets and scales @param griddedTile gridded tile @param value coverage data value @return pixel value
[ "Convert", "integer", "coverage", "typed", "coverage", "data", "value", "to", "a", "pixel", "value", "through", "offsets", "and", "scales" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/extension/coverage/CoverageDataCore.java#L1570-L1587
javers/javers
javers-core/src/main/java/org/javers/repository/jql/QueryBuilder.java
QueryBuilder.byValueObjectId
public static QueryBuilder byValueObjectId(Object ownerLocalId, Class ownerEntityClass, String path){ Validate.argumentsAreNotNull(ownerEntityClass, ownerLocalId, path); return new QueryBuilder(new IdFilterDefinition(ValueObjectIdDTO.valueObjectId(ownerLocalId, ownerEntityClass, path))); }
java
public static QueryBuilder byValueObjectId(Object ownerLocalId, Class ownerEntityClass, String path){ Validate.argumentsAreNotNull(ownerEntityClass, ownerLocalId, path); return new QueryBuilder(new IdFilterDefinition(ValueObjectIdDTO.valueObjectId(ownerLocalId, ownerEntityClass, path))); }
[ "public", "static", "QueryBuilder", "byValueObjectId", "(", "Object", "ownerLocalId", ",", "Class", "ownerEntityClass", ",", "String", "path", ")", "{", "Validate", ".", "argumentsAreNotNull", "(", "ownerEntityClass", ",", "ownerLocalId", ",", "path", ")", ";", "r...
Query for selecting changes (or snapshots) made on a concrete ValueObject (so a ValueObject owned by a concrete Entity instance). <br/><br/> <b>Path parameter</b> is a relative path from owning Entity instance to ValueObject that you are looking for. <br/><br/> When ValueObject is just <b>a property</b>, use propertyName. For example: <pre> class Employee { &#64;Id String name; Address primaryAddress; } ... javers.findChanges( QueryBuilder.byValueObjectId("bob", Employee.class, "primaryAddress").build() ); </pre> When ValueObject is stored in <b>a List</b>, use propertyName and list index separated by "/", for example: <pre> class Employee { &#64;Id String name; List&lt;Address&gt; addresses; } ... javers.findChanges( QueryBuilder.byValueObjectId("bob", Employee.class, "addresses/0").build() ); </pre> When ValueObject is stored as <b>a Map value</b>, use propertyName and map key separated by "/", for example: <pre> class Employee { &#64;Id String name; Map&lt;String,Address&gt; addressMap; } ... javers.findChanges( QueryBuilder.byValueObjectId("bob", Employee.class, "addressMap/HOME").build() ); </pre>
[ "Query", "for", "selecting", "changes", "(", "or", "snapshots", ")", "made", "on", "a", "concrete", "ValueObject", "(", "so", "a", "ValueObject", "owned", "by", "a", "concrete", "Entity", "instance", ")", ".", "<br", "/", ">", "<br", "/", ">" ]
train
https://github.com/javers/javers/blob/a51511be7d8bcee3e1812db8b7e69a45330b4e14/javers-core/src/main/java/org/javers/repository/jql/QueryBuilder.java#L174-L177
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/java/JavaUtil.java
JavaUtil.generateTypeJavadoc
public static String generateTypeJavadoc(final String indent, final Token typeToken) { final String description = typeToken.description(); if (null == description || description.isEmpty()) { return ""; } return indent + "/**\n" + indent + " * " + description + '\n' + indent + " */\n"; }
java
public static String generateTypeJavadoc(final String indent, final Token typeToken) { final String description = typeToken.description(); if (null == description || description.isEmpty()) { return ""; } return indent + "/**\n" + indent + " * " + description + '\n' + indent + " */\n"; }
[ "public", "static", "String", "generateTypeJavadoc", "(", "final", "String", "indent", ",", "final", "Token", "typeToken", ")", "{", "final", "String", "description", "=", "typeToken", ".", "description", "(", ")", ";", "if", "(", "null", "==", "description", ...
Generate the Javadoc comment header for a type. @param indent level for the comment. @param typeToken for the type. @return a string representation of the Javadoc comment.
[ "Generate", "the", "Javadoc", "comment", "header", "for", "a", "type", "." ]
train
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/java/JavaUtil.java#L259-L271
apache/incubator-zipkin
zipkin/src/main/java/zipkin2/internal/HexCodec.java
HexCodec.lowerHexToUnsignedLong
public static long lowerHexToUnsignedLong(String lowerHex, int index) { long result = 0; for (int endIndex = Math.min(index + 16, lowerHex.length()); index < endIndex; index++) { char c = lowerHex.charAt(index); result <<= 4; if (c >= '0' && c <= '9') { result |= c - '0'; } else if (c >= 'a' && c <= 'f') { result |= c - 'a' + 10; } else { throw isntLowerHexLong(lowerHex); } } return result; }
java
public static long lowerHexToUnsignedLong(String lowerHex, int index) { long result = 0; for (int endIndex = Math.min(index + 16, lowerHex.length()); index < endIndex; index++) { char c = lowerHex.charAt(index); result <<= 4; if (c >= '0' && c <= '9') { result |= c - '0'; } else if (c >= 'a' && c <= 'f') { result |= c - 'a' + 10; } else { throw isntLowerHexLong(lowerHex); } } return result; }
[ "public", "static", "long", "lowerHexToUnsignedLong", "(", "String", "lowerHex", ",", "int", "index", ")", "{", "long", "result", "=", "0", ";", "for", "(", "int", "endIndex", "=", "Math", ".", "min", "(", "index", "+", "16", ",", "lowerHex", ".", "len...
Parses a 16 character lower-hex string with no prefix into an unsigned long, starting at the spe index.
[ "Parses", "a", "16", "character", "lower", "-", "hex", "string", "with", "no", "prefix", "into", "an", "unsigned", "long", "starting", "at", "the", "spe", "index", "." ]
train
https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin/src/main/java/zipkin2/internal/HexCodec.java#L39-L53
raydac/java-binary-block-parser
jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java
JBBPOut.Bool
public JBBPOut Bool(final boolean value, final JBBPBitOrder bitOrder) throws IOException { assertNotEnded(); if (this.processCommands) { this.outStream.write(value ? bitOrder == JBBPBitOrder.MSB0 ? 0x80 : 1 : 0); } return this; }
java
public JBBPOut Bool(final boolean value, final JBBPBitOrder bitOrder) throws IOException { assertNotEnded(); if (this.processCommands) { this.outStream.write(value ? bitOrder == JBBPBitOrder.MSB0 ? 0x80 : 1 : 0); } return this; }
[ "public", "JBBPOut", "Bool", "(", "final", "boolean", "value", ",", "final", "JBBPBitOrder", "bitOrder", ")", "throws", "IOException", "{", "assertNotEnded", "(", ")", ";", "if", "(", "this", ".", "processCommands", ")", "{", "this", ".", "outStream", ".", ...
Write a boolean value into the session stream as a byte. @param value a boolean value to be written, true is 1, false is 0 @param bitOrder bit outOrder for saving data @return the DSL session @throws IOException it will be thrown for transport errors @since 1.1
[ "Write", "a", "boolean", "value", "into", "the", "session", "stream", "as", "a", "byte", "." ]
train
https://github.com/raydac/java-binary-block-parser/blob/6d98abcab01e0c72d525ebcc9e7b694f9ce49f5b/jbbp/src/main/java/com/igormaznitsa/jbbp/io/JBBPOut.java#L605-L611
Jasig/uPortal
uPortal-core/src/main/java/org/apereo/portal/properties/PropertiesManager.java
PropertiesManager.getPropertyAsDouble
public static double getPropertyAsDouble(String name) throws MissingPropertyException, BadPropertyException { if (PropertiesManager.props == null) loadProps(); try { return Double.parseDouble(getProperty(name)); } catch (NumberFormatException nfe) { throw new BadPropertyException(name, getProperty(name), "double"); } }
java
public static double getPropertyAsDouble(String name) throws MissingPropertyException, BadPropertyException { if (PropertiesManager.props == null) loadProps(); try { return Double.parseDouble(getProperty(name)); } catch (NumberFormatException nfe) { throw new BadPropertyException(name, getProperty(name), "double"); } }
[ "public", "static", "double", "getPropertyAsDouble", "(", "String", "name", ")", "throws", "MissingPropertyException", ",", "BadPropertyException", "{", "if", "(", "PropertiesManager", ".", "props", "==", "null", ")", "loadProps", "(", ")", ";", "try", "{", "ret...
Returns the value of a property for a given name as a <code>long</code> @param name the name of the requested property @return value the property's value as a <code>double</code> @throws MissingPropertyException - if the property has not been set @throws BadPropertyException - if the property cannot be parsed as a double or is not set.
[ "Returns", "the", "value", "of", "a", "property", "for", "a", "given", "name", "as", "a", "<code", ">", "long<", "/", "code", ">" ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-core/src/main/java/org/apereo/portal/properties/PropertiesManager.java#L291-L299
geomajas/geomajas-project-server
plugin/layer-hibernate/hibernate/src/main/java/org/geomajas/layer/hibernate/HibernateLayer.java
HibernateLayer.getBoundsLocal
private Envelope getBoundsLocal(Filter filter) throws LayerException { try { Session session = getSessionFactory().getCurrentSession(); Criteria criteria = session.createCriteria(getFeatureInfo().getDataSourceName()); CriteriaVisitor visitor = new CriteriaVisitor((HibernateFeatureModel) getFeatureModel(), dateFormat); Criterion c = (Criterion) filter.accept(visitor, criteria); if (c != null) { criteria.add(c); } criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); List<?> features = criteria.list(); Envelope bounds = new Envelope(); for (Object f : features) { Envelope geomBounds = getFeatureModel().getGeometry(f).getEnvelopeInternal(); if (!geomBounds.isNull()) { bounds.expandToInclude(geomBounds); } } return bounds; } catch (HibernateException he) { throw new HibernateLayerException(he, ExceptionCode.HIBERNATE_LOAD_FILTER_FAIL, getFeatureInfo() .getDataSourceName(), filter.toString()); } }
java
private Envelope getBoundsLocal(Filter filter) throws LayerException { try { Session session = getSessionFactory().getCurrentSession(); Criteria criteria = session.createCriteria(getFeatureInfo().getDataSourceName()); CriteriaVisitor visitor = new CriteriaVisitor((HibernateFeatureModel) getFeatureModel(), dateFormat); Criterion c = (Criterion) filter.accept(visitor, criteria); if (c != null) { criteria.add(c); } criteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); List<?> features = criteria.list(); Envelope bounds = new Envelope(); for (Object f : features) { Envelope geomBounds = getFeatureModel().getGeometry(f).getEnvelopeInternal(); if (!geomBounds.isNull()) { bounds.expandToInclude(geomBounds); } } return bounds; } catch (HibernateException he) { throw new HibernateLayerException(he, ExceptionCode.HIBERNATE_LOAD_FILTER_FAIL, getFeatureInfo() .getDataSourceName(), filter.toString()); } }
[ "private", "Envelope", "getBoundsLocal", "(", "Filter", "filter", ")", "throws", "LayerException", "{", "try", "{", "Session", "session", "=", "getSessionFactory", "(", ")", ".", "getCurrentSession", "(", ")", ";", "Criteria", "criteria", "=", "session", ".", ...
Bounds are calculated locally, can use any filter, but slower than native. @param filter filter which needs to be applied @return the bounds of the specified features @throws LayerException oops
[ "Bounds", "are", "calculated", "locally", "can", "use", "any", "filter", "but", "slower", "than", "native", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/plugin/layer-hibernate/hibernate/src/main/java/org/geomajas/layer/hibernate/HibernateLayer.java#L484-L507
couchbase/couchbase-java-client
src/main/java/com/couchbase/client/java/query/Index.java
Index.dropPrimaryIndex
public static UsingPath dropPrimaryIndex(String namespace, String keyspace) { return new DefaultDropPath().dropPrimary(namespace, keyspace); }
java
public static UsingPath dropPrimaryIndex(String namespace, String keyspace) { return new DefaultDropPath().dropPrimary(namespace, keyspace); }
[ "public", "static", "UsingPath", "dropPrimaryIndex", "(", "String", "namespace", ",", "String", "keyspace", ")", "{", "return", "new", "DefaultDropPath", "(", ")", ".", "dropPrimary", "(", "namespace", ",", "keyspace", ")", ";", "}" ]
Drop the primary index of the given namespace:keyspace. @param namespace the namespace prefix (will be escaped). @param keyspace the keyspace (bucket, will be escaped). @see #dropNamedPrimaryIndex(String, String, String) if the primary index name has been customized.
[ "Drop", "the", "primary", "index", "of", "the", "given", "namespace", ":", "keyspace", "." ]
train
https://github.com/couchbase/couchbase-java-client/blob/f36a0ee0c66923bdde47838ca543e50cbaa99e14/src/main/java/com/couchbase/client/java/query/Index.java#L106-L108
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/carts/ExtendedPropertyUrl.java
ExtendedPropertyUrl.updateExtendedPropertyUrl
public static MozuUrl updateExtendedPropertyUrl(String key, String responseFields, Boolean upsert) { UrlFormatter formatter = new UrlFormatter("/api/commerce/carts/current/extendedproperties/{key}?upsert={upsert}&responseFields={responseFields}"); formatter.formatUrl("key", key); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("upsert", upsert); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
java
public static MozuUrl updateExtendedPropertyUrl(String key, String responseFields, Boolean upsert) { UrlFormatter formatter = new UrlFormatter("/api/commerce/carts/current/extendedproperties/{key}?upsert={upsert}&responseFields={responseFields}"); formatter.formatUrl("key", key); formatter.formatUrl("responseFields", responseFields); formatter.formatUrl("upsert", upsert); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ; }
[ "public", "static", "MozuUrl", "updateExtendedPropertyUrl", "(", "String", "key", ",", "String", "responseFields", ",", "Boolean", "upsert", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/commerce/carts/current/extendedproperties/{key}?upser...
Get Resource Url for UpdateExtendedProperty @param key Key used for metadata defined for objects, including extensible attributes, custom attributes associated with a shipping provider, and search synonyms definitions. This content may be user-defined depending on the object and usage. @param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object. This parameter should only be used to retrieve data. Attempting to update data using this parameter may cause data loss. @param upsert Any set of key value pairs to be stored in the extended properties of a cart. @return String Resource Url
[ "Get", "Resource", "Url", "for", "UpdateExtendedProperty" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/commerce/carts/ExtendedPropertyUrl.java#L43-L50
op4j/op4j
src/main/java/org/op4j/functions/FnString.java
FnString.toShort
public static final Function<String,Short> toShort(final RoundingMode roundingMode, final Locale locale) { return new ToShort(roundingMode, locale); }
java
public static final Function<String,Short> toShort(final RoundingMode roundingMode, final Locale locale) { return new ToShort(roundingMode, locale); }
[ "public", "static", "final", "Function", "<", "String", ",", "Short", ">", "toShort", "(", "final", "RoundingMode", "roundingMode", ",", "final", "Locale", "locale", ")", "{", "return", "new", "ToShort", "(", "roundingMode", ",", "locale", ")", ";", "}" ]
<p> Converts a String into a Short, using the specified locale for determining decimal point. Rounding mode is used for removing the decimal part of the number. The integer part of the input string must be between {@link Short#MIN_VALUE} and {@link Short#MAX_VALUE} </p> @param roundingMode the rounding mode to be used when setting the scale @param locale the locale defining the way in which the number was written @return the resulting Short object
[ "<p", ">", "Converts", "a", "String", "into", "a", "Short", "using", "the", "specified", "locale", "for", "determining", "decimal", "point", ".", "Rounding", "mode", "is", "used", "for", "removing", "the", "decimal", "part", "of", "the", "number", ".", "Th...
train
https://github.com/op4j/op4j/blob/b577596dfe462089d3dd169666defc6de7ad289a/src/main/java/org/op4j/functions/FnString.java#L1104-L1106
graphhopper/graphhopper
core/src/main/java/com/graphhopper/util/GHUtility.java
GHUtility.sortDFS
public static Graph sortDFS(Graph g, Graph sortedGraph) { int nodes = g.getNodes(); final GHIntArrayList list = new GHIntArrayList(nodes); list.fill(nodes, -1); final GHBitSetImpl bitset = new GHBitSetImpl(nodes); final AtomicInteger ref = new AtomicInteger(-1); EdgeExplorer explorer = g.createEdgeExplorer(); for (int startNode = 0; startNode >= 0 && startNode < nodes; startNode = bitset.nextClear(startNode + 1)) { new DepthFirstSearch() { @Override protected GHBitSet createBitSet() { return bitset; } @Override protected boolean goFurther(int nodeId) { list.set(nodeId, ref.incrementAndGet()); return super.goFurther(nodeId); } }.start(explorer, startNode); } return createSortedGraph(g, sortedGraph, list); }
java
public static Graph sortDFS(Graph g, Graph sortedGraph) { int nodes = g.getNodes(); final GHIntArrayList list = new GHIntArrayList(nodes); list.fill(nodes, -1); final GHBitSetImpl bitset = new GHBitSetImpl(nodes); final AtomicInteger ref = new AtomicInteger(-1); EdgeExplorer explorer = g.createEdgeExplorer(); for (int startNode = 0; startNode >= 0 && startNode < nodes; startNode = bitset.nextClear(startNode + 1)) { new DepthFirstSearch() { @Override protected GHBitSet createBitSet() { return bitset; } @Override protected boolean goFurther(int nodeId) { list.set(nodeId, ref.incrementAndGet()); return super.goFurther(nodeId); } }.start(explorer, startNode); } return createSortedGraph(g, sortedGraph, list); }
[ "public", "static", "Graph", "sortDFS", "(", "Graph", "g", ",", "Graph", "sortedGraph", ")", "{", "int", "nodes", "=", "g", ".", "getNodes", "(", ")", ";", "final", "GHIntArrayList", "list", "=", "new", "GHIntArrayList", "(", "nodes", ")", ";", "list", ...
Sorts the graph according to depth-first search traversal. Other traversals have either no significant difference (bfs) for querying or are worse (z-curve).
[ "Sorts", "the", "graph", "according", "to", "depth", "-", "first", "search", "traversal", ".", "Other", "traversals", "have", "either", "no", "significant", "difference", "(", "bfs", ")", "for", "querying", "or", "are", "worse", "(", "z", "-", "curve", ")"...
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/util/GHUtility.java#L308-L331
deeplearning4j/deeplearning4j
datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/BaseSerializer.java
BaseSerializer.deserializeDataActionList
public List<DataAction> deserializeDataActionList(String str) { return load(str, ListWrappers.DataActionList.class).getList(); }
java
public List<DataAction> deserializeDataActionList(String str) { return load(str, ListWrappers.DataActionList.class).getList(); }
[ "public", "List", "<", "DataAction", ">", "deserializeDataActionList", "(", "String", "str", ")", "{", "return", "load", "(", "str", ",", "ListWrappers", ".", "DataActionList", ".", "class", ")", ".", "getList", "(", ")", ";", "}" ]
Deserialize a DataAction List serialized using {@link #serializeDataActionList(List)}, or an array serialized using {@link #serialize(DataAction[])} @param str String representation (YAML/JSON) of the DataAction list @return {@code List<DataAction>}
[ "Deserialize", "a", "DataAction", "List", "serialized", "using", "{", "@link", "#serializeDataActionList", "(", "List", ")", "}", "or", "an", "array", "serialized", "using", "{", "@link", "#serialize", "(", "DataAction", "[]", ")", "}" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-api/src/main/java/org/datavec/api/transform/serde/BaseSerializer.java#L333-L335
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLEquivalentObjectPropertiesAxiomImpl_CustomFieldSerializer.java
OWLEquivalentObjectPropertiesAxiomImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLEquivalentObjectPropertiesAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLEquivalentObjectPropertiesAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLEquivalentObjectPropertiesAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";"...
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLEquivalentObjectPropertiesAxiomImpl_CustomFieldSerializer.java#L96-L99
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java
XPathParser.errorForDOM3
void errorForDOM3(String msg, Object[] args) throws TransformerException { String fmsg = XSLMessages.createXPATHMessage(msg, args); ErrorListener ehandler = this.getErrorListener(); TransformerException te = new XPathStylesheetDOM3Exception(fmsg, m_sourceLocator); if (null != ehandler) { // TO DO: Need to get stylesheet Locator from here. ehandler.fatalError(te); } else { // System.err.println(fmsg); throw te; } }
java
void errorForDOM3(String msg, Object[] args) throws TransformerException { String fmsg = XSLMessages.createXPATHMessage(msg, args); ErrorListener ehandler = this.getErrorListener(); TransformerException te = new XPathStylesheetDOM3Exception(fmsg, m_sourceLocator); if (null != ehandler) { // TO DO: Need to get stylesheet Locator from here. ehandler.fatalError(te); } else { // System.err.println(fmsg); throw te; } }
[ "void", "errorForDOM3", "(", "String", "msg", ",", "Object", "[", "]", "args", ")", "throws", "TransformerException", "{", "String", "fmsg", "=", "XSLMessages", ".", "createXPATHMessage", "(", "msg", ",", "args", ")", ";", "ErrorListener", "ehandler", "=", "...
This method is added to support DOM 3 XPath API. <p> This method is exactly like error(String, Object[]); except that the underlying TransformerException is XpathStylesheetDOM3Exception (which extends TransformerException). <p> So older XPath code in Xalan is not affected by this. To older XPath code the behavior of whether error() or errorForDOM3() is called because it is always catching TransformerException objects and is oblivious to the new subclass of XPathStylesheetDOM3Exception. Older XPath code runs as before. <p> However, newer DOM3 XPath code upon catching a TransformerException can can check if the exception is an instance of XPathStylesheetDOM3Exception and take appropriate action. @param msg An error msgkey that corresponds to one of the constants found in {@link org.apache.xpath.res.XPATHErrorResources}, which is a key for a format string. @param args An array of arguments represented in the format string, which may be null. @throws TransformerException if the current ErrorListoner determines to throw an exception.
[ "This", "method", "is", "added", "to", "support", "DOM", "3", "XPath", "API", ".", "<p", ">", "This", "method", "is", "exactly", "like", "error", "(", "String", "Object", "[]", ")", ";", "except", "that", "the", "underlying", "TransformerException", "is", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java#L649-L666
Steveice10/OpenNBT
src/main/java/com/github/steveice10/opennbt/NBTIO.java
NBTIO.writeFile
public static void writeFile(CompoundTag tag, String path, boolean compressed, boolean littleEndian) throws IOException { writeFile(tag, new File(path), compressed, littleEndian); }
java
public static void writeFile(CompoundTag tag, String path, boolean compressed, boolean littleEndian) throws IOException { writeFile(tag, new File(path), compressed, littleEndian); }
[ "public", "static", "void", "writeFile", "(", "CompoundTag", "tag", ",", "String", "path", ",", "boolean", "compressed", ",", "boolean", "littleEndian", ")", "throws", "IOException", "{", "writeFile", "(", "tag", ",", "new", "File", "(", "path", ")", ",", ...
Writes the given root CompoundTag to the given file. @param tag Tag to write. @param path Path to write to. @param compressed Whether the NBT file should be compressed. @param littleEndian Whether to write little endian NBT. @throws java.io.IOException If an I/O error occurs.
[ "Writes", "the", "given", "root", "CompoundTag", "to", "the", "given", "file", "." ]
train
https://github.com/Steveice10/OpenNBT/blob/9bf4adb2afd206a21bc4309c85d642494d1fb536/src/main/java/com/github/steveice10/opennbt/NBTIO.java#L117-L119
ops4j/org.ops4j.pax.logging
pax-logging-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java
AbstractLogger.checkMessageFactory
public static void checkMessageFactory(final ExtendedLogger logger, final MessageFactory messageFactory) { final String name = logger.getName(); final MessageFactory loggerMessageFactory = logger.getMessageFactory(); if (messageFactory != null && !loggerMessageFactory.equals(messageFactory)) { StatusLogger.getLogger().warn( "The Logger {} was created with the message factory {} and is now requested with the " + "message factory {}, which may create log events with unexpected formatting.", name, loggerMessageFactory, messageFactory); } else if (messageFactory == null && !loggerMessageFactory.getClass().equals(DEFAULT_MESSAGE_FACTORY_CLASS)) { StatusLogger .getLogger() .warn("The Logger {} was created with the message factory {} and is now requested with a null " + "message factory (defaults to {}), which may create log events with unexpected " + "formatting.", name, loggerMessageFactory, DEFAULT_MESSAGE_FACTORY_CLASS.getName()); } }
java
public static void checkMessageFactory(final ExtendedLogger logger, final MessageFactory messageFactory) { final String name = logger.getName(); final MessageFactory loggerMessageFactory = logger.getMessageFactory(); if (messageFactory != null && !loggerMessageFactory.equals(messageFactory)) { StatusLogger.getLogger().warn( "The Logger {} was created with the message factory {} and is now requested with the " + "message factory {}, which may create log events with unexpected formatting.", name, loggerMessageFactory, messageFactory); } else if (messageFactory == null && !loggerMessageFactory.getClass().equals(DEFAULT_MESSAGE_FACTORY_CLASS)) { StatusLogger .getLogger() .warn("The Logger {} was created with the message factory {} and is now requested with a null " + "message factory (defaults to {}), which may create log events with unexpected " + "formatting.", name, loggerMessageFactory, DEFAULT_MESSAGE_FACTORY_CLASS.getName()); } }
[ "public", "static", "void", "checkMessageFactory", "(", "final", "ExtendedLogger", "logger", ",", "final", "MessageFactory", "messageFactory", ")", "{", "final", "String", "name", "=", "logger", ".", "getName", "(", ")", ";", "final", "MessageFactory", "loggerMess...
Checks that the message factory a logger was created with is the same as the given messageFactory. If they are different log a warning to the {@linkplain StatusLogger}. A null MessageFactory translates to the default MessageFactory {@link #DEFAULT_MESSAGE_FACTORY_CLASS}. @param logger The logger to check @param messageFactory The message factory to check.
[ "Checks", "that", "the", "message", "factory", "a", "logger", "was", "created", "with", "is", "the", "same", "as", "the", "given", "messageFactory", ".", "If", "they", "are", "different", "log", "a", "warning", "to", "the", "{", "@linkplain", "StatusLogger",...
train
https://github.com/ops4j/org.ops4j.pax.logging/blob/493de4e1db4fe9f981f3dd78b8e40e5bf2b2e59d/pax-logging-api/src/main/java/org/apache/logging/log4j/spi/AbstractLogger.java#L146-L162
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/BorderLayoutRenderer.java
BorderLayoutRenderer.getConstraints
private static BorderLayoutConstraint getConstraints(final WPanel panel, final WComponent child) { Object constraints = panel.getLayoutConstraints(child); if (constraints instanceof BorderLayoutConstraint) { return (BorderLayoutConstraint) constraints; } else if (constraints == null) { return BorderLayout.CENTER; } else { throw new IllegalStateException("Constraint must be a BorderLayoutConstraint"); } }
java
private static BorderLayoutConstraint getConstraints(final WPanel panel, final WComponent child) { Object constraints = panel.getLayoutConstraints(child); if (constraints instanceof BorderLayoutConstraint) { return (BorderLayoutConstraint) constraints; } else if (constraints == null) { return BorderLayout.CENTER; } else { throw new IllegalStateException("Constraint must be a BorderLayoutConstraint"); } }
[ "private", "static", "BorderLayoutConstraint", "getConstraints", "(", "final", "WPanel", "panel", ",", "final", "WComponent", "child", ")", "{", "Object", "constraints", "=", "panel", ".", "getLayoutConstraints", "(", "child", ")", ";", "if", "(", "constraints", ...
Retrieves the layout constraint for the given component. If the constraint is incorrectly configured, an {@link IllegalStateException} will be thrown. @param panel the panel which contains the child @param child the component to retrieve the constraint for. @return the layout constraint for the given component.
[ "Retrieves", "the", "layout", "constraint", "for", "the", "given", "component", ".", "If", "the", "constraint", "is", "incorrectly", "configured", "an", "{", "@link", "IllegalStateException", "}", "will", "be", "thrown", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/BorderLayoutRenderer.java#L131-L141
census-instrumentation/opencensus-java
api/src/main/java/io/opencensus/resource/Resource.java
Resource.create
public static Resource create(@Nullable String type, Map<String, String> labels) { return createInternal( type, Collections.unmodifiableMap( new LinkedHashMap<String, String>(Utils.checkNotNull(labels, "labels")))); }
java
public static Resource create(@Nullable String type, Map<String, String> labels) { return createInternal( type, Collections.unmodifiableMap( new LinkedHashMap<String, String>(Utils.checkNotNull(labels, "labels")))); }
[ "public", "static", "Resource", "create", "(", "@", "Nullable", "String", "type", ",", "Map", "<", "String", ",", "String", ">", "labels", ")", "{", "return", "createInternal", "(", "type", ",", "Collections", ".", "unmodifiableMap", "(", "new", "LinkedHashM...
Returns a {@link Resource}. @param type the type identifier for the resource. @param labels a map of labels that describe the resource. @return a {@code Resource}. @throws NullPointerException if {@code labels} is null. @throws IllegalArgumentException if type or label key or label value is not a valid printable ASCII string or exceed {@link #MAX_LENGTH} characters. @since 0.18
[ "Returns", "a", "{", "@link", "Resource", "}", "." ]
train
https://github.com/census-instrumentation/opencensus-java/blob/deefac9bed77e40a2297bff1ca5ec5aa48a5f755/api/src/main/java/io/opencensus/resource/Resource.java#L104-L109
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_quotaHistory_GET
public ArrayList<Long> serviceName_quotaHistory_GET(String serviceName, Date historizedDate_from, Date historizedDate_to, String zone) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/quotaHistory"; StringBuilder sb = path(qPath, serviceName); query(sb, "historizedDate.from", historizedDate_from); query(sb, "historizedDate.to", historizedDate_to); query(sb, "zone", zone); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
java
public ArrayList<Long> serviceName_quotaHistory_GET(String serviceName, Date historizedDate_from, Date historizedDate_to, String zone) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/quotaHistory"; StringBuilder sb = path(qPath, serviceName); query(sb, "historizedDate.from", historizedDate_from); query(sb, "historizedDate.to", historizedDate_to); query(sb, "zone", zone); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t2); }
[ "public", "ArrayList", "<", "Long", ">", "serviceName_quotaHistory_GET", "(", "String", "serviceName", ",", "Date", "historizedDate_from", ",", "Date", "historizedDate_to", ",", "String", "zone", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ipLoadb...
Quota history informations, per month REST: GET /ipLoadbalancing/{serviceName}/quotaHistory @param zone [required] Filter the value of zone property (=) @param historizedDate_to [required] Filter the value of historizedDate property (<=) @param historizedDate_from [required] Filter the value of historizedDate property (>=) @param serviceName [required] The internal name of your IP load balancing
[ "Quota", "history", "informations", "per", "month" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L567-L575
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BiologicalAssemblyBuilder.java
BiologicalAssemblyBuilder.orderTransformationsByChainId
private void orderTransformationsByChainId(Structure asymUnit, List<BiologicalAssemblyTransformation> transformations) { final List<String> chainIds = getChainIds(asymUnit); Collections.sort(transformations, new Comparator<BiologicalAssemblyTransformation>() { @Override public int compare(BiologicalAssemblyTransformation t1, BiologicalAssemblyTransformation t2) { // set sort order only if the two ids are identical if (t1.getId().equals(t2.getId())) { return chainIds.indexOf(t1.getChainId()) - chainIds.indexOf(t2.getChainId()); } else { return t1.getId().compareTo(t2.getId()); } } }); }
java
private void orderTransformationsByChainId(Structure asymUnit, List<BiologicalAssemblyTransformation> transformations) { final List<String> chainIds = getChainIds(asymUnit); Collections.sort(transformations, new Comparator<BiologicalAssemblyTransformation>() { @Override public int compare(BiologicalAssemblyTransformation t1, BiologicalAssemblyTransformation t2) { // set sort order only if the two ids are identical if (t1.getId().equals(t2.getId())) { return chainIds.indexOf(t1.getChainId()) - chainIds.indexOf(t2.getChainId()); } else { return t1.getId().compareTo(t2.getId()); } } }); }
[ "private", "void", "orderTransformationsByChainId", "(", "Structure", "asymUnit", ",", "List", "<", "BiologicalAssemblyTransformation", ">", "transformations", ")", "{", "final", "List", "<", "String", ">", "chainIds", "=", "getChainIds", "(", "asymUnit", ")", ";", ...
Orders model transformations by chain ids in the same order as in the asymmetric unit @param asymUnit @param transformations
[ "Orders", "model", "transformations", "by", "chain", "ids", "in", "the", "same", "order", "as", "in", "the", "asymmetric", "unit" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/quaternary/BiologicalAssemblyBuilder.java#L165-L178
facebookarchive/hadoop-20
src/mapred/org/apache/hadoop/mapred/TaskRunner.java
TaskRunner.addJobJarToClassPath
private void addJobJarToClassPath(String localJarFile, StringBuffer classPath) { File jobCacheDir = new File (new Path(localJarFile).getParent().toString()); File[] libs = new File(jobCacheDir, "lib").listFiles(); String sep = System.getProperty("path.separator"); if (libs != null) { for (int i = 0; i < libs.length; i++) { classPath.append(sep); // add libs from jar to classpath classPath.append(libs[i]); } } classPath.append(sep); classPath.append(new File(jobCacheDir, "classes")); classPath.append(sep); classPath.append(jobCacheDir); }
java
private void addJobJarToClassPath(String localJarFile, StringBuffer classPath) { File jobCacheDir = new File (new Path(localJarFile).getParent().toString()); File[] libs = new File(jobCacheDir, "lib").listFiles(); String sep = System.getProperty("path.separator"); if (libs != null) { for (int i = 0; i < libs.length; i++) { classPath.append(sep); // add libs from jar to classpath classPath.append(libs[i]); } } classPath.append(sep); classPath.append(new File(jobCacheDir, "classes")); classPath.append(sep); classPath.append(jobCacheDir); }
[ "private", "void", "addJobJarToClassPath", "(", "String", "localJarFile", ",", "StringBuffer", "classPath", ")", "{", "File", "jobCacheDir", "=", "new", "File", "(", "new", "Path", "(", "localJarFile", ")", ".", "getParent", "(", ")", ".", "toString", "(", "...
Given the path to the localized job jar file, add it's constituents to the classpath
[ "Given", "the", "path", "to", "the", "localized", "job", "jar", "file", "add", "it", "s", "constituents", "to", "the", "classpath" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskRunner.java#L223-L239
andkulikov/Transitions-Everywhere
library(1.x)/src/main/java/com/transitionseverywhere/Scene.java
Scene.setCurrentScene
static void setCurrentScene(@NonNull View view, @Nullable Scene scene) { view.setTag(R.id.current_scene, scene); }
java
static void setCurrentScene(@NonNull View view, @Nullable Scene scene) { view.setTag(R.id.current_scene, scene); }
[ "static", "void", "setCurrentScene", "(", "@", "NonNull", "View", "view", ",", "@", "Nullable", "Scene", "scene", ")", "{", "view", ".", "setTag", "(", "R", ".", "id", ".", "current_scene", ",", "scene", ")", ";", "}" ]
Set the scene that the given view is in. The current scene is set only on the root view of a scene, not for every view in that hierarchy. This information is used by Scene to determine whether there is a previous scene which should be exited before the new scene is entered. @param view The view on which the current scene is being set
[ "Set", "the", "scene", "that", "the", "given", "view", "is", "in", ".", "The", "current", "scene", "is", "set", "only", "on", "the", "root", "view", "of", "a", "scene", "not", "for", "every", "view", "in", "that", "hierarchy", ".", "This", "information...
train
https://github.com/andkulikov/Transitions-Everywhere/blob/828efe5f152a2f05e2bfeee6254b74ad2269d4f1/library(1.x)/src/main/java/com/transitionseverywhere/Scene.java#L203-L205
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/shared/BaseSharedTable.java
BaseSharedTable.addListener
public void addListener(Record record, FileListener listener) { super.addListener(record, listener); if (listener.getOwner() == this.getRecord()) // Only replicate listeners added to base. { Iterator<BaseTable> iterator = this.getTables(); while (iterator.hasNext()) { BaseTable table = iterator.next(); if ((table != null) && (table != this.getNextTable())) { FileListener newBehavior = null; // Clone the file behaviors try { newBehavior = (FileListener)listener.clone(); // Clone the file behaviors } catch (CloneNotSupportedException ex) { newBehavior = null; } record = table.getRecord(); if (newBehavior != null) table.addListener(record, newBehavior); // Add them to the new query } } } }
java
public void addListener(Record record, FileListener listener) { super.addListener(record, listener); if (listener.getOwner() == this.getRecord()) // Only replicate listeners added to base. { Iterator<BaseTable> iterator = this.getTables(); while (iterator.hasNext()) { BaseTable table = iterator.next(); if ((table != null) && (table != this.getNextTable())) { FileListener newBehavior = null; // Clone the file behaviors try { newBehavior = (FileListener)listener.clone(); // Clone the file behaviors } catch (CloneNotSupportedException ex) { newBehavior = null; } record = table.getRecord(); if (newBehavior != null) table.addListener(record, newBehavior); // Add them to the new query } } } }
[ "public", "void", "addListener", "(", "Record", "record", ",", "FileListener", "listener", ")", "{", "super", ".", "addListener", "(", "record", ",", "listener", ")", ";", "if", "(", "listener", ".", "getOwner", "(", ")", "==", "this", ".", "getRecord", ...
Add a listener to the chain. The listener must be cloned and added to all records on the list. @param listener The listener to add.
[ "Add", "a", "listener", "to", "the", "chain", ".", "The", "listener", "must", "be", "cloned", "and", "added", "to", "all", "records", "on", "the", "list", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/shared/BaseSharedTable.java#L112-L135
CloudSlang/cs-actions
cs-database/src/main/java/io/cloudslang/content/database/services/dbconnection/DBConnectionManager.java
DBConnectionManager.getPropIntValue
protected int getPropIntValue(String aPropName, String aDefaultValue) { int retValue; String temp = dbPoolingProperties.getProperty(aPropName, aDefaultValue); retValue = Integer.valueOf(temp); return retValue; }
java
protected int getPropIntValue(String aPropName, String aDefaultValue) { int retValue; String temp = dbPoolingProperties.getProperty(aPropName, aDefaultValue); retValue = Integer.valueOf(temp); return retValue; }
[ "protected", "int", "getPropIntValue", "(", "String", "aPropName", ",", "String", "aDefaultValue", ")", "{", "int", "retValue", ";", "String", "temp", "=", "dbPoolingProperties", ".", "getProperty", "(", "aPropName", ",", "aDefaultValue", ")", ";", "retValue", "...
get int value based on the property name from property file the property file is databasePooling.properties @param aPropName a property name @param aDefaultValue a default value for that property, if the property is not there. @return int value of that property
[ "get", "int", "value", "based", "on", "the", "property", "name", "from", "property", "file", "the", "property", "file", "is", "databasePooling", ".", "properties" ]
train
https://github.com/CloudSlang/cs-actions/blob/9a1be1e99ad88286a6c153d5f2275df6ae1a57a1/cs-database/src/main/java/io/cloudslang/content/database/services/dbconnection/DBConnectionManager.java#L358-L365
ben-manes/caffeine
simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/membership/bloom/BloomFilter.java
BloomFilter.ensureCapacity
void ensureCapacity(@NonNegative long expectedInsertions, @NonNegative double fpp) { checkArgument(expectedInsertions >= 0); checkArgument(fpp > 0 && fpp < 1); double optimalBitsFactor = -Math.log(fpp) / (Math.log(2) * Math.log(2)); int optimalNumberOfBits = (int) (expectedInsertions * optimalBitsFactor); int optimalSize = optimalNumberOfBits >>> BITS_PER_LONG_SHIFT; if ((table != null) && (table.length >= optimalSize)) { return; } else if (optimalSize == 0) { tableShift = Integer.SIZE - 1; table = new long[1]; } else { int powerOfTwoShift = Integer.SIZE - Integer.numberOfLeadingZeros(optimalSize - 1); tableShift = Integer.SIZE - powerOfTwoShift; table = new long[1 << powerOfTwoShift]; } }
java
void ensureCapacity(@NonNegative long expectedInsertions, @NonNegative double fpp) { checkArgument(expectedInsertions >= 0); checkArgument(fpp > 0 && fpp < 1); double optimalBitsFactor = -Math.log(fpp) / (Math.log(2) * Math.log(2)); int optimalNumberOfBits = (int) (expectedInsertions * optimalBitsFactor); int optimalSize = optimalNumberOfBits >>> BITS_PER_LONG_SHIFT; if ((table != null) && (table.length >= optimalSize)) { return; } else if (optimalSize == 0) { tableShift = Integer.SIZE - 1; table = new long[1]; } else { int powerOfTwoShift = Integer.SIZE - Integer.numberOfLeadingZeros(optimalSize - 1); tableShift = Integer.SIZE - powerOfTwoShift; table = new long[1 << powerOfTwoShift]; } }
[ "void", "ensureCapacity", "(", "@", "NonNegative", "long", "expectedInsertions", ",", "@", "NonNegative", "double", "fpp", ")", "{", "checkArgument", "(", "expectedInsertions", ">=", "0", ")", ";", "checkArgument", "(", "fpp", ">", "0", "&&", "fpp", "<", "1"...
Initializes and increases the capacity of this <tt>BloomFilter</tt> instance, if necessary, to ensure that it can accurately estimate the membership of elements given the expected number of insertions. This operation forgets all previous memberships when resizing. @param expectedInsertions the number of expected insertions @param fpp the false positive probability, where 0.0 > fpp < 1.0
[ "Initializes", "and", "increases", "the", "capacity", "of", "this", "<tt", ">", "BloomFilter<", "/", "tt", ">", "instance", "if", "necessary", "to", "ensure", "that", "it", "can", "accurately", "estimate", "the", "membership", "of", "elements", "given", "the",...
train
https://github.com/ben-manes/caffeine/blob/4cf6d6e6a18ea2e8088f166261e5949343b0f2eb/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/membership/bloom/BloomFilter.java#L63-L80
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.setSasDefinitionAsync
public Observable<SasDefinitionBundle> setSasDefinitionAsync(String vaultBaseUrl, String storageAccountName, String sasDefinitionName, String templateUri, SasTokenType sasType, String validityPeriod) { return setSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName, templateUri, sasType, validityPeriod).map(new Func1<ServiceResponse<SasDefinitionBundle>, SasDefinitionBundle>() { @Override public SasDefinitionBundle call(ServiceResponse<SasDefinitionBundle> response) { return response.body(); } }); }
java
public Observable<SasDefinitionBundle> setSasDefinitionAsync(String vaultBaseUrl, String storageAccountName, String sasDefinitionName, String templateUri, SasTokenType sasType, String validityPeriod) { return setSasDefinitionWithServiceResponseAsync(vaultBaseUrl, storageAccountName, sasDefinitionName, templateUri, sasType, validityPeriod).map(new Func1<ServiceResponse<SasDefinitionBundle>, SasDefinitionBundle>() { @Override public SasDefinitionBundle call(ServiceResponse<SasDefinitionBundle> response) { return response.body(); } }); }
[ "public", "Observable", "<", "SasDefinitionBundle", ">", "setSasDefinitionAsync", "(", "String", "vaultBaseUrl", ",", "String", "storageAccountName", ",", "String", "sasDefinitionName", ",", "String", "templateUri", ",", "SasTokenType", "sasType", ",", "String", "validi...
Creates or updates a new SAS definition for the specified storage account. This operation requires the storage/setsas permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param storageAccountName The name of the storage account. @param sasDefinitionName The name of the SAS definition. @param templateUri The SAS definition token template signed with an arbitrary key. Tokens created according to the SAS definition will have the same properties as the template. @param sasType The type of SAS token the SAS definition will create. Possible values include: 'account', 'service' @param validityPeriod The validity period of SAS tokens created according to the SAS definition. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the SasDefinitionBundle object
[ "Creates", "or", "updates", "a", "new", "SAS", "definition", "for", "the", "specified", "storage", "account", ".", "This", "operation", "requires", "the", "storage", "/", "setsas", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L11287-L11294
neo4j/license-maven-plugin
src/main/java/com/google/code/mojo/license/util/resource/ResourceFinder.java
ResourceFinder.findResource
public URL findResource(String resource) throws MojoFailureException { // first search relatively to the base directory URL res = toURL(new File(basedir, resource)); if (res != null) { return res; } // if not found, search for absolute location on file system, or relative to execution dir res = toURL(new File(resource)); if (res != null) { return res; } // if not found, try the classpaths String cpResource = resource.startsWith("/") ? resource.substring(1) : resource; // tries compile claspath of projet res = compileClassPath.getResource(cpResource); if (res != null) { return res; } // tries this plugin classpath res = pluginClassPath.getResource(cpResource); if (res != null) { return res; } // otherwise, tries to return a valid URL try { res = new URL(resource); res.openStream().close(); return res; } catch (Exception e) { throw new MojoFailureException("Resource " + resource + " not found in file system, classpath or URL: " + e.getMessage(), e); } }
java
public URL findResource(String resource) throws MojoFailureException { // first search relatively to the base directory URL res = toURL(new File(basedir, resource)); if (res != null) { return res; } // if not found, search for absolute location on file system, or relative to execution dir res = toURL(new File(resource)); if (res != null) { return res; } // if not found, try the classpaths String cpResource = resource.startsWith("/") ? resource.substring(1) : resource; // tries compile claspath of projet res = compileClassPath.getResource(cpResource); if (res != null) { return res; } // tries this plugin classpath res = pluginClassPath.getResource(cpResource); if (res != null) { return res; } // otherwise, tries to return a valid URL try { res = new URL(resource); res.openStream().close(); return res; } catch (Exception e) { throw new MojoFailureException("Resource " + resource + " not found in file system, classpath or URL: " + e.getMessage(), e); } }
[ "public", "URL", "findResource", "(", "String", "resource", ")", "throws", "MojoFailureException", "{", "// first search relatively to the base directory\r", "URL", "res", "=", "toURL", "(", "new", "File", "(", "basedir", ",", "resource", ")", ")", ";", "if", "(",...
Find a resource by searching:<br/> 1. In the filesystem, relative to basedir<br/> 2. In the filesystem, as an absolute path (or relative to current execution directory)<br/> 3. In project classpath<br/> 4. In plugin classpath<br/> 5. As a URL @param resource The resource to get @return A valid URL @throws MojoFailureException If the resource is not found
[ "Find", "a", "resource", "by", "searching", ":", "<br", "/", ">", "1", ".", "In", "the", "filesystem", "relative", "to", "basedir<br", "/", ">", "2", ".", "In", "the", "filesystem", "as", "an", "absolute", "path", "(", "or", "relative", "to", "current"...
train
https://github.com/neo4j/license-maven-plugin/blob/2850cc6809820f15458400e687de2c84099a49c2/src/main/java/com/google/code/mojo/license/util/resource/ResourceFinder.java#L64-L101
google/closure-compiler
src/com/google/javascript/rhino/jstype/RecordTypeBuilder.java
RecordTypeBuilder.addProperty
public RecordTypeBuilder addProperty(String name, JSType type, Node propertyNode) { isEmpty = false; properties.put(name, new RecordProperty(type, propertyNode)); return this; }
java
public RecordTypeBuilder addProperty(String name, JSType type, Node propertyNode) { isEmpty = false; properties.put(name, new RecordProperty(type, propertyNode)); return this; }
[ "public", "RecordTypeBuilder", "addProperty", "(", "String", "name", ",", "JSType", "type", ",", "Node", "propertyNode", ")", "{", "isEmpty", "=", "false", ";", "properties", ".", "put", "(", "name", ",", "new", "RecordProperty", "(", "type", ",", "propertyN...
Adds a property with the given name and type to the record type. If you add a property that has already been added, then {@link #build} will fail. @param name the name of the new property @param type the JSType of the new property @param propertyNode the node that holds this property definition @return The builder itself for chaining purposes.
[ "Adds", "a", "property", "with", "the", "given", "name", "and", "type", "to", "the", "record", "type", ".", "If", "you", "add", "a", "property", "that", "has", "already", "been", "added", "then", "{", "@link", "#build", "}", "will", "fail", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/rhino/jstype/RecordTypeBuilder.java#L75-L79
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlModifyBuilder.java
SqlModifyBuilder.generateSQL
public static void generateSQL(final SQLiteModelMethod method, MethodSpec.Builder methodBuilder) { JQLChecker jqlChecker = JQLChecker.getInstance(); methodBuilder.addCode("\n// generate sql\n"); String sql = jqlChecker.replace(method, method.jql, new JQLReplacerListenerImpl(method) { @Override public String onColumnNameToUpdate(String columnName) { // only entity's columns return currentEntity.findPropertyByName(columnName).columnName; } @Override public String onColumnName(String columnName) { return currentSchema.findColumnNameByPropertyName(method, columnName); } @Override public String onBindParameter(String bindParameterName, boolean inStatement) { return "?"; } }); if (method.jql.dynamicReplace.containsKey(JQLDynamicStatementType.DYNAMIC_WHERE)) { methodBuilder.addStatement("String _sql=String.format($S, $L)", sql.replace(method.jql.dynamicReplace.get(JQLDynamicStatementType.DYNAMIC_WHERE), "%s"), "StringUtils.ifNotEmptyAppend(_sqlDynamicWhere,\" AND \")"); } else { methodBuilder.addStatement("String _sql=$S", sql); } }
java
public static void generateSQL(final SQLiteModelMethod method, MethodSpec.Builder methodBuilder) { JQLChecker jqlChecker = JQLChecker.getInstance(); methodBuilder.addCode("\n// generate sql\n"); String sql = jqlChecker.replace(method, method.jql, new JQLReplacerListenerImpl(method) { @Override public String onColumnNameToUpdate(String columnName) { // only entity's columns return currentEntity.findPropertyByName(columnName).columnName; } @Override public String onColumnName(String columnName) { return currentSchema.findColumnNameByPropertyName(method, columnName); } @Override public String onBindParameter(String bindParameterName, boolean inStatement) { return "?"; } }); if (method.jql.dynamicReplace.containsKey(JQLDynamicStatementType.DYNAMIC_WHERE)) { methodBuilder.addStatement("String _sql=String.format($S, $L)", sql.replace(method.jql.dynamicReplace.get(JQLDynamicStatementType.DYNAMIC_WHERE), "%s"), "StringUtils.ifNotEmptyAppend(_sqlDynamicWhere,\" AND \")"); } else { methodBuilder.addStatement("String _sql=$S", sql); } }
[ "public", "static", "void", "generateSQL", "(", "final", "SQLiteModelMethod", "method", ",", "MethodSpec", ".", "Builder", "methodBuilder", ")", "{", "JQLChecker", "jqlChecker", "=", "JQLChecker", ".", "getInstance", "(", ")", ";", "methodBuilder", ".", "addCode",...
Generate SQL. @param method the method @param methodBuilder the method builder
[ "Generate", "SQL", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/SqlModifyBuilder.java#L650-L680
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/queue/AsynchConsumerQueue.java
AsynchConsumerQueue.put
public void put(QueueData queueData, short msgBatch) // f200337 { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "put", new Object[] {queueData, ""+msgBatch}); synchronized(this) { if (!ordered && batchesReady == 1) { // A non-ordered async consumer proxy queue only caches one batch at a time. Therefore // if we are trying to put messages on when there is a batch already ready, we // messed up. SIErrorException e = new SIErrorException( nls.getFormattedMessage("ASYNC_BATCH_ALREADY_READY_SICO1031", null, null) ); FFDCFilter.processException(e, CLASS_NAME + ".put", CommsConstants.ASYNCHPQ_PUT_01, this); throw e; } queue.addLast(queueData); // If the data added to the queue was not a chunked message, then we have received an // entire message - so update counters etc if (!queueData.isChunkedMessage()) { notifyMessageReceived(queueData.isLastInBatch()); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Put has completed: " + this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "put"); }
java
public void put(QueueData queueData, short msgBatch) // f200337 { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "put", new Object[] {queueData, ""+msgBatch}); synchronized(this) { if (!ordered && batchesReady == 1) { // A non-ordered async consumer proxy queue only caches one batch at a time. Therefore // if we are trying to put messages on when there is a batch already ready, we // messed up. SIErrorException e = new SIErrorException( nls.getFormattedMessage("ASYNC_BATCH_ALREADY_READY_SICO1031", null, null) ); FFDCFilter.processException(e, CLASS_NAME + ".put", CommsConstants.ASYNCHPQ_PUT_01, this); throw e; } queue.addLast(queueData); // If the data added to the queue was not a chunked message, then we have received an // entire message - so update counters etc if (!queueData.isChunkedMessage()) { notifyMessageReceived(queueData.isLastInBatch()); } } if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "Put has completed: " + this); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "put"); }
[ "public", "void", "put", "(", "QueueData", "queueData", ",", "short", "msgBatch", ")", "// f200337", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this...
Places a message onto the queue. @param queueData The data which comprises the message to queue. @param msgBatch The message batch number.
[ "Places", "a", "message", "onto", "the", "queue", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/queue/AsynchConsumerQueue.java#L94-L129
phax/ph-web
ph-servlet/src/main/java/com/helger/servlet/async/ServletAsyncSpec.java
ServletAsyncSpec.createAsync
@Nonnull public static ServletAsyncSpec createAsync (@CheckForSigned final long nTimeoutMillis, @Nullable final Iterable <? extends AsyncListener> aAsyncListeners) { return new ServletAsyncSpec (true, nTimeoutMillis, aAsyncListeners); }
java
@Nonnull public static ServletAsyncSpec createAsync (@CheckForSigned final long nTimeoutMillis, @Nullable final Iterable <? extends AsyncListener> aAsyncListeners) { return new ServletAsyncSpec (true, nTimeoutMillis, aAsyncListeners); }
[ "@", "Nonnull", "public", "static", "ServletAsyncSpec", "createAsync", "(", "@", "CheckForSigned", "final", "long", "nTimeoutMillis", ",", "@", "Nullable", "final", "Iterable", "<", "?", "extends", "AsyncListener", ">", "aAsyncListeners", ")", "{", "return", "new"...
Create an async spec. @param nTimeoutMillis Timeout in milliseconds. Only value &gt; 0 are considered. @param aAsyncListeners The async listeners to use. May be <code>null</code>. @return A new {@link ServletAsyncSpec} and never <code>null</code>.
[ "Create", "an", "async", "spec", "." ]
train
https://github.com/phax/ph-web/blob/d445fd25184605b62682c93c9782409acf0ae813/ph-servlet/src/main/java/com/helger/servlet/async/ServletAsyncSpec.java#L169-L174
morimekta/providence
providence-core/src/main/java-gen/net/morimekta/providence/util/Any.java
Any.wrappedTypeIs
public <M extends net.morimekta.providence.PMessage<M, F>, F extends net.morimekta.providence.descriptor.PField> boolean wrappedTypeIs(@javax.annotation.Nonnull net.morimekta.providence.descriptor.PMessageDescriptor<M,F> descriptor) { return descriptor.getQualifiedName().equals(getType()); }
java
public <M extends net.morimekta.providence.PMessage<M, F>, F extends net.morimekta.providence.descriptor.PField> boolean wrappedTypeIs(@javax.annotation.Nonnull net.morimekta.providence.descriptor.PMessageDescriptor<M,F> descriptor) { return descriptor.getQualifiedName().equals(getType()); }
[ "public", "<", "M", "extends", "net", ".", "morimekta", ".", "providence", ".", "PMessage", "<", "M", ",", "F", ">", ",", "F", "extends", "net", ".", "morimekta", ".", "providence", ".", "descriptor", ".", "PField", ">", "boolean", "wrappedTypeIs", "(", ...
Check the wrapped message type against the provided message type descriptor. @param descriptor The message type to check. @param <M> The message type @param <F> The message field type @return True if the wrapped message type matches the provided.
[ "Check", "the", "wrapped", "message", "type", "against", "the", "provided", "message", "type", "descriptor", "." ]
train
https://github.com/morimekta/providence/blob/7c17dc1c96b1a1d4b9ff942c2cfeb725278bd3aa/providence-core/src/main/java-gen/net/morimekta/providence/util/Any.java#L274-L277
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java
CPOptionPersistenceImpl.findByGroupId
@Override public List<CPOption> findByGroupId(long groupId) { return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
java
@Override public List<CPOption> findByGroupId(long groupId) { return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); }
[ "@", "Override", "public", "List", "<", "CPOption", ">", "findByGroupId", "(", "long", "groupId", ")", "{", "return", "findByGroupId", "(", "groupId", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryUtil", ".", "ALL_POS", ",", "null", ")", ";", "}" ]
Returns all the cp options where groupId = &#63;. @param groupId the group ID @return the matching cp options
[ "Returns", "all", "the", "cp", "options", "where", "groupId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPOptionPersistenceImpl.java#L1500-L1503
weld/core
impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java
AbstractBeanDeployer.createObserversProducersDisposers
protected <T> void createObserversProducersDisposers(AbstractClassBean<T> bean) { if (bean instanceof ManagedBean<?> || bean instanceof SessionBean<?>) { // disposal methods have to go first as we want them to be ready for resolution when initializing producer method/fields createDisposalMethods(bean, bean.getEnhancedAnnotated()); createProducerMethods(bean, bean.getEnhancedAnnotated()); createProducerFields(bean, bean.getEnhancedAnnotated()); if (manager.isBeanEnabled(bean)) { createObserverMethods(bean, bean.getEnhancedAnnotated()); } } }
java
protected <T> void createObserversProducersDisposers(AbstractClassBean<T> bean) { if (bean instanceof ManagedBean<?> || bean instanceof SessionBean<?>) { // disposal methods have to go first as we want them to be ready for resolution when initializing producer method/fields createDisposalMethods(bean, bean.getEnhancedAnnotated()); createProducerMethods(bean, bean.getEnhancedAnnotated()); createProducerFields(bean, bean.getEnhancedAnnotated()); if (manager.isBeanEnabled(bean)) { createObserverMethods(bean, bean.getEnhancedAnnotated()); } } }
[ "protected", "<", "T", ">", "void", "createObserversProducersDisposers", "(", "AbstractClassBean", "<", "T", ">", "bean", ")", "{", "if", "(", "bean", "instanceof", "ManagedBean", "<", "?", ">", "||", "bean", "instanceof", "SessionBean", "<", "?", ">", ")", ...
Creates the sub bean for an class (simple or enterprise) bean @param bean The class bean
[ "Creates", "the", "sub", "bean", "for", "an", "class", "(", "simple", "or", "enterprise", ")", "bean" ]
train
https://github.com/weld/core/blob/567a2eaf95b168597d23a56be89bf05a7834b2aa/impl/src/main/java/org/jboss/weld/bootstrap/AbstractBeanDeployer.java#L188-L198
jaxio/javaee-lab
javaee7-jpa-query-by-example/src/main/java/com/jaxio/jpa/querybyexample/GenericRepository.java
GenericRepository.findProperty
@Transactional public <T> List<T> findProperty(Class<T> propertyType, E entity, SearchParameters sp, List<Attribute<?, ?>> attributes) { if (sp.hasNamedQuery()) { return byNamedQueryUtil.findByNamedQuery(sp); } CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<T> criteriaQuery = builder.createQuery(propertyType); if (sp.getDistinct()) { criteriaQuery.distinct(true); } Root<E> root = criteriaQuery.from(type); Path<T> path = jpaUtil.getPath(root, attributes); criteriaQuery.select(path); // predicate Predicate predicate = getPredicate(criteriaQuery, root, builder, entity, sp); if (predicate != null) { criteriaQuery = criteriaQuery.where(predicate); } // fetches fetches(sp, root); // order by // we do not want to follow order by specified in search parameters criteriaQuery.orderBy(builder.asc(path)); TypedQuery<T> typedQuery = entityManager.createQuery(criteriaQuery); applyCacheHints(typedQuery, sp); jpaUtil.applyPagination(typedQuery, sp); List<T> entities = typedQuery.getResultList(); log.fine("Returned " + entities.size() + " elements"); return entities; }
java
@Transactional public <T> List<T> findProperty(Class<T> propertyType, E entity, SearchParameters sp, List<Attribute<?, ?>> attributes) { if (sp.hasNamedQuery()) { return byNamedQueryUtil.findByNamedQuery(sp); } CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<T> criteriaQuery = builder.createQuery(propertyType); if (sp.getDistinct()) { criteriaQuery.distinct(true); } Root<E> root = criteriaQuery.from(type); Path<T> path = jpaUtil.getPath(root, attributes); criteriaQuery.select(path); // predicate Predicate predicate = getPredicate(criteriaQuery, root, builder, entity, sp); if (predicate != null) { criteriaQuery = criteriaQuery.where(predicate); } // fetches fetches(sp, root); // order by // we do not want to follow order by specified in search parameters criteriaQuery.orderBy(builder.asc(path)); TypedQuery<T> typedQuery = entityManager.createQuery(criteriaQuery); applyCacheHints(typedQuery, sp); jpaUtil.applyPagination(typedQuery, sp); List<T> entities = typedQuery.getResultList(); log.fine("Returned " + entities.size() + " elements"); return entities; }
[ "@", "Transactional", "public", "<", "T", ">", "List", "<", "T", ">", "findProperty", "(", "Class", "<", "T", ">", "propertyType", ",", "E", "entity", ",", "SearchParameters", "sp", ",", "List", "<", "Attribute", "<", "?", ",", "?", ">", ">", "attrib...
/* Find a list of E property. @param propertyType type of the property @param entity a sample entity whose non-null properties may be used as search hints @param sp carries additional search information @param attributes the list of attributes to the property @return the entities property matching the search.
[ "/", "*", "Find", "a", "list", "of", "E", "property", "." ]
train
https://github.com/jaxio/javaee-lab/blob/61238b967952446d81cc68424a4e809093a77fcf/javaee7-jpa-query-by-example/src/main/java/com/jaxio/jpa/querybyexample/GenericRepository.java#L272-L306
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
QueryReferenceBroker.retrieveCollection
public void retrieveCollection(Object obj, ClassDescriptor cld, CollectionDescriptor cds, boolean forced) { doRetrieveCollection(obj, cld, cds, forced, cds.isLazy()); }
java
public void retrieveCollection(Object obj, ClassDescriptor cld, CollectionDescriptor cds, boolean forced) { doRetrieveCollection(obj, cld, cds, forced, cds.isLazy()); }
[ "public", "void", "retrieveCollection", "(", "Object", "obj", ",", "ClassDescriptor", "cld", ",", "CollectionDescriptor", "cds", ",", "boolean", "forced", ")", "{", "doRetrieveCollection", "(", "obj", ",", "cld", ",", "cds", ",", "forced", ",", "cds", ".", "...
Retrieve a single Collection on behalf of <b>obj</b>. The Collection is retrieved only if <b>cascade.retrieve is true</b> or if <b>forced</b> is set to true. * @param obj - the object to be updated @param cld - the ClassDescriptor describing obj @param cds - the CollectionDescriptor describing the collection attribute to be loaded @param forced - if set to true loading is forced, even if cds differs.
[ "Retrieve", "a", "single", "Collection", "on", "behalf", "of", "<b", ">", "obj<", "/", "b", ">", ".", "The", "Collection", "is", "retrieved", "only", "if", "<b", ">", "cascade", ".", "retrieve", "is", "true<", "/", "b", ">", "or", "if", "<b", ">", ...
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java#L720-L723
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2.java
SM2.verify
public boolean verify(byte[] data, byte[] sign, byte[] id) { lock.lock(); final SM2Signer signer = getSigner(); try { CipherParameters param = getCipherParameters(KeyType.PublicKey); if (id != null) { param = new ParametersWithID(param, id); } signer.init(false, param); signer.update(data, 0, data.length); return signer.verifySignature(sign); } catch (Exception e) { throw new CryptoException(e); } finally { lock.unlock(); } }
java
public boolean verify(byte[] data, byte[] sign, byte[] id) { lock.lock(); final SM2Signer signer = getSigner(); try { CipherParameters param = getCipherParameters(KeyType.PublicKey); if (id != null) { param = new ParametersWithID(param, id); } signer.init(false, param); signer.update(data, 0, data.length); return signer.verifySignature(sign); } catch (Exception e) { throw new CryptoException(e); } finally { lock.unlock(); } }
[ "public", "boolean", "verify", "(", "byte", "[", "]", "data", ",", "byte", "[", "]", "sign", ",", "byte", "[", "]", "id", ")", "{", "lock", ".", "lock", "(", ")", ";", "final", "SM2Signer", "signer", "=", "getSigner", "(", ")", ";", "try", "{", ...
用公钥检验数字签名的合法性 @param data 数据 @param sign 签名 @param id 可以为null,若为null,则默认withId为字节数组:"1234567812345678".getBytes() @return 是否验证通过
[ "用公钥检验数字签名的合法性" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/SM2.java#L219-L235
josueeduardo/snappy
plugin-parent/snappy-loader/src/main/java/io/joshworks/snappy/loader/jar/JarFile.java
JarFile.getUrl
public URL getUrl() throws MalformedURLException { if (this.url == null) { Handler handler = new Handler(this); String file = this.rootFile.getFile().toURI() + this.pathFromRoot + "!/"; file = file.replace("file:////", "file://"); // Fix UNC paths this.url = new URL("jar", "", -1, file, handler); } return this.url; }
java
public URL getUrl() throws MalformedURLException { if (this.url == null) { Handler handler = new Handler(this); String file = this.rootFile.getFile().toURI() + this.pathFromRoot + "!/"; file = file.replace("file:////", "file://"); // Fix UNC paths this.url = new URL("jar", "", -1, file, handler); } return this.url; }
[ "public", "URL", "getUrl", "(", ")", "throws", "MalformedURLException", "{", "if", "(", "this", ".", "url", "==", "null", ")", "{", "Handler", "handler", "=", "new", "Handler", "(", "this", ")", ";", "String", "file", "=", "this", ".", "rootFile", ".",...
Return a URL that can be used to access this JAR file. NOTE: the specified URL cannot be serialized and or cloned. @return the URL @throws MalformedURLException if the URL is malformed
[ "Return", "a", "URL", "that", "can", "be", "used", "to", "access", "this", "JAR", "file", ".", "NOTE", ":", "the", "specified", "URL", "cannot", "be", "serialized", "and", "or", "cloned", "." ]
train
https://github.com/josueeduardo/snappy/blob/d95a9e811eda3c24a5e53086369208819884fa49/plugin-parent/snappy-loader/src/main/java/io/joshworks/snappy/loader/jar/JarFile.java#L452-L460
vanilladb/vanillacore
src/main/java/org/vanilladb/core/storage/metadata/statistics/SampledHistogramBuilder.java
SampledHistogramBuilder.newMaxDiffFreqHistogram
public Histogram newMaxDiffFreqHistogram(int numBkts, int numPcts) { Map<String, BucketBuilder> initBbs = new HashMap<String, BucketBuilder>(); // initialize the first bucket builder for every field for (String fld : schema.fields()) initBbs.put(fld, new MaxDiffFreqBucketBuilder(frequencies(fld), numPcts)); return newMaxDiffHistogram(numBkts, initBbs); }
java
public Histogram newMaxDiffFreqHistogram(int numBkts, int numPcts) { Map<String, BucketBuilder> initBbs = new HashMap<String, BucketBuilder>(); // initialize the first bucket builder for every field for (String fld : schema.fields()) initBbs.put(fld, new MaxDiffFreqBucketBuilder(frequencies(fld), numPcts)); return newMaxDiffHistogram(numBkts, initBbs); }
[ "public", "Histogram", "newMaxDiffFreqHistogram", "(", "int", "numBkts", ",", "int", "numPcts", ")", "{", "Map", "<", "String", ",", "BucketBuilder", ">", "initBbs", "=", "new", "HashMap", "<", "String", ",", "BucketBuilder", ">", "(", ")", ";", "// initiali...
Constructs a histogram with the "MaxDiff(V, F)" buckets for all fields. @param numBkts the number of buckets to construct for each field @param numPcts the number of value percentiles in each bucket @return a "MaxDiff(V, F)" histogram
[ "Constructs", "a", "histogram", "with", "the", "MaxDiff", "(", "V", "F", ")", "buckets", "for", "all", "fields", "." ]
train
https://github.com/vanilladb/vanillacore/blob/d9a34e876b1b83226036d1fa982a614bbef59bd1/src/main/java/org/vanilladb/core/storage/metadata/statistics/SampledHistogramBuilder.java#L434-L441
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/util/Interval.java
Interval.toInterval
public static <E extends Comparable<E>> Interval<E> toInterval(E a, E b, int flags) { int comp = a.compareTo(b); if (comp <= 0) { return new Interval(a,b, flags); } else { return null; } }
java
public static <E extends Comparable<E>> Interval<E> toInterval(E a, E b, int flags) { int comp = a.compareTo(b); if (comp <= 0) { return new Interval(a,b, flags); } else { return null; } }
[ "public", "static", "<", "E", "extends", "Comparable", "<", "E", ">", ">", "Interval", "<", "E", ">", "toInterval", "(", "E", "a", ",", "E", "b", ",", "int", "flags", ")", "{", "int", "comp", "=", "a", ".", "compareTo", "(", "b", ")", ";", "if"...
Create an interval with the specified endpoints in the specified order, using the specified flags. Returns null if a does not come before b (invalid interval) @param a start endpoints @param b end endpoint @param flags flags characterizing the interval @param <E> type of the interval endpoints @return Interval with endpoints in specified order, null if a does not come before b
[ "Create", "an", "interval", "with", "the", "specified", "endpoints", "in", "the", "specified", "order", "using", "the", "specified", "flags", ".", "Returns", "null", "if", "a", "does", "not", "come", "before", "b", "(", "invalid", "interval", ")" ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/util/Interval.java#L353-L360
zaproxy/zaproxy
src/org/zaproxy/zap/extension/ascan/PolicyAllCategoryPanel.java
PolicyAllCategoryPanel.hasSameStatus
private boolean hasSameStatus(Plugin scanner, String status) { if (status.equals(Constant.messages.getString("ascan.policy.table.quality.all"))) { return true; } return status.equals(View.getSingleton().getStatusUI(scanner.getStatus()).toString()); }
java
private boolean hasSameStatus(Plugin scanner, String status) { if (status.equals(Constant.messages.getString("ascan.policy.table.quality.all"))) { return true; } return status.equals(View.getSingleton().getStatusUI(scanner.getStatus()).toString()); }
[ "private", "boolean", "hasSameStatus", "(", "Plugin", "scanner", ",", "String", "status", ")", "{", "if", "(", "status", ".", "equals", "(", "Constant", ".", "messages", ".", "getString", "(", "\"ascan.policy.table.quality.all\"", ")", ")", ")", "{", "return",...
Tells whether or not the given {@code scanner} has the given {@code status}. <p> If the given {@code status} represents all statuses it returns always {@code true}. @param scanner the scanner that will be checked @param status the status to check @return {@code true} if it has the same status, {@code false} otherwise. @see Plugin#getStatus()
[ "Tells", "whether", "or", "not", "the", "given", "{", "@code", "scanner", "}", "has", "the", "given", "{", "@code", "status", "}", ".", "<p", ">", "If", "the", "given", "{", "@code", "status", "}", "represents", "all", "statuses", "it", "returns", "alw...
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/ascan/PolicyAllCategoryPanel.java#L333-L338
alkacon/opencms-core
src/org/opencms/security/CmsOrgUnitManager.java
CmsOrgUnitManager.setUsersOrganizationalUnit
public void setUsersOrganizationalUnit(CmsObject cms, String ouFqn, String userName) throws CmsException { CmsOrganizationalUnit orgUnit = readOrganizationalUnit(cms, ouFqn); CmsUser user = cms.readUser(userName); m_securityManager.setUsersOrganizationalUnit(cms.getRequestContext(), orgUnit, user); }
java
public void setUsersOrganizationalUnit(CmsObject cms, String ouFqn, String userName) throws CmsException { CmsOrganizationalUnit orgUnit = readOrganizationalUnit(cms, ouFqn); CmsUser user = cms.readUser(userName); m_securityManager.setUsersOrganizationalUnit(cms.getRequestContext(), orgUnit, user); }
[ "public", "void", "setUsersOrganizationalUnit", "(", "CmsObject", "cms", ",", "String", "ouFqn", ",", "String", "userName", ")", "throws", "CmsException", "{", "CmsOrganizationalUnit", "orgUnit", "=", "readOrganizationalUnit", "(", "cms", ",", "ouFqn", ")", ";", "...
Moves an user to the given organizational unit.<p> @param cms the opencms context @param ouFqn the full qualified name of the organizational unit to add the user to @param userName the name of the user that is to be added to the organizational unit @throws CmsException if something goes wrong
[ "Moves", "an", "user", "to", "the", "given", "organizational", "unit", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/security/CmsOrgUnitManager.java#L356-L361
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/ReflectionUtil.java
ReflectionUtil.matchesParameters
@Pure @Inline(value = "ReflectionUtil.matchesParameters(($1).getParameterTypes(), ($2))", imported = {ReflectionUtil.class}) public static boolean matchesParameters(Method method, Object... parameters) { return matchesParameters(method.getParameterTypes(), parameters); }
java
@Pure @Inline(value = "ReflectionUtil.matchesParameters(($1).getParameterTypes(), ($2))", imported = {ReflectionUtil.class}) public static boolean matchesParameters(Method method, Object... parameters) { return matchesParameters(method.getParameterTypes(), parameters); }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"ReflectionUtil.matchesParameters(($1).getParameterTypes(), ($2))\"", ",", "imported", "=", "{", "ReflectionUtil", ".", "class", "}", ")", "public", "static", "boolean", "matchesParameters", "(", "Method", "method", ","...
Replies if the parameters of the given method are matching the given values. @param method the method that contains the types. @param parameters the objects associated to the paramters. @return <code>true</code> if the values could be passed to the method. @since 7.1
[ "Replies", "if", "the", "parameters", "of", "the", "given", "method", "are", "matching", "the", "given", "values", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/ReflectionUtil.java#L827-L831
enioka/jqm
jqm-all/jqm-client/jqm-api-client-core/src/main/java/com/enioka/jqm/api/Query.java
Query.addSortDesc
public Query addSortDesc(Sort column) { this.sorts.add(new SortSpec(SortOrder.DESCENDING, column)); return this; }
java
public Query addSortDesc(Sort column) { this.sorts.add(new SortSpec(SortOrder.DESCENDING, column)); return this; }
[ "public", "Query", "addSortDesc", "(", "Sort", "column", ")", "{", "this", ".", "sorts", ".", "add", "(", "new", "SortSpec", "(", "SortOrder", ".", "DESCENDING", ",", "column", ")", ")", ";", "return", "this", ";", "}" ]
Adds a new column a the end of the sorting clause. @see #addSortAsc(Sort)
[ "Adds", "a", "new", "column", "a", "the", "end", "of", "the", "sorting", "clause", "." ]
train
https://github.com/enioka/jqm/blob/391733b8e291404b97c714c3727a241c4a861f98/jqm-all/jqm-client/jqm-api-client-core/src/main/java/com/enioka/jqm/api/Query.java#L152-L156
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java
CoverageUtilities.renderedImage2WritableRaster
public static WritableRaster renderedImage2WritableRaster( RenderedImage renderedImage, boolean nullBorders ) { int width = renderedImage.getWidth(); int height = renderedImage.getHeight(); Raster data = renderedImage.getData(); WritableRaster writableRaster = data.createCompatibleWritableRaster(); writableRaster.setDataElements(0, 0, data); if (nullBorders) { for( int c = 0; c < width; c++ ) { writableRaster.setSample(c, 0, 0, doubleNovalue); writableRaster.setSample(c, height - 1, 0, doubleNovalue); } for( int r = 0; r < height; r++ ) { writableRaster.setSample(0, r, 0, doubleNovalue); writableRaster.setSample(width - 1, r, 0, doubleNovalue); } } return writableRaster; }
java
public static WritableRaster renderedImage2WritableRaster( RenderedImage renderedImage, boolean nullBorders ) { int width = renderedImage.getWidth(); int height = renderedImage.getHeight(); Raster data = renderedImage.getData(); WritableRaster writableRaster = data.createCompatibleWritableRaster(); writableRaster.setDataElements(0, 0, data); if (nullBorders) { for( int c = 0; c < width; c++ ) { writableRaster.setSample(c, 0, 0, doubleNovalue); writableRaster.setSample(c, height - 1, 0, doubleNovalue); } for( int r = 0; r < height; r++ ) { writableRaster.setSample(0, r, 0, doubleNovalue); writableRaster.setSample(width - 1, r, 0, doubleNovalue); } } return writableRaster; }
[ "public", "static", "WritableRaster", "renderedImage2WritableRaster", "(", "RenderedImage", "renderedImage", ",", "boolean", "nullBorders", ")", "{", "int", "width", "=", "renderedImage", ".", "getWidth", "(", ")", ";", "int", "height", "=", "renderedImage", ".", ...
Creates a compatible {@link WritableRaster} from a {@link RenderedImage}. @param renderedImage the image to convert. @param nullBorders a flag that indicates if the borders should be set to null. @return the converted writable raster.
[ "Creates", "a", "compatible", "{", "@link", "WritableRaster", "}", "from", "a", "{", "@link", "RenderedImage", "}", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L939-L958
ngageoint/geopackage-core-java
src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java
TileBoundingBoxUtils.toleranceDistance
public static double toleranceDistance(int zoom, int pixelWidth, int pixelHeight) { return toleranceDistance(zoom, Math.max(pixelWidth, pixelHeight)); }
java
public static double toleranceDistance(int zoom, int pixelWidth, int pixelHeight) { return toleranceDistance(zoom, Math.max(pixelWidth, pixelHeight)); }
[ "public", "static", "double", "toleranceDistance", "(", "int", "zoom", ",", "int", "pixelWidth", ",", "int", "pixelHeight", ")", "{", "return", "toleranceDistance", "(", "zoom", ",", "Math", ".", "max", "(", "pixelWidth", ",", "pixelHeight", ")", ")", ";", ...
Get the tolerance distance in meters for the zoom level and pixels length @param zoom zoom level @param pixelWidth pixel width @param pixelHeight pixel height @return tolerance distance in meters @since 2.0.0
[ "Get", "the", "tolerance", "distance", "in", "meters", "for", "the", "zoom", "level", "and", "pixels", "length" ]
train
https://github.com/ngageoint/geopackage-core-java/blob/6431c3b041a45b7f3802904ea4156b4082a72daa/src/main/java/mil/nga/geopackage/tiles/TileBoundingBoxUtils.java#L754-L757
alkacon/opencms-core
src/org/opencms/ui/apps/scheduler/CmsJobTable.java
CmsJobTable.getJobInfo
public static CmsResourceInfo getJobInfo(String name, String className) { return new CmsResourceInfo(name, className, new CmsCssIcon(OpenCmsTheme.ICON_JOB)); }
java
public static CmsResourceInfo getJobInfo(String name, String className) { return new CmsResourceInfo(name, className, new CmsCssIcon(OpenCmsTheme.ICON_JOB)); }
[ "public", "static", "CmsResourceInfo", "getJobInfo", "(", "String", "name", ",", "String", "className", ")", "{", "return", "new", "CmsResourceInfo", "(", "name", ",", "className", ",", "new", "CmsCssIcon", "(", "OpenCmsTheme", ".", "ICON_JOB", ")", ")", ";", ...
Returns the resource info box to the given job.<p> @param name the job name @param className the job class @return the info box component
[ "Returns", "the", "resource", "info", "box", "to", "the", "given", "job", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ui/apps/scheduler/CmsJobTable.java#L579-L582
brianwhu/xillium
base/src/main/java/org/xillium/base/text/Balanced.java
Balanced.indexOf
public static int indexOf(String text, char target) { return indexOf(text, 0, text.length(), target, null); }
java
public static int indexOf(String text, char target) { return indexOf(text, 0, text.length(), target, null); }
[ "public", "static", "int", "indexOf", "(", "String", "text", ",", "char", "target", ")", "{", "return", "indexOf", "(", "text", ",", "0", ",", "text", ".", "length", "(", ")", ",", "target", ",", "null", ")", ";", "}" ]
Returns the index within this string of the first occurrence of the specified character, similar to String.indexOf(). However, any occurrence of the specified character enclosed between balanced parentheses/brackets/braces is ignored. @param text a String @param target the character to search for @return the index of the character in the string, or -1 if the specified character is not found
[ "Returns", "the", "index", "within", "this", "string", "of", "the", "first", "occurrence", "of", "the", "specified", "character", "similar", "to", "String", ".", "indexOf", "()", ".", "However", "any", "occurrence", "of", "the", "specified", "character", "encl...
train
https://github.com/brianwhu/xillium/blob/e8dbf8cb6589fa1031a0bfcdcb58cb03d2ba7799/base/src/main/java/org/xillium/base/text/Balanced.java#L94-L96
iipc/openwayback
wayback-cdx-server-core/src/main/java/org/archive/cdxserver/CDXServer.java
CDXServer.findLastCapture
public CDXLine findLastCapture(String url, String digest, boolean ignoreRobots) { final String WARC_REVISIT = "warc/revisit"; final String REVISIT_FILTER = "!mimetype:" + WARC_REVISIT; CDXListWriter listWriter = new CDXListWriter(); CDXQuery query = new CDXQuery(url); query.setFilter(new String[] { CDXFieldConstants.digest + ":" + digest, REVISIT_FILTER }); query.setLimit(-1); AuthToken auth = new AuthToken(); auth.setIgnoreRobots(ignoreRobots); try { getCdx(query, auth, listWriter); } catch (IOException e) { // No dedup info return null; } catch (RuntimeException re) { // Keeping the original code as comment. // Cannot throw AccessControlException from CDXServer // because it is currently defined in wayback-core, on // which wayback-cdxserver cannot depend. // As AccessControlException is thrown when entire url // is excluded (by robots.txt exclusion or some other rules), // it should be okay to consider it as"non-existent". // Throwable cause = re.getCause(); // // // Propagate AccessControlException // if (cause instanceof AccessControlException) { // throw (AccessControlException)cause; // } return null; } if (!listWriter.getCDXLines().isEmpty()) { CDXLine line = listWriter.getCDXLines().get(0); // Just check the last line for the digest if (digest == null || line.getDigest().equals(digest)) { return line; } } return null; }
java
public CDXLine findLastCapture(String url, String digest, boolean ignoreRobots) { final String WARC_REVISIT = "warc/revisit"; final String REVISIT_FILTER = "!mimetype:" + WARC_REVISIT; CDXListWriter listWriter = new CDXListWriter(); CDXQuery query = new CDXQuery(url); query.setFilter(new String[] { CDXFieldConstants.digest + ":" + digest, REVISIT_FILTER }); query.setLimit(-1); AuthToken auth = new AuthToken(); auth.setIgnoreRobots(ignoreRobots); try { getCdx(query, auth, listWriter); } catch (IOException e) { // No dedup info return null; } catch (RuntimeException re) { // Keeping the original code as comment. // Cannot throw AccessControlException from CDXServer // because it is currently defined in wayback-core, on // which wayback-cdxserver cannot depend. // As AccessControlException is thrown when entire url // is excluded (by robots.txt exclusion or some other rules), // it should be okay to consider it as"non-existent". // Throwable cause = re.getCause(); // // // Propagate AccessControlException // if (cause instanceof AccessControlException) { // throw (AccessControlException)cause; // } return null; } if (!listWriter.getCDXLines().isEmpty()) { CDXLine line = listWriter.getCDXLines().get(0); // Just check the last line for the digest if (digest == null || line.getDigest().equals(digest)) { return line; } } return null; }
[ "public", "CDXLine", "findLastCapture", "(", "String", "url", ",", "String", "digest", ",", "boolean", "ignoreRobots", ")", "{", "final", "String", "WARC_REVISIT", "=", "\"warc/revisit\"", ";", "final", "String", "REVISIT_FILTER", "=", "\"!mimetype:\"", "+", "WARC...
Look up the latest (non-revisit) capture of {@code url} in the CDX database. If {@code digest} is non-{@code null}, return only a capture with identical digest. @param url URL (in regular form) to look for @param digest content digest in the same format as CDX database, or {@code null} if any version qualifies. @param ignoreRobots whether robots.txt-excluded captures qualify @return CDXLine found
[ "Look", "up", "the", "latest", "(", "non", "-", "revisit", ")", "capture", "of", "{" ]
train
https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-cdx-server-core/src/main/java/org/archive/cdxserver/CDXServer.java#L638-L686
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java
FeatureShapes.addMapMetadataShape
public void addMapMetadataShape(GoogleMapShape mapShape, long featureId, String database, String table) { FeatureShape featureShape = getFeatureShape(database, table, featureId); featureShape.addMetadataShape(mapShape); }
java
public void addMapMetadataShape(GoogleMapShape mapShape, long featureId, String database, String table) { FeatureShape featureShape = getFeatureShape(database, table, featureId); featureShape.addMetadataShape(mapShape); }
[ "public", "void", "addMapMetadataShape", "(", "GoogleMapShape", "mapShape", ",", "long", "featureId", ",", "String", "database", ",", "String", "table", ")", "{", "FeatureShape", "featureShape", "=", "getFeatureShape", "(", "database", ",", "table", ",", "featureI...
Add a map metadata shape with the feature id, database, and table @param mapShape map metadata shape @param featureId feature id @param database GeoPackage database @param table table name @since 3.2.0
[ "Add", "a", "map", "metadata", "shape", "with", "the", "feature", "id", "database", "and", "table" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/FeatureShapes.java#L194-L197
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/cluster/RedisAdvancedClusterReactiveCommandsImpl.java
RedisAdvancedClusterReactiveCommandsImpl.executeOnMasters
protected <T> Map<String, Publisher<T>> executeOnMasters( Function<RedisClusterReactiveCommands<K, V>, ? extends Publisher<T>> function) { return executeOnNodes(function, redisClusterNode -> redisClusterNode.is(MASTER)); }
java
protected <T> Map<String, Publisher<T>> executeOnMasters( Function<RedisClusterReactiveCommands<K, V>, ? extends Publisher<T>> function) { return executeOnNodes(function, redisClusterNode -> redisClusterNode.is(MASTER)); }
[ "protected", "<", "T", ">", "Map", "<", "String", ",", "Publisher", "<", "T", ">", ">", "executeOnMasters", "(", "Function", "<", "RedisClusterReactiveCommands", "<", "K", ",", "V", ">", ",", "?", "extends", "Publisher", "<", "T", ">", ">", "function", ...
Run a command on all available masters, @param function function producing the command @param <T> result type @return map of a key (counter) and commands.
[ "Run", "a", "command", "on", "all", "available", "masters" ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/cluster/RedisAdvancedClusterReactiveCommandsImpl.java#L521-L524
hdbeukel/james-extensions
src/main/java/org/jamesframework/ext/analysis/AnalysisResults.java
AnalysisResults.getNumRuns
public int getNumRuns(String problemID, String searchID){ if(!results.containsKey(problemID)){ throw new UnknownIDException("Unknown problem ID " + problemID + "."); } if(!results.get(problemID).containsKey(searchID)){ throw new UnknownIDException("Unknown search ID " + searchID + " for problem " + problemID + "."); } return results.get(problemID).get(searchID).size(); }
java
public int getNumRuns(String problemID, String searchID){ if(!results.containsKey(problemID)){ throw new UnknownIDException("Unknown problem ID " + problemID + "."); } if(!results.get(problemID).containsKey(searchID)){ throw new UnknownIDException("Unknown search ID " + searchID + " for problem " + problemID + "."); } return results.get(problemID).get(searchID).size(); }
[ "public", "int", "getNumRuns", "(", "String", "problemID", ",", "String", "searchID", ")", "{", "if", "(", "!", "results", ".", "containsKey", "(", "problemID", ")", ")", "{", "throw", "new", "UnknownIDException", "(", "\"Unknown problem ID \"", "+", "problemI...
Get the number of performed runs of the given search when solving the given problem. @param problemID ID of the problem @param searchID ID of the applied search @return number of performed runs of the given search when solving the given problem @throws UnknownIDException if an unknown problem or search ID is given
[ "Get", "the", "number", "of", "performed", "runs", "of", "the", "given", "search", "when", "solving", "the", "given", "problem", "." ]
train
https://github.com/hdbeukel/james-extensions/blob/37a43aa6ac4d67575cabc7aed25fd96c91d4c7b2/src/main/java/org/jamesframework/ext/analysis/AnalysisResults.java#L147-L155
ReactiveX/RxNetty
rxnetty-tcp/src/main/java/io/reactivex/netty/protocol/tcp/server/TcpServer.java
TcpServer.newServer
public static TcpServer<ByteBuf, ByteBuf> newServer(int port, EventLoopGroup eventLoopGroup, Class<? extends ServerChannel> channelClass) { return newServer(port, eventLoopGroup, eventLoopGroup, channelClass); }
java
public static TcpServer<ByteBuf, ByteBuf> newServer(int port, EventLoopGroup eventLoopGroup, Class<? extends ServerChannel> channelClass) { return newServer(port, eventLoopGroup, eventLoopGroup, channelClass); }
[ "public", "static", "TcpServer", "<", "ByteBuf", ",", "ByteBuf", ">", "newServer", "(", "int", "port", ",", "EventLoopGroup", "eventLoopGroup", ",", "Class", "<", "?", "extends", "ServerChannel", ">", "channelClass", ")", "{", "return", "newServer", "(", "port...
Creates a new server using the passed port. @param port Port for the server. {@code 0} to use ephemeral port. @param eventLoopGroup Eventloop group to be used for server as well as client sockets. @param channelClass The class to be used for server channel. @return A new {@link TcpServer}
[ "Creates", "a", "new", "server", "using", "the", "passed", "port", "." ]
train
https://github.com/ReactiveX/RxNetty/blob/a7ca9a9c1d544a79c82f7b17036daf6958bf1cd6/rxnetty-tcp/src/main/java/io/reactivex/netty/protocol/tcp/server/TcpServer.java#L382-L385
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.credit_balance_GET
public ArrayList<String> credit_balance_GET(OvhType type) throws IOException { String qPath = "/me/credit/balance"; StringBuilder sb = path(qPath); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
java
public ArrayList<String> credit_balance_GET(OvhType type) throws IOException { String qPath = "/me/credit/balance"; StringBuilder sb = path(qPath); query(sb, "type", type); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, t1); }
[ "public", "ArrayList", "<", "String", ">", "credit_balance_GET", "(", "OvhType", "type", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/me/credit/balance\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPath", ")", ";", "query", "(", "sb", ...
Retrieve credit balance names REST: GET /me/credit/balance @param type [required] Balance type
[ "Retrieve", "credit", "balance", "names" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L923-L929
wisdom-framework/wisdom-jcr
wisdom-modeshape-web-jcr-rest/src/main/java/org/modeshape/web/jcr/rest/model/RestRepositories.java
RestRepositories.addRepository
public Repository addRepository(String name, String url) { Repository repository = new Repository(name, url); repositories.add(repository); return repository; }
java
public Repository addRepository(String name, String url) { Repository repository = new Repository(name, url); repositories.add(repository); return repository; }
[ "public", "Repository", "addRepository", "(", "String", "name", ",", "String", "url", ")", "{", "Repository", "repository", "=", "new", "Repository", "(", "name", ",", "url", ")", ";", "repositories", ".", "add", "(", "repository", ")", ";", "return", "rep...
Adds a repository to the list. @param name a {@code non-null} string, the name of the repository. @param url a {@code non-null} string, the absolute url to the repository @return a {@link Repository} instance.
[ "Adds", "a", "repository", "to", "the", "list", "." ]
train
https://github.com/wisdom-framework/wisdom-jcr/blob/2711383dde2239a19b90c226b3fd2aecab5715e4/wisdom-modeshape-web-jcr-rest/src/main/java/org/modeshape/web/jcr/rest/model/RestRepositories.java#L67-L72
bmwcarit/joynr
java/messaging/bounceproxy-controller-service/src/main/java/io/joynr/messaging/info/PerformanceMeasures.java
PerformanceMeasures.addMeasure
public void addMeasure(Key key, int value) { if (key != null) { measures.put(key, value); } else { // TODO for now, we just ignore the value } }
java
public void addMeasure(Key key, int value) { if (key != null) { measures.put(key, value); } else { // TODO for now, we just ignore the value } }
[ "public", "void", "addMeasure", "(", "Key", "key", ",", "int", "value", ")", "{", "if", "(", "key", "!=", "null", ")", "{", "measures", ".", "put", "(", "key", ",", "value", ")", ";", "}", "else", "{", "// TODO for now, we just ignore the value", "}", ...
Adds a measure. If the key is <code>null</code>, the measure is simply ignored without any warning. @param key the key of the measure to be added to hash map @param value the value of the measure to be added to hash map
[ "Adds", "a", "measure", ".", "If", "the", "key", "is", "<code", ">", "null<", "/", "code", ">", "the", "measure", "is", "simply", "ignored", "without", "any", "warning", "." ]
train
https://github.com/bmwcarit/joynr/blob/b7a92bad1cf2f093de080facd2c803560f4c6c26/java/messaging/bounceproxy-controller-service/src/main/java/io/joynr/messaging/info/PerformanceMeasures.java#L133-L140
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java
MultiViewOps.inducedHomography13
public static DMatrixRMaj inducedHomography13( TrifocalTensor tensor , Vector3D_F64 line2 , DMatrixRMaj output ) { if( output == null ) output = new DMatrixRMaj(3,3); DMatrixRMaj T = tensor.T1; // H(:,0) = transpose(T1)*line output.data[0] = T.data[0]*line2.x + T.data[3]*line2.y + T.data[6]*line2.z; output.data[3] = T.data[1]*line2.x + T.data[4]*line2.y + T.data[7]*line2.z; output.data[6] = T.data[2]*line2.x + T.data[5]*line2.y + T.data[8]*line2.z; // H(:,1) = transpose(T2)*line T = tensor.T2; output.data[1] = T.data[0]*line2.x + T.data[3]*line2.y + T.data[6]*line2.z; output.data[4] = T.data[1]*line2.x + T.data[4]*line2.y + T.data[7]*line2.z; output.data[7] = T.data[2]*line2.x + T.data[5]*line2.y + T.data[8]*line2.z; // H(:,2) = transpose(T3)*line T = tensor.T3; output.data[2] = T.data[0]*line2.x + T.data[3]*line2.y + T.data[6]*line2.z; output.data[5] = T.data[1]*line2.x + T.data[4]*line2.y + T.data[7]*line2.z; output.data[8] = T.data[2]*line2.x + T.data[5]*line2.y + T.data[8]*line2.z; // Vector3D_F64 temp = new Vector3D_F64(); // // for( int i = 0; i < 3; i++ ) { // GeometryMath_F64.multTran(tensor.getT(i),line,temp); // output.unsafe_set(0,i,temp.x); // output.unsafe_set(1,i,temp.y); // output.unsafe_set(2,i,temp.z); // } return output; }
java
public static DMatrixRMaj inducedHomography13( TrifocalTensor tensor , Vector3D_F64 line2 , DMatrixRMaj output ) { if( output == null ) output = new DMatrixRMaj(3,3); DMatrixRMaj T = tensor.T1; // H(:,0) = transpose(T1)*line output.data[0] = T.data[0]*line2.x + T.data[3]*line2.y + T.data[6]*line2.z; output.data[3] = T.data[1]*line2.x + T.data[4]*line2.y + T.data[7]*line2.z; output.data[6] = T.data[2]*line2.x + T.data[5]*line2.y + T.data[8]*line2.z; // H(:,1) = transpose(T2)*line T = tensor.T2; output.data[1] = T.data[0]*line2.x + T.data[3]*line2.y + T.data[6]*line2.z; output.data[4] = T.data[1]*line2.x + T.data[4]*line2.y + T.data[7]*line2.z; output.data[7] = T.data[2]*line2.x + T.data[5]*line2.y + T.data[8]*line2.z; // H(:,2) = transpose(T3)*line T = tensor.T3; output.data[2] = T.data[0]*line2.x + T.data[3]*line2.y + T.data[6]*line2.z; output.data[5] = T.data[1]*line2.x + T.data[4]*line2.y + T.data[7]*line2.z; output.data[8] = T.data[2]*line2.x + T.data[5]*line2.y + T.data[8]*line2.z; // Vector3D_F64 temp = new Vector3D_F64(); // // for( int i = 0; i < 3; i++ ) { // GeometryMath_F64.multTran(tensor.getT(i),line,temp); // output.unsafe_set(0,i,temp.x); // output.unsafe_set(1,i,temp.y); // output.unsafe_set(2,i,temp.z); // } return output; }
[ "public", "static", "DMatrixRMaj", "inducedHomography13", "(", "TrifocalTensor", "tensor", ",", "Vector3D_F64", "line2", ",", "DMatrixRMaj", "output", ")", "{", "if", "(", "output", "==", "null", ")", "output", "=", "new", "DMatrixRMaj", "(", "3", ",", "3", ...
Computes the homography induced from view 1 to 3 by a line in view 2. The provided line in view 2 must contain the view 2 observation. p3 = H13*p1 @param tensor Input: Trifocal tensor @param line2 Input: Line in view 2. {@link LineGeneral2D_F64 General notation}. @param output Output: Optional storage for homography. 3x3 matrix @return Homography from view 1 to 3
[ "Computes", "the", "homography", "induced", "from", "view", "1", "to", "3", "by", "a", "line", "in", "view", "2", ".", "The", "provided", "line", "in", "view", "2", "must", "contain", "the", "view", "2", "observation", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/MultiViewOps.java#L438-L473
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/cp/internal/raft/impl/state/RaftState.java
RaftState.restoreGroupMembers
public void restoreGroupMembers(long logIndex, Collection<Endpoint> members) { assert lastGroupMembers.index() <= logIndex : "Cannot restore group members to: " + members + " at log index: " + logIndex + " because last group members: " + lastGroupMembers + " has a bigger log index."; // there is no leader state to clean up RaftGroupMembers groupMembers = new RaftGroupMembers(logIndex, members, localEndpoint); this.committedGroupMembers = groupMembers; this.lastGroupMembers = groupMembers; }
java
public void restoreGroupMembers(long logIndex, Collection<Endpoint> members) { assert lastGroupMembers.index() <= logIndex : "Cannot restore group members to: " + members + " at log index: " + logIndex + " because last group members: " + lastGroupMembers + " has a bigger log index."; // there is no leader state to clean up RaftGroupMembers groupMembers = new RaftGroupMembers(logIndex, members, localEndpoint); this.committedGroupMembers = groupMembers; this.lastGroupMembers = groupMembers; }
[ "public", "void", "restoreGroupMembers", "(", "long", "logIndex", ",", "Collection", "<", "Endpoint", ">", "members", ")", "{", "assert", "lastGroupMembers", ".", "index", "(", ")", "<=", "logIndex", ":", "\"Cannot restore group members to: \"", "+", "members", "+...
Restores group members from the snapshot. Both {@link #committedGroupMembers} and {@link #lastGroupMembers} are overwritten and they become the same.
[ "Restores", "group", "members", "from", "the", "snapshot", ".", "Both", "{" ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/cp/internal/raft/impl/state/RaftState.java#L437-L447
kohsuke/args4j
args4j/src/org/kohsuke/args4j/OptionHandlerRegistry.java
OptionHandlerRegistry.createOptionHandler
@SuppressWarnings("unchecked") protected OptionHandler createOptionHandler(CmdLineParser parser, OptionDef o, Setter setter) { checkNonNull(o, "CmdLineParser"); checkNonNull(o, "OptionDef"); checkNonNull(setter, "Setter"); Class<? extends OptionHandler> h = o.handler(); if(h==OptionHandler.class) { // infer the type Class<?> t = setter.getType(); // enum is the special case if(Enum.class.isAssignableFrom(t)) return new EnumOptionHandler(parser,o,setter,t); OptionHandlerFactory factory = handlers.get(t); if (factory==null) throw new IllegalAnnotationError(Messages.UNKNOWN_HANDLER.format(t)); return factory.getHandler(parser, o, setter); } else { // explicit handler specified return new DefaultConstructorHandlerFactory(h).getHandler(parser, o, setter); } }
java
@SuppressWarnings("unchecked") protected OptionHandler createOptionHandler(CmdLineParser parser, OptionDef o, Setter setter) { checkNonNull(o, "CmdLineParser"); checkNonNull(o, "OptionDef"); checkNonNull(setter, "Setter"); Class<? extends OptionHandler> h = o.handler(); if(h==OptionHandler.class) { // infer the type Class<?> t = setter.getType(); // enum is the special case if(Enum.class.isAssignableFrom(t)) return new EnumOptionHandler(parser,o,setter,t); OptionHandlerFactory factory = handlers.get(t); if (factory==null) throw new IllegalAnnotationError(Messages.UNKNOWN_HANDLER.format(t)); return factory.getHandler(parser, o, setter); } else { // explicit handler specified return new DefaultConstructorHandlerFactory(h).getHandler(parser, o, setter); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "OptionHandler", "createOptionHandler", "(", "CmdLineParser", "parser", ",", "OptionDef", "o", ",", "Setter", "setter", ")", "{", "checkNonNull", "(", "o", ",", "\"CmdLineParser\"", ")", ";", "checkN...
Creates an {@link OptionHandler} that handles the given {@link Option} annotation and the {@link Setter} instance.
[ "Creates", "an", "{" ]
train
https://github.com/kohsuke/args4j/blob/dc2e7e265caf15a1a146e3389c1f16a8781f06cf/args4j/src/org/kohsuke/args4j/OptionHandlerRegistry.java#L166-L190
btrplace/scheduler
choco/src/main/java/org/btrplace/scheduler/choco/view/CShareableResource.java
CShareableResource.minVMAllocation
public int minVMAllocation(int vmIdx, int v) { int vv = Math.max(v, vmAllocation.get(vmIdx)); vmAllocation.set(vmIdx, vv); return vv; }
java
public int minVMAllocation(int vmIdx, int v) { int vv = Math.max(v, vmAllocation.get(vmIdx)); vmAllocation.set(vmIdx, vv); return vv; }
[ "public", "int", "minVMAllocation", "(", "int", "vmIdx", ",", "int", "v", ")", "{", "int", "vv", "=", "Math", ".", "max", "(", "v", ",", "vmAllocation", ".", "get", "(", "vmIdx", ")", ")", ";", "vmAllocation", ".", "set", "(", "vmIdx", ",", "vv", ...
Change the VM resource allocation. @param vmIdx the VM identifier @param v the amount to ask. @return the retained value. May be bigger than {@code v} if a previous call asks for more
[ "Change", "the", "VM", "resource", "allocation", "." ]
train
https://github.com/btrplace/scheduler/blob/611063aad0b47a016e57ebf36fa4dfdf24de09e8/choco/src/main/java/org/btrplace/scheduler/choco/view/CShareableResource.java#L221-L225
apache/groovy
src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
DefaultGroovyMethods.getAt
@SuppressWarnings("unchecked") public static List<Integer> getAt(int[] array, ObjectRange range) { return primitiveArrayGet(array, range); }
java
@SuppressWarnings("unchecked") public static List<Integer> getAt(int[] array, ObjectRange range) { return primitiveArrayGet(array, range); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "static", "List", "<", "Integer", ">", "getAt", "(", "int", "[", "]", "array", ",", "ObjectRange", "range", ")", "{", "return", "primitiveArrayGet", "(", "array", ",", "range", ")", ";", "}" ]
Support the subscript operator with an ObjectRange for an int array @param array an int array @param range an ObjectRange indicating the indices for the items to retrieve @return list of the retrieved ints @since 1.0
[ "Support", "the", "subscript", "operator", "with", "an", "ObjectRange", "for", "an", "int", "array" ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/DefaultGroovyMethods.java#L13873-L13876
bluelinelabs/Conductor
demo/src/main/java/com/bluelinelabs/conductor/demo/util/AnimUtils.java
AnimUtils.createFloatProperty
public static <T> Property<T, Float> createFloatProperty(final FloatProp<T> impl) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { return new FloatProperty<T>(impl.name) { @Override public Float get(T object) { return impl.get(object); } @Override public void setValue(T object, float value) { impl.set(object, value); } }; } else { return new Property<T, Float>(Float.class, impl.name) { @Override public Float get(T object) { return impl.get(object); } @Override public void set(T object, Float value) { impl.set(object, value); } }; } }
java
public static <T> Property<T, Float> createFloatProperty(final FloatProp<T> impl) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { return new FloatProperty<T>(impl.name) { @Override public Float get(T object) { return impl.get(object); } @Override public void setValue(T object, float value) { impl.set(object, value); } }; } else { return new Property<T, Float>(Float.class, impl.name) { @Override public Float get(T object) { return impl.get(object); } @Override public void set(T object, Float value) { impl.set(object, value); } }; } }
[ "public", "static", "<", "T", ">", "Property", "<", "T", ",", "Float", ">", "createFloatProperty", "(", "final", "FloatProp", "<", "T", ">", "impl", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".",...
The animation framework has an optimization for <code>Properties</code> of type <code>float</code> but it was only made public in API24, so wrap the impl in our own type and conditionally create the appropriate type, delegating the implementation.
[ "The", "animation", "framework", "has", "an", "optimization", "for", "<code", ">", "Properties<", "/", "code", ">", "of", "type", "<code", ">", "float<", "/", "code", ">", "but", "it", "was", "only", "made", "public", "in", "API24", "so", "wrap", "the", ...
train
https://github.com/bluelinelabs/Conductor/blob/94c9121bb16f93b481954513a8e3905846829fb2/demo/src/main/java/com/bluelinelabs/conductor/demo/util/AnimUtils.java#L157-L183
Waikato/moa
moa/src/main/java/moa/classifiers/core/attributeclassobservers/FIMTDDNumericAttributeClassObserver.java
FIMTDDNumericAttributeClassObserver.removeBadSplits
public void removeBadSplits(SplitCriterion criterion, double lastCheckRatio, double lastCheckSDR, double lastCheckE) { removeBadSplitNodes(criterion, this.root, lastCheckRatio, lastCheckSDR, lastCheckE); }
java
public void removeBadSplits(SplitCriterion criterion, double lastCheckRatio, double lastCheckSDR, double lastCheckE) { removeBadSplitNodes(criterion, this.root, lastCheckRatio, lastCheckSDR, lastCheckE); }
[ "public", "void", "removeBadSplits", "(", "SplitCriterion", "criterion", ",", "double", "lastCheckRatio", ",", "double", "lastCheckSDR", ",", "double", "lastCheckE", ")", "{", "removeBadSplitNodes", "(", "criterion", ",", "this", ".", "root", ",", "lastCheckRatio", ...
A method to remove all nodes in the E-BST in which it and all it's children represent 'bad' split points
[ "A", "method", "to", "remove", "all", "nodes", "in", "the", "E", "-", "BST", "in", "which", "it", "and", "all", "it", "s", "children", "represent", "bad", "split", "points" ]
train
https://github.com/Waikato/moa/blob/395982e5100bfe75a3a4d26115462ce2cc74cbb0/moa/src/main/java/moa/classifiers/core/attributeclassobservers/FIMTDDNumericAttributeClassObserver.java#L193-L195
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/auth/ChooseAuthenticationFragment.java
ChooseAuthenticationFragment.createChooseAuthenticationFragment
public static ChooseAuthenticationFragment createChooseAuthenticationFragment(final Context context, final ArrayList<BoxAuthentication.BoxAuthenticationInfo> listOfAuthInfo){ ChooseAuthenticationFragment fragment = createAuthenticationActivity(context); Bundle b = fragment.getArguments(); if (b == null){ b = new Bundle(); } ArrayList<CharSequence> jsonSerialized = new ArrayList<CharSequence>(listOfAuthInfo.size()); for (BoxAuthentication.BoxAuthenticationInfo info : listOfAuthInfo){ jsonSerialized.add(info.toJson()); } b.putCharSequenceArrayList(EXTRA_BOX_AUTHENTICATION_INFOS, jsonSerialized); fragment.setArguments(b); return fragment; }
java
public static ChooseAuthenticationFragment createChooseAuthenticationFragment(final Context context, final ArrayList<BoxAuthentication.BoxAuthenticationInfo> listOfAuthInfo){ ChooseAuthenticationFragment fragment = createAuthenticationActivity(context); Bundle b = fragment.getArguments(); if (b == null){ b = new Bundle(); } ArrayList<CharSequence> jsonSerialized = new ArrayList<CharSequence>(listOfAuthInfo.size()); for (BoxAuthentication.BoxAuthenticationInfo info : listOfAuthInfo){ jsonSerialized.add(info.toJson()); } b.putCharSequenceArrayList(EXTRA_BOX_AUTHENTICATION_INFOS, jsonSerialized); fragment.setArguments(b); return fragment; }
[ "public", "static", "ChooseAuthenticationFragment", "createChooseAuthenticationFragment", "(", "final", "Context", "context", ",", "final", "ArrayList", "<", "BoxAuthentication", ".", "BoxAuthenticationInfo", ">", "listOfAuthInfo", ")", "{", "ChooseAuthenticationFragment", "f...
Create an instance of this fragment to display the given list of BoxAuthenticationInfos. @param context current context @param listOfAuthInfo a list of auth infos in the order to display to the user. @return a fragment displaying list of authinfos provided above.
[ "Create", "an", "instance", "of", "this", "fragment", "to", "display", "the", "given", "list", "of", "BoxAuthenticationInfos", "." ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/auth/ChooseAuthenticationFragment.java#L103-L119
MorphiaOrg/morphia
morphia/src/main/java/dev/morphia/mapping/Mapper.java
Mapper.getMappedClass
public MappedClass getMappedClass(final Object obj) { if (obj == null) { return null; } Class type = (obj instanceof Class) ? (Class) obj : obj.getClass(); if (ProxyHelper.isProxy(obj)) { type = ProxyHelper.getReferentClass(obj); } MappedClass mc = mappedClasses.get(type.getName()); if (mc == null) { mc = new MappedClass(type, this); // no validation addMappedClass(mc, false); } return mc; }
java
public MappedClass getMappedClass(final Object obj) { if (obj == null) { return null; } Class type = (obj instanceof Class) ? (Class) obj : obj.getClass(); if (ProxyHelper.isProxy(obj)) { type = ProxyHelper.getReferentClass(obj); } MappedClass mc = mappedClasses.get(type.getName()); if (mc == null) { mc = new MappedClass(type, this); // no validation addMappedClass(mc, false); } return mc; }
[ "public", "MappedClass", "getMappedClass", "(", "final", "Object", "obj", ")", "{", "if", "(", "obj", "==", "null", ")", "{", "return", "null", ";", "}", "Class", "type", "=", "(", "obj", "instanceof", "Class", ")", "?", "(", "Class", ")", "obj", ":"...
Gets the {@link MappedClass} for the object (type). If it isn't mapped, create a new class and cache it (without validating). @param obj the object to process @return the MappedClass for the object given
[ "Gets", "the", "{", "@link", "MappedClass", "}", "for", "the", "object", "(", "type", ")", ".", "If", "it", "isn", "t", "mapped", "create", "a", "new", "class", "and", "cache", "it", "(", "without", "validating", ")", "." ]
train
https://github.com/MorphiaOrg/morphia/blob/667c30bdc7c6f1d9f2e2eb8774835d6137b52d12/morphia/src/main/java/dev/morphia/mapping/Mapper.java#L504-L521
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java
WordVectorSerializer.readVocabCache
public static VocabCache<VocabWord> readVocabCache(@NonNull InputStream stream) throws IOException { val vocabCache = new AbstractCache.Builder<VocabWord>().build(); val factory = new VocabWordFactory(); boolean firstLine = true; long totalWordOcc = -1L; try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) { String line; while ((line = reader.readLine()) != null) { // try to treat first line as header with 3 digits if (firstLine) { firstLine = false; val split = line.split("\\ "); if (split.length != 3) continue; try { vocabCache.setTotalDocCount(Long.valueOf(split[1])); totalWordOcc = Long.valueOf(split[2]); continue; } catch (NumberFormatException e) { // no-op } } val word = factory.deserialize(line); vocabCache.addToken(word); vocabCache.addWordToIndex(word.getIndex(), word.getLabel()); } } if (totalWordOcc >= 0) vocabCache.setTotalWordOccurences(totalWordOcc); return vocabCache; }
java
public static VocabCache<VocabWord> readVocabCache(@NonNull InputStream stream) throws IOException { val vocabCache = new AbstractCache.Builder<VocabWord>().build(); val factory = new VocabWordFactory(); boolean firstLine = true; long totalWordOcc = -1L; try (BufferedReader reader = new BufferedReader(new InputStreamReader(stream, StandardCharsets.UTF_8))) { String line; while ((line = reader.readLine()) != null) { // try to treat first line as header with 3 digits if (firstLine) { firstLine = false; val split = line.split("\\ "); if (split.length != 3) continue; try { vocabCache.setTotalDocCount(Long.valueOf(split[1])); totalWordOcc = Long.valueOf(split[2]); continue; } catch (NumberFormatException e) { // no-op } } val word = factory.deserialize(line); vocabCache.addToken(word); vocabCache.addWordToIndex(word.getIndex(), word.getLabel()); } } if (totalWordOcc >= 0) vocabCache.setTotalWordOccurences(totalWordOcc); return vocabCache; }
[ "public", "static", "VocabCache", "<", "VocabWord", ">", "readVocabCache", "(", "@", "NonNull", "InputStream", "stream", ")", "throws", "IOException", "{", "val", "vocabCache", "=", "new", "AbstractCache", ".", "Builder", "<", "VocabWord", ">", "(", ")", ".", ...
This method reads vocab cache from provided InputStream. Please note: it reads only vocab content, so it's suitable mostly for BagOfWords/TF-IDF vectorizers @param stream @return @throws IOException
[ "This", "method", "reads", "vocab", "cache", "from", "provided", "InputStream", ".", "Please", "note", ":", "it", "reads", "only", "vocab", "content", "so", "it", "s", "suitable", "mostly", "for", "BagOfWords", "/", "TF", "-", "IDF", "vectorizers" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java#L2236-L2272
apptentive/apptentive-android
apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java
Apptentive.register
public static void register(Application application, String apptentiveKey, String apptentiveSignature) { register(application, new ApptentiveConfiguration(apptentiveKey, apptentiveSignature)); }
java
public static void register(Application application, String apptentiveKey, String apptentiveSignature) { register(application, new ApptentiveConfiguration(apptentiveKey, apptentiveSignature)); }
[ "public", "static", "void", "register", "(", "Application", "application", ",", "String", "apptentiveKey", ",", "String", "apptentiveSignature", ")", "{", "register", "(", "application", ",", "new", "ApptentiveConfiguration", "(", "apptentiveKey", ",", "apptentiveSign...
Must be called from the {@link Application#onCreate()} method in the {@link Application} object defined in your app's manifest. @param application Application object. @param apptentiveKey Apptentive Key. @param apptentiveSignature Apptentive Signature.
[ "Must", "be", "called", "from", "the", "{" ]
train
https://github.com/apptentive/apptentive-android/blob/887c08d7bd5ae6488a90366dfb58f58938861a93/apptentive/src/main/java/com/apptentive/android/sdk/Apptentive.java#L110-L112
ibm-bluemix-mobile-services/bms-clientsdk-android-core
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationProcessManager.java
AuthorizationProcessManager.logout
public void logout(Context context, ResponseListener listener) { AuthorizationRequestManager.RequestOptions options = new AuthorizationRequestManager.RequestOptions(); options.parameters = new HashMap<String,String>(1); options.parameters.put("client_id", preferences.clientId.get()); options.headers = new HashMap<>(1); addSessionIdHeader(options.headers); options.requestMethod = Request.GET; try { authorizationRequestSend(context,"logout", options, listener); } catch (Exception e) { logger.debug("Could not log out"); } }
java
public void logout(Context context, ResponseListener listener) { AuthorizationRequestManager.RequestOptions options = new AuthorizationRequestManager.RequestOptions(); options.parameters = new HashMap<String,String>(1); options.parameters.put("client_id", preferences.clientId.get()); options.headers = new HashMap<>(1); addSessionIdHeader(options.headers); options.requestMethod = Request.GET; try { authorizationRequestSend(context,"logout", options, listener); } catch (Exception e) { logger.debug("Could not log out"); } }
[ "public", "void", "logout", "(", "Context", "context", ",", "ResponseListener", "listener", ")", "{", "AuthorizationRequestManager", ".", "RequestOptions", "options", "=", "new", "AuthorizationRequestManager", ".", "RequestOptions", "(", ")", ";", "options", ".", "p...
logs out user @param context Android Activity that will handle the authorization (like facebook or google) @param listener Response listener
[ "logs", "out", "user" ]
train
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-core/blob/8db4f00d0d564792397bfc0e5bd57d52a238b858/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/security/mca/internal/AuthorizationProcessManager.java#L123-L135
spockframework/spock
spock-spring/src/main/java/org/spockframework/spring/UnwrapAopProxyExtension.java
UnwrapAopProxyExtension.getUltimateTargetObject
public static <T> T getUltimateTargetObject(Object candidate) { Assert.notNull(candidate, "Candidate must not be null"); try { if (AopUtils.isAopProxy(candidate) && (candidate instanceof Advised)) { Object target = ((Advised) candidate).getTargetSource().getTarget(); if (target != null) { return (T) getUltimateTargetObject(target); } } } catch (Throwable ex) { throw new IllegalStateException("Failed to unwrap proxied object", ex); } return (T) candidate; }
java
public static <T> T getUltimateTargetObject(Object candidate) { Assert.notNull(candidate, "Candidate must not be null"); try { if (AopUtils.isAopProxy(candidate) && (candidate instanceof Advised)) { Object target = ((Advised) candidate).getTargetSource().getTarget(); if (target != null) { return (T) getUltimateTargetObject(target); } } } catch (Throwable ex) { throw new IllegalStateException("Failed to unwrap proxied object", ex); } return (T) candidate; }
[ "public", "static", "<", "T", ">", "T", "getUltimateTargetObject", "(", "Object", "candidate", ")", "{", "Assert", ".", "notNull", "(", "candidate", ",", "\"Candidate must not be null\"", ")", ";", "try", "{", "if", "(", "AopUtils", ".", "isAopProxy", "(", "...
Taken from {@link org.springframework.test.util.AopTestUtils#getUltimateTargetObject(java.lang.Object)} and copied to provide support for versions earlier then Spring 4.2 Get the ultimate <em>target</em> object of the supplied {@code candidate} object, unwrapping not only a top-level proxy but also any number of nested proxies. <p>If the supplied {@code candidate} is a Spring {@linkplain AopUtils#isAopProxy proxy}, the ultimate target of all nested proxies will be returned; otherwise, the {@code candidate} will be returned <em>as is</em>. @param candidate the instance to check (potentially a Spring AOP proxy; never {@code null}) @return the target object or the {@code candidate} (never {@code null}) @throws IllegalStateException if an error occurs while unwrapping a proxy @see Advised#getTargetSource() @see org.springframework.aop.framework.AopProxyUtils#ultimateTargetClass
[ "Taken", "from", "{", "@link", "org", ".", "springframework", ".", "test", ".", "util", ".", "AopTestUtils#getUltimateTargetObject", "(", "java", ".", "lang", ".", "Object", ")", "}", "and", "copied", "to", "provide", "support", "for", "versions", "earlier", ...
train
https://github.com/spockframework/spock/blob/d751a0abd8d5a2ec5338aa10bc2d19371b3b3ad9/spock-spring/src/main/java/org/spockframework/spring/UnwrapAopProxyExtension.java#L51-L65
OpenLiberty/open-liberty
dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/composite/CompositeTagAttributeUtils.java
CompositeTagAttributeUtils.containsUnspecifiedAttributes
public static boolean containsUnspecifiedAttributes(Tag tag, String[] standardAttributesSorted) { for (TagAttribute attribute : tag.getAttributes().getAll()) { final String name = attribute.getLocalName(); if (Arrays.binarySearch(standardAttributesSorted, name) < 0) { return true; } } return false; }
java
public static boolean containsUnspecifiedAttributes(Tag tag, String[] standardAttributesSorted) { for (TagAttribute attribute : tag.getAttributes().getAll()) { final String name = attribute.getLocalName(); if (Arrays.binarySearch(standardAttributesSorted, name) < 0) { return true; } } return false; }
[ "public", "static", "boolean", "containsUnspecifiedAttributes", "(", "Tag", "tag", ",", "String", "[", "]", "standardAttributesSorted", ")", "{", "for", "(", "TagAttribute", "attribute", ":", "tag", ".", "getAttributes", "(", ")", ".", "getAll", "(", ")", ")",...
Returns true if the given Tag contains attributes that are not specified in standardAttributesSorted. NOTE that standardAttributesSorted has to be alphabetically sorted in order to use binary search. @param tag @param standardAttributesSorted @return
[ "Returns", "true", "if", "the", "given", "Tag", "contains", "attributes", "that", "are", "not", "specified", "in", "standardAttributesSorted", ".", "NOTE", "that", "standardAttributesSorted", "has", "to", "be", "alphabetically", "sorted", "in", "order", "to", "use...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.jsf.2.2/src/org/apache/myfaces/view/facelets/tag/composite/CompositeTagAttributeUtils.java#L76-L87
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javadoc/AnnotationTypeElementDocImpl.java
AnnotationTypeElementDocImpl.defaultValue
public AnnotationValue defaultValue() { return (sym.defaultValue == null) ? null : new AnnotationValueImpl(env, sym.defaultValue); }
java
public AnnotationValue defaultValue() { return (sym.defaultValue == null) ? null : new AnnotationValueImpl(env, sym.defaultValue); }
[ "public", "AnnotationValue", "defaultValue", "(", ")", "{", "return", "(", "sym", ".", "defaultValue", "==", "null", ")", "?", "null", ":", "new", "AnnotationValueImpl", "(", "env", ",", "sym", ".", "defaultValue", ")", ";", "}" ]
Returns the default value of this element. Returns null if this element has no default.
[ "Returns", "the", "default", "value", "of", "this", "element", ".", "Returns", "null", "if", "this", "element", "has", "no", "default", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javadoc/AnnotationTypeElementDocImpl.java#L85-L89
alkacon/opencms-core
src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java
CmsSitemapController.removeFromNavigation
public void removeFromNavigation(CmsUUID entryId) { CmsClientSitemapEntry entry = getEntryById(entryId); CmsClientSitemapEntry parent = getEntry(CmsResource.getParentFolder(entry.getSitePath())); CmsSitemapChange change = new CmsSitemapChange(entry.getId(), entry.getSitePath(), ChangeType.remove); change.setParentId(parent.getId()); change.setDefaultFileId(entry.getDefaultFileId()); CmsSitemapClipboardData data = CmsSitemapView.getInstance().getController().getData().getClipboardData().copy(); data.addModified(entry); change.setClipBoardData(data); //TODO: handle detail page delete commitChange(change, null); }
java
public void removeFromNavigation(CmsUUID entryId) { CmsClientSitemapEntry entry = getEntryById(entryId); CmsClientSitemapEntry parent = getEntry(CmsResource.getParentFolder(entry.getSitePath())); CmsSitemapChange change = new CmsSitemapChange(entry.getId(), entry.getSitePath(), ChangeType.remove); change.setParentId(parent.getId()); change.setDefaultFileId(entry.getDefaultFileId()); CmsSitemapClipboardData data = CmsSitemapView.getInstance().getController().getData().getClipboardData().copy(); data.addModified(entry); change.setClipBoardData(data); //TODO: handle detail page delete commitChange(change, null); }
[ "public", "void", "removeFromNavigation", "(", "CmsUUID", "entryId", ")", "{", "CmsClientSitemapEntry", "entry", "=", "getEntryById", "(", "entryId", ")", ";", "CmsClientSitemapEntry", "parent", "=", "getEntry", "(", "CmsResource", ".", "getParentFolder", "(", "entr...
Removes the entry with the given site-path from navigation.<p> @param entryId the entry id
[ "Removes", "the", "entry", "with", "the", "given", "site", "-", "path", "from", "navigation", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-gwt/org/opencms/ade/sitemap/client/control/CmsSitemapController.java#L1816-L1829
schallee/alib4j
jvm/src/main/java/net/darkmist/alib/jvm/JVMLauncher.java
JVMLauncher.getProcessBuilder
public static ProcessBuilder getProcessBuilder(String mainClass, List<URL> classPath, String...args) throws LauncherException { return getProcessBuilder(mainClass, classPath, Arrays.asList(args)); }
java
public static ProcessBuilder getProcessBuilder(String mainClass, List<URL> classPath, String...args) throws LauncherException { return getProcessBuilder(mainClass, classPath, Arrays.asList(args)); }
[ "public", "static", "ProcessBuilder", "getProcessBuilder", "(", "String", "mainClass", ",", "List", "<", "URL", ">", "classPath", ",", "String", "...", "args", ")", "throws", "LauncherException", "{", "return", "getProcessBuilder", "(", "mainClass", ",", "classPat...
Get a process loader for a JVM. @param mainClass Main class to run @param classPath List of urls to use for the new JVM's class path. @param args Additional command line parameters @return ProcessBuilder that has not been started.
[ "Get", "a", "process", "loader", "for", "a", "JVM", "." ]
train
https://github.com/schallee/alib4j/blob/0e0718aee574bbb62268e1cf58e99286529ce529/jvm/src/main/java/net/darkmist/alib/jvm/JVMLauncher.java#L207-L210
beanshell/beanshell
src/main/java/bsh/Name.java
Name.toObject
public Object toObject( CallStack callstack, Interpreter interpreter ) throws UtilEvalError { return toObject( callstack, interpreter, false ); }
java
public Object toObject( CallStack callstack, Interpreter interpreter ) throws UtilEvalError { return toObject( callstack, interpreter, false ); }
[ "public", "Object", "toObject", "(", "CallStack", "callstack", ",", "Interpreter", "interpreter", ")", "throws", "UtilEvalError", "{", "return", "toObject", "(", "callstack", ",", "interpreter", ",", "false", ")", ";", "}" ]
Resolve possibly complex name to an object value. Throws EvalError on various failures. A null object value is indicated by a Primitive.NULL. A return type of Primitive.VOID comes from attempting to access an undefined variable. Some cases: myVariable myVariable.foo myVariable.foo.bar java.awt.GridBagConstraints.BOTH my.package.stuff.MyClass.someField.someField... Interpreter reference is necessary to allow resolution of "this.interpreter" magic field. CallStack reference is necessary to allow resolution of "this.caller" magic field. "this.callstack" magic field.
[ "Resolve", "possibly", "complex", "name", "to", "an", "object", "value", "." ]
train
https://github.com/beanshell/beanshell/blob/fdddee3de948c9e6babb2d1337028f6fd0a2ba5c/src/main/java/bsh/Name.java#L174-L178
spring-projects/spring-loaded
springloaded/src/main/java/org/springsource/loaded/Utils.java
Utils.createLoadsBasedOnDescriptor
public static void createLoadsBasedOnDescriptor(MethodVisitor mv, String descriptor, int startindex) { int slot = startindex; int descriptorpos = 1; // start after the '(' char ch; while ((ch = descriptor.charAt(descriptorpos)) != ')') { switch (ch) { case '[': mv.visitVarInsn(ALOAD, slot); slot++; // jump to end of array, could be [[[[I while (descriptor.charAt(++descriptorpos) == '[') { } if (descriptor.charAt(descriptorpos) == 'L') { descriptorpos = descriptor.indexOf(';', descriptorpos) + 1; } else { // Just a primitive array descriptorpos++; } break; case 'L': mv.visitVarInsn(ALOAD, slot); slot++; // jump to end of 'L' signature descriptorpos = descriptor.indexOf(';', descriptorpos) + 1; break; case 'J': mv.visitVarInsn(LLOAD, slot); slot += 2; // double slotter descriptorpos++; break; case 'D': mv.visitVarInsn(DLOAD, slot); slot += 2; // double slotter descriptorpos++; break; case 'F': mv.visitVarInsn(FLOAD, slot); descriptorpos++; slot++; break; case 'I': case 'Z': case 'B': case 'C': case 'S': mv.visitVarInsn(ILOAD, slot); descriptorpos++; slot++; break; default: throw new IllegalStateException("Unexpected type in descriptor: " + ch); } } }
java
public static void createLoadsBasedOnDescriptor(MethodVisitor mv, String descriptor, int startindex) { int slot = startindex; int descriptorpos = 1; // start after the '(' char ch; while ((ch = descriptor.charAt(descriptorpos)) != ')') { switch (ch) { case '[': mv.visitVarInsn(ALOAD, slot); slot++; // jump to end of array, could be [[[[I while (descriptor.charAt(++descriptorpos) == '[') { } if (descriptor.charAt(descriptorpos) == 'L') { descriptorpos = descriptor.indexOf(';', descriptorpos) + 1; } else { // Just a primitive array descriptorpos++; } break; case 'L': mv.visitVarInsn(ALOAD, slot); slot++; // jump to end of 'L' signature descriptorpos = descriptor.indexOf(';', descriptorpos) + 1; break; case 'J': mv.visitVarInsn(LLOAD, slot); slot += 2; // double slotter descriptorpos++; break; case 'D': mv.visitVarInsn(DLOAD, slot); slot += 2; // double slotter descriptorpos++; break; case 'F': mv.visitVarInsn(FLOAD, slot); descriptorpos++; slot++; break; case 'I': case 'Z': case 'B': case 'C': case 'S': mv.visitVarInsn(ILOAD, slot); descriptorpos++; slot++; break; default: throw new IllegalStateException("Unexpected type in descriptor: " + ch); } } }
[ "public", "static", "void", "createLoadsBasedOnDescriptor", "(", "MethodVisitor", "mv", ",", "String", "descriptor", ",", "int", "startindex", ")", "{", "int", "slot", "=", "startindex", ";", "int", "descriptorpos", "=", "1", ";", "// start after the '('", "char",...
Create the set of LOAD instructions to load the method parameters. Take into account the size and type. @param mv the method visitor to recieve the load instructions @param descriptor the complete method descriptor (eg. "(ILjava/lang/String;)V") - params and return type are skipped @param startindex the initial index in which to assume the first parameter is stored
[ "Create", "the", "set", "of", "LOAD", "instructions", "to", "load", "the", "method", "parameters", ".", "Take", "into", "account", "the", "size", "and", "type", "." ]
train
https://github.com/spring-projects/spring-loaded/blob/59b32f957a05c6d9f149148158053605e2a6205a/springloaded/src/main/java/org/springsource/loaded/Utils.java#L193-L247
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java
VirtualMachineScaleSetsInner.getByResourceGroupAsync
public Observable<VirtualMachineScaleSetInner> getByResourceGroupAsync(String resourceGroupName, String vmScaleSetName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<VirtualMachineScaleSetInner>, VirtualMachineScaleSetInner>() { @Override public VirtualMachineScaleSetInner call(ServiceResponse<VirtualMachineScaleSetInner> response) { return response.body(); } }); }
java
public Observable<VirtualMachineScaleSetInner> getByResourceGroupAsync(String resourceGroupName, String vmScaleSetName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, vmScaleSetName).map(new Func1<ServiceResponse<VirtualMachineScaleSetInner>, VirtualMachineScaleSetInner>() { @Override public VirtualMachineScaleSetInner call(ServiceResponse<VirtualMachineScaleSetInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualMachineScaleSetInner", ">", "getByResourceGroupAsync", "(", "String", "resourceGroupName", ",", "String", "vmScaleSetName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmScaleSetName", ...
Display information about a virtual machine scale set. @param resourceGroupName The name of the resource group. @param vmScaleSetName The name of the VM scale set. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualMachineScaleSetInner object
[ "Display", "information", "about", "a", "virtual", "machine", "scale", "set", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachineScaleSetsInner.java#L729-L736
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/CFFFontSubset.java
CFFFontSubset.CreateKeys
protected void CreateKeys(OffsetItem fdarrayRef,OffsetItem fdselectRef,OffsetItem charsetRef,OffsetItem charstringsRef) { // create an FDArray key OutputList.addLast(fdarrayRef); OutputList.addLast(new UInt8Item((char)12)); OutputList.addLast(new UInt8Item((char)36)); // create an FDSelect key OutputList.addLast(fdselectRef); OutputList.addLast(new UInt8Item((char)12)); OutputList.addLast(new UInt8Item((char)37)); // create an charset key OutputList.addLast(charsetRef); OutputList.addLast(new UInt8Item((char)15)); // create a CharStrings key OutputList.addLast(charstringsRef); OutputList.addLast(new UInt8Item((char)17)); }
java
protected void CreateKeys(OffsetItem fdarrayRef,OffsetItem fdselectRef,OffsetItem charsetRef,OffsetItem charstringsRef) { // create an FDArray key OutputList.addLast(fdarrayRef); OutputList.addLast(new UInt8Item((char)12)); OutputList.addLast(new UInt8Item((char)36)); // create an FDSelect key OutputList.addLast(fdselectRef); OutputList.addLast(new UInt8Item((char)12)); OutputList.addLast(new UInt8Item((char)37)); // create an charset key OutputList.addLast(charsetRef); OutputList.addLast(new UInt8Item((char)15)); // create a CharStrings key OutputList.addLast(charstringsRef); OutputList.addLast(new UInt8Item((char)17)); }
[ "protected", "void", "CreateKeys", "(", "OffsetItem", "fdarrayRef", ",", "OffsetItem", "fdselectRef", ",", "OffsetItem", "charsetRef", ",", "OffsetItem", "charstringsRef", ")", "{", "// create an FDArray key", "OutputList", ".", "addLast", "(", "fdarrayRef", ")", ";",...
Function adds the keys into the TopDict @param fdarrayRef OffsetItem for the FDArray @param fdselectRef OffsetItem for the FDSelect @param charsetRef OffsetItem for the CharSet @param charstringsRef OffsetItem for the CharString
[ "Function", "adds", "the", "keys", "into", "the", "TopDict" ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/CFFFontSubset.java#L1276-L1292
infinispan/infinispan
core/src/main/java/org/infinispan/util/concurrent/CommandAckCollector.java
CommandAckCollector.backupAck
public void backupAck(long id, Address from, int topologyId) { BaseAckTarget ackTarget = collectorMap.get(id); if (ackTarget instanceof SingleKeyCollector) { ((SingleKeyCollector) ackTarget).backupAck(topologyId, from); } else if (ackTarget instanceof MultiTargetCollectorImpl) { ((MultiTargetCollectorImpl) ackTarget).backupAck(topologyId, from); } }
java
public void backupAck(long id, Address from, int topologyId) { BaseAckTarget ackTarget = collectorMap.get(id); if (ackTarget instanceof SingleKeyCollector) { ((SingleKeyCollector) ackTarget).backupAck(topologyId, from); } else if (ackTarget instanceof MultiTargetCollectorImpl) { ((MultiTargetCollectorImpl) ackTarget).backupAck(topologyId, from); } }
[ "public", "void", "backupAck", "(", "long", "id", ",", "Address", "from", ",", "int", "topologyId", ")", "{", "BaseAckTarget", "ackTarget", "=", "collectorMap", ".", "get", "(", "id", ")", ";", "if", "(", "ackTarget", "instanceof", "SingleKeyCollector", ")",...
Acknowledges a write operation completion in the backup owner. @param id the id from {@link CommandInvocationId#getId()}. @param from the backup owner. @param topologyId the topology id.
[ "Acknowledges", "a", "write", "operation", "completion", "in", "the", "backup", "owner", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/core/src/main/java/org/infinispan/util/concurrent/CommandAckCollector.java#L165-L172