repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
194
func_name
stringlengths
6
111
whole_func_string
stringlengths
80
3.8k
language
stringclasses
1 value
func_code_string
stringlengths
80
3.8k
func_code_tokens
listlengths
20
697
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
listlengths
1
434
split_name
stringclasses
1 value
func_code_url
stringlengths
111
308
pravega/pravega
common/src/main/java/io/pravega/common/util/ToStringUtils.java
ToStringUtils.decompressFromBase64
@SneakyThrows(IOException.class) public static String decompressFromBase64(final String base64CompressedString) { Exceptions.checkNotNullOrEmpty(base64CompressedString, "base64CompressedString"); try { @Cleanup final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(base64CompressedString.getBytes(UTF_8)); @Cleanup final InputStream base64InputStream = Base64.getDecoder().wrap(byteArrayInputStream); @Cleanup final GZIPInputStream gzipInputStream = new GZIPInputStream(base64InputStream); return IOUtils.toString(gzipInputStream, UTF_8); } catch (ZipException | EOFException e) { // exceptions thrown for invalid encoding and partial data. throw new IllegalArgumentException("Invalid base64 input.", e); } }
java
@SneakyThrows(IOException.class) public static String decompressFromBase64(final String base64CompressedString) { Exceptions.checkNotNullOrEmpty(base64CompressedString, "base64CompressedString"); try { @Cleanup final ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(base64CompressedString.getBytes(UTF_8)); @Cleanup final InputStream base64InputStream = Base64.getDecoder().wrap(byteArrayInputStream); @Cleanup final GZIPInputStream gzipInputStream = new GZIPInputStream(base64InputStream); return IOUtils.toString(gzipInputStream, UTF_8); } catch (ZipException | EOFException e) { // exceptions thrown for invalid encoding and partial data. throw new IllegalArgumentException("Invalid base64 input.", e); } }
[ "@", "SneakyThrows", "(", "IOException", ".", "class", ")", "public", "static", "String", "decompressFromBase64", "(", "final", "String", "base64CompressedString", ")", "{", "Exceptions", ".", "checkNotNullOrEmpty", "(", "base64CompressedString", ",", "\"base64Compresse...
Get the original string from its compressed base64 representation. @param base64CompressedString Compressed Base64 representation of the string. @return The original string. @throws NullPointerException If base64CompressedString is null. @throws IllegalArgumentException If base64CompressedString is not null, but has a length of zero or if the input is invalid.
[ "Get", "the", "original", "string", "from", "its", "compressed", "base64", "representation", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/common/src/main/java/io/pravega/common/util/ToStringUtils.java#L146-L160
shrinkwrap/resolver
maven/api-maven/src/main/java/org/jboss/shrinkwrap/resolver/api/maven/repository/MavenRemoteRepositories.java
MavenRemoteRepositories.createRemoteRepository
public static MavenRemoteRepository createRemoteRepository(final String id, final String url, final String layout) throws IllegalArgumentException { try { return createRemoteRepository(id, new URL(url), layout); } catch (MalformedURLException e) { throw new IllegalArgumentException("invalid URL", e); } }
java
public static MavenRemoteRepository createRemoteRepository(final String id, final String url, final String layout) throws IllegalArgumentException { try { return createRemoteRepository(id, new URL(url), layout); } catch (MalformedURLException e) { throw new IllegalArgumentException("invalid URL", e); } }
[ "public", "static", "MavenRemoteRepository", "createRemoteRepository", "(", "final", "String", "id", ",", "final", "String", "url", ",", "final", "String", "layout", ")", "throws", "IllegalArgumentException", "{", "try", "{", "return", "createRemoteRepository", "(", ...
Overload of {@link #createRemoteRepository(String, URL, String)} that thrown an exception if URL is wrong. @param id The unique ID of the repository to create (arbitrary name) @param url The base URL of the Maven repository @param layout he repository layout. Should always be "default" @return A new <code>MavenRemoteRepository</code> with the given ID and URL. @throws IllegalArgumentException for null or empty id or if the URL is technically wrong or null
[ "Overload", "of", "{", "@link", "#createRemoteRepository", "(", "String", "URL", "String", ")", "}", "that", "thrown", "an", "exception", "if", "URL", "is", "wrong", "." ]
train
https://github.com/shrinkwrap/resolver/blob/e881a84b8cff5b0a014f2a5ebf612be3eb9db01f/maven/api-maven/src/main/java/org/jboss/shrinkwrap/resolver/api/maven/repository/MavenRemoteRepositories.java#L39-L47
SimplicityApks/ReminderDatePicker
lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java
DateSpinner.setShowPastItems
public void setShowPastItems(boolean enable) { if(enable && !showPastItems) { // first reset the minimum date if necessary: if(getMinDate() != null && compareCalendarDates(getMinDate(), Calendar.getInstance()) == 0) setMinDate(null); // create the yesterday and last Monday item: final Resources res = getResources(); final Calendar date = Calendar.getInstance(); // yesterday: date.add(Calendar.DAY_OF_YEAR, -1); insertAdapterItem(new DateItem(res.getString(R.string.date_yesterday), date, R.id.date_yesterday), 0); // last weekday item: date.add(Calendar.DAY_OF_YEAR, -6); int weekday = date.get(Calendar.DAY_OF_WEEK); insertAdapterItem(new DateItem(getWeekDay(weekday, R.string.date_last_weekday), date, R.id.date_last_week), 0); } else if(!enable && showPastItems) { // delete the yesterday and last weekday items: removeAdapterItemById(R.id.date_last_week); removeAdapterItemById(R.id.date_yesterday); // we set the minimum date to today as we don't allow past items setMinDate(Calendar.getInstance()); } showPastItems = enable; }
java
public void setShowPastItems(boolean enable) { if(enable && !showPastItems) { // first reset the minimum date if necessary: if(getMinDate() != null && compareCalendarDates(getMinDate(), Calendar.getInstance()) == 0) setMinDate(null); // create the yesterday and last Monday item: final Resources res = getResources(); final Calendar date = Calendar.getInstance(); // yesterday: date.add(Calendar.DAY_OF_YEAR, -1); insertAdapterItem(new DateItem(res.getString(R.string.date_yesterday), date, R.id.date_yesterday), 0); // last weekday item: date.add(Calendar.DAY_OF_YEAR, -6); int weekday = date.get(Calendar.DAY_OF_WEEK); insertAdapterItem(new DateItem(getWeekDay(weekday, R.string.date_last_weekday), date, R.id.date_last_week), 0); } else if(!enable && showPastItems) { // delete the yesterday and last weekday items: removeAdapterItemById(R.id.date_last_week); removeAdapterItemById(R.id.date_yesterday); // we set the minimum date to today as we don't allow past items setMinDate(Calendar.getInstance()); } showPastItems = enable; }
[ "public", "void", "setShowPastItems", "(", "boolean", "enable", ")", "{", "if", "(", "enable", "&&", "!", "showPastItems", ")", "{", "// first reset the minimum date if necessary:", "if", "(", "getMinDate", "(", ")", "!=", "null", "&&", "compareCalendarDates", "("...
Toggles showing the past items. Past mode shows the yesterday and last weekday item. @param enable True to enable, false to disable past mode.
[ "Toggles", "showing", "the", "past", "items", ".", "Past", "mode", "shows", "the", "yesterday", "and", "last", "weekday", "item", "." ]
train
https://github.com/SimplicityApks/ReminderDatePicker/blob/7596fbac77a5d26f687fec11758935a2b7db156f/lib/src/main/java/com/simplicityapks/reminderdatepicker/lib/DateSpinner.java#L488-L515
aspectran/aspectran
core/src/main/java/com/aspectran/core/util/ClassUtils.java
ClassUtils.isLoadable
private static boolean isLoadable(Class<?> clazz, ClassLoader classLoader) { try { return (clazz == classLoader.loadClass(clazz.getName())); // Else: different class with same name found } catch (ClassNotFoundException ex) { // No corresponding class found at all return false; } }
java
private static boolean isLoadable(Class<?> clazz, ClassLoader classLoader) { try { return (clazz == classLoader.loadClass(clazz.getName())); // Else: different class with same name found } catch (ClassNotFoundException ex) { // No corresponding class found at all return false; } }
[ "private", "static", "boolean", "isLoadable", "(", "Class", "<", "?", ">", "clazz", ",", "ClassLoader", "classLoader", ")", "{", "try", "{", "return", "(", "clazz", "==", "classLoader", ".", "loadClass", "(", "clazz", ".", "getName", "(", ")", ")", ")", ...
Check whether the given class is loadable in the given ClassLoader. @param clazz the class to check (typically an interface) @param classLoader the ClassLoader to check against @return true if the given class is loadable; otherwise false @since 6.0.0
[ "Check", "whether", "the", "given", "class", "is", "loadable", "in", "the", "given", "ClassLoader", "." ]
train
https://github.com/aspectran/aspectran/blob/2d758a2a28b71ee85b42823c12dc44674d7f2c70/core/src/main/java/com/aspectran/core/util/ClassUtils.java#L172-L180
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java
HexUtil.appendHexString
static public void appendHexString(StringBuilder buffer, byte[] bytes, int offset, int length) { assertNotNull(buffer); if (bytes == null) { return; // do nothing (a noop) } assertOffsetLengthValid(offset, length, bytes.length); int end = offset + length; for (int i = offset; i < end; i++) { int nibble1 = (bytes[i] & 0xF0) >>> 4; int nibble0 = (bytes[i] & 0x0F); buffer.append(HEX_TABLE[nibble1]); buffer.append(HEX_TABLE[nibble0]); } }
java
static public void appendHexString(StringBuilder buffer, byte[] bytes, int offset, int length) { assertNotNull(buffer); if (bytes == null) { return; // do nothing (a noop) } assertOffsetLengthValid(offset, length, bytes.length); int end = offset + length; for (int i = offset; i < end; i++) { int nibble1 = (bytes[i] & 0xF0) >>> 4; int nibble0 = (bytes[i] & 0x0F); buffer.append(HEX_TABLE[nibble1]); buffer.append(HEX_TABLE[nibble0]); } }
[ "static", "public", "void", "appendHexString", "(", "StringBuilder", "buffer", ",", "byte", "[", "]", "bytes", ",", "int", "offset", ",", "int", "length", ")", "{", "assertNotNull", "(", "buffer", ")", ";", "if", "(", "bytes", "==", "null", ")", "{", "...
Appends a byte array to a StringBuilder with each byte in a "Big Endian" hexidecimal format. For example, a byte 0x34 will be appended as a String in format "34". A byte array of { 0x34, 035 } would append "3435". @param buffer The StringBuilder the byte array in hexidecimal format will be appended to. If the buffer is null, this method will throw a NullPointerException. @param bytes The byte array that will be converted to a hexidecimal String. If the byte array is null, this method will append nothing (a noop) @param offset The offset in the byte array to start from. If the offset or length combination is invalid, this method will throw an IllegalArgumentException. @param length The length (from the offset) to conver the bytes. If the offset or length combination is invalid, this method will throw an IllegalArgumentException.
[ "Appends", "a", "byte", "array", "to", "a", "StringBuilder", "with", "each", "byte", "in", "a", "Big", "Endian", "hexidecimal", "format", ".", "For", "example", "a", "byte", "0x34", "will", "be", "appended", "as", "a", "String", "in", "format", "34", "."...
train
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/HexUtil.java#L108-L121
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShaderData.java
GVRShaderData.setTexture
public void setTexture(String key, GVRTexture texture) { checkStringNotNullOrEmpty("key", key); synchronized (textures) { textures.put(key, texture); NativeShaderData.setTexture(getNative(), key, texture != null ? texture.getNative() : 0); } }
java
public void setTexture(String key, GVRTexture texture) { checkStringNotNullOrEmpty("key", key); synchronized (textures) { textures.put(key, texture); NativeShaderData.setTexture(getNative(), key, texture != null ? texture.getNative() : 0); } }
[ "public", "void", "setTexture", "(", "String", "key", ",", "GVRTexture", "texture", ")", "{", "checkStringNotNullOrEmpty", "(", "\"key\"", ",", "key", ")", ";", "synchronized", "(", "textures", ")", "{", "textures", ".", "put", "(", "key", ",", "texture", ...
Bind a {@link GVRTexture texture} to the shader uniform {@code key}. @param key Name of the shader uniform to bind the texture to. @param texture The {@link GVRTexture texture} to bind.
[ "Bind", "a", "{", "@link", "GVRTexture", "texture", "}", "to", "the", "shader", "uniform", "{", "@code", "key", "}", "." ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/GVRShaderData.java#L218-L226
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getWvWRankInfo
public void getWvWRankInfo(int[] ids, Callback<List<WvWRank>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getWvWRankInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
java
public void getWvWRankInfo(int[] ids, Callback<List<WvWRank>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getWvWRankInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
[ "public", "void", "getWvWRankInfo", "(", "int", "[", "]", "ids", ",", "Callback", "<", "List", "<", "WvWRank", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ids",...
For more info on WvW ranks API go <a href="https://wiki.guildwars2.com/wiki/API:2/wvw/ranks">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param ids list of WvW rank id @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see WvWRank WvW rank info
[ "For", "more", "info", "on", "WvW", "ranks", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "wvw", "/", "ranks", ">", "here<", "/", "a", ">", "<br", "/", ">", ...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L2766-L2769
petrbouda/joyrest
joyrest-core/src/main/java/org/joyrest/routing/matcher/RequestMatcher.java
RequestMatcher.matchProduces
public static boolean matchProduces(InternalRoute route, InternalRequest<?> request) { if (nonEmpty(request.getAccept())) { List<MediaType> matchedAcceptTypes = getAcceptedMediaTypes(route.getProduces(), request.getAccept()); if (nonEmpty(matchedAcceptTypes)) { request.setMatchedAccept(matchedAcceptTypes.get(0)); return true; } } return false; }
java
public static boolean matchProduces(InternalRoute route, InternalRequest<?> request) { if (nonEmpty(request.getAccept())) { List<MediaType> matchedAcceptTypes = getAcceptedMediaTypes(route.getProduces(), request.getAccept()); if (nonEmpty(matchedAcceptTypes)) { request.setMatchedAccept(matchedAcceptTypes.get(0)); return true; } } return false; }
[ "public", "static", "boolean", "matchProduces", "(", "InternalRoute", "route", ",", "InternalRequest", "<", "?", ">", "request", ")", "{", "if", "(", "nonEmpty", "(", "request", ".", "getAccept", "(", ")", ")", ")", "{", "List", "<", "MediaType", ">", "m...
Matches route produces configurer and Accept-header in an incoming provider @param route route configurer @param request incoming provider object @return returns {@code true} if the given route has produces Media-Type one of an Accept from an incoming provider
[ "Matches", "route", "produces", "configurer", "and", "Accept", "-", "header", "in", "an", "incoming", "provider" ]
train
https://github.com/petrbouda/joyrest/blob/58903f06fb7f0b8fdf1ef91318fb48a88bf970e0/joyrest-core/src/main/java/org/joyrest/routing/matcher/RequestMatcher.java#L47-L58
google/error-prone-javac
src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java
Types.makeSuperWildcard
private WildcardType makeSuperWildcard(Type bound, TypeVar formal) { if (bound.hasTag(BOT)) { return new WildcardType(syms.objectType, BoundKind.UNBOUND, syms.boundClass, formal); } else { return new WildcardType(bound, BoundKind.SUPER, syms.boundClass, formal); } }
java
private WildcardType makeSuperWildcard(Type bound, TypeVar formal) { if (bound.hasTag(BOT)) { return new WildcardType(syms.objectType, BoundKind.UNBOUND, syms.boundClass, formal); } else { return new WildcardType(bound, BoundKind.SUPER, syms.boundClass, formal); } }
[ "private", "WildcardType", "makeSuperWildcard", "(", "Type", "bound", ",", "TypeVar", "formal", ")", "{", "if", "(", "bound", ".", "hasTag", "(", "BOT", ")", ")", "{", "return", "new", "WildcardType", "(", "syms", ".", "objectType", ",", "BoundKind", ".", ...
Create a wildcard with the given lower (super) bound; create an unbounded wildcard if bound is bottom (type of {@code null}). @param bound the lower bound @param formal the formal type parameter that will be substituted by the wildcard
[ "Create", "a", "wildcard", "with", "the", "given", "lower", "(", "super", ")", "bound", ";", "create", "an", "unbounded", "wildcard", "if", "bound", "is", "bottom", "(", "type", "of", "{", "@code", "null", "}", ")", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java#L4558-L4570
lightblueseas/swing-components
src/main/java/de/alpharogroup/swing/panels/output/ConsolePanel.java
ConsolePanel.newJXTextArea
protected JXTextArea newJXTextArea() { JXTextArea textArea = new JXTextArea(); JTextAreaOutputStream taout = new JTextAreaOutputStream(textArea, 60); PrintStream ps = new PrintStream(taout); System.setOut(ps); System.setErr(ps); return textArea; }
java
protected JXTextArea newJXTextArea() { JXTextArea textArea = new JXTextArea(); JTextAreaOutputStream taout = new JTextAreaOutputStream(textArea, 60); PrintStream ps = new PrintStream(taout); System.setOut(ps); System.setErr(ps); return textArea; }
[ "protected", "JXTextArea", "newJXTextArea", "(", ")", "{", "JXTextArea", "textArea", "=", "new", "JXTextArea", "(", ")", ";", "JTextAreaOutputStream", "taout", "=", "new", "JTextAreaOutputStream", "(", "textArea", ",", "60", ")", ";", "PrintStream", "ps", "=", ...
Factory method that creates a new {@link JXTextArea} that prints the output from system out and error output stream. For custom @return the JX text area
[ "Factory", "method", "that", "creates", "a", "new", "{", "@link", "JXTextArea", "}", "that", "prints", "the", "output", "from", "system", "out", "and", "error", "output", "stream", ".", "For", "custom" ]
train
https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/panels/output/ConsolePanel.java#L60-L68
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java
WebhooksInner.updateAsync
public Observable<WebhookInner> updateAsync(String resourceGroupName, String registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters) { return updateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookUpdateParameters).map(new Func1<ServiceResponse<WebhookInner>, WebhookInner>() { @Override public WebhookInner call(ServiceResponse<WebhookInner> response) { return response.body(); } }); }
java
public Observable<WebhookInner> updateAsync(String resourceGroupName, String registryName, String webhookName, WebhookUpdateParameters webhookUpdateParameters) { return updateWithServiceResponseAsync(resourceGroupName, registryName, webhookName, webhookUpdateParameters).map(new Func1<ServiceResponse<WebhookInner>, WebhookInner>() { @Override public WebhookInner call(ServiceResponse<WebhookInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "WebhookInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "webhookName", ",", "WebhookUpdateParameters", "webhookUpdateParameters", ")", "{", "return", "updateWithServiceResponseAsync",...
Updates a webhook with the specified parameters. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param webhookName The name of the webhook. @param webhookUpdateParameters The parameters for updating a webhook. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Updates", "a", "webhook", "with", "the", "specified", "parameters", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java#L601-L608
beangle/beangle3
commons/web/src/main/java/org/beangle/commons/web/util/CookieUtils.java
CookieUtils.addCookie
public static void addCookie(HttpServletRequest request, HttpServletResponse response, String name, String value, String path, int age) { LOG.debug("add cookie[name:{},value={},path={}]", new String[] { name, value, path }); Cookie cookie = null; try { cookie = new Cookie(name, URLEncoder.encode(value, "utf-8")); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } cookie.setSecure(false); cookie.setPath(path); cookie.setMaxAge(age); cookie.setHttpOnly(true); response.addCookie(cookie); }
java
public static void addCookie(HttpServletRequest request, HttpServletResponse response, String name, String value, String path, int age) { LOG.debug("add cookie[name:{},value={},path={}]", new String[] { name, value, path }); Cookie cookie = null; try { cookie = new Cookie(name, URLEncoder.encode(value, "utf-8")); } catch (UnsupportedEncodingException e) { throw new RuntimeException(e); } cookie.setSecure(false); cookie.setPath(path); cookie.setMaxAge(age); cookie.setHttpOnly(true); response.addCookie(cookie); }
[ "public", "static", "void", "addCookie", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ",", "String", "name", ",", "String", "value", ",", "String", "path", ",", "int", "age", ")", "{", "LOG", ".", "debug", "(", "\"add cookie[na...
Convenience method to set a cookie <br> 刚方法自动将value进行编码存储<br> @param response @param name @param value @param path
[ "Convenience", "method", "to", "set", "a", "cookie", "<br", ">", "刚方法自动将value进行编码存储<br", ">" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/web/src/main/java/org/beangle/commons/web/util/CookieUtils.java#L107-L121
stephanenicolas/robospice
robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/request/notifier/SpiceServiceListenerNotifier.java
SpiceServiceListenerNotifier.notifyObserversOfRequestCancellation
public void notifyObserversOfRequestCancellation(CachedSpiceRequest<?> request) { RequestProcessingContext requestProcessingContext = new RequestProcessingContext(); requestProcessingContext.setExecutionThread(Thread.currentThread()); post(new RequestCancelledNotifier(request, spiceServiceListenerList, requestProcessingContext)); }
java
public void notifyObserversOfRequestCancellation(CachedSpiceRequest<?> request) { RequestProcessingContext requestProcessingContext = new RequestProcessingContext(); requestProcessingContext.setExecutionThread(Thread.currentThread()); post(new RequestCancelledNotifier(request, spiceServiceListenerList, requestProcessingContext)); }
[ "public", "void", "notifyObserversOfRequestCancellation", "(", "CachedSpiceRequest", "<", "?", ">", "request", ")", "{", "RequestProcessingContext", "requestProcessingContext", "=", "new", "RequestProcessingContext", "(", ")", ";", "requestProcessingContext", ".", "setExecu...
Notify interested observers that the request was cancelled. @param request the request that was cancelled.
[ "Notify", "interested", "observers", "that", "the", "request", "was", "cancelled", "." ]
train
https://github.com/stephanenicolas/robospice/blob/8bffde88b3534a961a13cab72a8f07a755f0a0fe/robospice-core-parent/robospice/src/main/java/com/octo/android/robospice/request/notifier/SpiceServiceListenerNotifier.java#L111-L115
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.getSecretVersionsAsync
public Observable<Page<SecretItem>> getSecretVersionsAsync(final String vaultBaseUrl, final String secretName) { return getSecretVersionsWithServiceResponseAsync(vaultBaseUrl, secretName) .map(new Func1<ServiceResponse<Page<SecretItem>>, Page<SecretItem>>() { @Override public Page<SecretItem> call(ServiceResponse<Page<SecretItem>> response) { return response.body(); } }); }
java
public Observable<Page<SecretItem>> getSecretVersionsAsync(final String vaultBaseUrl, final String secretName) { return getSecretVersionsWithServiceResponseAsync(vaultBaseUrl, secretName) .map(new Func1<ServiceResponse<Page<SecretItem>>, Page<SecretItem>>() { @Override public Page<SecretItem> call(ServiceResponse<Page<SecretItem>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "SecretItem", ">", ">", "getSecretVersionsAsync", "(", "final", "String", "vaultBaseUrl", ",", "final", "String", "secretName", ")", "{", "return", "getSecretVersionsWithServiceResponseAsync", "(", "vaultBaseUrl", ",", "secret...
List all versions of the specified secret. The full secret identifier and attributes are provided in the response. No values are returned for the secrets. This operations requires the secrets/list permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param secretName The name of the secret. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SecretItem&gt; object
[ "List", "all", "versions", "of", "the", "specified", "secret", ".", "The", "full", "secret", "identifier", "and", "attributes", "are", "provided", "in", "the", "response", ".", "No", "values", "are", "returned", "for", "the", "secrets", ".", "This", "operati...
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#L4198-L4206
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getBackStoryQuestionInfo
public void getBackStoryQuestionInfo(int[] ids, Callback<List<BackStoryQuestion>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getBackStoryQuestionInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
java
public void getBackStoryQuestionInfo(int[] ids, Callback<List<BackStoryQuestion>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getBackStoryQuestionInfo(processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
[ "public", "void", "getBackStoryQuestionInfo", "(", "int", "[", "]", "ids", ",", "Callback", "<", "List", "<", "BackStoryQuestion", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamCheck...
For more info on back story questions API go <a href="https://wiki.guildwars2.com/wiki/API:2/backstory/questions">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param ids list of back story question id(s) @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception invalid API key @throws NullPointerException if given {@link Callback} is empty @see BackStoryQuestion back story question info
[ "For", "more", "info", "on", "back", "story", "questions", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "backstory", "/", "questions", ">", "here<", "/", "a", ">"...
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L618-L621
ModeShape/modeshape
web/modeshape-web-explorer/src/main/java/org/modeshape/web/client/contents/Contents.java
Contents.getAndDisplayNode
public void getAndDisplayNode(final String path, final boolean changeHistory) { showLoadIcon(); console.jcrService().node(repository(), workspace(), path, new AsyncCallback<JcrNode>() { @Override public void onFailure(Throwable caught) { hideLoadIcon(); SC.say(caught.getMessage()); } @Override public void onSuccess(JcrNode node) { displayNode(node); console.changeWorkspaceInURL(workspace(), changeHistory); console.changePathInURL(path, changeHistory); hideLoadIcon(); } }); }
java
public void getAndDisplayNode(final String path, final boolean changeHistory) { showLoadIcon(); console.jcrService().node(repository(), workspace(), path, new AsyncCallback<JcrNode>() { @Override public void onFailure(Throwable caught) { hideLoadIcon(); SC.say(caught.getMessage()); } @Override public void onSuccess(JcrNode node) { displayNode(node); console.changeWorkspaceInURL(workspace(), changeHistory); console.changePathInURL(path, changeHistory); hideLoadIcon(); } }); }
[ "public", "void", "getAndDisplayNode", "(", "final", "String", "path", ",", "final", "boolean", "changeHistory", ")", "{", "showLoadIcon", "(", ")", ";", "console", ".", "jcrService", "(", ")", ".", "node", "(", "repository", "(", ")", ",", "workspace", "(...
Reads node with given path and selected repository and workspace. @param path the path to the node. @param changeHistory if true then path will be reflected in browser history.
[ "Reads", "node", "with", "given", "path", "and", "selected", "repository", "and", "workspace", "." ]
train
https://github.com/ModeShape/modeshape/blob/794cfdabb67a90f24629c4fff0424a6125f8f95b/web/modeshape-web-explorer/src/main/java/org/modeshape/web/client/contents/Contents.java#L219-L236
carewebframework/carewebframework-core
org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/CommandUtil.java
CommandUtil.dissociateCommand
public static void dissociateCommand(String commandName, BaseUIComponent component) { Command command = getCommand(commandName, false); if (command != null) { command.unbind(component); } }
java
public static void dissociateCommand(String commandName, BaseUIComponent component) { Command command = getCommand(commandName, false); if (command != null) { command.unbind(component); } }
[ "public", "static", "void", "dissociateCommand", "(", "String", "commandName", ",", "BaseUIComponent", "component", ")", "{", "Command", "command", "=", "getCommand", "(", "commandName", ",", "false", ")", ";", "if", "(", "command", "!=", "null", ")", "{", "...
Dissociate a UI component with a command. @param commandName Name of the command. @param component Component to be associated.
[ "Dissociate", "a", "UI", "component", "with", "a", "command", "." ]
train
https://github.com/carewebframework/carewebframework-core/blob/fa3252d4f7541dbe151b92c3d4f6f91433cd1673/org.carewebframework.ui-parent/org.carewebframework.ui.core/src/main/java/org/carewebframework/ui/command/CommandUtil.java#L209-L215
sksamuel/scrimage
scrimage-core/src/main/java/com/sksamuel/scrimage/nio/GifSequenceWriter.java
GifSequenceWriter.getNode
private IIOMetadataNode getNode(IIOMetadataNode rootNode, String nodeName) { IIOMetadataNode[] nodes = new IIOMetadataNode[rootNode.getLength()]; for (int i = 0; i < rootNode.getLength(); i++) { nodes[i] = (IIOMetadataNode) rootNode.item(i); } return Arrays.stream(nodes) .filter(n -> n.getNodeName().equalsIgnoreCase(nodeName)) .findFirst().orElseGet(() -> { IIOMetadataNode node = new IIOMetadataNode(nodeName); rootNode.appendChild(node); return node; }); }
java
private IIOMetadataNode getNode(IIOMetadataNode rootNode, String nodeName) { IIOMetadataNode[] nodes = new IIOMetadataNode[rootNode.getLength()]; for (int i = 0; i < rootNode.getLength(); i++) { nodes[i] = (IIOMetadataNode) rootNode.item(i); } return Arrays.stream(nodes) .filter(n -> n.getNodeName().equalsIgnoreCase(nodeName)) .findFirst().orElseGet(() -> { IIOMetadataNode node = new IIOMetadataNode(nodeName); rootNode.appendChild(node); return node; }); }
[ "private", "IIOMetadataNode", "getNode", "(", "IIOMetadataNode", "rootNode", ",", "String", "nodeName", ")", "{", "IIOMetadataNode", "[", "]", "nodes", "=", "new", "IIOMetadataNode", "[", "rootNode", ".", "getLength", "(", ")", "]", ";", "for", "(", "int", "...
Returns an existing child node, or creates and returns a new child node (if the requested node does not exist). @param rootNode the <tt>IIOMetadataNode</tt> to search for the child node. @param nodeName the name of the child node. @return the child node, if found or a new node created with the given name.
[ "Returns", "an", "existing", "child", "node", "or", "creates", "and", "returns", "a", "new", "child", "node", "(", "if", "the", "requested", "node", "does", "not", "exist", ")", "." ]
train
https://github.com/sksamuel/scrimage/blob/52dab448136e6657a71951b0e6b7d5e64dc979ac/scrimage-core/src/main/java/com/sksamuel/scrimage/nio/GifSequenceWriter.java#L56-L71
mgormley/pacaya
src/main/java/edu/jhu/pacaya/autodiff/StochasticGradientApproximation.java
StochasticGradientApproximation.getGradDotDirApprox
public static double getGradDotDirApprox(Function fn, IntDoubleVector x, IntDoubleVector d, double c) { double dot = 0; { // L(\theta + c * d) IntDoubleVector d1 = d.copy(); d1.scale(c); IntDoubleVector x1 = x.copy(); x1.add(d1); dot += fn.getValue(x1); } { // - L(\theta - c * d) IntDoubleVector d1 = d.copy(); d1.scale(-c); IntDoubleVector x1 = x.copy(); x1.add(d1); dot -= fn.getValue(x1); } dot /= (2.0 * c); return dot; }
java
public static double getGradDotDirApprox(Function fn, IntDoubleVector x, IntDoubleVector d, double c) { double dot = 0; { // L(\theta + c * d) IntDoubleVector d1 = d.copy(); d1.scale(c); IntDoubleVector x1 = x.copy(); x1.add(d1); dot += fn.getValue(x1); } { // - L(\theta - c * d) IntDoubleVector d1 = d.copy(); d1.scale(-c); IntDoubleVector x1 = x.copy(); x1.add(d1); dot -= fn.getValue(x1); } dot /= (2.0 * c); return dot; }
[ "public", "static", "double", "getGradDotDirApprox", "(", "Function", "fn", ",", "IntDoubleVector", "x", ",", "IntDoubleVector", "d", ",", "double", "c", ")", "{", "double", "dot", "=", "0", ";", "{", "// L(\\theta + c * d)", "IntDoubleVector", "d1", "=", "d",...
Compute f'(x)^T d = ( L(x + c * d) - L(x - c * d) ) / (2c) @param fn Function, f. @param x Point at which to evaluate the gradient, x. @param d Random direction, d. @param c Epsilon constant. @return
[ "Compute", "f", "(", "x", ")", "^T", "d", "=", "(", "L", "(", "x", "+", "c", "*", "d", ")", "-", "L", "(", "x", "-", "c", "*", "d", ")", ")", "/", "(", "2c", ")" ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/autodiff/StochasticGradientApproximation.java#L110-L130
Azure/azure-sdk-for-java
resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourceGroupsInner.java
ResourceGroupsInner.updateAsync
public Observable<ResourceGroupInner> updateAsync(String resourceGroupName, ResourceGroupPatchable parameters) { return updateWithServiceResponseAsync(resourceGroupName, parameters).map(new Func1<ServiceResponse<ResourceGroupInner>, ResourceGroupInner>() { @Override public ResourceGroupInner call(ServiceResponse<ResourceGroupInner> response) { return response.body(); } }); }
java
public Observable<ResourceGroupInner> updateAsync(String resourceGroupName, ResourceGroupPatchable parameters) { return updateWithServiceResponseAsync(resourceGroupName, parameters).map(new Func1<ServiceResponse<ResourceGroupInner>, ResourceGroupInner>() { @Override public ResourceGroupInner call(ServiceResponse<ResourceGroupInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ResourceGroupInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "ResourceGroupPatchable", "parameters", ")", "{", "return", "updateWithServiceResponseAsync", "(", "resourceGroupName", ",", "parameters", ")", ".", "map", "(...
Updates a resource group. Resource groups can be updated through a simple PATCH operation to a group address. The format of the request is the same as that for creating a resource group. If a field is unspecified, the current value is retained. @param resourceGroupName The name of the resource group to update. The name is case insensitive. @param parameters Parameters supplied to update a resource group. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ResourceGroupInner object
[ "Updates", "a", "resource", "group", ".", "Resource", "groups", "can", "be", "updated", "through", "a", "simple", "PATCH", "operation", "to", "a", "group", "address", ".", "The", "format", "of", "the", "request", "is", "the", "same", "as", "that", "for", ...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/resources/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/resources/v2018_02_01/implementation/ResourceGroupsInner.java#L540-L547
Azure/azure-sdk-for-java
redis/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/redis/v2018_03_01/implementation/LinkedServersInner.java
LinkedServersInner.beginCreateAsync
public Observable<RedisLinkedServerWithPropertiesInner> beginCreateAsync(String resourceGroupName, String name, String linkedServerName, RedisLinkedServerCreateParameters parameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, name, linkedServerName, parameters).map(new Func1<ServiceResponse<RedisLinkedServerWithPropertiesInner>, RedisLinkedServerWithPropertiesInner>() { @Override public RedisLinkedServerWithPropertiesInner call(ServiceResponse<RedisLinkedServerWithPropertiesInner> response) { return response.body(); } }); }
java
public Observable<RedisLinkedServerWithPropertiesInner> beginCreateAsync(String resourceGroupName, String name, String linkedServerName, RedisLinkedServerCreateParameters parameters) { return beginCreateWithServiceResponseAsync(resourceGroupName, name, linkedServerName, parameters).map(new Func1<ServiceResponse<RedisLinkedServerWithPropertiesInner>, RedisLinkedServerWithPropertiesInner>() { @Override public RedisLinkedServerWithPropertiesInner call(ServiceResponse<RedisLinkedServerWithPropertiesInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RedisLinkedServerWithPropertiesInner", ">", "beginCreateAsync", "(", "String", "resourceGroupName", ",", "String", "name", ",", "String", "linkedServerName", ",", "RedisLinkedServerCreateParameters", "parameters", ")", "{", "return", "beginCrea...
Adds a linked server to the Redis cache (requires Premium SKU). @param resourceGroupName The name of the resource group. @param name The name of the Redis cache. @param linkedServerName The name of the linked server that is being added to the Redis cache. @param parameters Parameters supplied to the Create Linked server operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RedisLinkedServerWithPropertiesInner object
[ "Adds", "a", "linked", "server", "to", "the", "Redis", "cache", "(", "requires", "Premium", "SKU", ")", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/redis/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/redis/v2018_03_01/implementation/LinkedServersInner.java#L216-L223
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java
WordVectorSerializer.writeWordVectors
public static <T extends SequenceElement> void writeWordVectors(WeightLookupTable<T> lookupTable, File file) throws IOException { try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file))) { writeWordVectors(lookupTable, bos); } catch (Exception e) { throw new RuntimeException(e); } }
java
public static <T extends SequenceElement> void writeWordVectors(WeightLookupTable<T> lookupTable, File file) throws IOException { try (BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file))) { writeWordVectors(lookupTable, bos); } catch (Exception e) { throw new RuntimeException(e); } }
[ "public", "static", "<", "T", "extends", "SequenceElement", ">", "void", "writeWordVectors", "(", "WeightLookupTable", "<", "T", ">", "lookupTable", ",", "File", "file", ")", "throws", "IOException", "{", "try", "(", "BufferedOutputStream", "bos", "=", "new", ...
This method writes word vectors to the given file. Please note: this method doesn't load whole vocab/lookupTable into memory, so it's able to process large vocabularies served over network. @param lookupTable @param file @param <T>
[ "This", "method", "writes", "word", "vectors", "to", "the", "given", "file", ".", "Please", "note", ":", "this", "method", "doesn", "t", "load", "whole", "vocab", "/", "lookupTable", "into", "memory", "so", "it", "s", "able", "to", "process", "large", "v...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/embeddings/loader/WordVectorSerializer.java#L321-L328
BioPAX/Paxtools
paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java
QueryExecuter.runPathsBetween
public static Set<BioPAXElement> runPathsBetween(Set<BioPAXElement> sourceSet, Model model, int limit, Filter... filters) { Graph graph; if (model.getLevel() == BioPAXLevel.L3) { graph = new GraphL3(model, filters); } else return Collections.emptySet(); Collection<Set<Node>> sourceWrappers = prepareNodeSets(sourceSet, graph); if (sourceWrappers.size() < 2) return Collections.emptySet(); PathsBetweenQuery query = new PathsBetweenQuery(sourceWrappers, limit); Set<GraphObject> resultWrappers = query.run(); return convertQueryResult(resultWrappers, graph, true); }
java
public static Set<BioPAXElement> runPathsBetween(Set<BioPAXElement> sourceSet, Model model, int limit, Filter... filters) { Graph graph; if (model.getLevel() == BioPAXLevel.L3) { graph = new GraphL3(model, filters); } else return Collections.emptySet(); Collection<Set<Node>> sourceWrappers = prepareNodeSets(sourceSet, graph); if (sourceWrappers.size() < 2) return Collections.emptySet(); PathsBetweenQuery query = new PathsBetweenQuery(sourceWrappers, limit); Set<GraphObject> resultWrappers = query.run(); return convertQueryResult(resultWrappers, graph, true); }
[ "public", "static", "Set", "<", "BioPAXElement", ">", "runPathsBetween", "(", "Set", "<", "BioPAXElement", ">", "sourceSet", ",", "Model", "model", ",", "int", "limit", ",", "Filter", "...", "filters", ")", "{", "Graph", "graph", ";", "if", "(", "model", ...
Gets the graph constructed by the paths between the given seed nodes. Does not get paths between physical entities that belong the same entity reference. @param sourceSet Seed to the query @param model BioPAX model @param limit Length limit for the paths to be found @param filters optional filters - for filtering graph elements @return BioPAX elements in the result
[ "Gets", "the", "graph", "constructed", "by", "the", "paths", "between", "the", "given", "seed", "nodes", ".", "Does", "not", "get", "paths", "between", "physical", "entities", "that", "belong", "the", "same", "entity", "reference", "." ]
train
https://github.com/BioPAX/Paxtools/blob/2f93afa94426bf8b5afc2e0e61cd4b269a83288d/paxtools-query/src/main/java/org/biopax/paxtools/query/QueryExecuter.java#L118-L136
baidubce/bce-sdk-java
src/main/java/com/baidubce/services/dcc/DccClient.java
DccClient.listDedicatedHosts
public ListDedicatedHostsResponse listDedicatedHosts(ListDedicatedHostsRequest request) { InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, null); if (!Strings.isNullOrEmpty(request.getMarker())) { internalRequest.addParameter("marker", request.getMarker()); } if (request.getMaxKeys() >= 0) { internalRequest.addParameter("maxKeys", String.valueOf(request.getMaxKeys())); } if (!Strings.isNullOrEmpty(request.getZoneName())) { internalRequest.addParameter("zoneName", request.getZoneName()); } return invokeHttpClient(internalRequest, ListDedicatedHostsResponse.class); }
java
public ListDedicatedHostsResponse listDedicatedHosts(ListDedicatedHostsRequest request) { InternalRequest internalRequest = this.createRequest(request, HttpMethodName.GET, null); if (!Strings.isNullOrEmpty(request.getMarker())) { internalRequest.addParameter("marker", request.getMarker()); } if (request.getMaxKeys() >= 0) { internalRequest.addParameter("maxKeys", String.valueOf(request.getMaxKeys())); } if (!Strings.isNullOrEmpty(request.getZoneName())) { internalRequest.addParameter("zoneName", request.getZoneName()); } return invokeHttpClient(internalRequest, ListDedicatedHostsResponse.class); }
[ "public", "ListDedicatedHostsResponse", "listDedicatedHosts", "(", "ListDedicatedHostsRequest", "request", ")", "{", "InternalRequest", "internalRequest", "=", "this", ".", "createRequest", "(", "request", ",", "HttpMethodName", ".", "GET", ",", "null", ")", ";", "if"...
get a list of hosts owned by the authenticated user and specified conditions @param request The request containing all options for query @return
[ "get", "a", "list", "of", "hosts", "owned", "by", "the", "authenticated", "user", "and", "specified", "conditions" ]
train
https://github.com/baidubce/bce-sdk-java/blob/f7140f28dd82121515c88ded7bfe769a37d0ec4a/src/main/java/com/baidubce/services/dcc/DccClient.java#L107-L119
jferard/fastods
fastods/src/main/java/com/github/jferard/fastods/odselement/ContentElement.java
ContentElement.addChildCellStyle
public TableCellStyle addChildCellStyle(final TableCellStyle style, final TableCell.Type type) { final TableCellStyle newStyle; final DataStyle dataStyle = this.format.getDataStyle(type); if (dataStyle == null) { newStyle = style; } else { newStyle = this.stylesContainer.addChildCellStyle(style, dataStyle); } return newStyle; }
java
public TableCellStyle addChildCellStyle(final TableCellStyle style, final TableCell.Type type) { final TableCellStyle newStyle; final DataStyle dataStyle = this.format.getDataStyle(type); if (dataStyle == null) { newStyle = style; } else { newStyle = this.stylesContainer.addChildCellStyle(style, dataStyle); } return newStyle; }
[ "public", "TableCellStyle", "addChildCellStyle", "(", "final", "TableCellStyle", "style", ",", "final", "TableCell", ".", "Type", "type", ")", "{", "final", "TableCellStyle", "newStyle", ";", "final", "DataStyle", "dataStyle", "=", "this", ".", "format", ".", "g...
Create an automatic style for this TableCellStyle and this type of cell. Do not produce any effect if the type is Type.STRING or Type.VOID. @param style the style of the cell (color, data style, etc.) @param type the type of the cell @return the created style, or style if the type is Type.STRING or Type.VOID
[ "Create", "an", "automatic", "style", "for", "this", "TableCellStyle", "and", "this", "type", "of", "cell", ".", "Do", "not", "produce", "any", "effect", "if", "the", "type", "is", "Type", ".", "STRING", "or", "Type", ".", "VOID", "." ]
train
https://github.com/jferard/fastods/blob/a034d173083ffa602dc525699b97f753082eaef9/fastods/src/main/java/com/github/jferard/fastods/odselement/ContentElement.java#L87-L96
neoremind/fluent-validator
fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/FluentValidator.java
FluentValidator.putClosure2Context
public FluentValidator putClosure2Context(String key, Closure value) { if (context == null) { context = new ValidatorContext(); } context.setClosure(key, value); return this; }
java
public FluentValidator putClosure2Context(String key, Closure value) { if (context == null) { context = new ValidatorContext(); } context.setClosure(key, value); return this; }
[ "public", "FluentValidator", "putClosure2Context", "(", "String", "key", ",", "Closure", "value", ")", "{", "if", "(", "context", "==", "null", ")", "{", "context", "=", "new", "ValidatorContext", "(", ")", ";", "}", "context", ".", "setClosure", "(", "key...
将闭包注入上下文 @param key 键 @param value 闭包 @return FluentValidator
[ "将闭包注入上下文" ]
train
https://github.com/neoremind/fluent-validator/blob/b516970591aa9468b44ba63938b98ec341fd6ead/fluent-validator/src/main/java/com/baidu/unbiz/fluentvalidator/FluentValidator.java#L116-L122
tvesalainen/util
util/src/main/java/org/vesalainen/nio/channels/GZIPChannel.java
GZIPChannel.extractAll
public void extractAll(Path targetDir, CopyOption... options) throws IOException { if (!Files.isDirectory(targetDir)) { throw new NotDirectoryException(targetDir.toString()); } ensureReading(); do { Path p = targetDir.resolve(filename); InputStream is = Channels.newInputStream(this); Files.copy(is, p, options); Files.setLastModifiedTime(p, lastModified); } while (nextInput()); }
java
public void extractAll(Path targetDir, CopyOption... options) throws IOException { if (!Files.isDirectory(targetDir)) { throw new NotDirectoryException(targetDir.toString()); } ensureReading(); do { Path p = targetDir.resolve(filename); InputStream is = Channels.newInputStream(this); Files.copy(is, p, options); Files.setLastModifiedTime(p, lastModified); } while (nextInput()); }
[ "public", "void", "extractAll", "(", "Path", "targetDir", ",", "CopyOption", "...", "options", ")", "throws", "IOException", "{", "if", "(", "!", "Files", ".", "isDirectory", "(", "targetDir", ")", ")", "{", "throw", "new", "NotDirectoryException", "(", "tar...
Extract files from this GZIPChannel to given directory. @param targetDir @param options @throws IOException
[ "Extract", "files", "from", "this", "GZIPChannel", "to", "given", "directory", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/channels/GZIPChannel.java#L220-L234
google/auto
common/src/main/java/com/google/auto/common/SimpleAnnotationMirror.java
SimpleAnnotationMirror.of
public static AnnotationMirror of( TypeElement annotationType, Map<String, ? extends AnnotationValue> namedValues) { return new SimpleAnnotationMirror(annotationType, namedValues); }
java
public static AnnotationMirror of( TypeElement annotationType, Map<String, ? extends AnnotationValue> namedValues) { return new SimpleAnnotationMirror(annotationType, namedValues); }
[ "public", "static", "AnnotationMirror", "of", "(", "TypeElement", "annotationType", ",", "Map", "<", "String", ",", "?", "extends", "AnnotationValue", ">", "namedValues", ")", "{", "return", "new", "SimpleAnnotationMirror", "(", "annotationType", ",", "namedValues",...
An object representing an {@linkplain ElementKind#ANNOTATION_TYPE annotation} instance. If {@code annotationType} has any annotation members, they must either be present in {@code namedValues} or have default values.
[ "An", "object", "representing", "an", "{" ]
train
https://github.com/google/auto/blob/4158a5fa71f1ef763e683b627f4d29bc04cfde9d/common/src/main/java/com/google/auto/common/SimpleAnnotationMirror.java#L98-L101
jqm4gwt/jqm4gwt
library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java
JQMListItem.setControlGroup
public void setControlGroup(boolean value, boolean linkable) { if (value) { createControlGroup(linkable); } else if (controlGroup != null) { if (anchorPanel != null) remove(anchorPanel); else if (anchor != null) getElement().removeChild(anchor); anchor = null; anchorPanel = null; setSplitHref(null); controlGroupRoot = null; controlGroup = null; checkBoxInput = null; } }
java
public void setControlGroup(boolean value, boolean linkable) { if (value) { createControlGroup(linkable); } else if (controlGroup != null) { if (anchorPanel != null) remove(anchorPanel); else if (anchor != null) getElement().removeChild(anchor); anchor = null; anchorPanel = null; setSplitHref(null); controlGroupRoot = null; controlGroup = null; checkBoxInput = null; } }
[ "public", "void", "setControlGroup", "(", "boolean", "value", ",", "boolean", "linkable", ")", "{", "if", "(", "value", ")", "{", "createControlGroup", "(", "linkable", ")", ";", "}", "else", "if", "(", "controlGroup", "!=", "null", ")", "{", "if", "(", ...
true - prepare and allow to add widgets to this list box item. @param linkable - if true &lt;a> will be forcefully created, so row will be clickable.
[ "true", "-", "prepare", "and", "allow", "to", "add", "widgets", "to", "this", "list", "box", "item", "." ]
train
https://github.com/jqm4gwt/jqm4gwt/blob/cf59958e9ba6d4b70f42507b2c77f10c2465085b/library/src/main/java/com/sksamuel/jqm4gwt/list/JQMListItem.java#L747-L760
Omertron/api-rottentomatoes
src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java
RottenTomatoesApi.getCurrentReleaseDvds
public List<RTMovie> getCurrentReleaseDvds(String country) throws RottenTomatoesException { return getCurrentReleaseDvds(country, DEFAULT_PAGE, DEFAULT_PAGE_LIMIT); }
java
public List<RTMovie> getCurrentReleaseDvds(String country) throws RottenTomatoesException { return getCurrentReleaseDvds(country, DEFAULT_PAGE, DEFAULT_PAGE_LIMIT); }
[ "public", "List", "<", "RTMovie", ">", "getCurrentReleaseDvds", "(", "String", "country", ")", "throws", "RottenTomatoesException", "{", "return", "getCurrentReleaseDvds", "(", "country", ",", "DEFAULT_PAGE", ",", "DEFAULT_PAGE_LIMIT", ")", ";", "}" ]
Retrieves current release DVDs @param country Provides localized data for the selected country @return @throws RottenTomatoesException
[ "Retrieves", "current", "release", "DVDs" ]
train
https://github.com/Omertron/api-rottentomatoes/blob/abaf1833acafc6ada593d52b14ff1bacb4e441ee/src/main/java/com/omertron/rottentomatoesapi/RottenTomatoesApi.java#L394-L396
UrielCh/ovh-java-sdk
ovh-java-sdk-metrics/src/main/java/net/minidev/ovh/api/ApiOvhMetrics.java
ApiOvhMetrics.serviceName_token_tokenId_PUT
public OvhToken serviceName_token_tokenId_PUT(String serviceName, String tokenId, String description) throws IOException { String qPath = "/metrics/{serviceName}/token/{tokenId}"; StringBuilder sb = path(qPath, serviceName, tokenId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhToken.class); }
java
public OvhToken serviceName_token_tokenId_PUT(String serviceName, String tokenId, String description) throws IOException { String qPath = "/metrics/{serviceName}/token/{tokenId}"; StringBuilder sb = path(qPath, serviceName, tokenId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "description", description); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhToken.class); }
[ "public", "OvhToken", "serviceName_token_tokenId_PUT", "(", "String", "serviceName", ",", "String", "tokenId", ",", "String", "description", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/metrics/{serviceName}/token/{tokenId}\"", ";", "StringBuilder", "sb"...
Modify a token REST: PUT /metrics/{serviceName}/token/{tokenId} @param description [required] New description for your token @param serviceName [required] Name of your service @param tokenId [required] ID of the desired token API beta
[ "Modify", "a", "token" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-metrics/src/main/java/net/minidev/ovh/api/ApiOvhMetrics.java#L266-L273
nohana/Amalgam
amalgam/src/main/java/com/amalgam/os/BundleUtils.java
BundleUtils.optCharSequenceArrayList
@TargetApi(Build.VERSION_CODES.FROYO) @Nullable public static ArrayList<CharSequence> optCharSequenceArrayList(@Nullable Bundle bundle, @Nullable String key) { return optCharSequenceArrayList(bundle, key, new ArrayList<CharSequence>()); }
java
@TargetApi(Build.VERSION_CODES.FROYO) @Nullable public static ArrayList<CharSequence> optCharSequenceArrayList(@Nullable Bundle bundle, @Nullable String key) { return optCharSequenceArrayList(bundle, key, new ArrayList<CharSequence>()); }
[ "@", "TargetApi", "(", "Build", ".", "VERSION_CODES", ".", "FROYO", ")", "@", "Nullable", "public", "static", "ArrayList", "<", "CharSequence", ">", "optCharSequenceArrayList", "(", "@", "Nullable", "Bundle", "bundle", ",", "@", "Nullable", "String", "key", ")...
Since Bundle#getCharSequenceArrayList returns concrete ArrayList type, so this method follows that implementation.
[ "Since", "Bundle#getCharSequenceArrayList", "returns", "concrete", "ArrayList", "type", "so", "this", "method", "follows", "that", "implementation", "." ]
train
https://github.com/nohana/Amalgam/blob/57809ddbfe7897e979cf507982ce0b3aa5e0ed8a/amalgam/src/main/java/com/amalgam/os/BundleUtils.java#L392-L396
zaproxy/zaproxy
src/org/zaproxy/zap/utils/HirshbergMatcher.java
HirshbergMatcher.getMatchRatio
public double getMatchRatio(String strA, String strB) { if (strA == null && strB == null) { return MAX_RATIO; } else if (strA == null || strB == null) { return MIN_RATIO; } if (strA.isEmpty() && strB.isEmpty()) { return MAX_RATIO; } else if (strA.isEmpty() || strB.isEmpty()) { return MIN_RATIO; } //get the percentage match against the longer of the 2 strings return (double)getLCS(strA, strB).length() / Math.max(strA.length(), strB.length()); }
java
public double getMatchRatio(String strA, String strB) { if (strA == null && strB == null) { return MAX_RATIO; } else if (strA == null || strB == null) { return MIN_RATIO; } if (strA.isEmpty() && strB.isEmpty()) { return MAX_RATIO; } else if (strA.isEmpty() || strB.isEmpty()) { return MIN_RATIO; } //get the percentage match against the longer of the 2 strings return (double)getLCS(strA, strB).length() / Math.max(strA.length(), strB.length()); }
[ "public", "double", "getMatchRatio", "(", "String", "strA", ",", "String", "strB", ")", "{", "if", "(", "strA", "==", "null", "&&", "strB", "==", "null", ")", "{", "return", "MAX_RATIO", ";", "}", "else", "if", "(", "strA", "==", "null", "||", "strB"...
Calculate the ratio of similarity between 2 strings using LCS @param strA the first String @param strB the second String @return the percentage double number
[ "Calculate", "the", "ratio", "of", "similarity", "between", "2", "strings", "using", "LCS" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/utils/HirshbergMatcher.java#L154-L171
ologolo/streamline-api
src/org/daisy/streamline/api/tasks/TaskGroupInformation.java
TaskGroupInformation.newConvertBuilder
public static Builder newConvertBuilder(String input, String output) { return new Builder(input, output, TaskGroupActivity.CONVERT); }
java
public static Builder newConvertBuilder(String input, String output) { return new Builder(input, output, TaskGroupActivity.CONVERT); }
[ "public", "static", "Builder", "newConvertBuilder", "(", "String", "input", ",", "String", "output", ")", "{", "return", "new", "Builder", "(", "input", ",", "output", ",", "TaskGroupActivity", ".", "CONVERT", ")", ";", "}" ]
Creates a new builder of convert type with the specified parameters. @param input the input format @param output the output format @return returns a new builder
[ "Creates", "a", "new", "builder", "of", "convert", "type", "with", "the", "specified", "parameters", "." ]
train
https://github.com/ologolo/streamline-api/blob/4934b6da1de06e364ae90d6ea9b0929500da9cdb/src/org/daisy/streamline/api/tasks/TaskGroupInformation.java#L123-L125
kuali/ojb-1.0.4
src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java
ObjectEnvelopeTable.cascadeDeleteFor
private void cascadeDeleteFor(ObjectEnvelope mod, List alreadyPrepared) { // avoid endless recursion if(alreadyPrepared.contains(mod.getIdentity())) return; alreadyPrepared.add(mod.getIdentity()); ClassDescriptor cld = getTransaction().getBroker().getClassDescriptor(mod.getObject().getClass()); List refs = cld.getObjectReferenceDescriptors(true); cascadeDeleteSingleReferences(mod, refs, alreadyPrepared); List colls = cld.getCollectionDescriptors(true); cascadeDeleteCollectionReferences(mod, colls, alreadyPrepared); }
java
private void cascadeDeleteFor(ObjectEnvelope mod, List alreadyPrepared) { // avoid endless recursion if(alreadyPrepared.contains(mod.getIdentity())) return; alreadyPrepared.add(mod.getIdentity()); ClassDescriptor cld = getTransaction().getBroker().getClassDescriptor(mod.getObject().getClass()); List refs = cld.getObjectReferenceDescriptors(true); cascadeDeleteSingleReferences(mod, refs, alreadyPrepared); List colls = cld.getCollectionDescriptors(true); cascadeDeleteCollectionReferences(mod, colls, alreadyPrepared); }
[ "private", "void", "cascadeDeleteFor", "(", "ObjectEnvelope", "mod", ",", "List", "alreadyPrepared", ")", "{", "// avoid endless recursion\r", "if", "(", "alreadyPrepared", ".", "contains", "(", "mod", ".", "getIdentity", "(", ")", ")", ")", "return", ";", "alre...
Walk through the object graph of the specified delete object. Was used for recursive object graph walk.
[ "Walk", "through", "the", "object", "graph", "of", "the", "specified", "delete", "object", ".", "Was", "used", "for", "recursive", "object", "graph", "walk", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/odmg/ObjectEnvelopeTable.java#L698-L712
ralscha/extdirectspring
src/main/java/ch/ralscha/extdirectspring/util/JsonHandler.java
JsonHandler.writeValueAsString
public String writeValueAsString(Object obj, boolean indent) { try { if (indent) { return this.mapper.writer().withDefaultPrettyPrinter() .writeValueAsString(obj); } return this.mapper.writeValueAsString(obj); } catch (Exception e) { LogFactory.getLog(JsonHandler.class).info("serialize object to json", e); return null; } }
java
public String writeValueAsString(Object obj, boolean indent) { try { if (indent) { return this.mapper.writer().withDefaultPrettyPrinter() .writeValueAsString(obj); } return this.mapper.writeValueAsString(obj); } catch (Exception e) { LogFactory.getLog(JsonHandler.class).info("serialize object to json", e); return null; } }
[ "public", "String", "writeValueAsString", "(", "Object", "obj", ",", "boolean", "indent", ")", "{", "try", "{", "if", "(", "indent", ")", "{", "return", "this", ".", "mapper", ".", "writer", "(", ")", ".", "withDefaultPrettyPrinter", "(", ")", ".", "writ...
Converts an object into a JSON string. In case of an exceptions returns null and logs the exception. @param obj the source object @param indent if true JSON is written in a human readable format, if false JSON is written on one line @return obj JSON string, <code>null</code> if an exception occurred
[ "Converts", "an", "object", "into", "a", "JSON", "string", ".", "In", "case", "of", "an", "exceptions", "returns", "null", "and", "logs", "the", "exception", "." ]
train
https://github.com/ralscha/extdirectspring/blob/4b018497c4e7503033f91d0491b4e74bf8291d2c/src/main/java/ch/ralscha/extdirectspring/util/JsonHandler.java#L80-L92
infinispan/infinispan
commons/src/main/java/org/infinispan/commons/util/TypedProperties.java
TypedProperties.getProperty
public synchronized String getProperty(String key, String defaultValue, boolean doStringReplace) { if (doStringReplace) return StringPropertyReplacer.replaceProperties(getProperty(key, defaultValue)); else return getProperty(key, defaultValue); }
java
public synchronized String getProperty(String key, String defaultValue, boolean doStringReplace) { if (doStringReplace) return StringPropertyReplacer.replaceProperties(getProperty(key, defaultValue)); else return getProperty(key, defaultValue); }
[ "public", "synchronized", "String", "getProperty", "(", "String", "key", ",", "String", "defaultValue", ",", "boolean", "doStringReplace", ")", "{", "if", "(", "doStringReplace", ")", "return", "StringPropertyReplacer", ".", "replaceProperties", "(", "getProperty", ...
Get the property associated with the key, optionally applying string property replacement as defined in {@link StringPropertyReplacer#replaceProperties} to the result. @param key the hashtable key. @param defaultValue a default value. @param doStringReplace boolean indicating whether to apply string property replacement @return the value in this property list with the specified key valu after optionally being inspected for String property replacement
[ "Get", "the", "property", "associated", "with", "the", "key", "optionally", "applying", "string", "property", "replacement", "as", "defined", "in", "{", "@link", "StringPropertyReplacer#replaceProperties", "}", "to", "the", "result", "." ]
train
https://github.com/infinispan/infinispan/blob/7c62b94886c3febb4774ae8376acf2baa0265ab5/commons/src/main/java/org/infinispan/commons/util/TypedProperties.java#L148-L153
alkacon/opencms-core
src/org/opencms/file/CmsObject.java
CmsObject.writeUrlNameMapping
public String writeUrlNameMapping(String name, CmsUUID structureId, String locale, boolean replaceOnPublish) throws CmsException { return writeUrlNameMapping(new CmsNumberSuffixNameSequence(name), structureId, locale, replaceOnPublish); }
java
public String writeUrlNameMapping(String name, CmsUUID structureId, String locale, boolean replaceOnPublish) throws CmsException { return writeUrlNameMapping(new CmsNumberSuffixNameSequence(name), structureId, locale, replaceOnPublish); }
[ "public", "String", "writeUrlNameMapping", "(", "String", "name", ",", "CmsUUID", "structureId", ",", "String", "locale", ",", "boolean", "replaceOnPublish", ")", "throws", "CmsException", "{", "return", "writeUrlNameMapping", "(", "new", "CmsNumberSuffixNameSequence", ...
Writes a new URL name mapping for a given resource.<p> This method uses {@link CmsNumberSuffixNameSequence} to generate a sequence of name candidates from the given base name.<p> @param name the base name for the mapping @param structureId the structure id to which the name should be mapped @param locale the locale of the mapping @param replaceOnPublish mappings for which this is set will replace older mappings on publish @return the URL name that was actually used for the mapping @throws CmsException if something goes wrong
[ "Writes", "a", "new", "URL", "name", "mapping", "for", "a", "given", "resource", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/file/CmsObject.java#L4189-L4193
apereo/cas
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/scripting/ScriptingUtils.java
ScriptingUtils.executeGroovyScriptEngine
public static <T> T executeGroovyScriptEngine(final String script, final Map<String, Object> variables, final Class<T> clazz) { try { val engine = new ScriptEngineManager().getEngineByName("groovy"); if (engine == null) { LOGGER.warn("Script engine is not available for Groovy"); return null; } val binding = new SimpleBindings(); if (variables != null && !variables.isEmpty()) { binding.putAll(variables); } if (!binding.containsKey("logger")) { binding.put("logger", LOGGER); } val result = engine.eval(script, binding); return getGroovyScriptExecutionResultOrThrow(clazz, result); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return null; }
java
public static <T> T executeGroovyScriptEngine(final String script, final Map<String, Object> variables, final Class<T> clazz) { try { val engine = new ScriptEngineManager().getEngineByName("groovy"); if (engine == null) { LOGGER.warn("Script engine is not available for Groovy"); return null; } val binding = new SimpleBindings(); if (variables != null && !variables.isEmpty()) { binding.putAll(variables); } if (!binding.containsKey("logger")) { binding.put("logger", LOGGER); } val result = engine.eval(script, binding); return getGroovyScriptExecutionResultOrThrow(clazz, result); } catch (final Exception e) { LOGGER.error(e.getMessage(), e); } return null; }
[ "public", "static", "<", "T", ">", "T", "executeGroovyScriptEngine", "(", "final", "String", "script", ",", "final", "Map", "<", "String", ",", "Object", ">", "variables", ",", "final", "Class", "<", "T", ">", "clazz", ")", "{", "try", "{", "val", "eng...
Execute inline groovy script engine. @param <T> the type parameter @param script the script @param variables the variables @param clazz the clazz @return the t
[ "Execute", "inline", "groovy", "script", "engine", "." ]
train
https://github.com/apereo/cas/blob/b4b306433a8782cef803a39bea5b1f96740e0e9b/core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/scripting/ScriptingUtils.java#L376-L398
fommil/matrix-toolkits-java
src/main/java/no/uib/cipr/matrix/sparse/GMRES.java
GMRES.setRestart
public void setRestart(int restart) { this.restart = restart; if (restart <= 0) throw new IllegalArgumentException( "restart must be a positive integer"); s = new DenseVector(restart + 1); H = new DenseMatrix(restart + 1, restart); rotation = new GivensRotation[restart + 1]; v = new Vector[restart + 1]; for (int i = 0; i < v.length; ++i) v[i] = r.copy().zero(); }
java
public void setRestart(int restart) { this.restart = restart; if (restart <= 0) throw new IllegalArgumentException( "restart must be a positive integer"); s = new DenseVector(restart + 1); H = new DenseMatrix(restart + 1, restart); rotation = new GivensRotation[restart + 1]; v = new Vector[restart + 1]; for (int i = 0; i < v.length; ++i) v[i] = r.copy().zero(); }
[ "public", "void", "setRestart", "(", "int", "restart", ")", "{", "this", ".", "restart", "=", "restart", ";", "if", "(", "restart", "<=", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"restart must be a positive integer\"", ")", ";", "s", "=", ...
Sets the restart parameter @param restart GMRES iteration is restarted after this number of iterations
[ "Sets", "the", "restart", "parameter" ]
train
https://github.com/fommil/matrix-toolkits-java/blob/6157618bc86bcda3749af2a60bf869d8f3292960/src/main/java/no/uib/cipr/matrix/sparse/GMRES.java#L112-L125
metafacture/metafacture-core
metafacture-biblio/src/main/java/org/metafacture/biblio/iso2709/Iso646ByteBuffer.java
Iso646ByteBuffer.distanceTo
int distanceTo(final byte[] bytes, final int fromIndex) { assert 0 <= fromIndex && fromIndex < byteArray.length; int index = fromIndex; for (; index < byteArray.length; ++index) { if (containsByte(bytes, byteArray[index])) { break; } } return index - fromIndex; }
java
int distanceTo(final byte[] bytes, final int fromIndex) { assert 0 <= fromIndex && fromIndex < byteArray.length; int index = fromIndex; for (; index < byteArray.length; ++index) { if (containsByte(bytes, byteArray[index])) { break; } } return index - fromIndex; }
[ "int", "distanceTo", "(", "final", "byte", "[", "]", "bytes", ",", "final", "int", "fromIndex", ")", "{", "assert", "0", "<=", "fromIndex", "&&", "fromIndex", "<", "byteArray", ".", "length", ";", "int", "index", "=", "fromIndex", ";", "for", "(", ";",...
Returns the distance from {@code fromIndex} to the next occurrence of one of the bytes in {@code bytes}. If the byte at {@code fromIndex} is in {@code bytes} zero is returned. If there are no matching bytes between {@code fromIndex} and the end of the buffer then the distance to the end of the buffer is returned. @param bytes bytes to search for. @param fromIndex the position in the buffer from which to start searching. @return the distance in bytes to the next byte with the given value or if none is found to the end of the buffer.
[ "Returns", "the", "distance", "from", "{", "@code", "fromIndex", "}", "to", "the", "next", "occurrence", "of", "one", "of", "the", "bytes", "in", "{", "@code", "bytes", "}", ".", "If", "the", "byte", "at", "{", "@code", "fromIndex", "}", "is", "in", ...
train
https://github.com/metafacture/metafacture-core/blob/cb43933ec8eb01a4ddce4019c14b2415cc441918/metafacture-biblio/src/main/java/org/metafacture/biblio/iso2709/Iso646ByteBuffer.java#L105-L114
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java
FileSystem.toJarURL
@Pure public static URL toJarURL(URL jarFile, String insideFile) throws MalformedURLException { if (jarFile == null || insideFile == null) { return null; } final StringBuilder buf = new StringBuilder(); buf.append("jar:"); //$NON-NLS-1$ buf.append(jarFile.toExternalForm()); buf.append(JAR_URL_FILE_ROOT); final String path = fromFileStandardToURLStandard(insideFile); if (path.startsWith(URL_PATH_SEPARATOR)) { buf.append(path.substring(URL_PATH_SEPARATOR.length())); } else { buf.append(path); } return new URL(buf.toString()); }
java
@Pure public static URL toJarURL(URL jarFile, String insideFile) throws MalformedURLException { if (jarFile == null || insideFile == null) { return null; } final StringBuilder buf = new StringBuilder(); buf.append("jar:"); //$NON-NLS-1$ buf.append(jarFile.toExternalForm()); buf.append(JAR_URL_FILE_ROOT); final String path = fromFileStandardToURLStandard(insideFile); if (path.startsWith(URL_PATH_SEPARATOR)) { buf.append(path.substring(URL_PATH_SEPARATOR.length())); } else { buf.append(path); } return new URL(buf.toString()); }
[ "@", "Pure", "public", "static", "URL", "toJarURL", "(", "URL", "jarFile", ",", "String", "insideFile", ")", "throws", "MalformedURLException", "{", "if", "(", "jarFile", "==", "null", "||", "insideFile", "==", "null", ")", "{", "return", "null", ";", "}",...
Replies the jar-schemed URL composed of the two given components. <p>If the inputs are {@code file:/path1/archive.jar} and @{code /path2/file}, the output of this function is {@code jar:file:/path1/archive.jar!/path2/file}. @param jarFile is the URL to the jar file. @param insideFile is the name of the file inside the jar. @return the jar-schemed URL. @throws MalformedURLException when the URL is malformed.
[ "Replies", "the", "jar", "-", "schemed", "URL", "composed", "of", "the", "two", "given", "components", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L350-L366
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfStamper.java
PdfStamper.addFileAttachment
public void addFileAttachment(String description, byte fileStore[], String file, String fileDisplay) throws IOException { addFileAttachment(description, PdfFileSpecification.fileEmbedded(stamper, file, fileDisplay, fileStore)); }
java
public void addFileAttachment(String description, byte fileStore[], String file, String fileDisplay) throws IOException { addFileAttachment(description, PdfFileSpecification.fileEmbedded(stamper, file, fileDisplay, fileStore)); }
[ "public", "void", "addFileAttachment", "(", "String", "description", ",", "byte", "fileStore", "[", "]", ",", "String", "file", ",", "String", "fileDisplay", ")", "throws", "IOException", "{", "addFileAttachment", "(", "description", ",", "PdfFileSpecification", "...
Adds a file attachment at the document level. Existing attachments will be kept. @param description the file description @param fileStore an array with the file. If it's <CODE>null</CODE> the file will be read from the disk @param file the path to the file. It will only be used if <CODE>fileStore</CODE> is not <CODE>null</CODE> @param fileDisplay the actual file name stored in the pdf @throws IOException on error
[ "Adds", "a", "file", "attachment", "at", "the", "document", "level", ".", "Existing", "attachments", "will", "be", "kept", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfStamper.java#L503-L505
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/dense/DescribeDenseSiftAlg.java
DescribeDenseSiftAlg.setImageGradient
public void setImageGradient(D derivX , D derivY ) { InputSanityCheck.checkSameShape(derivX,derivY); if( derivX.stride != derivY.stride || derivX.startIndex != derivY.startIndex ) throw new IllegalArgumentException("stride and start index must be the same"); savedAngle.reshape(derivX.width,derivX.height); savedMagnitude.reshape(derivX.width,derivX.height); imageDerivX.wrap(derivX); imageDerivY.wrap(derivY); precomputeAngles(derivX); }
java
public void setImageGradient(D derivX , D derivY ) { InputSanityCheck.checkSameShape(derivX,derivY); if( derivX.stride != derivY.stride || derivX.startIndex != derivY.startIndex ) throw new IllegalArgumentException("stride and start index must be the same"); savedAngle.reshape(derivX.width,derivX.height); savedMagnitude.reshape(derivX.width,derivX.height); imageDerivX.wrap(derivX); imageDerivY.wrap(derivY); precomputeAngles(derivX); }
[ "public", "void", "setImageGradient", "(", "D", "derivX", ",", "D", "derivY", ")", "{", "InputSanityCheck", ".", "checkSameShape", "(", "derivX", ",", "derivY", ")", ";", "if", "(", "derivX", ".", "stride", "!=", "derivY", ".", "stride", "||", "derivX", ...
Sets the gradient and precomputes pixel orientation and magnitude @param derivX image derivative x-axis @param derivY image derivative y-axis
[ "Sets", "the", "gradient", "and", "precomputes", "pixel", "orientation", "and", "magnitude" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/dense/DescribeDenseSiftAlg.java#L103-L115
Axway/Grapes
utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java
GrapesClient.getModules
public List<Module> getModules(final Map<String, String> filters) throws GrapesCommunicationException { final Client client = getClient(); WebResource resource = client.resource(serverURL).path(RequestUtils.getAllModulesPath()); for(final Map.Entry<String,String> queryParam: filters.entrySet()){ resource = resource.queryParam(queryParam.getKey(), queryParam.getValue()); } final ClientResponse response = resource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); client.destroy(); if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){ final String message = "Failed to get filtered modules."; if(LOG.isErrorEnabled()) { LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus())); } throw new GrapesCommunicationException(message, response.getStatus()); } return response.getEntity(new GenericType<List<Module>>(){}); }
java
public List<Module> getModules(final Map<String, String> filters) throws GrapesCommunicationException { final Client client = getClient(); WebResource resource = client.resource(serverURL).path(RequestUtils.getAllModulesPath()); for(final Map.Entry<String,String> queryParam: filters.entrySet()){ resource = resource.queryParam(queryParam.getKey(), queryParam.getValue()); } final ClientResponse response = resource.accept(MediaType.APPLICATION_JSON).get(ClientResponse.class); client.destroy(); if(ClientResponse.Status.OK.getStatusCode() != response.getStatus()){ final String message = "Failed to get filtered modules."; if(LOG.isErrorEnabled()) { LOG.error(String.format(HTTP_STATUS_TEMPLATE_MSG, message, response.getStatus())); } throw new GrapesCommunicationException(message, response.getStatus()); } return response.getEntity(new GenericType<List<Module>>(){}); }
[ "public", "List", "<", "Module", ">", "getModules", "(", "final", "Map", "<", "String", ",", "String", ">", "filters", ")", "throws", "GrapesCommunicationException", "{", "final", "Client", "client", "=", "getClient", "(", ")", ";", "WebResource", "resource", ...
Get a list of modules regarding filters @param filters Map<String,String> @return List<Module> @throws GrapesCommunicationException
[ "Get", "a", "list", "of", "modules", "regarding", "filters" ]
train
https://github.com/Axway/Grapes/blob/ce9cc73d85f83eaa5fbc991abb593915a8c8374e/utils/src/main/java/org/axway/grapes/utils/client/GrapesClient.java#L249-L268
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java
ComputerVisionImpl.generateThumbnailInStream
public InputStream generateThumbnailInStream(int width, int height, byte[] image, GenerateThumbnailInStreamOptionalParameter generateThumbnailInStreamOptionalParameter) { return generateThumbnailInStreamWithServiceResponseAsync(width, height, image, generateThumbnailInStreamOptionalParameter).toBlocking().single().body(); }
java
public InputStream generateThumbnailInStream(int width, int height, byte[] image, GenerateThumbnailInStreamOptionalParameter generateThumbnailInStreamOptionalParameter) { return generateThumbnailInStreamWithServiceResponseAsync(width, height, image, generateThumbnailInStreamOptionalParameter).toBlocking().single().body(); }
[ "public", "InputStream", "generateThumbnailInStream", "(", "int", "width", ",", "int", "height", ",", "byte", "[", "]", "image", ",", "GenerateThumbnailInStreamOptionalParameter", "generateThumbnailInStreamOptionalParameter", ")", "{", "return", "generateThumbnailInStreamWith...
This operation generates a thumbnail image with the user-specified width and height. By default, the service analyzes the image, identifies the region of interest (ROI), and generates smart cropping coordinates based on the ROI. Smart cropping helps when you specify an aspect ratio that differs from that of the input image. A successful response contains the thumbnail image binary. If the request failed, the response contains an error code and a message to help determine what went wrong. @param width Width of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. @param height Height of the thumbnail. It must be between 1 and 1024. Recommended minimum of 50. @param image An image stream. @param generateThumbnailInStreamOptionalParameter the object representing the optional parameters to be set before calling this API @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the InputStream object if successful.
[ "This", "operation", "generates", "a", "thumbnail", "image", "with", "the", "user", "-", "specified", "width", "and", "height", ".", "By", "default", "the", "service", "analyzes", "the", "image", "identifies", "the", "region", "of", "interest", "(", "ROI", "...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/computervision/src/main/java/com/microsoft/azure/cognitiveservices/vision/computervision/implementation/ComputerVisionImpl.java#L905-L907
att/AAF
authz/authz-cass/src/main/java/com/att/dao/Loader.java
Loader.writeStringSet
public static void writeStringSet(DataOutputStream os, Collection<String> set) throws IOException { if(set==null) { os.writeInt(-1); } else { os.writeInt(set.size()); for(String s : set) { writeString(os, s); } } }
java
public static void writeStringSet(DataOutputStream os, Collection<String> set) throws IOException { if(set==null) { os.writeInt(-1); } else { os.writeInt(set.size()); for(String s : set) { writeString(os, s); } } }
[ "public", "static", "void", "writeStringSet", "(", "DataOutputStream", "os", ",", "Collection", "<", "String", ">", "set", ")", "throws", "IOException", "{", "if", "(", "set", "==", "null", ")", "{", "os", ".", "writeInt", "(", "-", "1", ")", ";", "}",...
Write a set with proper sizing Note: at the moment, this is just String. Probably can develop system where types are supported too... but not now. @param os @param set @throws IOException
[ "Write", "a", "set", "with", "proper", "sizing" ]
train
https://github.com/att/AAF/blob/090562e956c0035db972aafba844dc6d3fc948ee/authz/authz-cass/src/main/java/com/att/dao/Loader.java#L110-L120
groupon/odo
client/src/main/java/com/groupon/odo/client/Client.java
Client.addServerGroup
public ServerGroup addServerGroup(String groupName) { ServerGroup group = new ServerGroup(); BasicNameValuePair[] params = { new BasicNameValuePair("name", groupName), new BasicNameValuePair("profileIdentifier", this._profileName) }; try { JSONObject response = new JSONObject(doPost(BASE_SERVERGROUP, params)); group = getServerGroupFromJSON(response); } catch (Exception e) { e.printStackTrace(); return null; } return group; }
java
public ServerGroup addServerGroup(String groupName) { ServerGroup group = new ServerGroup(); BasicNameValuePair[] params = { new BasicNameValuePair("name", groupName), new BasicNameValuePair("profileIdentifier", this._profileName) }; try { JSONObject response = new JSONObject(doPost(BASE_SERVERGROUP, params)); group = getServerGroupFromJSON(response); } catch (Exception e) { e.printStackTrace(); return null; } return group; }
[ "public", "ServerGroup", "addServerGroup", "(", "String", "groupName", ")", "{", "ServerGroup", "group", "=", "new", "ServerGroup", "(", ")", ";", "BasicNameValuePair", "[", "]", "params", "=", "{", "new", "BasicNameValuePair", "(", "\"name\"", ",", "groupName",...
Create a new server group @param groupName name of server group @return Created ServerGroup
[ "Create", "a", "new", "server", "group" ]
train
https://github.com/groupon/odo/blob/3bae43d5eca8ace036775e5b2d3ed9af1a9ff9b1/client/src/main/java/com/groupon/odo/client/Client.java#L1205-L1220
devnewton/jnuit
jpegdecoder/src/main/java/de/matthiasmann/jpegdecoder/JPEGDecoder.java
JPEGDecoder.decodeRGB
@Deprecated public void decodeRGB(ByteBuffer dst, int stride, int numMCURows) throws IOException { decode(dst, stride, numMCURows, YUVtoRGBA.instance); }
java
@Deprecated public void decodeRGB(ByteBuffer dst, int stride, int numMCURows) throws IOException { decode(dst, stride, numMCURows, YUVtoRGBA.instance); }
[ "@", "Deprecated", "public", "void", "decodeRGB", "(", "ByteBuffer", "dst", ",", "int", "stride", ",", "int", "numMCURows", ")", "throws", "IOException", "{", "decode", "(", "dst", ",", "stride", ",", "numMCURows", ",", "YUVtoRGBA", ".", "instance", ")", "...
Decodes a number of MCU rows into the specified ByteBuffer as RGBA data. {@link #startDecode() } must be called before this method. <p>The first decoded line is placed at {@code dst.position() }, the second line at {@code dst.position() + stride } and so on. After decoding the buffer position is at {@code dst.position() + n*stride } where n is the number of decoded lines which might be less than {@code numMCURows * getMCURowHeight() } at the end of the image.</p> <p>This method calls {@link #decode(java.nio.ByteBuffer, int, int, de.matthiasmann.jpegdecoder.YUVDecoder) } with {@link YUVtoRGBA#instance} as decoder.</p> @param dst the target ByteBuffer @param stride the distance in bytes from the start of one line to the start of the next. The absolute value should be &gt;= {@link #getImageWidth() }*4, can also be negative. @param numMCURows the number of MCU rows to decode. @throws IOException if an IO error occurred @throws IllegalArgumentException if numMCURows is invalid @throws IllegalStateException if {@link #startDecode() } has not been called @throws UnsupportedOperationException if the JPEG is not a color JPEG @see #getNumComponents() @see #getNumMCURows() @deprecated This method should have been named {@code decodeRGBA}
[ "Decodes", "a", "number", "of", "MCU", "rows", "into", "the", "specified", "ByteBuffer", "as", "RGBA", "data", ".", "{", "@link", "#startDecode", "()", "}", "must", "be", "called", "before", "this", "method", "." ]
train
https://github.com/devnewton/jnuit/blob/191f19b55a17451d0f277c151c7e9b4427a12415/jpegdecoder/src/main/java/de/matthiasmann/jpegdecoder/JPEGDecoder.java#L288-L291
alkacon/opencms-core
src/org/opencms/ade/contenteditor/shared/CmsContentDefinition.java
CmsContentDefinition.createDefaultValueEntity
protected static CmsEntity createDefaultValueEntity( CmsType entityType, Map<String, CmsType> entityTypes, Map<String, CmsAttributeConfiguration> attributeConfigurations) { CmsEntity result = new CmsEntity(null, entityType.getId()); for (String attributeName : entityType.getAttributeNames()) { CmsType attributeType = entityTypes.get(entityType.getAttributeTypeName(attributeName)); for (int i = 0; i < entityType.getAttributeMinOccurrence(attributeName); i++) { if (attributeType.isSimpleType()) { result.addAttributeValue( attributeName, attributeConfigurations.get(attributeName).getDefaultValue()); } else { result.addAttributeValue( attributeName, createDefaultValueEntity(attributeType, entityTypes, attributeConfigurations)); } } } return result; }
java
protected static CmsEntity createDefaultValueEntity( CmsType entityType, Map<String, CmsType> entityTypes, Map<String, CmsAttributeConfiguration> attributeConfigurations) { CmsEntity result = new CmsEntity(null, entityType.getId()); for (String attributeName : entityType.getAttributeNames()) { CmsType attributeType = entityTypes.get(entityType.getAttributeTypeName(attributeName)); for (int i = 0; i < entityType.getAttributeMinOccurrence(attributeName); i++) { if (attributeType.isSimpleType()) { result.addAttributeValue( attributeName, attributeConfigurations.get(attributeName).getDefaultValue()); } else { result.addAttributeValue( attributeName, createDefaultValueEntity(attributeType, entityTypes, attributeConfigurations)); } } } return result; }
[ "protected", "static", "CmsEntity", "createDefaultValueEntity", "(", "CmsType", "entityType", ",", "Map", "<", "String", ",", "CmsType", ">", "entityTypes", ",", "Map", "<", "String", ",", "CmsAttributeConfiguration", ">", "attributeConfigurations", ")", "{", "CmsEn...
Creates an entity object containing the default values configured for it's type.<p> @param entityType the entity type @param entityTypes the entity types @param attributeConfigurations the attribute configurations @return the created entity
[ "Creates", "an", "entity", "object", "containing", "the", "default", "values", "configured", "for", "it", "s", "type", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/contenteditor/shared/CmsContentDefinition.java#L390-L411
networknt/light-4j
utility/src/main/java/com/networknt/utility/RegExUtils.java
RegExUtils.replaceAll
public static String replaceAll(final String text, final String regex, final String replacement) { if (text == null || regex == null || replacement == null) { return text; } return text.replaceAll(regex, replacement); }
java
public static String replaceAll(final String text, final String regex, final String replacement) { if (text == null || regex == null || replacement == null) { return text; } return text.replaceAll(regex, replacement); }
[ "public", "static", "String", "replaceAll", "(", "final", "String", "text", ",", "final", "String", "regex", ",", "final", "String", "replacement", ")", "{", "if", "(", "text", "==", "null", "||", "regex", "==", "null", "||", "replacement", "==", "null", ...
<p>Replaces each substring of the text String that matches the given regular expression with the given replacement.</p> This method is a {@code null} safe equivalent to: <ul> <li>{@code text.replaceAll(regex, replacement)}</li> <li>{@code Pattern.compile(regex).matcher(text).replaceAll(replacement)}</li> </ul> <p>A {@code null} reference passed to this method is a no-op.</p> <p>Unlike in the {@link #replacePattern(String, String, String)} method, the {@link Pattern#DOTALL} option is NOT automatically added. To use the DOTALL option prepend <code>"(?s)"</code> to the regex. DOTALL is also known as single-line mode in Perl.</p> <pre> StringUtils.replaceAll(null, *, *) = null StringUtils.replaceAll("any", (String) null, *) = "any" StringUtils.replaceAll("any", *, null) = "any" StringUtils.replaceAll("", "", "zzz") = "zzz" StringUtils.replaceAll("", ".*", "zzz") = "zzz" StringUtils.replaceAll("", ".+", "zzz") = "" StringUtils.replaceAll("abc", "", "ZZ") = "ZZaZZbZZcZZ" StringUtils.replaceAll("&lt;__&gt;\n&lt;__&gt;", "&lt;.*&gt;", "z") = "z\nz" StringUtils.replaceAll("&lt;__&gt;\n&lt;__&gt;", "(?s)&lt;.*&gt;", "z") = "z" StringUtils.replaceAll("ABCabc123", "[a-z]", "_") = "ABC___123" StringUtils.replaceAll("ABCabc123", "[^A-Z0-9]+", "_") = "ABC_123" StringUtils.replaceAll("ABCabc123", "[^A-Z0-9]+", "") = "ABC123" StringUtils.replaceAll("Lorem ipsum dolor sit", "( +)([a-z]+)", "_$2") = "Lorem_ipsum_dolor_sit" </pre> @param text text to search and replace in, may be null @param regex the regular expression to which this string is to be matched @param replacement the string to be substituted for each match @return the text with any replacements processed, {@code null} if null String input @throws java.util.regex.PatternSyntaxException if the regular expression's syntax is invalid @see #replacePattern(String, String, String) @see String#replaceAll(String, String) @see java.util.regex.Pattern @see java.util.regex.Pattern#DOTALL
[ "<p", ">", "Replaces", "each", "substring", "of", "the", "text", "String", "that", "matches", "the", "given", "regular", "expression", "with", "the", "given", "replacement", ".", "<", "/", "p", ">" ]
train
https://github.com/networknt/light-4j/blob/2a60257c60663684c8f6dc8b5ea3cf184e534db6/utility/src/main/java/com/networknt/utility/RegExUtils.java#L312-L317
VoltDB/voltdb
src/frontend/org/voltdb/planner/SubPlanAssembler.java
SubPlanAssembler.getRelevantNaivePath
protected static AccessPath getRelevantNaivePath(List<AbstractExpression> joinExprs, List<AbstractExpression> filterExprs) { AccessPath naivePath = new AccessPath(); if (filterExprs != null) { naivePath.otherExprs.addAll(filterExprs); } if (joinExprs != null) { naivePath.joinExprs.addAll(joinExprs); } return naivePath; }
java
protected static AccessPath getRelevantNaivePath(List<AbstractExpression> joinExprs, List<AbstractExpression> filterExprs) { AccessPath naivePath = new AccessPath(); if (filterExprs != null) { naivePath.otherExprs.addAll(filterExprs); } if (joinExprs != null) { naivePath.joinExprs.addAll(joinExprs); } return naivePath; }
[ "protected", "static", "AccessPath", "getRelevantNaivePath", "(", "List", "<", "AbstractExpression", ">", "joinExprs", ",", "List", "<", "AbstractExpression", ">", "filterExprs", ")", "{", "AccessPath", "naivePath", "=", "new", "AccessPath", "(", ")", ";", "if", ...
Generate the naive (scan) pass given a join and filter expressions @param joinExprs join expressions @param filterExprs filter expressions @return Naive access path
[ "Generate", "the", "naive", "(", "scan", ")", "pass", "given", "a", "join", "and", "filter", "expressions" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/planner/SubPlanAssembler.java#L228-L238
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/GridBagLayoutFormBuilder.java
GridBagLayoutFormBuilder.appendLabeledField
public GridBagLayoutFormBuilder appendLabeledField(String propertyName, LabelOrientation labelOrientation, int colSpan) { final JComponent field = createDefaultBinding(propertyName).getControl(); return appendLabeledField(propertyName, field, labelOrientation, colSpan); }
java
public GridBagLayoutFormBuilder appendLabeledField(String propertyName, LabelOrientation labelOrientation, int colSpan) { final JComponent field = createDefaultBinding(propertyName).getControl(); return appendLabeledField(propertyName, field, labelOrientation, colSpan); }
[ "public", "GridBagLayoutFormBuilder", "appendLabeledField", "(", "String", "propertyName", ",", "LabelOrientation", "labelOrientation", ",", "int", "colSpan", ")", "{", "final", "JComponent", "field", "=", "createDefaultBinding", "(", "propertyName", ")", ".", "getContr...
Appends a label and field to the end of the current line. <p /> The label will be to the left of the field, and be right-justified. <br /> The field will "grow" horizontally as space allows. <p /> @param propertyName the name of the property to create the controls for @param colSpan the number of columns the field should span @return "this" to make it easier to string together append calls
[ "Appends", "a", "label", "and", "field", "to", "the", "end", "of", "the", "current", "line", ".", "<p", "/", ">" ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/form/builder/GridBagLayoutFormBuilder.java#L114-L119
OpenLiberty/open-liberty
dev/com.ibm.websphere.javaee.el.3.0/src/javax/el/ELContext.java
ELContext.convertToType
public Object convertToType(Object obj, Class<?> type) { boolean originalResolved = isPropertyResolved(); setPropertyResolved(false); try { ELResolver resolver = getELResolver(); if (resolver != null) { Object result = resolver.convertToType(this, obj, type); if (isPropertyResolved()) { return result; } } } finally { setPropertyResolved(originalResolved); } return ELManager.getExpressionFactory().coerceToType(obj, type); }
java
public Object convertToType(Object obj, Class<?> type) { boolean originalResolved = isPropertyResolved(); setPropertyResolved(false); try { ELResolver resolver = getELResolver(); if (resolver != null) { Object result = resolver.convertToType(this, obj, type); if (isPropertyResolved()) { return result; } } } finally { setPropertyResolved(originalResolved); } return ELManager.getExpressionFactory().coerceToType(obj, type); }
[ "public", "Object", "convertToType", "(", "Object", "obj", ",", "Class", "<", "?", ">", "type", ")", "{", "boolean", "originalResolved", "=", "isPropertyResolved", "(", ")", ";", "setPropertyResolved", "(", "false", ")", ";", "try", "{", "ELResolver", "resol...
Coerce the supplied object to the requested type. @param obj The object to be coerced @param type The type to which the object should be coerced @return An instance of the requested type. @throws ELException If the conversion fails @since EL 3.0
[ "Coerce", "the", "supplied", "object", "to", "the", "requested", "type", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.el.3.0/src/javax/el/ELContext.java#L290-L307
Squarespace/cldr
runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java
CalendarFormatterBase.formatHours
void formatHours(StringBuilder b, ZonedDateTime d, int width, boolean twelveHour) { int hours = d.getHour(); if (twelveHour && hours > 12) { hours = hours - 12; } if (twelveHour && hours == 0) { hours = 12; } zeroPad2(b, hours, width); }
java
void formatHours(StringBuilder b, ZonedDateTime d, int width, boolean twelveHour) { int hours = d.getHour(); if (twelveHour && hours > 12) { hours = hours - 12; } if (twelveHour && hours == 0) { hours = 12; } zeroPad2(b, hours, width); }
[ "void", "formatHours", "(", "StringBuilder", "b", ",", "ZonedDateTime", "d", ",", "int", "width", ",", "boolean", "twelveHour", ")", "{", "int", "hours", "=", "d", ".", "getHour", "(", ")", ";", "if", "(", "twelveHour", "&&", "hours", ">", "12", ")", ...
Format the hours in 12- or 24-hour format, optionally zero-padded.
[ "Format", "the", "hours", "in", "12", "-", "or", "24", "-", "hour", "format", "optionally", "zero", "-", "padded", "." ]
train
https://github.com/Squarespace/cldr/blob/54b752d4ec2457df56e98461618f9c0eec41e1e1/runtime/src/main/java/com/squarespace/cldr/dates/CalendarFormatterBase.java#L729-L738
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/views/DefaultAvatarController.java
DefaultAvatarController.cleanOutOldAvatars
protected void cleanOutOldAvatars(File directory, int maxLifeInDays){ if (directory != null){ if (mCleanedDirectories.contains(directory.getAbsolutePath())){ return; } long oldestTimeAllowed = System.currentTimeMillis() - maxLifeInDays * TimeUnit.DAYS.toMillis(maxLifeInDays); File[] files = directory.listFiles(); if (files != null){ for (File file : files){ if (file.getName().startsWith(DEFAULT_AVATAR_FILE_PREFIX) && file.lastModified() < oldestTimeAllowed){ file.delete(); } } } } }
java
protected void cleanOutOldAvatars(File directory, int maxLifeInDays){ if (directory != null){ if (mCleanedDirectories.contains(directory.getAbsolutePath())){ return; } long oldestTimeAllowed = System.currentTimeMillis() - maxLifeInDays * TimeUnit.DAYS.toMillis(maxLifeInDays); File[] files = directory.listFiles(); if (files != null){ for (File file : files){ if (file.getName().startsWith(DEFAULT_AVATAR_FILE_PREFIX) && file.lastModified() < oldestTimeAllowed){ file.delete(); } } } } }
[ "protected", "void", "cleanOutOldAvatars", "(", "File", "directory", ",", "int", "maxLifeInDays", ")", "{", "if", "(", "directory", "!=", "null", ")", "{", "if", "(", "mCleanedDirectories", ".", "contains", "(", "directory", ".", "getAbsolutePath", "(", ")", ...
Delete all files for user that is older than maxLifeInDays @param directory the directory where avatar files are being held. @param maxLifeInDays the number of days avatar files are allowed to live for.
[ "Delete", "all", "files", "for", "user", "that", "is", "older", "than", "maxLifeInDays" ]
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/views/DefaultAvatarController.java#L88-L103
tvesalainen/util
util/src/main/java/org/vesalainen/math/CircleFitter.java
CircleFitter.filterInnerPoints
public static void filterInnerPoints(DenseMatrix64F points, DenseMatrix64F center, int minLeft, double percent) { assert points.numCols == 2; assert center.numCols == 1; assert center.numRows == 2; if (percent <= 0 || percent >= 1) { throw new IllegalArgumentException("percent "+percent+" is not between 0 & 1"); } DistComp dc = new DistComp(center.data[0], center.data[1]); Matrices.sort(points, dc); int rows = points.numRows; double[] d = points.data; double limit = dc.distance(d[0], d[1])*percent; for (int r=minLeft;r<rows;r++) { double distance = dc.distance(d[2*r], d[2*r+1]); if (distance < limit) { points.reshape(r/2, 2, true); break; } } }
java
public static void filterInnerPoints(DenseMatrix64F points, DenseMatrix64F center, int minLeft, double percent) { assert points.numCols == 2; assert center.numCols == 1; assert center.numRows == 2; if (percent <= 0 || percent >= 1) { throw new IllegalArgumentException("percent "+percent+" is not between 0 & 1"); } DistComp dc = new DistComp(center.data[0], center.data[1]); Matrices.sort(points, dc); int rows = points.numRows; double[] d = points.data; double limit = dc.distance(d[0], d[1])*percent; for (int r=minLeft;r<rows;r++) { double distance = dc.distance(d[2*r], d[2*r+1]); if (distance < limit) { points.reshape(r/2, 2, true); break; } } }
[ "public", "static", "void", "filterInnerPoints", "(", "DenseMatrix64F", "points", ",", "DenseMatrix64F", "center", ",", "int", "minLeft", ",", "double", "percent", ")", "{", "assert", "points", ".", "numCols", "==", "2", ";", "assert", "center", ".", "numCols"...
Filters points which are closes to the last estimated tempCenter. @param points @param center
[ "Filters", "points", "which", "are", "closes", "to", "the", "last", "estimated", "tempCenter", "." ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/CircleFitter.java#L115-L138
square/dagger
core/src/main/java/dagger/internal/Keys.java
Keys.get
public static String get(Type type, Annotation[] annotations, Object subject) { return get(type, extractQualifier(annotations, subject)); }
java
public static String get(Type type, Annotation[] annotations, Object subject) { return get(type, extractQualifier(annotations, subject)); }
[ "public", "static", "String", "get", "(", "Type", "type", ",", "Annotation", "[", "]", "annotations", ",", "Object", "subject", ")", "{", "return", "get", "(", "type", ",", "extractQualifier", "(", "annotations", ",", "subject", ")", ")", ";", "}" ]
Returns a key for {@code type} annotated with {@code annotations}, reporting failures against {@code subject}. @param annotations the annotations on a single method, field or parameter. This array may contain at most one qualifier annotation.
[ "Returns", "a", "key", "for", "{", "@code", "type", "}", "annotated", "with", "{", "@code", "annotations", "}", "reporting", "failures", "against", "{", "@code", "subject", "}", "." ]
train
https://github.com/square/dagger/blob/572cdd2fe97fc3c148fb3d8e1b2ce7beb4dcbcde/core/src/main/java/dagger/internal/Keys.java#L111-L113
b3dgs/lionengine
lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/MapTileTransitionModel.java
MapTileTransitionModel.checkTransitives
private void checkTransitives(Collection<Tile> resolved, Tile tile) { boolean isTransitive = false; for (final Tile neighbor : map.getNeighbors(tile)) { final String group = mapGroup.getGroup(tile); final String neighborGroup = mapGroup.getGroup(neighbor); final Collection<GroupTransition> transitives = getTransitives(group, neighborGroup); if (transitives.size() > 1 && (getTransition(neighbor, group) == null || isCenter(neighbor))) { final int iterations = transitives.size() - 3; int i = 0; for (final GroupTransition transitive : transitives) { updateTransitive(resolved, tile, neighbor, transitive); isTransitive = true; i++; if (i > iterations) { break; } } } } // Restore initial tile once transition solved by transitive if (isTransitive) { map.setTile(tile); } }
java
private void checkTransitives(Collection<Tile> resolved, Tile tile) { boolean isTransitive = false; for (final Tile neighbor : map.getNeighbors(tile)) { final String group = mapGroup.getGroup(tile); final String neighborGroup = mapGroup.getGroup(neighbor); final Collection<GroupTransition> transitives = getTransitives(group, neighborGroup); if (transitives.size() > 1 && (getTransition(neighbor, group) == null || isCenter(neighbor))) { final int iterations = transitives.size() - 3; int i = 0; for (final GroupTransition transitive : transitives) { updateTransitive(resolved, tile, neighbor, transitive); isTransitive = true; i++; if (i > iterations) { break; } } } } // Restore initial tile once transition solved by transitive if (isTransitive) { map.setTile(tile); } }
[ "private", "void", "checkTransitives", "(", "Collection", "<", "Tile", ">", "resolved", ",", "Tile", "tile", ")", "{", "boolean", "isTransitive", "=", "false", ";", "for", "(", "final", "Tile", "neighbor", ":", "map", ".", "getNeighbors", "(", "tile", ")",...
Check tile transitive groups. @param resolved The resolved tiles. @param tile The tile to check.
[ "Check", "tile", "transitive", "groups", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-game/src/main/java/com/b3dgs/lionengine/game/feature/tile/map/transition/MapTileTransitionModel.java#L318-L348
atbashEE/atbash-config
impl/src/main/java/be/atbash/config/AbstractConfiguration.java
AbstractConfiguration.getOptionalValue
protected <T> T getOptionalValue(String propertyName, T defaultValue, Class<T> propertyType) { T result = ConfigOptionalValue.getValue(propertyName, propertyType); if (result == null) { result = defaultValue; } return result; }
java
protected <T> T getOptionalValue(String propertyName, T defaultValue, Class<T> propertyType) { T result = ConfigOptionalValue.getValue(propertyName, propertyType); if (result == null) { result = defaultValue; } return result; }
[ "protected", "<", "T", ">", "T", "getOptionalValue", "(", "String", "propertyName", ",", "T", "defaultValue", ",", "Class", "<", "T", ">", "propertyType", ")", "{", "T", "result", "=", "ConfigOptionalValue", ".", "getValue", "(", "propertyName", ",", "proper...
Reads the configuration property as an optional value, so it is not required to have a value for the key/propertyName, and returns the <code>defaultValue</code> when the value isn't defined. @param <T> the property type @param propertyName The configuration propertyName. @param propertyType The type into which the resolve property value should be converted @return the resolved property value as an value of the requested type. (defaultValue when not found)
[ "Reads", "the", "configuration", "property", "as", "an", "optional", "value", "so", "it", "is", "not", "required", "to", "have", "a", "value", "for", "the", "key", "/", "propertyName", "and", "returns", "the", "<code", ">", "defaultValue<", "/", "code", ">...
train
https://github.com/atbashEE/atbash-config/blob/80c06c6e535957514ffb51380948ecd351d5068c/impl/src/main/java/be/atbash/config/AbstractConfiguration.java#L36-L43
alkacon/opencms-core
src/org/opencms/relations/CmsLink.java
CmsLink.updateLink
public void updateLink(String target, String anchor, String query) { // set the components m_target = target; m_anchor = anchor; setQuery(query); // create the uri from the components setUri(); // update the xml CmsLinkUpdateUtil.updateXml(this, m_element, true); }
java
public void updateLink(String target, String anchor, String query) { // set the components m_target = target; m_anchor = anchor; setQuery(query); // create the uri from the components setUri(); // update the xml CmsLinkUpdateUtil.updateXml(this, m_element, true); }
[ "public", "void", "updateLink", "(", "String", "target", ",", "String", "anchor", ",", "String", "query", ")", "{", "// set the components", "m_target", "=", "target", ";", "m_anchor", "=", "anchor", ";", "setQuery", "(", "query", ")", ";", "// create the uri ...
Updates the uri of this link with a new target, anchor and query.<p> If anchor and/or query are <code>null</code>, this features are not used.<p> Note that you can <b>not</b> update the "internal" or "type" values of the link, so the new link must be of same type (A, IMG) and also remain either an internal or external link.<p> Also updates the structure of the underlying XML page document this link belongs to.<p> @param target the target (destination) of this link @param anchor the anchor or null if undefined @param query the query or null if undefined
[ "Updates", "the", "uri", "of", "this", "link", "with", "a", "new", "target", "anchor", "and", "query", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsLink.java#L661-L673
OpenTSDB/opentsdb
src/tools/ConfigArgP.java
ConfigArgP.getConfigurationItem
public ConfigurationItem getConfigurationItem(final String key) { if(key==null || key.trim().isEmpty()) throw new IllegalArgumentException("The passed key was null or empty"); return getConfigurationItemByKey(configItemsByKey, key); }
java
public ConfigurationItem getConfigurationItem(final String key) { if(key==null || key.trim().isEmpty()) throw new IllegalArgumentException("The passed key was null or empty"); return getConfigurationItemByKey(configItemsByKey, key); }
[ "public", "ConfigurationItem", "getConfigurationItem", "(", "final", "String", "key", ")", "{", "if", "(", "key", "==", "null", "||", "key", ".", "trim", "(", ")", ".", "isEmpty", "(", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"The passed ...
Returns the {@link ConfigurationItem} with the passed key @param key The key of the item to fetch @return The matching ConfigurationItem or null if one was not found
[ "Returns", "the", "{" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tools/ConfigArgP.java#L372-L375
raydac/java-comment-preprocessor
jcp/src/main/java/com/igormaznitsa/jcp/expression/Expression.java
Expression.evalExpression
@Nonnull public static Value evalExpression(@Nonnull final String expression, @Nonnull final PreprocessorContext context) { try { final ExpressionTree tree = ExpressionParser.getInstance().parse(expression, context); return evalTree(tree, context); } catch (IOException unexpected) { throw context.makeException("[Expression]Wrong expression format detected [" + expression + ']', unexpected); } }
java
@Nonnull public static Value evalExpression(@Nonnull final String expression, @Nonnull final PreprocessorContext context) { try { final ExpressionTree tree = ExpressionParser.getInstance().parse(expression, context); return evalTree(tree, context); } catch (IOException unexpected) { throw context.makeException("[Expression]Wrong expression format detected [" + expression + ']', unexpected); } }
[ "@", "Nonnull", "public", "static", "Value", "evalExpression", "(", "@", "Nonnull", "final", "String", "expression", ",", "@", "Nonnull", "final", "PreprocessorContext", "context", ")", "{", "try", "{", "final", "ExpressionTree", "tree", "=", "ExpressionParser", ...
Evaluate expression @param expression the expression as a String, must not be null @param context a preprocessor context to be used for expression operations @return the result as a Value object, it can't be null
[ "Evaluate", "expression" ]
train
https://github.com/raydac/java-comment-preprocessor/blob/83ac87b575ac084914d77695a8c8673de3b8300c/jcp/src/main/java/com/igormaznitsa/jcp/expression/Expression.java#L82-L90
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/query/SearchFilter.java
SearchFilter.compareFilter
public void compareFilter(String ElementName, String value, int oper) throws DBException { // Delete the old search filter m_filter = null; // If this is not a binary operator, throw an exception if ((oper & BINARY_OPER_MASK) == 0) { throw new DBException(); // Create a SearchBaseLeafComparison node and store it as the filter } m_filter = new SearchBaseLeafComparison(ElementName, oper, value); }
java
public void compareFilter(String ElementName, String value, int oper) throws DBException { // Delete the old search filter m_filter = null; // If this is not a binary operator, throw an exception if ((oper & BINARY_OPER_MASK) == 0) { throw new DBException(); // Create a SearchBaseLeafComparison node and store it as the filter } m_filter = new SearchBaseLeafComparison(ElementName, oper, value); }
[ "public", "void", "compareFilter", "(", "String", "ElementName", ",", "String", "value", ",", "int", "oper", ")", "throws", "DBException", "{", "// Delete the old search filter\r", "m_filter", "=", "null", ";", "// If this is not a binary operator, throw an exception\r", ...
Change the search filter to one that compares an element name to a value. The old search filter is deleted. @param ElementName is the name of the element to be tested @param value is the value to be compared against @param oper is the binary comparison operator to be used @exception DBException
[ "Change", "the", "search", "filter", "to", "one", "that", "compares", "an", "element", "name", "to", "a", "value", ".", "The", "old", "search", "filter", "is", "deleted", "." ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/query/SearchFilter.java#L196-L207
knowm/XChange
xchange-btcturk/src/main/java/org/knowm/xchange/btcturk/BTCTurkAdapters.java
BTCTurkAdapters.adaptTrades
public static Trades adaptTrades(List<BTCTurkTrades> btcTurkTrades, CurrencyPair currencyPair) { List<Trade> trades = new ArrayList<>(); BigDecimal lastTradeId = new BigDecimal("0"); for (BTCTurkTrades btcTurkTrade : btcTurkTrades) { if (btcTurkTrade.getTid().compareTo(lastTradeId) > 0) { lastTradeId = btcTurkTrade.getTid(); } trades.add(adaptTrade(btcTurkTrade, currencyPair)); } return new Trades(trades, lastTradeId.longValue(), Trades.TradeSortType.SortByID); }
java
public static Trades adaptTrades(List<BTCTurkTrades> btcTurkTrades, CurrencyPair currencyPair) { List<Trade> trades = new ArrayList<>(); BigDecimal lastTradeId = new BigDecimal("0"); for (BTCTurkTrades btcTurkTrade : btcTurkTrades) { if (btcTurkTrade.getTid().compareTo(lastTradeId) > 0) { lastTradeId = btcTurkTrade.getTid(); } trades.add(adaptTrade(btcTurkTrade, currencyPair)); } return new Trades(trades, lastTradeId.longValue(), Trades.TradeSortType.SortByID); }
[ "public", "static", "Trades", "adaptTrades", "(", "List", "<", "BTCTurkTrades", ">", "btcTurkTrades", ",", "CurrencyPair", "currencyPair", ")", "{", "List", "<", "Trade", ">", "trades", "=", "new", "ArrayList", "<>", "(", ")", ";", "BigDecimal", "lastTradeId",...
Adapts a BTCTurkTrade[] to a Trades Object @param btcTurkTrades The BTCTurk trades @param currencyPair (e.g. BTC/TRY) @return The XChange Trades
[ "Adapts", "a", "BTCTurkTrade", "[]", "to", "a", "Trades", "Object" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-btcturk/src/main/java/org/knowm/xchange/btcturk/BTCTurkAdapters.java#L84-L94
lucee/Lucee
core/src/main/java/lucee/commons/io/IOUtil.java
IOUtil.getWriter
public static Writer getWriter(OutputStream os, Charset charset) throws IOException { if (charset == null) charset = SystemUtil.getCharset(); return new BufferedWriter(new OutputStreamWriter(os, charset)); }
java
public static Writer getWriter(OutputStream os, Charset charset) throws IOException { if (charset == null) charset = SystemUtil.getCharset(); return new BufferedWriter(new OutputStreamWriter(os, charset)); }
[ "public", "static", "Writer", "getWriter", "(", "OutputStream", "os", ",", "Charset", "charset", ")", "throws", "IOException", "{", "if", "(", "charset", "==", "null", ")", "charset", "=", "SystemUtil", ".", "getCharset", "(", ")", ";", "return", "new", "B...
returns a Reader for the given InputStream @param is @param charset @return Reader @throws IOException
[ "returns", "a", "Reader", "for", "the", "given", "InputStream" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/commons/io/IOUtil.java#L1224-L1227
hawkular/hawkular-apm
client/agent-opentracing/src/main/java/org/hawkular/apm/agent/opentracing/OpenTracingManager.java
OpenTracingManager.setVariable
public void setVariable(String name, Object value) { TraceState ts = traceState.get(); if (ts != null) { if (log.isLoggable(Level.FINEST)) { log.finest("Set variable '" + name + "' value = " + value); } ts.getVariables().put(name, value); } else if (log.isLoggable(Level.FINEST)) { log.finest("Set variable '" + name + "' value = " + value + "' requested, but no trace state"); } }
java
public void setVariable(String name, Object value) { TraceState ts = traceState.get(); if (ts != null) { if (log.isLoggable(Level.FINEST)) { log.finest("Set variable '" + name + "' value = " + value); } ts.getVariables().put(name, value); } else if (log.isLoggable(Level.FINEST)) { log.finest("Set variable '" + name + "' value = " + value + "' requested, but no trace state"); } }
[ "public", "void", "setVariable", "(", "String", "name", ",", "Object", "value", ")", "{", "TraceState", "ts", "=", "traceState", ".", "get", "(", ")", ";", "if", "(", "ts", "!=", "null", ")", "{", "if", "(", "log", ".", "isLoggable", "(", "Level", ...
This method retrieves a variable associated with the current trace. @return The variable value, or null if not found
[ "This", "method", "retrieves", "a", "variable", "associated", "with", "the", "current", "trace", "." ]
train
https://github.com/hawkular/hawkular-apm/blob/57a4df0611b359597626563ea5f9ac64d4bb2533/client/agent-opentracing/src/main/java/org/hawkular/apm/agent/opentracing/OpenTracingManager.java#L506-L517
UrielCh/ovh-java-sdk
ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java
ApiOvhDbaaslogs.serviceName_input_inputId_GET
public OvhInput serviceName_input_inputId_GET(String serviceName, String inputId) throws IOException { String qPath = "/dbaas/logs/{serviceName}/input/{inputId}"; StringBuilder sb = path(qPath, serviceName, inputId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhInput.class); }
java
public OvhInput serviceName_input_inputId_GET(String serviceName, String inputId) throws IOException { String qPath = "/dbaas/logs/{serviceName}/input/{inputId}"; StringBuilder sb = path(qPath, serviceName, inputId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhInput.class); }
[ "public", "OvhInput", "serviceName_input_inputId_GET", "(", "String", "serviceName", ",", "String", "inputId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/dbaas/logs/{serviceName}/input/{inputId}\"", ";", "StringBuilder", "sb", "=", "path", "(", "qPat...
Returns details of specified input REST: GET /dbaas/logs/{serviceName}/input/{inputId} @param serviceName [required] Service name @param inputId [required] Input ID
[ "Returns", "details", "of", "specified", "input" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L396-L401
Azure/azure-sdk-for-java
datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java
ServicesInner.checkNameAvailabilityAsync
public Observable<NameAvailabilityResponseInner> checkNameAvailabilityAsync(String location, NameAvailabilityRequest parameters) { return checkNameAvailabilityWithServiceResponseAsync(location, parameters).map(new Func1<ServiceResponse<NameAvailabilityResponseInner>, NameAvailabilityResponseInner>() { @Override public NameAvailabilityResponseInner call(ServiceResponse<NameAvailabilityResponseInner> response) { return response.body(); } }); }
java
public Observable<NameAvailabilityResponseInner> checkNameAvailabilityAsync(String location, NameAvailabilityRequest parameters) { return checkNameAvailabilityWithServiceResponseAsync(location, parameters).map(new Func1<ServiceResponse<NameAvailabilityResponseInner>, NameAvailabilityResponseInner>() { @Override public NameAvailabilityResponseInner call(ServiceResponse<NameAvailabilityResponseInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "NameAvailabilityResponseInner", ">", "checkNameAvailabilityAsync", "(", "String", "location", ",", "NameAvailabilityRequest", "parameters", ")", "{", "return", "checkNameAvailabilityWithServiceResponseAsync", "(", "location", ",", "parameters", "...
Check name validity and availability. This method checks whether a proposed top-level resource name is valid and available. @param location The Azure region of the operation @param parameters Requested name to validate @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the NameAvailabilityResponseInner object
[ "Check", "name", "validity", "and", "availability", ".", "This", "method", "checks", "whether", "a", "proposed", "top", "-", "level", "resource", "name", "is", "valid", "and", "available", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/datamigration/resource-manager/v2017_11_15_preview/src/main/java/com/microsoft/azure/management/datamigration/v2017_11_15_preview/implementation/ServicesInner.java#L1839-L1846
VoltDB/voltdb
src/frontend/org/voltdb/iv2/MpScheduler.java
MpScheduler.safeAddToDuplicateCounterMap
void safeAddToDuplicateCounterMap(long dpKey, DuplicateCounter counter) { DuplicateCounter existingDC = m_duplicateCounters.get(dpKey); if (existingDC != null) { // this is a collision and is bad existingDC.logWithCollidingDuplicateCounters(counter); VoltDB.crashGlobalVoltDB("DUPLICATE COUNTER MISMATCH: two duplicate counter keys collided.", true, null); } else { m_duplicateCounters.put(dpKey, counter); } }
java
void safeAddToDuplicateCounterMap(long dpKey, DuplicateCounter counter) { DuplicateCounter existingDC = m_duplicateCounters.get(dpKey); if (existingDC != null) { // this is a collision and is bad existingDC.logWithCollidingDuplicateCounters(counter); VoltDB.crashGlobalVoltDB("DUPLICATE COUNTER MISMATCH: two duplicate counter keys collided.", true, null); } else { m_duplicateCounters.put(dpKey, counter); } }
[ "void", "safeAddToDuplicateCounterMap", "(", "long", "dpKey", ",", "DuplicateCounter", "counter", ")", "{", "DuplicateCounter", "existingDC", "=", "m_duplicateCounters", ".", "get", "(", "dpKey", ")", ";", "if", "(", "existingDC", "!=", "null", ")", "{", "// thi...
Just using "put" on the dup counter map is unsafe. It won't detect the case where keys collide from two different transactions.
[ "Just", "using", "put", "on", "the", "dup", "counter", "map", "is", "unsafe", ".", "It", "won", "t", "detect", "the", "case", "where", "keys", "collide", "from", "two", "different", "transactions", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/iv2/MpScheduler.java#L641-L651
netty/netty
buffer/src/main/java/io/netty/buffer/ByteBufUtil.java
ByteBufUtil.indexOf
public static int indexOf(ByteBuf needle, ByteBuf haystack) { // TODO: maybe use Boyer Moore for efficiency. int attempts = haystack.readableBytes() - needle.readableBytes() + 1; for (int i = 0; i < attempts; i++) { if (equals(needle, needle.readerIndex(), haystack, haystack.readerIndex() + i, needle.readableBytes())) { return haystack.readerIndex() + i; } } return -1; }
java
public static int indexOf(ByteBuf needle, ByteBuf haystack) { // TODO: maybe use Boyer Moore for efficiency. int attempts = haystack.readableBytes() - needle.readableBytes() + 1; for (int i = 0; i < attempts; i++) { if (equals(needle, needle.readerIndex(), haystack, haystack.readerIndex() + i, needle.readableBytes())) { return haystack.readerIndex() + i; } } return -1; }
[ "public", "static", "int", "indexOf", "(", "ByteBuf", "needle", ",", "ByteBuf", "haystack", ")", "{", "// TODO: maybe use Boyer Moore for efficiency.", "int", "attempts", "=", "haystack", ".", "readableBytes", "(", ")", "-", "needle", ".", "readableBytes", "(", ")...
Returns the reader index of needle in haystack, or -1 if needle is not in haystack.
[ "Returns", "the", "reader", "index", "of", "needle", "in", "haystack", "or", "-", "1", "if", "needle", "is", "not", "in", "haystack", "." ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L210-L221
Azure/azure-sdk-for-java
hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java
ClustersInner.updateGatewaySettingsAsync
public Observable<Void> updateGatewaySettingsAsync(String resourceGroupName, String clusterName, UpdateGatewaySettingsParameters parameters) { return updateGatewaySettingsWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> updateGatewaySettingsAsync(String resourceGroupName, String clusterName, UpdateGatewaySettingsParameters parameters) { return updateGatewaySettingsWithServiceResponseAsync(resourceGroupName, clusterName, parameters).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "updateGatewaySettingsAsync", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "UpdateGatewaySettingsParameters", "parameters", ")", "{", "return", "updateGatewaySettingsWithServiceResponseAsync", "(", "resourceG...
Configures the gateway settings on the specified cluster. @param resourceGroupName The name of the resource group. @param clusterName The name of the cluster. @param parameters The cluster configurations. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Configures", "the", "gateway", "settings", "on", "the", "specified", "cluster", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/hdinsight/resource-manager/v2018_06_01_preview/src/main/java/com/microsoft/azure/management/hdinsight/v2018_06_01_preview/implementation/ClustersInner.java#L1576-L1583
HeidelTime/heideltime
src/jvnsensegmenter/JVnSenSegmenter.java
JVnSenSegmenter.senSegment
public void senSegment(String text, List senList){ senList.clear(); String resultStr = senSegment(text); StringTokenizer senTknr = new StringTokenizer(resultStr, "\n"); while(senTknr.hasMoreTokens()){ senList.add(senTknr.nextToken()); } }
java
public void senSegment(String text, List senList){ senList.clear(); String resultStr = senSegment(text); StringTokenizer senTknr = new StringTokenizer(resultStr, "\n"); while(senTknr.hasMoreTokens()){ senList.add(senTknr.nextToken()); } }
[ "public", "void", "senSegment", "(", "String", "text", ",", "List", "senList", ")", "{", "senList", ".", "clear", "(", ")", ";", "String", "resultStr", "=", "senSegment", "(", "text", ")", ";", "StringTokenizer", "senTknr", "=", "new", "StringTokenizer", "...
Sen segment. @param text the text @param senList the sen list
[ "Sen", "segment", "." ]
train
https://github.com/HeidelTime/heideltime/blob/4ef5002eb5ecfeb818086ff7e394e792ee360335/src/jvnsensegmenter/JVnSenSegmenter.java#L122-L130
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java
GISCoordinates.WSG84_L93
@Pure public static Point2d WSG84_L93(double lambda, double phi) { final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_93_N, LAMBERT_93_C, LAMBERT_93_XS, LAMBERT_93_YS); }
java
@Pure public static Point2d WSG84_L93(double lambda, double phi) { final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi); return NTFLambdaPhi_NTFLambert( ntfLambdaPhi.getX(), ntfLambdaPhi.getY(), LAMBERT_93_N, LAMBERT_93_C, LAMBERT_93_XS, LAMBERT_93_YS); }
[ "@", "Pure", "public", "static", "Point2d", "WSG84_L93", "(", "double", "lambda", ",", "double", "phi", ")", "{", "final", "Point2d", "ntfLambdaPhi", "=", "WSG84_NTFLamdaPhi", "(", "lambda", ",", "phi", ")", ";", "return", "NTFLambdaPhi_NTFLambert", "(", "ntfL...
This function convert WSG84 GPS coordinate to France Lambert 93 coordinate. @param lambda in degrees. @param phi in degrees. @return the France Lambert 93 coordinates.
[ "This", "function", "convert", "WSG84", "GPS", "coordinate", "to", "France", "Lambert", "93", "coordinate", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L1132-L1141
lettuce-io/lettuce-core
src/main/java/io/lettuce/core/dynamic/support/ResolvableType.java
ResolvableType.forClassWithGenerics
public static ResolvableType forClassWithGenerics(Class<?> sourceClass, ResolvableType... generics) { LettuceAssert.notNull(sourceClass, "Source class must not be null"); LettuceAssert.notNull(generics, "Generics must not be null"); TypeVariable<?>[] variables = sourceClass.getTypeParameters(); LettuceAssert.isTrue(variables.length == generics.length, "Mismatched number of generics specified"); Type[] arguments = new Type[generics.length]; for (int i = 0; i < generics.length; i++) { ResolvableType generic = generics[i]; Type argument = (generic != null ? generic.getType() : null); arguments[i] = (argument != null ? argument : variables[i]); } ParameterizedType syntheticType = new SyntheticParameterizedType(sourceClass, arguments); return forType(syntheticType, new TypeVariablesVariableResolver(variables, generics)); }
java
public static ResolvableType forClassWithGenerics(Class<?> sourceClass, ResolvableType... generics) { LettuceAssert.notNull(sourceClass, "Source class must not be null"); LettuceAssert.notNull(generics, "Generics must not be null"); TypeVariable<?>[] variables = sourceClass.getTypeParameters(); LettuceAssert.isTrue(variables.length == generics.length, "Mismatched number of generics specified"); Type[] arguments = new Type[generics.length]; for (int i = 0; i < generics.length; i++) { ResolvableType generic = generics[i]; Type argument = (generic != null ? generic.getType() : null); arguments[i] = (argument != null ? argument : variables[i]); } ParameterizedType syntheticType = new SyntheticParameterizedType(sourceClass, arguments); return forType(syntheticType, new TypeVariablesVariableResolver(variables, generics)); }
[ "public", "static", "ResolvableType", "forClassWithGenerics", "(", "Class", "<", "?", ">", "sourceClass", ",", "ResolvableType", "...", "generics", ")", "{", "LettuceAssert", ".", "notNull", "(", "sourceClass", ",", "\"Source class must not be null\"", ")", ";", "Le...
Return a {@link ResolvableType} for the specified {@link Class} with pre-declared generics. @param sourceClass the source class @param generics the generics of the class @return a {@link ResolvableType} for the specific class and generics @see #forClassWithGenerics(Class, Class...)
[ "Return", "a", "{", "@link", "ResolvableType", "}", "for", "the", "specified", "{", "@link", "Class", "}", "with", "pre", "-", "declared", "generics", "." ]
train
https://github.com/lettuce-io/lettuce-core/blob/b6de74e384dea112e3656684ca3f50cdfd6c8e0d/src/main/java/io/lettuce/core/dynamic/support/ResolvableType.java#L895-L910
datacleaner/AnalyzerBeans
components/value-distribution/src/main/java/org/eobjects/analyzer/result/AbstractValueCountingAnalyzerResult.java
AbstractValueCountingAnalyzerResult.appendToString
protected void appendToString(StringBuilder sb, ValueCountingAnalyzerResult groupResult, int maxEntries) { if (maxEntries != 0) { Collection<ValueFrequency> valueCounts = groupResult.getValueCounts(); for (ValueFrequency valueCount : valueCounts) { sb.append("\n - "); sb.append(valueCount.getName()); sb.append(": "); sb.append(valueCount.getCount()); maxEntries--; if (maxEntries == 0) { sb.append("\n ..."); break; } } } }
java
protected void appendToString(StringBuilder sb, ValueCountingAnalyzerResult groupResult, int maxEntries) { if (maxEntries != 0) { Collection<ValueFrequency> valueCounts = groupResult.getValueCounts(); for (ValueFrequency valueCount : valueCounts) { sb.append("\n - "); sb.append(valueCount.getName()); sb.append(": "); sb.append(valueCount.getCount()); maxEntries--; if (maxEntries == 0) { sb.append("\n ..."); break; } } } }
[ "protected", "void", "appendToString", "(", "StringBuilder", "sb", ",", "ValueCountingAnalyzerResult", "groupResult", ",", "int", "maxEntries", ")", "{", "if", "(", "maxEntries", "!=", "0", ")", "{", "Collection", "<", "ValueFrequency", ">", "valueCounts", "=", ...
Appends a string representation with a maximum amount of entries @param sb the StringBuilder to append to @param maxEntries @return
[ "Appends", "a", "string", "representation", "with", "a", "maximum", "amount", "of", "entries" ]
train
https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/components/value-distribution/src/main/java/org/eobjects/analyzer/result/AbstractValueCountingAnalyzerResult.java#L179-L195
UrielCh/ovh-java-sdk
ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java
ApiOvhMe.contact_contactId_PUT
public OvhContact contact_contactId_PUT(Long contactId, OvhAddress address, String birthCity, OvhCountryEnum birthCountry, Date birthDay, String birthZip, String cellPhone, String companyNationalIdentificationNumber, String email, String fax, String firstName, OvhGenderEnum gender, OvhLanguageEnum language, String lastName, OvhLegalFormEnum legalForm, String nationalIdentificationNumber, OvhCountryEnum nationality, String organisationName, String organisationType, String phone, String vat) throws IOException { String qPath = "/me/contact/{contactId}"; StringBuilder sb = path(qPath, contactId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "address", address); addBody(o, "birthCity", birthCity); addBody(o, "birthCountry", birthCountry); addBody(o, "birthDay", birthDay); addBody(o, "birthZip", birthZip); addBody(o, "cellPhone", cellPhone); addBody(o, "companyNationalIdentificationNumber", companyNationalIdentificationNumber); addBody(o, "email", email); addBody(o, "fax", fax); addBody(o, "firstName", firstName); addBody(o, "gender", gender); addBody(o, "language", language); addBody(o, "lastName", lastName); addBody(o, "legalForm", legalForm); addBody(o, "nationalIdentificationNumber", nationalIdentificationNumber); addBody(o, "nationality", nationality); addBody(o, "organisationName", organisationName); addBody(o, "organisationType", organisationType); addBody(o, "phone", phone); addBody(o, "vat", vat); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhContact.class); }
java
public OvhContact contact_contactId_PUT(Long contactId, OvhAddress address, String birthCity, OvhCountryEnum birthCountry, Date birthDay, String birthZip, String cellPhone, String companyNationalIdentificationNumber, String email, String fax, String firstName, OvhGenderEnum gender, OvhLanguageEnum language, String lastName, OvhLegalFormEnum legalForm, String nationalIdentificationNumber, OvhCountryEnum nationality, String organisationName, String organisationType, String phone, String vat) throws IOException { String qPath = "/me/contact/{contactId}"; StringBuilder sb = path(qPath, contactId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "address", address); addBody(o, "birthCity", birthCity); addBody(o, "birthCountry", birthCountry); addBody(o, "birthDay", birthDay); addBody(o, "birthZip", birthZip); addBody(o, "cellPhone", cellPhone); addBody(o, "companyNationalIdentificationNumber", companyNationalIdentificationNumber); addBody(o, "email", email); addBody(o, "fax", fax); addBody(o, "firstName", firstName); addBody(o, "gender", gender); addBody(o, "language", language); addBody(o, "lastName", lastName); addBody(o, "legalForm", legalForm); addBody(o, "nationalIdentificationNumber", nationalIdentificationNumber); addBody(o, "nationality", nationality); addBody(o, "organisationName", organisationName); addBody(o, "organisationType", organisationType); addBody(o, "phone", phone); addBody(o, "vat", vat); String resp = exec(qPath, "PUT", sb.toString(), o); return convertTo(resp, OvhContact.class); }
[ "public", "OvhContact", "contact_contactId_PUT", "(", "Long", "contactId", ",", "OvhAddress", "address", ",", "String", "birthCity", ",", "OvhCountryEnum", "birthCountry", ",", "Date", "birthDay", ",", "String", "birthZip", ",", "String", "cellPhone", ",", "String",...
Update an existing contact REST: PUT /me/contact/{contactId} @param contactId [required] Contact Identifier @param address [required] Address of the contact @param cellPhone [required] Cellphone number @param phone [required] Landline phone number @param fax [required] Fax phone number @param birthDay [required] Birthday date @param birthCity [required] City of birth @param birthZip [required] Birth Zipcode @param birthCountry [required] Birth Country @param vat [required] VAT number @param companyNationalIdentificationNumber [required] Company national identification number @param nationalIdentificationNumber [required] National identification number @param organisationType [required] Type of your organisation @param organisationName [required] Name of your organisation @param email [required] Email address @param firstName [required] First name @param gender [required] Gender @param language [required] Language @param nationality [required] Nationality @param lastName [required] Last name @param legalForm [required] Legal form of the contact
[ "Update", "an", "existing", "contact" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-me/src/main/java/net/minidev/ovh/api/ApiOvhMe.java#L3058-L3084
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.getTimestampFromTenths
public static final Date getTimestampFromTenths(byte[] data, int offset) { long ms = ((long) getInt(data, offset)) * 6000; return (DateHelper.getTimestampFromLong(EPOCH + ms)); }
java
public static final Date getTimestampFromTenths(byte[] data, int offset) { long ms = ((long) getInt(data, offset)) * 6000; return (DateHelper.getTimestampFromLong(EPOCH + ms)); }
[ "public", "static", "final", "Date", "getTimestampFromTenths", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "long", "ms", "=", "(", "(", "long", ")", "getInt", "(", "data", ",", "offset", ")", ")", "*", "6000", ";", "return", "(", ...
Reads a combined date and time value expressed in tenths of a minute. @param data byte array of data @param offset location of data as offset into the array @return time value
[ "Reads", "a", "combined", "date", "and", "time", "value", "expressed", "in", "tenths", "of", "a", "minute", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L406-L410
httpcache4j/httpcache4j
httpcache4j-api/src/main/java/org/codehaus/httpcache4j/MIMEType.java
MIMEType.addParameter
public MIMEType addParameter(String name, String value) { Map<String, String> copy = new LinkedHashMap<>(this.parameters); copy.put(name, value); return new MIMEType(type, subType, copy); }
java
public MIMEType addParameter(String name, String value) { Map<String, String> copy = new LinkedHashMap<>(this.parameters); copy.put(name, value); return new MIMEType(type, subType, copy); }
[ "public", "MIMEType", "addParameter", "(", "String", "name", ",", "String", "value", ")", "{", "Map", "<", "String", ",", "String", ">", "copy", "=", "new", "LinkedHashMap", "<>", "(", "this", ".", "parameters", ")", ";", "copy", ".", "put", "(", "name...
Adds a parameter to the MIMEType. @param name name of parameter @param value value of parameter @return returns a new instance with the parameter set
[ "Adds", "a", "parameter", "to", "the", "MIMEType", "." ]
train
https://github.com/httpcache4j/httpcache4j/blob/9c07ebd63cd104a99eb9e771f760f14efa4fe0f6/httpcache4j-api/src/main/java/org/codehaus/httpcache4j/MIMEType.java#L54-L58
zeroturnaround/zt-zip
src/main/java/org/zeroturnaround/zip/ZipEntryUtil.java
ZipEntryUtil.fromFile
static ZipEntry fromFile(String name, File file) { ZipEntry zipEntry = new ZipEntry(name); if (!file.isDirectory()) { zipEntry.setSize(file.length()); } zipEntry.setTime(file.lastModified()); ZTFilePermissions permissions = ZTFilePermissionsUtil.getDefaultStategy().getPermissions(file); if (permissions != null) { ZipEntryUtil.setZTFilePermissions(zipEntry, permissions); } return zipEntry; }
java
static ZipEntry fromFile(String name, File file) { ZipEntry zipEntry = new ZipEntry(name); if (!file.isDirectory()) { zipEntry.setSize(file.length()); } zipEntry.setTime(file.lastModified()); ZTFilePermissions permissions = ZTFilePermissionsUtil.getDefaultStategy().getPermissions(file); if (permissions != null) { ZipEntryUtil.setZTFilePermissions(zipEntry, permissions); } return zipEntry; }
[ "static", "ZipEntry", "fromFile", "(", "String", "name", ",", "File", "file", ")", "{", "ZipEntry", "zipEntry", "=", "new", "ZipEntry", "(", "name", ")", ";", "if", "(", "!", "file", ".", "isDirectory", "(", ")", ")", "{", "zipEntry", ".", "setSize", ...
Create new Zip entry and fill it with associated with file meta-info @param name Zip entry name @param file source File @return newly created Zip entry
[ "Create", "new", "Zip", "entry", "and", "fill", "it", "with", "associated", "with", "file", "meta", "-", "info" ]
train
https://github.com/zeroturnaround/zt-zip/blob/abb4dc43583e4d19339c0c021035019798970a13/src/main/java/org/zeroturnaround/zip/ZipEntryUtil.java#L143-L155
DiUS/pact-jvm
pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java
LambdaDslObject.minArrayLike
public LambdaDslObject minArrayLike(String name, Integer size, PactDslJsonRootValue value, int numberExamples) { object.minArrayLike(name, size, value, numberExamples); return this; }
java
public LambdaDslObject minArrayLike(String name, Integer size, PactDslJsonRootValue value, int numberExamples) { object.minArrayLike(name, size, value, numberExamples); return this; }
[ "public", "LambdaDslObject", "minArrayLike", "(", "String", "name", ",", "Integer", "size", ",", "PactDslJsonRootValue", "value", ",", "int", "numberExamples", ")", "{", "object", ".", "minArrayLike", "(", "name", ",", "size", ",", "value", ",", "numberExamples"...
Attribute that is an array of values with a minimum size that are not objects where each item must match the following example @param name field name @param size minimum size of the array @param value Value to use to match each item @param numberExamples number of examples to generate
[ "Attribute", "that", "is", "an", "array", "of", "values", "with", "a", "minimum", "size", "that", "are", "not", "objects", "where", "each", "item", "must", "match", "the", "following", "example" ]
train
https://github.com/DiUS/pact-jvm/blob/2f447e9dd4ac152a6a36b7fcf8962d07de9ef3ef/pact-jvm-consumer-java8/src/main/java/io/pactfoundation/consumer/dsl/LambdaDslObject.java#L470-L473
ldapchai/ldapchai
src/main/java/com/novell/ldapchai/impl/edir/NmasCrFactory.java
NmasCrFactory.readAssignedChallengeSet
public static ChallengeSet readAssignedChallengeSet( final ChaiUser theUser, final Locale locale ) throws ChaiUnavailableException, ChaiOperationException, ChaiValidationException { final ChaiPasswordPolicy passwordPolicy = theUser.getPasswordPolicy(); if ( passwordPolicy == null ) { LOGGER.trace( "user does not have an assigned password policy, return null for readAssignedChallengeSet()" ); return null; } return readAssignedChallengeSet( theUser.getChaiProvider(), passwordPolicy, locale ); }
java
public static ChallengeSet readAssignedChallengeSet( final ChaiUser theUser, final Locale locale ) throws ChaiUnavailableException, ChaiOperationException, ChaiValidationException { final ChaiPasswordPolicy passwordPolicy = theUser.getPasswordPolicy(); if ( passwordPolicy == null ) { LOGGER.trace( "user does not have an assigned password policy, return null for readAssignedChallengeSet()" ); return null; } return readAssignedChallengeSet( theUser.getChaiProvider(), passwordPolicy, locale ); }
[ "public", "static", "ChallengeSet", "readAssignedChallengeSet", "(", "final", "ChaiUser", "theUser", ",", "final", "Locale", "locale", ")", "throws", "ChaiUnavailableException", ",", "ChaiOperationException", ",", "ChaiValidationException", "{", "final", "ChaiPasswordPolicy...
This method will first read the user's assigned password challenge set policy. @param theUser ChaiUser to read policy for @param locale Desired locale @return A valid ChallengeSet if found, otherwise null. @throws ChaiOperationException If there is an error during the operation @throws ChaiUnavailableException If the directory server(s) are unavailable @throws ChaiValidationException when there is a logical problem with the challenge set data, such as more randoms required then exist
[ "This", "method", "will", "first", "read", "the", "user", "s", "assigned", "password", "challenge", "set", "policy", "." ]
train
https://github.com/ldapchai/ldapchai/blob/a6d4b5dbfa4e270db0ce70892512cbe39e64b874/src/main/java/com/novell/ldapchai/impl/edir/NmasCrFactory.java#L164-L176
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java
GoogleMapShapeConverter.closePolygonRing
public void closePolygonRing(List<LatLng> points) { if (!PolyUtil.isClosedPolygon(points)) { LatLng first = points.get(0); points.add(new LatLng(first.latitude, first.longitude)); } }
java
public void closePolygonRing(List<LatLng> points) { if (!PolyUtil.isClosedPolygon(points)) { LatLng first = points.get(0); points.add(new LatLng(first.latitude, first.longitude)); } }
[ "public", "void", "closePolygonRing", "(", "List", "<", "LatLng", ">", "points", ")", "{", "if", "(", "!", "PolyUtil", ".", "isClosedPolygon", "(", "points", ")", ")", "{", "LatLng", "first", "=", "points", ".", "get", "(", "0", ")", ";", "points", "...
Close the polygon ring (exterior or hole) points if needed @param points ring points @since 1.3.2
[ "Close", "the", "polygon", "ring", "(", "exterior", "or", "hole", ")", "points", "if", "needed" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/geom/GoogleMapShapeConverter.java#L714-L719
kuali/ojb-1.0.4
src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java
QueryReferenceBroker.retrieveProxyCollections
public void retrieveProxyCollections(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException { doRetrieveCollections(newObj, cld, forced, true); }
java
public void retrieveProxyCollections(Object newObj, ClassDescriptor cld, boolean forced) throws PersistenceBrokerException { doRetrieveCollections(newObj, cld, forced, true); }
[ "public", "void", "retrieveProxyCollections", "(", "Object", "newObj", ",", "ClassDescriptor", "cld", ",", "boolean", "forced", ")", "throws", "PersistenceBrokerException", "{", "doRetrieveCollections", "(", "newObj", ",", "cld", ",", "forced", ",", "true", ")", "...
Retrieve all Collection attributes of a given instance, and make all of the Proxy Collections @param newObj the instance to be loaded or refreshed @param cld the ClassDescriptor of the instance @param forced if set to true, loading is forced even if cld differs
[ "Retrieve", "all", "Collection", "attributes", "of", "a", "given", "instance", "and", "make", "all", "of", "the", "Proxy", "Collections" ]
train
https://github.com/kuali/ojb-1.0.4/blob/9a544372f67ce965f662cdc71609dd03683c8f04/src/java/org/apache/ojb/broker/core/QueryReferenceBroker.java#L951-L954
mgm-tp/jfunk
jfunk-common/src/main/java/com/mgmtp/jfunk/common/random/MathRandom.java
MathRandom.getDate
public Date getDate(final Date min, final Date max) { return getDate(min.getTime(), max.getTime()); }
java
public Date getDate(final Date min, final Date max) { return getDate(min.getTime(), max.getTime()); }
[ "public", "Date", "getDate", "(", "final", "Date", "min", ",", "final", "Date", "max", ")", "{", "return", "getDate", "(", "min", ".", "getTime", "(", ")", ",", "max", ".", "getTime", "(", ")", ")", ";", "}" ]
Returns a random date in the range of [min, max]. @param min minimum value for generated date @param max maximum value for generated date
[ "Returns", "a", "random", "date", "in", "the", "range", "of", "[", "min", "max", "]", "." ]
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-common/src/main/java/com/mgmtp/jfunk/common/random/MathRandom.java#L153-L155
apache/flink
flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/AbstractMetricGroup.java
AbstractMetricGroup.addMetric
protected void addMetric(String name, Metric metric) { if (metric == null) { LOG.warn("Ignoring attempted registration of a metric due to being null for name {}.", name); return; } // add the metric only if the group is still open synchronized (this) { if (!closed) { // immediately put without a 'contains' check to optimize the common case (no collision) // collisions are resolved later Metric prior = metrics.put(name, metric); // check for collisions with other metric names if (prior == null) { // no other metric with this name yet if (groups.containsKey(name)) { // we warn here, rather than failing, because metrics are tools that should not fail the // program when used incorrectly LOG.warn("Name collision: Adding a metric with the same name as a metric subgroup: '" + name + "'. Metric might not get properly reported. " + Arrays.toString(scopeComponents)); } registry.register(metric, name, this); } else { // we had a collision. put back the original value metrics.put(name, prior); // we warn here, rather than failing, because metrics are tools that should not fail the // program when used incorrectly LOG.warn("Name collision: Group already contains a Metric with the name '" + name + "'. Metric will not be reported." + Arrays.toString(scopeComponents)); } } } }
java
protected void addMetric(String name, Metric metric) { if (metric == null) { LOG.warn("Ignoring attempted registration of a metric due to being null for name {}.", name); return; } // add the metric only if the group is still open synchronized (this) { if (!closed) { // immediately put without a 'contains' check to optimize the common case (no collision) // collisions are resolved later Metric prior = metrics.put(name, metric); // check for collisions with other metric names if (prior == null) { // no other metric with this name yet if (groups.containsKey(name)) { // we warn here, rather than failing, because metrics are tools that should not fail the // program when used incorrectly LOG.warn("Name collision: Adding a metric with the same name as a metric subgroup: '" + name + "'. Metric might not get properly reported. " + Arrays.toString(scopeComponents)); } registry.register(metric, name, this); } else { // we had a collision. put back the original value metrics.put(name, prior); // we warn here, rather than failing, because metrics are tools that should not fail the // program when used incorrectly LOG.warn("Name collision: Group already contains a Metric with the name '" + name + "'. Metric will not be reported." + Arrays.toString(scopeComponents)); } } } }
[ "protected", "void", "addMetric", "(", "String", "name", ",", "Metric", "metric", ")", "{", "if", "(", "metric", "==", "null", ")", "{", "LOG", ".", "warn", "(", "\"Ignoring attempted registration of a metric due to being null for name {}.\"", ",", "name", ")", ";...
Adds the given metric to the group and registers it at the registry, if the group is not yet closed, and if no metric with the same name has been registered before. @param name the name to register the metric under @param metric the metric to register
[ "Adds", "the", "given", "metric", "to", "the", "group", "and", "registers", "it", "at", "the", "registry", "if", "the", "group", "is", "not", "yet", "closed", "and", "if", "no", "metric", "with", "the", "same", "name", "has", "been", "registered", "befor...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/AbstractMetricGroup.java#L373-L409
GerdHolz/TOVAL
src/de/invation/code/toval/graphic/renderer/VerticalTableHeaderCellRenderer.java
VerticalTableHeaderCellRenderer.getIcon
@Override protected Icon getIcon(JTable table, int column) { SortKey sortKey = getSortKey(table, column); if (sortKey != null && table.convertColumnIndexToView(sortKey.getColumn()) == column) { SortOrder sortOrder = sortKey.getSortOrder(); switch (sortOrder) { case ASCENDING: return VerticalSortIcon.ASCENDING; case DESCENDING: return VerticalSortIcon.DESCENDING; case UNSORTED: return VerticalSortIcon.ASCENDING; } } return null; }
java
@Override protected Icon getIcon(JTable table, int column) { SortKey sortKey = getSortKey(table, column); if (sortKey != null && table.convertColumnIndexToView(sortKey.getColumn()) == column) { SortOrder sortOrder = sortKey.getSortOrder(); switch (sortOrder) { case ASCENDING: return VerticalSortIcon.ASCENDING; case DESCENDING: return VerticalSortIcon.DESCENDING; case UNSORTED: return VerticalSortIcon.ASCENDING; } } return null; }
[ "@", "Override", "protected", "Icon", "getIcon", "(", "JTable", "table", ",", "int", "column", ")", "{", "SortKey", "sortKey", "=", "getSortKey", "(", "table", ",", "column", ")", ";", "if", "(", "sortKey", "!=", "null", "&&", "table", ".", "convertColum...
Overridden to return a rotated version of the sort icon. @param table the <code>JTable</code>. @param column the colummn index. @return the sort icon, or null if the column is unsorted.
[ "Overridden", "to", "return", "a", "rotated", "version", "of", "the", "sort", "icon", "." ]
train
https://github.com/GerdHolz/TOVAL/blob/036922cdfd710fa53b18e5dbe1e07f226f731fde/src/de/invation/code/toval/graphic/renderer/VerticalTableHeaderCellRenderer.java#L48-L63
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/las/utils/LasUtils.java
LasUtils.dumpLasFolderOverview
public static void dumpLasFolderOverview( String folder, CoordinateReferenceSystem crs ) throws Exception { SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName("overview"); b.setCRS(crs); b.add("the_geom", Polygon.class); b.add("name", String.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); DefaultFeatureCollection newCollection = new DefaultFeatureCollection(); OmsFileIterator iter = new OmsFileIterator(); iter.inFolder = folder; iter.fileFilter = new FileFilter(){ public boolean accept( File pathname ) { return pathname.getName().endsWith(".las"); } }; iter.process(); List<File> filesList = iter.filesList; for( File file : filesList ) { try (ALasReader r = new LasReaderBuffered(file, crs)) { r.open(); ReferencedEnvelope3D envelope = r.getHeader().getDataEnvelope(); Polygon polygon = GeometryUtilities.createPolygonFromEnvelope(envelope); Object[] objs = new Object[]{polygon, r.getLasFile().getName()}; builder.addAll(objs); SimpleFeature feature = builder.buildFeature(null); newCollection.add(feature); } } File folderFile = new File(folder); File outFile = new File(folder, "overview_" + folderFile.getName() + ".shp"); OmsVectorWriter.writeVector(outFile.getAbsolutePath(), newCollection); }
java
public static void dumpLasFolderOverview( String folder, CoordinateReferenceSystem crs ) throws Exception { SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder(); b.setName("overview"); b.setCRS(crs); b.add("the_geom", Polygon.class); b.add("name", String.class); SimpleFeatureType type = b.buildFeatureType(); SimpleFeatureBuilder builder = new SimpleFeatureBuilder(type); DefaultFeatureCollection newCollection = new DefaultFeatureCollection(); OmsFileIterator iter = new OmsFileIterator(); iter.inFolder = folder; iter.fileFilter = new FileFilter(){ public boolean accept( File pathname ) { return pathname.getName().endsWith(".las"); } }; iter.process(); List<File> filesList = iter.filesList; for( File file : filesList ) { try (ALasReader r = new LasReaderBuffered(file, crs)) { r.open(); ReferencedEnvelope3D envelope = r.getHeader().getDataEnvelope(); Polygon polygon = GeometryUtilities.createPolygonFromEnvelope(envelope); Object[] objs = new Object[]{polygon, r.getLasFile().getName()}; builder.addAll(objs); SimpleFeature feature = builder.buildFeature(null); newCollection.add(feature); } } File folderFile = new File(folder); File outFile = new File(folder, "overview_" + folderFile.getName() + ".shp"); OmsVectorWriter.writeVector(outFile.getAbsolutePath(), newCollection); }
[ "public", "static", "void", "dumpLasFolderOverview", "(", "String", "folder", ",", "CoordinateReferenceSystem", "crs", ")", "throws", "Exception", "{", "SimpleFeatureTypeBuilder", "b", "=", "new", "SimpleFeatureTypeBuilder", "(", ")", ";", "b", ".", "setName", "(", ...
Dump an overview shapefile for a las folder. @param folder the folder. @param crs the crs to use. @throws Exception
[ "Dump", "an", "overview", "shapefile", "for", "a", "las", "folder", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/las/utils/LasUtils.java#L251-L288
Esri/geometry-api-java
src/main/java/com/esri/core/geometry/Transformation2D.java
Transformation2D.flipX
public void flipX(double x0, double x1) { xx = -xx; xy = -xy; xd = x0 + x1 - xd; }
java
public void flipX(double x0, double x1) { xx = -xx; xy = -xy; xd = x0 + x1 - xd; }
[ "public", "void", "flipX", "(", "double", "x0", ",", "double", "x1", ")", "{", "xx", "=", "-", "xx", ";", "xy", "=", "-", "xy", ";", "xd", "=", "x0", "+", "x1", "-", "xd", ";", "}" ]
Flips the transformation around the X axis. @param x0 The X coordinate to flip. @param x1 The X coordinate to flip to.
[ "Flips", "the", "transformation", "around", "the", "X", "axis", "." ]
train
https://github.com/Esri/geometry-api-java/blob/494da8ec953d76e7c6072afbc081abfe48ff07cf/src/main/java/com/esri/core/geometry/Transformation2D.java#L798-L802
innoq/LiQID
ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java
LdapHelper.getGroupTemplate
public LdapGroup getGroupTemplate(String cn) { LdapGroup group = new LdapGroup(cn, this); group.set("dn", getDNForNode(group)); for (String oc : groupObjectClasses) { group.addObjectClass(oc.trim()); } group = (LdapGroup) updateObjectClasses(group); // TODO this needs to be cleaner :-/. // for inetOrgPerson if (group.getObjectClasses().contains("shadowAccount")) { group.set("uid", cn); } // for groupOfNames // First User is always the Principal group.addUser((LdapUser) getPrincipal()); return group; }
java
public LdapGroup getGroupTemplate(String cn) { LdapGroup group = new LdapGroup(cn, this); group.set("dn", getDNForNode(group)); for (String oc : groupObjectClasses) { group.addObjectClass(oc.trim()); } group = (LdapGroup) updateObjectClasses(group); // TODO this needs to be cleaner :-/. // for inetOrgPerson if (group.getObjectClasses().contains("shadowAccount")) { group.set("uid", cn); } // for groupOfNames // First User is always the Principal group.addUser((LdapUser) getPrincipal()); return group; }
[ "public", "LdapGroup", "getGroupTemplate", "(", "String", "cn", ")", "{", "LdapGroup", "group", "=", "new", "LdapGroup", "(", "cn", ",", "this", ")", ";", "group", ".", "set", "(", "\"dn\"", ",", "getDNForNode", "(", "group", ")", ")", ";", "for", "(",...
Returns a basic LDAP-Group-Template for a new LDAP-Group. The Group contains always the LDAP-Principal User (for Reading). @param cn of the new LDAP-Group. @return the (pre-filled) Group-Template.
[ "Returns", "a", "basic", "LDAP", "-", "Group", "-", "Template", "for", "a", "new", "LDAP", "-", "Group", ".", "The", "Group", "contains", "always", "the", "LDAP", "-", "Principal", "User", "(", "for", "Reading", ")", "." ]
train
https://github.com/innoq/LiQID/blob/ae3de2c1fd78c40219780d510eba57c931901279/ldap-connector/src/main/java/com/innoq/ldap/connector/LdapHelper.java#L664-L682
ehcache/ehcache3
impl/src/main/java/org/ehcache/impl/config/copy/DefaultCopyProviderConfiguration.java
DefaultCopyProviderConfiguration.addCopierFor
public <T> DefaultCopyProviderConfiguration addCopierFor(Class<T> clazz, Class<? extends Copier<T>> copierClass) { return addCopierFor(clazz, copierClass, false); }
java
public <T> DefaultCopyProviderConfiguration addCopierFor(Class<T> clazz, Class<? extends Copier<T>> copierClass) { return addCopierFor(clazz, copierClass, false); }
[ "public", "<", "T", ">", "DefaultCopyProviderConfiguration", "addCopierFor", "(", "Class", "<", "T", ">", "clazz", ",", "Class", "<", "?", "extends", "Copier", "<", "T", ">", ">", "copierClass", ")", "{", "return", "addCopierFor", "(", "clazz", ",", "copie...
Adds a new {@code Class} - {@link Copier} pair to this configuration object @param clazz the {@code Class} for which this copier is @param copierClass the {@link Copier} type to use @param <T> the type of objects the copier will deal with @return this configuration instance @throws NullPointerException if any argument is null @throws IllegalArgumentException in a case a mapping for {@code clazz} already exists
[ "Adds", "a", "new", "{", "@code", "Class", "}", "-", "{", "@link", "Copier", "}", "pair", "to", "this", "configuration", "object" ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/impl/config/copy/DefaultCopyProviderConfiguration.java#L68-L70
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/MappedParametrizedObjectEntry.java
MappedParametrizedObjectEntry.getParameterInteger
public Integer getParameterInteger(String name) throws RepositoryConfigurationException { try { return StringNumberParser.parseInt(getParameterValue(name)); } catch (NumberFormatException e) { throw new RepositoryConfigurationException(name + ": unparseable Integer. " + e, e); } }
java
public Integer getParameterInteger(String name) throws RepositoryConfigurationException { try { return StringNumberParser.parseInt(getParameterValue(name)); } catch (NumberFormatException e) { throw new RepositoryConfigurationException(name + ": unparseable Integer. " + e, e); } }
[ "public", "Integer", "getParameterInteger", "(", "String", "name", ")", "throws", "RepositoryConfigurationException", "{", "try", "{", "return", "StringNumberParser", ".", "parseInt", "(", "getParameterValue", "(", "name", ")", ")", ";", "}", "catch", "(", "Number...
Parse named parameter as Integer. @param name parameter name @return Integer value @throws RepositoryConfigurationException
[ "Parse", "named", "parameter", "as", "Integer", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/MappedParametrizedObjectEntry.java#L176-L186
gosu-lang/gosu-lang
gosu-core-api/src/main/java/gw/lang/reflect/TypeSystem.java
TypeSystem.getByRelativeName
public static IType getByRelativeName( String relativeName, ITypeUsesMap typeUses ) throws ClassNotFoundException { return CommonServices.getTypeSystem().getByRelativeName(relativeName, typeUses); }
java
public static IType getByRelativeName( String relativeName, ITypeUsesMap typeUses ) throws ClassNotFoundException { return CommonServices.getTypeSystem().getByRelativeName(relativeName, typeUses); }
[ "public", "static", "IType", "getByRelativeName", "(", "String", "relativeName", ",", "ITypeUsesMap", "typeUses", ")", "throws", "ClassNotFoundException", "{", "return", "CommonServices", ".", "getTypeSystem", "(", ")", ".", "getByRelativeName", "(", "relativeName", "...
Gets an intrinsic type based on a relative name. This could either be the name of an entity, like "User", the name of a typekey, like "SystemPermission", or a class name, like "java.lang.String" (relative and fully qualified class names are the same as far as this factory is concerned). Names can have [] appended to them to create arrays, and multi-dimensional arrays are supported. @param relativeName the relative name of the type @param typeUses the map of used types to use when resolving @return the corresponding IType @throws ClassNotFoundException if the specified name doesn't correspond to any type
[ "Gets", "an", "intrinsic", "type", "based", "on", "a", "relative", "name", ".", "This", "could", "either", "be", "the", "name", "of", "an", "entity", "like", "User", "the", "name", "of", "a", "typekey", "like", "SystemPermission", "or", "a", "class", "na...
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/lang/reflect/TypeSystem.java#L134-L137
citrusframework/citrus
modules/citrus-mail/src/main/java/com/consol/citrus/mail/message/MailMessageConverter.java
MailMessageConverter.createMailRequest
protected MailMessage createMailRequest(Map<String, Object> messageHeaders, BodyPart bodyPart, MailEndpointConfiguration endpointConfiguration) { return MailMessage.request(messageHeaders) .marshaller(endpointConfiguration.getMarshaller()) .from(messageHeaders.get(CitrusMailMessageHeaders.MAIL_FROM).toString()) .to(messageHeaders.get(CitrusMailMessageHeaders.MAIL_TO).toString()) .cc(messageHeaders.get(CitrusMailMessageHeaders.MAIL_CC).toString()) .bcc(messageHeaders.get(CitrusMailMessageHeaders.MAIL_BCC).toString()) .subject(messageHeaders.get(CitrusMailMessageHeaders.MAIL_SUBJECT).toString()) .body(bodyPart); }
java
protected MailMessage createMailRequest(Map<String, Object> messageHeaders, BodyPart bodyPart, MailEndpointConfiguration endpointConfiguration) { return MailMessage.request(messageHeaders) .marshaller(endpointConfiguration.getMarshaller()) .from(messageHeaders.get(CitrusMailMessageHeaders.MAIL_FROM).toString()) .to(messageHeaders.get(CitrusMailMessageHeaders.MAIL_TO).toString()) .cc(messageHeaders.get(CitrusMailMessageHeaders.MAIL_CC).toString()) .bcc(messageHeaders.get(CitrusMailMessageHeaders.MAIL_BCC).toString()) .subject(messageHeaders.get(CitrusMailMessageHeaders.MAIL_SUBJECT).toString()) .body(bodyPart); }
[ "protected", "MailMessage", "createMailRequest", "(", "Map", "<", "String", ",", "Object", ">", "messageHeaders", ",", "BodyPart", "bodyPart", ",", "MailEndpointConfiguration", "endpointConfiguration", ")", "{", "return", "MailMessage", ".", "request", "(", "messageHe...
Creates a new mail message model object from message headers. @param messageHeaders @param bodyPart @param endpointConfiguration @return
[ "Creates", "a", "new", "mail", "message", "model", "object", "from", "message", "headers", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-mail/src/main/java/com/consol/citrus/mail/message/MailMessageConverter.java#L126-L135
alkacon/opencms-core
src-setup/org/opencms/setup/db/update6to7/CmsUpdateDBCmsUsers.java
CmsUpdateDBCmsUsers.removeUnnecessaryColumns
protected void removeUnnecessaryColumns(CmsSetupDb dbCon) throws SQLException { System.out.println(new Exception().getStackTrace()[0].toString()); // Get the sql queries to drop the columns String dropUserInfo = readQuery(QUERY_DROP_USER_INFO_COLUMN); String dropUserAddress = readQuery(QUERY_DROP_USER_ADDRESS_COLUMN); String dropUserDescription = readQuery(QUERY_DROP_USER_DESCRIPTION_COLUMN); String dropUserType = readQuery(QUERY_DROP_USER_TYPE_COLUMN); // execute the queries to drop the columns, if they exist if (dbCon.hasTableOrColumn(CMS_USERS_TABLE, USER_INFO)) { dbCon.updateSqlStatement(dropUserInfo, null, null); } else { System.out.println("no column " + USER_INFO + " in table " + CMS_USERS_TABLE + " found"); } if (dbCon.hasTableOrColumn(CMS_USERS_TABLE, USER_ADDRESS)) { dbCon.updateSqlStatement(dropUserAddress, null, null); } else { System.out.println("no column " + USER_ADDRESS + " in table " + CMS_USERS_TABLE + " found"); } if (dbCon.hasTableOrColumn(CMS_USERS_TABLE, USER_DESCRIPTION)) { dbCon.updateSqlStatement(dropUserDescription, null, null); } else { System.out.println("no column " + USER_DESCRIPTION + " in table " + CMS_USERS_TABLE + " found"); } if (dbCon.hasTableOrColumn(CMS_USERS_TABLE, USER_TYPE)) { dbCon.updateSqlStatement(dropUserType, null, null); } else { System.out.println("no column " + USER_TYPE + " in table " + CMS_USERS_TABLE + " found"); } }
java
protected void removeUnnecessaryColumns(CmsSetupDb dbCon) throws SQLException { System.out.println(new Exception().getStackTrace()[0].toString()); // Get the sql queries to drop the columns String dropUserInfo = readQuery(QUERY_DROP_USER_INFO_COLUMN); String dropUserAddress = readQuery(QUERY_DROP_USER_ADDRESS_COLUMN); String dropUserDescription = readQuery(QUERY_DROP_USER_DESCRIPTION_COLUMN); String dropUserType = readQuery(QUERY_DROP_USER_TYPE_COLUMN); // execute the queries to drop the columns, if they exist if (dbCon.hasTableOrColumn(CMS_USERS_TABLE, USER_INFO)) { dbCon.updateSqlStatement(dropUserInfo, null, null); } else { System.out.println("no column " + USER_INFO + " in table " + CMS_USERS_TABLE + " found"); } if (dbCon.hasTableOrColumn(CMS_USERS_TABLE, USER_ADDRESS)) { dbCon.updateSqlStatement(dropUserAddress, null, null); } else { System.out.println("no column " + USER_ADDRESS + " in table " + CMS_USERS_TABLE + " found"); } if (dbCon.hasTableOrColumn(CMS_USERS_TABLE, USER_DESCRIPTION)) { dbCon.updateSqlStatement(dropUserDescription, null, null); } else { System.out.println("no column " + USER_DESCRIPTION + " in table " + CMS_USERS_TABLE + " found"); } if (dbCon.hasTableOrColumn(CMS_USERS_TABLE, USER_TYPE)) { dbCon.updateSqlStatement(dropUserType, null, null); } else { System.out.println("no column " + USER_TYPE + " in table " + CMS_USERS_TABLE + " found"); } }
[ "protected", "void", "removeUnnecessaryColumns", "(", "CmsSetupDb", "dbCon", ")", "throws", "SQLException", "{", "System", ".", "out", ".", "println", "(", "new", "Exception", "(", ")", ".", "getStackTrace", "(", ")", "[", "0", "]", ".", "toString", "(", "...
Removes the columns USER_INFO, USER_ADDRESS, USER_DESCRIPTION and USER_TYPE from the CMS_USERS table.<p> @param dbCon the db connection interface @throws SQLException if something goes wrong
[ "Removes", "the", "columns", "USER_INFO", "USER_ADDRESS", "USER_DESCRIPTION", "and", "USER_TYPE", "from", "the", "CMS_USERS", "table", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src-setup/org/opencms/setup/db/update6to7/CmsUpdateDBCmsUsers.java#L310-L340
DDTH/ddth-commons
ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DateTimeUtils.java
DateTimeUtils.addWeeks
public static Calendar addWeeks(Calendar origin, int value) { Calendar cal = sync((Calendar) origin.clone()); cal.add(Calendar.WEEK_OF_YEAR, value); return sync(cal); }
java
public static Calendar addWeeks(Calendar origin, int value) { Calendar cal = sync((Calendar) origin.clone()); cal.add(Calendar.WEEK_OF_YEAR, value); return sync(cal); }
[ "public", "static", "Calendar", "addWeeks", "(", "Calendar", "origin", ",", "int", "value", ")", "{", "Calendar", "cal", "=", "sync", "(", "(", "Calendar", ")", "origin", ".", "clone", "(", ")", ")", ";", "cal", ".", "add", "(", "Calendar", ".", "WEE...
Add/Subtract the specified amount of weeks to the given {@link Calendar}. <p> The returned {@link Calendar} has its fields synced. </p> @param origin @param value @return @since 0.9.2
[ "Add", "/", "Subtract", "the", "specified", "amount", "of", "weeks", "to", "the", "given", "{", "@link", "Calendar", "}", "." ]
train
https://github.com/DDTH/ddth-commons/blob/734f0e77321d41eeca78a557be9884df9874e46e/ddth-commons-core/src/main/java/com/github/ddth/commons/utils/DateTimeUtils.java#L706-L710
apache/incubator-zipkin
zipkin-storage/cassandra-v1/src/main/java/zipkin2/storage/cassandra/v1/CassandraStorage.java
CassandraStorage.spanConsumer
@Override public SpanConsumer spanConsumer() { if (spanConsumer == null) { synchronized (this) { if (spanConsumer == null) { spanConsumer = new CassandraSpanConsumer(this, indexCacheSpec); } } } return spanConsumer; }
java
@Override public SpanConsumer spanConsumer() { if (spanConsumer == null) { synchronized (this) { if (spanConsumer == null) { spanConsumer = new CassandraSpanConsumer(this, indexCacheSpec); } } } return spanConsumer; }
[ "@", "Override", "public", "SpanConsumer", "spanConsumer", "(", ")", "{", "if", "(", "spanConsumer", "==", "null", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "spanConsumer", "==", "null", ")", "{", "spanConsumer", "=", "new", "CassandraSpa...
{@inheritDoc} Memoized in order to avoid re-preparing statements
[ "{" ]
train
https://github.com/apache/incubator-zipkin/blob/89b2fab983fc626b3be32ce9d7cf64b3f01f1a87/zipkin-storage/cassandra-v1/src/main/java/zipkin2/storage/cassandra/v1/CassandraStorage.java#L365-L375
zxing/zxing
core/src/main/java/com/google/zxing/aztec/decoder/Decoder.java
Decoder.readByte
private static byte readByte(boolean[] rawbits, int startIndex) { int n = rawbits.length - startIndex; if (n >= 8) { return (byte) readCode(rawbits, startIndex, 8); } return (byte) (readCode(rawbits, startIndex, n) << (8 - n)); }
java
private static byte readByte(boolean[] rawbits, int startIndex) { int n = rawbits.length - startIndex; if (n >= 8) { return (byte) readCode(rawbits, startIndex, 8); } return (byte) (readCode(rawbits, startIndex, n) << (8 - n)); }
[ "private", "static", "byte", "readByte", "(", "boolean", "[", "]", "rawbits", ",", "int", "startIndex", ")", "{", "int", "n", "=", "rawbits", ".", "length", "-", "startIndex", ";", "if", "(", "n", ">=", "8", ")", "{", "return", "(", "byte", ")", "r...
Reads a code of length 8 in an array of bits, padding with zeros
[ "Reads", "a", "code", "of", "length", "8", "in", "an", "array", "of", "bits", "padding", "with", "zeros" ]
train
https://github.com/zxing/zxing/blob/653ac2a3beb11481eff82e7d5f2bab8a745f7fac/core/src/main/java/com/google/zxing/aztec/decoder/Decoder.java#L344-L350
line/armeria
core/src/main/java/com/linecorp/armeria/server/docs/DocServiceBuilder.java
DocServiceBuilder.exampleRequestForMethod
public DocServiceBuilder exampleRequestForMethod(String serviceName, String methodName, Object... exampleRequests) { requireNonNull(exampleRequests, "exampleRequests"); return exampleRequestForMethod(serviceName, methodName, ImmutableList.copyOf(exampleRequests)); }
java
public DocServiceBuilder exampleRequestForMethod(String serviceName, String methodName, Object... exampleRequests) { requireNonNull(exampleRequests, "exampleRequests"); return exampleRequestForMethod(serviceName, methodName, ImmutableList.copyOf(exampleRequests)); }
[ "public", "DocServiceBuilder", "exampleRequestForMethod", "(", "String", "serviceName", ",", "String", "methodName", ",", "Object", "...", "exampleRequests", ")", "{", "requireNonNull", "(", "exampleRequests", ",", "\"exampleRequests\"", ")", ";", "return", "exampleRequ...
Adds the example requests for the method with the specified service and method name.
[ "Adds", "the", "example", "requests", "for", "the", "method", "with", "the", "specified", "service", "and", "method", "name", "." ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/server/docs/DocServiceBuilder.java#L208-L212
dadoonet/fscrawler
framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/MetaFileHandler.java
MetaFileHandler.writeFile
protected void writeFile(String subdir, String filename, String content) throws IOException { Path dir = root; if (subdir != null) { dir = dir.resolve(subdir); // If the dir does not exist, we need to create it if (Files.notExists(dir)) { Files.createDirectory(dir); } } Files.write(dir.resolve(filename), content.getBytes(StandardCharsets.UTF_8)); }
java
protected void writeFile(String subdir, String filename, String content) throws IOException { Path dir = root; if (subdir != null) { dir = dir.resolve(subdir); // If the dir does not exist, we need to create it if (Files.notExists(dir)) { Files.createDirectory(dir); } } Files.write(dir.resolve(filename), content.getBytes(StandardCharsets.UTF_8)); }
[ "protected", "void", "writeFile", "(", "String", "subdir", ",", "String", "filename", ",", "String", "content", ")", "throws", "IOException", "{", "Path", "dir", "=", "root", ";", "if", "(", "subdir", "!=", "null", ")", "{", "dir", "=", "dir", ".", "re...
Write a file in ~/.fscrawler/{subdir} dir @param subdir subdir where we can read the file (null if we read in the root dir) @param filename filename @param content The String UTF-8 content to write @throws IOException in case of error while reading
[ "Write", "a", "file", "in", "~", "/", ".", "fscrawler", "/", "{", "subdir", "}", "dir" ]
train
https://github.com/dadoonet/fscrawler/blob/cca00a14e21ef9986aa30e19b160463aed6bf921/framework/src/main/java/fr/pilato/elasticsearch/crawler/fs/framework/MetaFileHandler.java#L64-L75